diff options
author | zhaoxiu.zeng <zhaoxiu.zeng@gmail.com> | 2015-03-15 11:56:04 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-16 17:40:10 +0300 |
commit | 332776f6c54c3409d6e91f6e08c7c2c94dbde555 (patch) | |
tree | b14f047de5d916e043557a57b0f0908251c2e88b /libavformat | |
parent | d79f7bf0d63a81ee66026ee92a6946a7303d04bd (diff) |
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>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/cavsvideodec.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavformat/cavsvideodec.c b/libavformat/cavsvideodec.c index 880f4ab534..b4da58e345 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)) { |