1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/extract_extradata_bsf: use the parsing code from vc1_split()

It's a simplifaction of the same code, originally commited as b4b9a64bdb.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2017-03-24 18:26:03 -03:00
parent ec996163c8
commit 173fdc4dea

View File

@ -137,20 +137,16 @@ static int extract_extradata_vc1(AVBSFContext *ctx, AVPacket *pkt,
uint8_t **data, int *size)
{
ExtractExtradataContext *s = ctx->priv_data;
const uint8_t *ptr = pkt->data, *end = pkt->data + pkt->size;
uint32_t state = UINT32_MAX;
int has_extradata = 0, extradata_size = 0;
int i;
for (i = 0; i < pkt->size; i++) {
state = (state << 8) | pkt->data[i];
if (IS_MARKER(state)) {
if (state == VC1_CODE_SEQHDR || state == VC1_CODE_ENTRYPOINT) {
has_extradata = 1;
} else if (has_extradata) {
extradata_size = i - 3;
break;
}
}
while (ptr < end) {
ptr = avpriv_find_start_code(ptr, end, &state);
if (state == VC1_CODE_SEQHDR || state == VC1_CODE_ENTRYPOINT) {
has_extradata = 1;
} else if (has_extradata && IS_MARKER(state))
extradata_size = ptr - 4 - pkt->data;
}
if (extradata_size) {