aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-03-24 18:26:03 -0300
committerJames Almer <jamrial@gmail.com>2017-03-25 22:38:13 -0300
commit173fdc4dea1351a8de5e04a324ad7f0fcb1563ea (patch)
tree019dfc8a0546418015c307bbf2e796903b978c44
parentec996163c8dbacf39c1a3d490d0467299af9a0bd (diff)
downloadffmpeg-173fdc4dea1351a8de5e04a324ad7f0fcb1563ea.tar.gz
avcodec/extract_extradata_bsf: use the parsing code from vc1_split()
It's a simplifaction of the same code, originally commited as b4b9a64bdb6. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavcodec/extract_extradata_bsf.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c
index d909ee6d17..447afb9f9a 100644
--- a/libavcodec/extract_extradata_bsf.c
+++ b/libavcodec/extract_extradata_bsf.c
@@ -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) {