[FFmpeg-devel] [RFC] mpeg4 parser do not split of sequence end code

Måns Rullgård mans
Tue Jun 22 21:30:39 CEST 2010


Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:

> Hello,
> currently the parser ends up putting a sequence end marker at the very end
> of a file into a separate packet.
> As a result, the decoder then complains about not being able to find proper
> frame headers.
> The solutions I saw:
> 1) Do not care about that
> 2) Make the decoder ignore packets that contain only a sequence end code
> 3) Make the parser keep the sequence end code together with the previous
>    frame if any.
>
> This patch should implement 3):
> Index: libavcodec/mpeg4video_parser.c
> ===================================================================
> --- libavcodec/mpeg4video_parser.c      (revision 23711)
> +++ libavcodec/mpeg4video_parser.c      (working copy)
> @@ -51,7 +51,7 @@
>              return 0;
>          for(; i<buf_size; i++){
>              state= (state<<8) | buf[i];
> -            if((state&0xFFFFFF00) == 0x100){
> +            if((state&0xFFFFFF00) == 0x100 && state != 0x1B1){
>                  pc->frame_start_found=0;
>                  pc->state=-1;
>                  return i-3;

4) Drop sequence end codes entirely, but that's probably not a good
idea.

I prefer 3.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list