[MPlayer-dev-eng] [PATCH] AVCodecTag redefined when using external libavformat

Michael Niedermayer michaelni at gmx.at
Sun Feb 4 16:21:18 CET 2007


Hi

On Sun, Feb 04, 2007 at 02:18:15PM +0100, Reimar Döffinger wrote:
> Hello,
> On Sun, Feb 04, 2007 at 01:19:16PM +0100, Nico Sabbi wrote:
> > Michael Niedermayer wrote:
> > >>calling av_codec_get_tag() and av_codec_get_id() requires as 
> > >>parameters the tables we actually need, so how can they be useful in 
> > >>this case?
> > >
> > >
> > >avi_muxer.codec_tag can be passed to them
> > >
> > >and the additional tables mplayer uses cannot use AVCodecTag they can
> > >use MPCodecTag (which may or may not be the same / is copy and pasted
> > >but wont break if AVCodecTag changes)
> 
> Huh? What does changing the name help? It will still break because we
> call a function that wants an AVCodecTag struct.

yes and you MUST NOT call that with your MPCodecTag!!!!!!!!!!!!!!!
but only with the opaque AVCodecTag which you CANNOT use for mplayers private
tables

so again, options are:
1. keep code as it is and live with the occasional breakage due to use of
   internal lav* stuff which isnt supposed to be used
2. use your own lav* independant 20lines of code to manage your own tables
   (this can be copy and pasted from lav* but must be renamed to avoid name
   clashes)
3. propose on ffmpeg-dev that AVCodecTags internal structure should be
   exported so that mplayer can use it and avoid 20 lines of code duplication


> Unless I miss something changing the name is IMO just pure obfuscation.

of course its not a matter of the name but rather what you do with it


> 
> > -const struct AVCodecTag *mp_bmp_taglists[] = {codec_bmp_tags, mp_bmp_tags, 0};
> > +const struct AVCodecTag *mp_bmp_taglists[3];
> >  
> >  static int mp_open(URLContext *h, const char *filename, int flags){
> >      return 0;
> > @@ -193,6 +199,14 @@
> >  
> >      memset(&ap, 0, sizeof(AVFormatParameters));
> >  
> > +    mp_wav_taglists[0] = avi_muxer.codec_tag[1];
> > +    mp_wav_taglists[1] = mp_wav_tags;
> > +    mp_wav_taglists[2] = 0;
> > +
> > +    mp_bmp_taglists[0] = avi_muxer.codec_tag[0];
> > +    mp_bmp_taglists[1] = mp_bmp_tags;
> > +    mp_bmp_taglists[2] = 0;

this code is exactly the problem you combine 2 _different_ structures
one is MPCodecTag (or whatever you call it) and the other is AVCodecTag


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070204/e52750fc/attachment.pgp>


More information about the MPlayer-dev-eng mailing list