[FFmpeg-devel] frames not parsed correctly for VOB file (mpeg2)

Michael Niedermayer michaelni
Wed Feb 3 23:09:14 CET 2010


On Wed, Feb 03, 2010 at 10:05:10PM +0100, Christian Cier-Zniewski wrote:
> Michael Niedermayer schrieb:
>>
>> Outputing 1 field per packet solves this with the old code for
>> compute_pkt_fields()
>>   
> Please find attached the old code replacing the current one.

you are quick :)




>  libavcodec/avcodec.h          |    1 
>  libavcodec/mpeg12.c           |   51 ++++++++++++++----------------------------
>  libavcodec/mpegvideo_parser.c |    9 +++++++
>  libavformat/avformat.h        |    4 +--
>  libavformat/seek.c            |    6 +++-
>  libavformat/utils.c           |   31 +++++++++++++++++--------
>  6 files changed, 54 insertions(+), 48 deletions(-)
> 0844db17114e573f6e275bb023c49004f031f0db  one_field_per_packet.patch
> Index: libavcodec/mpegvideo_parser.c
> ===================================================================
> --- libavcodec/mpegvideo_parser.c	(Revision 21627)
> +++ libavcodec/mpegvideo_parser.c	(Arbeitskopie)
> @@ -37,6 +37,7 @@
>      int did_set_size=0;
>  //FIXME replace the crap with get_bits()
>      s->repeat_pict = 0;
> +	s->parity = 0;

tabs are forbidden in our svn


>  
>      while (buf < buf_end) {
>          start_code= -1;
> @@ -108,6 +109,14 @@
>                                  s->repeat_pict = 2;
>                              }
>                          }
> +						
> +						/* the packet only represents half a frame
> +                           XXX,FIXME maybe find a different solution */
> +                        if(picture_structure != 3){
> +                            s->repeat_pict = -1;
> +                            s->parity = picture_structure-1;
> +                        }else
> +                            s->parity = !top_field_first;

the code above back then looked like:
                        if (repeat_first_field) {
                            if (pc->progressive_sequence) {
                                if (top_field_first)
                                    s->repeat_pict = 4;
                                else
                                    s->repeat_pict = 2;
                            } else if (progressive_frame) {
                                s->repeat_pict = 1;
                            }
                        }

now its different, repeat_pict is off by 1
it does not seem you adapted your code, also beware there are 2 repeat_pict
variables


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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- 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-devel/attachments/20100203/e56d70ee/attachment.pgp>



More information about the ffmpeg-devel mailing list