Commit ed2112fb authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/movenc: Check frame rate in mov_write_uuidprof_tag()

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 21bffa93
...@@ -4261,7 +4261,7 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s) ...@@ -4261,7 +4261,7 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
return update_size(pb, pos); return update_size(pb, pos);
} }
static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s) static int mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
{ {
AVStream *video_st = s->streams[0]; AVStream *video_st = s->streams[0];
AVCodecParameters *video_par = s->streams[0]->codecpar; AVCodecParameters *video_par = s->streams[0]->codecpar;
...@@ -4271,6 +4271,11 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s) ...@@ -4271,6 +4271,11 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
int audio_kbitrate = audio_par->bit_rate / 1000; int audio_kbitrate = audio_par->bit_rate / 1000;
int video_kbitrate = FFMIN(video_par->bit_rate / 1000, 800 - audio_kbitrate); int video_kbitrate = FFMIN(video_par->bit_rate / 1000, 800 - audio_kbitrate);
if (frame_rate < 0 || frame_rate > INT32_MAX) {
av_log(s, AV_LOG_ERROR, "Frame rate %f outside supported range\n", frame_rate / (double)0x10000);
return AVERROR(EINVAL);
}
avio_wb32(pb, 0x94); /* size */ avio_wb32(pb, 0x94); /* size */
ffio_wfourcc(pb, "uuid"); ffio_wfourcc(pb, "uuid");
ffio_wfourcc(pb, "PROF"); ffio_wfourcc(pb, "PROF");
...@@ -4321,6 +4326,8 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s) ...@@ -4321,6 +4326,8 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
avio_wb16(pb, video_par->width); avio_wb16(pb, video_par->width);
avio_wb16(pb, video_par->height); avio_wb16(pb, video_par->height);
avio_wb32(pb, 0x010001); /* ? */ avio_wb32(pb, 0x010001); /* ? */
return 0;
} }
static int mov_write_identification(AVIOContext *pb, AVFormatContext *s) static int mov_write_identification(AVIOContext *pb, AVFormatContext *s)
...@@ -4345,7 +4352,7 @@ static int mov_write_identification(AVIOContext *pb, AVFormatContext *s) ...@@ -4345,7 +4352,7 @@ static int mov_write_identification(AVIOContext *pb, AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio stream\n"); av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio stream\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
mov_write_uuidprof_tag(pb, s); return mov_write_uuidprof_tag(pb, s);
} }
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment