[FFmpeg-devel] [PATCH] vobsub in mov support
Reimar Döffinger
Reimar.Doeffinger
Wed Apr 1 11:43:03 CEST 2009
On Wed, Apr 01, 2009 at 12:54:10AM -0700, Baptiste Coudurier wrote:
> > ------------------------------------------------------------------------
> >
> > Index: libavformat/mov.c
> > ===================================================================
> > --- libavformat/mov.c (revision 18285)
> > +++ libavformat/mov.c (working copy)
> > @@ -806,7 +806,8 @@
> > if(id > 0)
> > st->codec->codec_type = CODEC_TYPE_SUBTITLE;
> > }
> > - }
> > + } else if (st->codec->codec_type == CODEC_TYPE_SUBTITLE)
> > + id = codec_get_id(ff_codec_movsubtitle_tags, format);
>
> I believe this hunk is not needed.
>
> > dprintf(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size,
> > (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff,
> > @@ -997,6 +998,7 @@
> > // ttxt stsd contains display flags, justification, background
> > // color, fonts, and default styles, so fake an atom to read it
> > MOVAtom fake_atom = { .size = size - (url_ftell(pb) - start_pos) };
> > + if (id != CODEC_ID_DVD_SUBTITLE) // this contains a proper esds atom
> > mov_read_glbl(c, pb, fake_atom);
> > st->codec->codec_id= id;
> > st->codec->width = sc->width;
>
> This hunk should be sufficient
No, certainly not. ff_codec_movsubtitle_tags is only consulted for
CODEC_TYPE_DATA, never for CODEC_TYPE_SUBTITLE, and in addition it is
also skipped explicitly for mp4s (without that it would be overridden
from CODEC_TYPE_SUBTITLE to CODEC_TYPE_VIDEO).
The whole code is either very carefully crafted and severely lacking
documentation or a very big piece of nonsense.
But as I mentioned in the original message, this would work, but I do
not know if it might break playback of some files completely:
Index: libavformat/mov.c
===================================================================
--- libavformat/mov.c (revision 18274)
+++ libavformat/mov.c (working copy)
@@ -997,6 +997,7 @@
// ttxt stsd contains display flags, justification,
// background
// color, fonts, and default styles, so fake an atom to
// read it
MOVAtom fake_atom = { .size = size - (url_ftell(pb) - start_pos) };
+ if (id > 0)
mov_read_glbl(c, pb, fake_atom);
st->codec->codec_id= id;
st->codec->width = sc->width;
More information about the ffmpeg-devel
mailing list