diff options
author | addr-see-the-website@aetey.se <addr-see-the-website@aetey.se> | 2014-02-02 16:57:36 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-03 02:04:38 +0100 |
commit | 8e36fc0c33566cb6fcb6379595214e7f9b909f88 (patch) | |
tree | c35c54499a4938c3fe0d86f0e9a2c4538ecd64d4 /libavformat/idroqenc.c | |
parent | 1bc2fa447c22df09d312a7fba7e95531cfb051f8 (diff) | |
download | ffmpeg-8e36fc0c33566cb6fcb6379595214e7f9b909f88.tar.gz |
RoQ encoder: support different integer framerates
Even though the most common framerate for RoQ is 30fps,
the format supports other framerates too.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/idroqenc.c')
-rw-r--r-- | libavformat/idroqenc.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/libavformat/idroqenc.c b/libavformat/idroqenc.c index 50c428046b..28a3aba9d4 100644 --- a/libavformat/idroqenc.c +++ b/libavformat/idroqenc.c @@ -25,9 +25,35 @@ static int roq_write_header(struct AVFormatContext *s) { - static const uint8_t header[] = { - 0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00 + uint8_t header[] = { + 0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, /* fps: */ 0x1E, 0x00 }; + int n; + AVCodecContext *avctx; + +// set the actual fps + for(n=0;n<s->nb_streams;n++) { + if ((avctx=s->streams[n]->codec)->codec_type == AVMEDIA_TYPE_VIDEO) { + unsigned int fps; + + if (avctx->time_base.num != 1) { + av_log(avctx, AV_LOG_ERROR, "Frame rate must be integer\n"); + return AVERROR(EINVAL); + } + + if ((fps=avctx->time_base.den) > 255) { + av_log(avctx, AV_LOG_ERROR, "Frame rate may not exceed 255fps\n"); + return AVERROR(EINVAL); + } + + if (fps != 30) { + av_log(avctx, AV_LOG_WARNING, "For vintage compatibility fps must be 30\n"); + } + + header[6] = fps; + break; + } + } avio_write(s->pb, header, 8); avio_flush(s->pb); |