[FFmpeg-cvslog] avformat/cavsvideodec: use avpriv_find_start_code in cavsvideo_probe()

zhaoxiu.zeng git at videolan.org
Mon Mar 16 16:29:00 CET 2015


ffmpeg | branch: master | zhaoxiu.zeng <zhaoxiu.zeng at gmail.com> | Sun Mar 15 16:56:04 2015 +0800| [332776f6c54c3409d6e91f6e08c7c2c94dbde555] | committer: Michael Niedermayer

avformat/cavsvideodec: use avpriv_find_start_code in cavsvideo_probe()

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=332776f6c54c3409d6e91f6e08c7c2c94dbde555
---

 libavformat/cavsvideodec.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavformat/cavsvideodec.c b/libavformat/cavsvideodec.c
index 880f4ab..b4da58e 100644
--- a/libavformat/cavsvideodec.c
+++ b/libavformat/cavsvideodec.c
@@ -21,6 +21,7 @@
 
 #include "avformat.h"
 #include "rawdec.h"
+#include "libavcodec/internal.h"
 
 #define CAVS_SEQ_START_CODE       0x000001b0
 #define CAVS_PIC_I_START_CODE     0x000001b3
@@ -33,10 +34,10 @@ static int cavsvideo_probe(AVProbeData *p)
 {
     uint32_t code= -1;
     int pic=0, seq=0, slice_pos = 0;
-    int i;
+    const uint8_t *ptr = p->buf, *end = p->buf + p->buf_size;
 
-    for(i=0; i<p->buf_size; i++){
-        code = (code<<8) + p->buf[i];
+    while (ptr < end) {
+        ptr = avpriv_find_start_code(ptr, end, &code);
         if ((code & 0xffffff00) == 0x100) {
             if(code < CAVS_SEQ_START_CODE) {
                 /* slices have to be consecutive */
@@ -49,7 +50,7 @@ static int cavsvideo_probe(AVProbeData *p)
             if (code == CAVS_SEQ_START_CODE) {
                 seq++;
                 /* check for the only currently supported profile */
-                if(p->buf[i+1] != CAVS_PROFILE_JIZHUN)
+                if (*ptr != CAVS_PROFILE_JIZHUN)
                     return 0;
             } else if ((code == CAVS_PIC_I_START_CODE) ||
                        (code == CAVS_PIC_PB_START_CODE)) {



More information about the ffmpeg-cvslog mailing list