[FFmpeg-devel] [PATCH] Decoding of raw UTF-8 text from Ogg streams

ogg.k.ogg.k at googlemail.com ogg.k.ogg.k
Tue Jul 28 18:56:48 CEST 2009


> Indeed, but I'm hitting a wall here: I need to get the time base to convert
> from whatever scale pts is in to milliseconds. I don't see how I can access
> the AVStream from the decoder, however. Any pointer on how to retrieve
> that time base info ?

I've found one way to carry this info, but I've no idea if that'd introduce
problems elsewhere. I don't know how this all works, so would this change
work (for Matroska only, obviously) ? It initializes the codec time base (which
I can access from libavcodec). Note that that timebase is also modified a
bit later, and I don't know what this does.
With this, I get the correct time base in ssadec.c (I get 0/1 otherwise).

Thanks

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 9405b46..d6828bf 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1336,6 +1336,7 @@ static int matroska_read_header(AVFormatContext
*s, AVFormatParameters *ap)
         if (track->time_scale < 0.01)
             track->time_scale = 1.0;
         av_set_pts_info(st, 64,
matroska->time_scale*track->time_scale, 1000*1000*1000); /* 64 bit pts
in ns */
+        st->codec->time_base = st->time_base;

         st->codec->codec_id = codec_id;
         st->start_time = 0;



More information about the ffmpeg-devel mailing list