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

Michael Niedermayer michael at niedermayer.cc
Mon Apr 30 19:12:13 EEST 2018


On Sun, Apr 29, 2018 at 11:23:17PM +0000, Kieran Kunhya wrote:
> 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

will apply with explanations in comments and names constants where it makes
sense

Thanks

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180430/17505ddb/attachment.sig>


More information about the ffmpeg-devel mailing list