[FFmpeg-devel] [PATCH] avformat/mov: read stream bitrates from isml manifest

Alexandre Sicard alexandre.sicard at smartjog.com
Wed Jul 3 17:58:03 CEST 2013


Le jeudi 27 juin 2013 15:25:02 Michael Niedermayer a écrit :
> On Thu, Jun 27, 2013 at 12:16:07PM +0200, Alexandre Sicard wrote:
> > Le jeudi 27 juin 2013 10:36:11 Michael Niedermayer a écrit :
> > > > +#include <regex.h>
> > > 
> > > This is unavaliable on at least windows AFAIK
> > 
> > Oops, this is a problem. Parsing XML would require regex or an XML parsing
> > library. Actually, I first wrote this patch using libexpat, but I thought
> > it was not worth adding a dependency when I could just use regex.
> > 
> > Now, I think it could be useful: I have a colleague working on adding
> > Smooth Streaming playback support to FFmpeg, and for now he uses libexpat
> > to parse the manifest. Other adaptive streaming formats such as DASH and
> > HDS have XML manifests too, so it could definitively be of use.
> > 
> > What do you think about this? Should I send a patch adding libexpat to
> > FFmpeg and the libexpat version of my patch?
> 
> does this really need more than 5 lines of C code with sscanf() ?
> 
> [...]

Indeed, the bitrates are quite easy to read even without a parser. Reading 
more fields could be tricky though. We can use string functions for now, see 
updated patch.

> > @@ -3221,6 +3293,12 @@ static int mov_read_header(AVFormatContext *s)
> > 
> >          }
> >      
> >      }
> > 
> > +    for (i = 0; i < mov->bitrates_count && i < s->nb_streams; i++) {
> > +        if (mov->bitrates[i] > 0) {
> > +            s->streams[i]->codec->bit_rate = mov->bitrates[i];
> > +        }
> > +    }
> 
> Is this indirection neccessary (compared to directly writing into
> s->streams[i]->codec->bit_rate)
> ?

The uuid box containing the manifest is the first box in the file. That means s-
>streams is null when it is read, so I can't directly write to it.

-- 
Alexandre SICARD - Intern, Research & Engineering
SmartJog | www.smartjog.com | a TDF Group company
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avformat-mov-read-stream-bitrates-from-isml-manifest.patch
Type: text/x-patch
Size: 4083 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130703/11b6d0bf/attachment.bin>


More information about the ffmpeg-devel mailing list