aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/flvdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-03-10 03:45:14 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-03-10 03:45:14 +0000
commitbb01a3f021d742b8b9615ec26c12a49d464b0053 (patch)
tree978124c7fddab2e1874542d88ae0b6fa1b53cf1f /libavformat/flvdec.c
parentc276af0471f9e90d48470a7dbd6c433282953da3 (diff)
downloadffmpeg-bb01a3f021d742b8b9615ec26c12a49d464b0053.tar.gz
guess framerate
Originally committed as revision 2866 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r--libavformat/flvdec.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 29772f75bc..560cb2860b 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -40,11 +40,15 @@ static int flv_probe(AVProbeData *p)
return 0;
}
+#define FRAME_RATE_UNKNOWN 31415 //yes i know its beatifull
+
static int flv_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
int offset, flags;
AVStream *st;
+
+ s->ctx_flags |= AVFMTCTX_NOHEADER; //ok we have a header but theres no fps, codec type, sample_rate, ...
av_set_pts_info(s, 24, 1, 1000); /* 24 bit pts in ms */
@@ -57,8 +61,9 @@ static int flv_read_header(AVFormatContext *s,
return AVERROR_NOMEM;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_FLV1;
- st->codec.frame_rate= ap->frame_rate;
- st->codec.frame_rate_base= ap->frame_rate_base;
+ st->codec.frame_rate= FRAME_RATE_UNKNOWN;
+// st->codec.frame_rate= ap->frame_rate;
+// st->codec.frame_rate_base= ap->frame_rate_base;
}
if ((flags & 4)) {
@@ -118,11 +123,17 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
goto skip;
found:
- if(type == 8){
+ if(type == 8 && st->codec.sample_rate == 0){
st->codec.channels = (flags&1)+1;
st->codec.sample_rate = (44100<<((flags>>2)&3))>>3;
}
+ //guess the frame rate
+ if(type==9 && st->codec.frame_rate == FRAME_RATE_UNKNOWN && pts){
+ st->codec.frame_rate_base=1;
+ st->codec.frame_rate= (1000 + pts/2)/pts;
+ }
+
if (av_new_packet(pkt, size) < 0)
return -EIO;