diff options
author | Jay Freeman <saurik@saurik.com> | 2008-12-12 01:40:00 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2008-12-12 01:40:00 +0000 |
commit | 65c127e3d56c54a1679edfd62f1bd49d98ddbf38 (patch) | |
tree | 5a27c5d23b787397e435b91630d6bdd292bd4404 /libavcodec | |
parent | d887151d8c55ac15be346e0236edd21ee05fa151 (diff) | |
download | ffmpeg-65c127e3d56c54a1679edfd62f1bd49d98ddbf38.tar.gz |
fix mjpega bitfilter when dht, dqt, sof0 are not ordered as expected, patch by Jay Freeman, saurik at saurik com
Originally committed as revision 16074 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mjpega_dump_header_bsf.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/mjpega_dump_header_bsf.c b/libavcodec/mjpega_dump_header_bsf.c index a3f0131742..fb27efbf77 100644 --- a/libavcodec/mjpega_dump_header_bsf.c +++ b/libavcodec/mjpega_dump_header_bsf.c @@ -35,6 +35,7 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av const uint8_t *buf, int buf_size, int keyframe) { uint8_t *poutbufp; + unsigned dqt = 0, dht = 0, sof0 = 0; int i; if (avctx->codec_id != CODEC_ID_MJPEG) { @@ -59,12 +60,13 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av for (i = 0; i < buf_size - 1; i++) { if (buf[i] == 0xff) { switch (buf[i + 1]) { - case DQT: /* quant off */ - case DHT: /* huff off */ - case SOF0: /* image off */ - bytestream_put_be32(&poutbufp, i + 46); - break; + case DQT: dqt = i + 46; break; + case DHT: dht = i + 46; break; + case SOF0: sof0 = i + 46; break; case SOS: + bytestream_put_be32(&poutbufp, dqt); /* quant off */ + bytestream_put_be32(&poutbufp, dht); /* huff off */ + bytestream_put_be32(&poutbufp, sof0); /* image off */ bytestream_put_be32(&poutbufp, i + 46); /* scan off */ bytestream_put_be32(&poutbufp, i + 46 + AV_RB16(buf + i + 2)); /* data off */ bytestream_put_buffer(&poutbufp, buf + 2, buf_size - 2); /* skip already written SOI */ |