Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2016-07-12 04:09:34 +0300
committerJames Almer <jamrial@gmail.com>2016-07-12 17:24:30 +0300
commit4acdbb1c6c1901893ebbe2bca1ef9014fc97070c (patch)
tree4708d2dd25ab8e0e0d1c729167fab10054c4200b /libavformat/oggenc.c
parent9157ac2f9c867a6e0ce013ede965de3832374729 (diff)
avformat/oggenc: always use the time base stored in the theora header
Fixes ticket #5704 Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/oggenc.c')
-rw-r--r--libavformat/oggenc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index fe1f34d843..6940a7b02f 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -533,6 +533,14 @@ static int ogg_write_header(AVFormatContext *s)
bytestream_put_buffer(&p, cstr, 6);
if (st->codecpar->codec_id == AV_CODEC_ID_THEORA) {
+ int den = AV_RB32(oggstream->header[0] + 22), num = AV_RB32(oggstream->header[0] + 26);
+ /* Make sure to use time base stored in the Theora stream header to write
+ correct timestamps */
+ if (st->time_base.num != num || st->time_base.den != den) {
+ av_log(s, AV_LOG_DEBUG, "Changing time base from %d/%d to %d/%d\n",
+ st->time_base.num, st->time_base.den, num, den);
+ avpriv_set_pts_info(st, 64, num, den);
+ }
/** KFGSHIFT is the width of the less significant section of the granule position
The less significant section is the frame count since the last keyframe */
oggstream->kfgshift = ((oggstream->header[0][40]&3)<<3)|(oggstream->header[0][41]>>5);