diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-03-13 01:56:33 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-13 01:56:33 +0100 |
commit | b25a265a5c921d2d223a8aeff2f918894d515934 (patch) | |
tree | 480f9648f685220520a344ac293f66e307abfc5c /libavcodec/mimic.c | |
parent | 2d38081b4f65f23077cb1b27f2d08c82c45afa05 (diff) | |
parent | bd3e07c82ae558c2cc3616115161827630826ec1 (diff) | |
download | ffmpeg-b25a265a5c921d2d223a8aeff2f918894d515934.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
pcm-mpeg: convert to bytestream2 API
Revert "h264: clear trailing bits in partially parsed NAL units"
remove iwmmxt optimizations
mimic: do not continue if swap_buf_size is 0
mimic: convert to bytestream2 API
frwu: use MKTAG to check marker instead of AV_RL32
txd: port to bytestream2 API
c93: convert to bytestream2 API
iff: make .long_name more descriptive
FATE: add test for cdxl demuxer
rtsp: Fix a typo
Conflicts:
libavcodec/arm/dsputil_iwmmxt.c
libavcodec/arm/dsputil_iwmmxt_rnd_template.c
libavcodec/arm/mpegvideo_iwmmxt.c
libavcodec/c93.c
libavcodec/txd.c
libavutil/arm/cpu.c
tests/fate/demux.mak
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mimic.c')
-rw-r--r-- | libavcodec/mimic.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c index 51ae5be8bc..4f085b4e5d 100644 --- a/libavcodec/mimic.c +++ b/libavcodec/mimic.c @@ -306,24 +306,26 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MimicContext *ctx = avctx->priv_data; + GetByteContext gb; int is_pframe; int width, height; int quality, num_coeffs; int swap_buf_size = buf_size - MIMIC_HEADER_SIZE; - if(buf_size < MIMIC_HEADER_SIZE) { + if (buf_size <= MIMIC_HEADER_SIZE) { av_log(avctx, AV_LOG_ERROR, "insufficient data\n"); return -1; } - buf += 2; /* some constant (always 256) */ - quality = bytestream_get_le16(&buf); - width = bytestream_get_le16(&buf); - height = bytestream_get_le16(&buf); - buf += 4; /* some constant */ - is_pframe = bytestream_get_le32(&buf); - num_coeffs = bytestream_get_byte(&buf); - buf += 3; /* some constant */ + bytestream2_init(&gb, buf, MIMIC_HEADER_SIZE); + bytestream2_skip(&gb, 2); /* some constant (always 256) */ + quality = bytestream2_get_le16u(&gb); + width = bytestream2_get_le16u(&gb); + height = bytestream2_get_le16u(&gb); + bytestream2_skip(&gb, 4); /* some constant */ + is_pframe = bytestream2_get_le32u(&gb); + num_coeffs = bytestream2_get_byteu(&gb); + bytestream2_skip(&gb, 3); /* some constant */ if(!ctx->avctx) { int i; @@ -372,7 +374,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data, return AVERROR(ENOMEM); ctx->dsp.bswap_buf(ctx->swap_buf, - (const uint32_t*) buf, + (const uint32_t*) (buf + MIMIC_HEADER_SIZE), swap_buf_size>>2); init_get_bits(&ctx->gb, ctx->swap_buf, swap_buf_size << 3); |