On Sun, Mar 15, 2015 at 04:58:52PM +0800, zhaoxiu.zeng wrote: > From 7d57cb0e822ac755ba7e3d9c09d90bf62c7da24d Mon Sep 17 00:00:00 2001 > From: Zeng Zhaoxiu <zhaoxiu.z...@gmail.com> > Date: Sun, 15 Mar 2015 11:59:27 +0800 > Subject: [PATCH 4/7] avformat/m4vdec: use avpriv_find_start_code in > mpeg4video_probe() > > Signed-off-by: Zeng Zhaoxiu <zhaoxiu.z...@gmail.com> > --- > libavformat/m4vdec.c | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) > > diff --git a/libavformat/m4vdec.c b/libavformat/m4vdec.c > index d8ee530..aa0ee36 100644 > --- a/libavformat/m4vdec.c > +++ b/libavformat/m4vdec.c > @@ -21,6 +21,7 @@ > > #include "avformat.h" > #include "rawdec.h" > +#include "libavcodec/internal.h" > > #define VISUAL_OBJECT_START_CODE 0x000001b5 > #define VOP_START_CODE 0x000001b6 > @@ -29,22 +30,20 @@ static int mpeg4video_probe(AVProbeData *probe_packet) > { > uint32_t temp_buffer = -1; > int VO = 0, VOL = 0, VOP = 0, VISO = 0, res = 0; > - int i; > + const uint8_t *ptr = probe_packet->buf, *end = ptr + > probe_packet->buf_size; > > - for (i = 0; i < probe_packet->buf_size; i++) { > - temp_buffer = (temp_buffer << 8) + probe_packet->buf[i]; > - if (temp_buffer & 0xfffffe00) > - continue; > - if (temp_buffer < 2) > - continue; > + while (ptr < end) { > + ptr = avpriv_find_start_code(ptr, end, &temp_buffer); > + if ((temp_buffer & 0xffffff00) != 0x100) > + break; > > if (temp_buffer == VOP_START_CODE) > VOP++; > else if (temp_buffer == VISUAL_OBJECT_START_CODE) > VISO++; > - else if (temp_buffer >= 0x100 && temp_buffer < 0x120) > + else if (temp_buffer < 0x120) > VO++; > - else if (temp_buffer >= 0x120 && temp_buffer < 0x130) > + else if (temp_buffer < 0x130) > VOL++; > else if (!(0x1AF < temp_buffer && temp_buffer < 0x1B7) && > !(0x1B9 < temp_buffer && temp_buffer < 0x1C4))
this is not doing the same, the old code considers 000000XX the new does only consider 000001XX [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel