[FFmpeg-devel] [PATCH] avformat/cavsvideodec: use avpriv_find_start_code in cavsvideo_probe()
zhaoxiu.zeng
zhaoxiu.zeng at gmail.com
Sun Mar 15 09:56:04 CET 2015
>From 9a97b5559a8c4ea9a03560d59e1725b6c99d0960 Mon Sep 17 00:00:00 2001
From: Zeng Zhaoxiu <zhaoxiu.zeng at gmail.com>
Date: Sun, 15 Mar 2015 11:58:12 +0800
Subject: [PATCH 3/7] avformat/cavsvideodec: use avpriv_find_start_code in
cavsvideo_probe()
Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng at gmail.com>
---
libavformat/cavsvideodec.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavformat/cavsvideodec.c b/libavformat/cavsvideodec.c
index 880f4ab..d985dd5 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)) {
--
2.1.0
More information about the ffmpeg-devel
mailing list