[MPlayer-dev-eng] [PATCH] demuxer-independent attachments

Evgeniy Stepanov eugeni.stepanov at gmail.com
Tue Jan 8 10:52:47 CET 2008


On Tuesday 08 January 2008 11:47:51 Nico Sabbi wrote:
> Il Tuesday 08 January 2008 01:35:49 Evgeniy Stepanov ha scritto:
> > Hi,
> >
> > with this patch, attachments are stored in demuxer_t. This allows
> > to remove the last remaining ass_* call from mkv demuxer.
> >
> > Index: libmpdemux/demuxer.c
> > ===================================================================
> > --- libmpdemux/demuxer.c        (revision 25646)
> > +++ libmpdemux/demuxer.c        (working copy)
> > @@ -22,6 +22,11 @@
> >
> >  #include "libaf/af_format.h"
> >
> > +#ifdef USE_ASS
> > +#include "libass/ass.h"
> > +#include "libass/ass_mp.h"
> > +#endif
> > +
> >  extern void resync_video_stream(sh_video_t *sh_video);
> >  extern void resync_audio_stream(sh_audio_t *sh_audio);
> >
> > @@ -332,6 +337,14 @@
> >            free(demuxer->chapters[i].name);
> >        free(demuxer->chapters);
> >      }
> > +    if (demuxer->attachments) {
> > +      for (i=0; i<demuxer->num_attachments; i++) {
> > +        free(demuxer->attachments[i].name);
> > +        free(demuxer->attachments[i].type);
> > +        free(demuxer->attachments[i].data);
> > +      }
> > +      free(demuxer->attachments);
> > +    }
> >      free(demuxer);
> >  }
> >
> > @@ -812,6 +825,19 @@
> >      sh_video->i_bps*0.008f,
> >      sh_video->i_bps/1024.0f );
> >  }
> > +#ifdef USE_ASS
> > + if (ass_enabled && ass_library) {
> > +   for (i = 0; i < demuxer->num_attachments; ++i) {
> > +     demux_attachment_t* att = demuxer->attachments + i;
> > +     if (extract_embedded_fonts &&
> > +         att->name && att->type && att->data && att->data_size &&
> > +         (strcmp(att->type, "application/x-truetype-font") == 0 ||
> > +          strcmp(att->type, "application/x-font") == 0))
> > +       ass_add_font(ass_library, att->name, att->data,
> > att->data_size); +   }
> > + }
> > +#endif
> > +
> >  return demuxer;
> >  }
>
> I don't like it even remotely: the demuxer layer has nothing to do
> with ass!

The chunk with ass_add_font could be moved to mplayer.c, right after the 
demuxer is opened. It makes sense because it deals with a global (per-file, 
to be exact) object.

What about ass_track in sh_sub, you also don't like it ? My other patch adds 
initialization code for it to demuxer.c (at the end of demux_open_stream).



More information about the MPlayer-dev-eng mailing list