[FFmpeg-devel] [PATCH 2/2] avformat/mpegts: Skip over broken 0x80 headers

Michael Niedermayer michael at niedermayer.cc
Sun Apr 10 23:13:55 CEST 2016


On Sun, Apr 10, 2016 at 08:23:58PM +0200, Paul B Mahol wrote:
> On 4/10/16, Michael Niedermayer <michael at niedermayer.cc> wrote:
> > This fixes demuxing of 01c56b0dc1.ts
> >
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavformat/mpegts.c |   12 +++++++++---
> >  1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> > index e856ff0..38ff264 100644
> > --- a/libavformat/mpegts.c
> > +++ b/libavformat/mpegts.c
> > @@ -2335,7 +2335,7 @@ static void reanalyze(MpegTSContext *ts) {
> >
> >  /* XXX: try to find a better synchro over several packets (use
> >   * get_packet_size() ?) */
> > -static int mpegts_resync(AVFormatContext *s, int seekback)
> > +static int mpegts_resync(AVFormatContext *s, int seekback, const uint8_t
> > *current_packet)
> >  {
> >      MpegTSContext *ts = s->priv_data;
> >      AVIOContext *pb = s->pb;
> > @@ -2344,6 +2344,12 @@ static int mpegts_resync(AVFormatContext *s, int
> > seekback)
> >
> >      avio_seek(pb, -FFMIN(seekback, pos), SEEK_CUR);
> >
> > +    //Special case for files like 01c56b0dc1.ts
> > +    if (current_packet[0] == 0x80 && current_packet[12] == 0x47) {
> > +        avio_seek(pb, 12, SEEK_CUR);
> > +        return 0;
> > +    }
> > +
> 
> Can this break valid files?

valid files are suposed to have 0x47 here not 0x80
so unless iam missing something (which is not impossible) this
should break no valid file

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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160410/740fe5c5/attachment.sig>


More information about the ffmpeg-devel mailing list