Commit 332776f6 authored by zhaoxiu.zeng's avatar zhaoxiu.zeng Committed by Michael Niedermayer

avformat/cavsvideodec: use avpriv_find_start_code in cavsvideo_probe()

Signed-off-by: 's avatarZeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent d79f7bf0
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "avformat.h" #include "avformat.h"
#include "rawdec.h" #include "rawdec.h"
#include "libavcodec/internal.h"
#define CAVS_SEQ_START_CODE 0x000001b0 #define CAVS_SEQ_START_CODE 0x000001b0
#define CAVS_PIC_I_START_CODE 0x000001b3 #define CAVS_PIC_I_START_CODE 0x000001b3
...@@ -33,10 +34,10 @@ static int cavsvideo_probe(AVProbeData *p) ...@@ -33,10 +34,10 @@ static int cavsvideo_probe(AVProbeData *p)
{ {
uint32_t code= -1; uint32_t code= -1;
int pic=0, seq=0, slice_pos = 0; 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++){ while (ptr < end) {
code = (code<<8) + p->buf[i]; ptr = avpriv_find_start_code(ptr, end, &code);
if ((code & 0xffffff00) == 0x100) { if ((code & 0xffffff00) == 0x100) {
if(code < CAVS_SEQ_START_CODE) { if(code < CAVS_SEQ_START_CODE) {
/* slices have to be consecutive */ /* slices have to be consecutive */
...@@ -49,7 +50,7 @@ static int cavsvideo_probe(AVProbeData *p) ...@@ -49,7 +50,7 @@ static int cavsvideo_probe(AVProbeData *p)
if (code == CAVS_SEQ_START_CODE) { if (code == CAVS_SEQ_START_CODE) {
seq++; seq++;
/* check for the only currently supported profile */ /* check for the only currently supported profile */
if(p->buf[i+1] != CAVS_PROFILE_JIZHUN) if (*ptr != CAVS_PROFILE_JIZHUN)
return 0; return 0;
} else if ((code == CAVS_PIC_I_START_CODE) || } else if ((code == CAVS_PIC_I_START_CODE) ||
(code == CAVS_PIC_PB_START_CODE)) { (code == CAVS_PIC_PB_START_CODE)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment