[FFmpeg-devel] [PATCH] RealMedia muxer: support audio codecs other than AC-3

Francesco Lavra francescolavra
Tue May 18 20:47:56 CEST 2010


On Sun, 2010-05-16 at 20:35 +0200, Michael Niedermayer wrote:
> [...]
> >  utils.c |   52 +++++++++++++++++++++++++++++++++++++++++++++++-----
> >  1 file changed, 47 insertions(+), 5 deletions(-)
> > 8014f5fbe7be074ec4046ac3a5bca8628b1bef3c  B_utils.patch
> > Index: libavformat/utils.c
> > ===================================================================
> > --- libavformat/utils.c	(revision 23141)
> > +++ libavformat/utils.c	(working copy)
> > @@ -2575,6 +2575,47 @@
> >      return 0;
> >  }
> >  
> > +static int validate_codec_tag(AVFormatContext *s, AVStream *st)
> > +{
> > +    const AVCodecTag *avctag;
> > +    int n;
> > +    enum CodecID id = CODEC_ID_NONE;
> > +    unsigned int tag = 0;
> > +
> > +    /**
> > +     * Check that tag + id is in the table
> > +     * If neither is in the table -> OK
> > +     * If tag is in the table with another id -> FAIL
> > +     * If id is in the table with another tag -> FAIL unless strict < normal
> > +     */
> > +    for (n = 0; s->oformat->codec_tag[n]; n++) {
> > +        avctag = s->oformat->codec_tag[n];
> > +        while (avctag->id != CODEC_ID_NONE) {
> 
> > +            if ((avctag->tag == st->codec->codec_tag) ||
> 
> redundant

Removed.

> > +                ((toupper((avctag->tag >> 0) & 0xFF) ==
> > +                  toupper((st->codec->codec_tag >> 0) & 0xFF)) &&
> > +                 (toupper((avctag->tag >> 8) & 0xFF) ==
> > +                  toupper((st->codec->codec_tag >> 8) & 0xFF)) &&
> > +                 (toupper((avctag->tag >> 16) & 0xFF) ==
> > +                  toupper((st->codec->codec_tag >> 16) & 0xFF)) &&
> > +                 (toupper((avctag->tag >> 24) & 0xFF) ==
> > +                  toupper((st->codec->codec_tag >> 24) & 0xFF)))) {
> 
> ff_toupper4(unsigned int x)
> {
>     return     toupper( x     &0xFF)
>             + (toupper((x>>8 )&0xFF)<<8 )
>             + (toupper((x>>16)&0xFF)<<16)
>             + (toupper((x>>24)&0xFF)<<24);
> }
> 
> this could also be used in MPV_common_init()

ff_toupper4.patch adds ff_toupper4() to libavcodec/utils.c and changes
MPV_common_init() and ff_codec_get_id() to use the new function;
B_utils.patch adds validate_codec_tag(), which also uses ff_toupper4().
The patches have been tested against regression tests and FATE.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ff_toupper4.patch
Type: text/x-patch
Size: 2997 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100518/7d118112/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: B_utils.patch
Type: text/x-patch
Size: 2141 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100518/7d118112/attachment-0001.bin>



More information about the ffmpeg-devel mailing list