You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avcodec/vc1: simplify vc1_split()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
committed by
Michael Niedermayer
parent
b39ac9d210
commit
b4b9a64bdb
@@ -29,6 +29,7 @@
|
|||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "vc1.h"
|
#include "vc1.h"
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
/** The maximum number of bytes of a sequence, entry point or
|
/** The maximum number of bytes of a sequence, entry point or
|
||||||
* frame header whose values we pay any attention to */
|
* frame header whose values we pay any attention to */
|
||||||
@@ -250,20 +251,18 @@ static int vc1_parse(AVCodecParserContext *s,
|
|||||||
static int vc1_split(AVCodecContext *avctx,
|
static int vc1_split(AVCodecContext *avctx,
|
||||||
const uint8_t *buf, int buf_size)
|
const uint8_t *buf, int buf_size)
|
||||||
{
|
{
|
||||||
int i;
|
uint32_t state = -1;
|
||||||
uint32_t state= -1;
|
int charged = 0;
|
||||||
int charged=0;
|
const uint8_t *ptr = buf, *end = buf + buf_size;
|
||||||
|
|
||||||
for(i=0; i<buf_size; i++){
|
while (ptr < end) {
|
||||||
state= (state<<8) | buf[i];
|
ptr = avpriv_find_start_code(ptr, end, &state);
|
||||||
if(IS_MARKER(state)){
|
if (state == VC1_CODE_SEQHDR || state == VC1_CODE_ENTRYPOINT) {
|
||||||
if(state == VC1_CODE_SEQHDR || state == VC1_CODE_ENTRYPOINT){
|
charged = 1;
|
||||||
charged=1;
|
} else if (charged && IS_MARKER(state))
|
||||||
}else if(charged){
|
return ptr - 4 - buf;
|
||||||
return i-3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user