mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-14 11:00:08 +01:00
flvdec: Set avg_frame_rate for video streams
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
committed by
Martin Storsjö
parent
8e2346154e
commit
628ce8b8b6
@@ -58,6 +58,7 @@ typedef struct FLVContext {
|
|||||||
int validate_next;
|
int validate_next;
|
||||||
int validate_count;
|
int validate_count;
|
||||||
int searched_for_end;
|
int searched_for_end;
|
||||||
|
AVRational framerate;
|
||||||
} FLVContext;
|
} FLVContext;
|
||||||
|
|
||||||
static int flv_probe(AVProbeData *p)
|
static int flv_probe(AVProbeData *p)
|
||||||
@@ -77,10 +78,14 @@ static int flv_probe(AVProbeData *p)
|
|||||||
|
|
||||||
static AVStream *create_stream(AVFormatContext *s, int codec_type)
|
static AVStream *create_stream(AVFormatContext *s, int codec_type)
|
||||||
{
|
{
|
||||||
|
FLVContext *flv = s->priv_data;
|
||||||
AVStream *st = avformat_new_stream(s, NULL);
|
AVStream *st = avformat_new_stream(s, NULL);
|
||||||
if (!st)
|
if (!st)
|
||||||
return NULL;
|
return NULL;
|
||||||
st->codecpar->codec_type = codec_type;
|
st->codecpar->codec_type = codec_type;
|
||||||
|
if (codec_type == AVMEDIA_TYPE_VIDEO)
|
||||||
|
st->avg_frame_rate = flv->framerate;
|
||||||
|
|
||||||
avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
|
avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
@@ -460,6 +465,10 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
|
|||||||
if (!st)
|
if (!st)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
st->codecpar->codec_id = AV_CODEC_ID_TEXT;
|
st->codecpar->codec_id = AV_CODEC_ID_TEXT;
|
||||||
|
} else if (!strcmp(key, "framerate")) {
|
||||||
|
flv->framerate = av_d2q(num_val, 1000);
|
||||||
|
if (vstream)
|
||||||
|
vstream->avg_frame_rate = flv->framerate;
|
||||||
} else if (flv->trust_metadata) {
|
} else if (flv->trust_metadata) {
|
||||||
if (!strcmp(key, "videocodecid") && vpar) {
|
if (!strcmp(key, "videocodecid") && vpar) {
|
||||||
flv_set_video_codec(s, vstream, num_val, 0);
|
flv_set_video_codec(s, vstream, num_val, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user