[FFmpeg-devel] [PATCH 1/3] avformat/m4vdec: Fix detection of raw MPEG-4 ES Studio

Kieran Kunhya kierank at obe.tv
Mon Apr 30 02:23:17 EEST 2018


On Sun, 29 Apr 2018 at 22:57 Michael Niedermayer <michael at niedermayer.cc>
wrote:

> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  libavformat/m4vdec.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/libavformat/m4vdec.c b/libavformat/m4vdec.c
> index 34d434f7d2..be30f86a5c 100644
> --- a/libavformat/m4vdec.c
> +++ b/libavformat/m4vdec.c
> @@ -29,6 +29,7 @@ static int mpeg4video_probe(AVProbeData *probe_packet)
>  {
>      uint32_t temp_buffer = -1;
>      int VO = 0, VOL = 0, VOP = 0, VISO = 0, res = 0;
> +    int res_main = 0;
>      int i;
>
>      for (i = 0; i < probe_packet->buf_size; i++) {
> @@ -46,11 +47,16 @@ static int mpeg4video_probe(AVProbeData *probe_packet)
>              VO++;
>          else if (temp_buffer >= 0x120 && temp_buffer < 0x130)
>              VOL++;
> +        else if (temp_buffer == 0x1B7 || temp_buffer == 0x1B8)
> +            res_main++;
>          else if (!(0x1AF < temp_buffer && temp_buffer < 0x1B7) &&
>                   !(0x1B9 < temp_buffer && temp_buffer < 0x1C4))
>              res++;
>      }
>
> +    if (res_main && 2*res_main < VOP)
> +        res += res_main;
> +
>      if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res == 0)
>          return VOP+VO > 4 ? AVPROBE_SCORE_EXTENSION :
> AVPROBE_SCORE_EXTENSION/2;
>

Lots of interesting made up numbers here, explanation would be great.
Kieran


More information about the ffmpeg-devel mailing list