[FFmpeg-devel] [RFC/PATCH] Pass PRIVATE_STREAM_2 MPEG-PS packets to caller

Richard peper03 at yahoo.com
Sat Mar 16 21:29:00 CET 2013


On 16/03/13 01:16, Michael Niedermayer wrote:
> On Sat, Mar 16, 2013 at 12:08:16AM +0100, Richard wrote:
>> On 15/03/13 21:50, Michael Niedermayer wrote:
>>> On Fri, Mar 15, 2013 at 11:28:03AM +0100, Richard wrote:
>>>> On 15/03/13 00:10, Michael Niedermayer wrote:
>>>>> On Fri, Mar 08, 2013 at 09:41:50PM +0100, Richard wrote:
>>>>>> +
>>>>>> +            while (len >= 6) {
>>>>>> +                len--;
>>>>>>                   if (avio_r8(s->pb) == 'S') {
>>>>>>                       uint8_t buf[5];
>>>>>>                       avio_read(s->pb, buf, sizeof(buf));
>>>>>> @@ -259,9 +269,32 @@ static int mpegps_read_pes_header(AVFormatContext *s,
>>>>>>                   }
>>>>>>               }
>>>>>>               m->sofdec -= !m->sofdec;
>>>>>
>>>>> you change sofdec detection behavior here
>>>>> before it run once, after your patch it runs on every packet
>>>>
>>>> No it doesn't.  There's still the check for '!m->sofdec', it's just
>>>> been extended to also check for '!m->dvd'.  Once the first packet
>>>> has been checked, m->sofdec is either 1 or -1, so that code will
>>>> only ever be executed once.
>>>
>>> ok but then why is the check for dvd == 0 there ?
>>> its 0 on the first run and irrelevant after
>>
>> Because if we're not dealing with a DVD, we should skip that packet
>> completely, just like before my patch.  It's not irrelevant after.
>>
>> On the first run, sofdec is zero and dvd is zero, so we enter the
>> 'checking code'.  That will set sofdec to either -1 (not sofdec) or
>> 1 (is sofdec), and if sofdec is not detected but a DVD packet is,
>> dvd will be set to 1 so the possibilities after running the checking
>> code on the first packet are:
>>
>> sofdec = -1
>> dvd    = 0
>>         = Unidentified packet - skip
>>
>> sofdec = 1
>> dvd    = 0
>>         = Sofdec packet - skip
>>
>> sofdec = -1
>> dvd    = 1
>>         = DVD packet, don't skip
>
> the code in your patch is this:
> if (!m->sofdec && !m->dvd) {
>
> it results in
> 0, 0 and 0 for these 3 cases and 1 for the initial state
>
> if (!m->sofdec)
>
> does the same

No it doesn't.  m->sofdec is changed in the check code.  It will be zero 
on the way in if it's the first packet but it definitely won't be zero 
on the way out.  That second 'if' is checking the value *after* the 
check code.

Anyway, that's moot.

Attached is a patch that checks the cell elapsed time, and vobu_end_pts 
 >= vobu_start_pts in PCI packets.

Hopefully there can only be errors in the new code and no more that have 
already been in several iterations before becoming problematic.

Richard.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-passing-DVD-navigation-packets-startcode-0x1bf-t.patch
Type: text/x-patch
Size: 12666 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130316/2cfbe7ce/attachment.bin>


More information about the ffmpeg-devel mailing list