avformat/cavsvideodec: use avpriv_find_start_code in cavsvideo_probe()

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
zhaoxiu.zeng 2015-03-15 16:56:04 +08:00 committed by Michael Niedermayer
parent d79f7bf0d6
commit 332776f6c5

View File

@ -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)) {