[FFmpeg-cvslog] r10908 - trunk/libavformat/mpeg.c

Michael Niedermayer michaelni
Sat Nov 3 15:55:59 CET 2007


On Sat, Nov 03, 2007 at 02:29:45PM +0000, M?ns Rullg?rd wrote:
> michael <subversion at mplayerhq.hu> writes:
> 
> > Author: michael
> > Date: Sat Nov  3 14:48:30 2007
> > New Revision: 10908
> >
> > Log:
> > fix misdetection of mp3could_not_find_codec_parameters.mp3
> >
> > Modified:
> >    trunk/libavformat/mpeg.c
> >
> > Modified: trunk/libavformat/mpeg.c
> > ==============================================================================
> > --- trunk/libavformat/mpeg.c	(original)
> > +++ trunk/libavformat/mpeg.c	Sat Nov  3 14:48:30 2007
> > @@ -44,6 +44,26 @@ static int cdxa_probe(AVProbeData *p)
> >          return 0;
> >  }
> >
> > +static int check_pes(uint8_t *p, uint8_t *end){
> > +    int pes1;
> > +    int pes2=      (p[3] & 0xC0) == 0x80
> > +                && (p[4] & 0xC0) != 0x40
> > +                &&((p[4] & 0xC0) == 0x00 || (p[4]&0xC0)>>2 == (p[6]&0xF0));
> > +
> > +    for(p+=3; p<end && *p == 0xFF; p++);
> 
> What is the purpose of this?  MPEG PS doesn't have unspecified-length
> sequences of 0xff bytes.

mpeg1 systems spec:
|packet() {                                  |          |          |
| packet_start_code_prefix                   |24        |bslbf     |
| stream_id                                  |8         |uimsbf    |
| packet_length                              |16        |uimsbf    |
| if (stream_id != private_stream_2) {       |          |          |
|  while (nextbits() == '1111 1111')         |          |          |
|   stuffing_byte                            |8         |bslbf     |

is my copy of the spec wrong?


> 
> > +    if((*p&0xC0) == 0x40) p+=2;
> > +    if((*p&0xF0) == 0x20){
> > +        pes1= p[0]&p[2]&p[4]&1;
> > +        p+=5;
> > +    }else if((*p&0xF0) == 0x30){
> > +        pes1= p[0]&p[2]&p[4]&p[5]&p[7]&p[9]&1;
> > +        p+=10;
> > +    }else
> > +        pes1 = *p == 0x0F;
> > +
> > +    return pes1||pes2;
> > +}
> > +
> >  static int mpegps_probe(AVProbeData *p)
> >  {
> >      uint32_t code= -1;
> > @@ -58,11 +78,13 @@ static int mpegps_probe(AVProbeData *p)
> >      for(i=0; i<p->buf_size; i++){
> >          code = (code<<8) + p->buf[i];
> >          if ((code & 0xffffff00) == 0x100) {
> > +            int pes= check_pes(p->buf+i, p->buf+i+p->buf_size);
> 
> Shouldn't that be check_pes(p->buf+i, p->buf+p->buf_size)?

oops, yes, ill fix it in a moment

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20071103/e206e789/attachment.pgp>



More information about the ffmpeg-cvslog mailing list