Commit f2f4de8a authored by bcoudurier's avatar bcoudurier

fix mjpega bitfilter when dht, dqt, sof0 are not ordered as expected, patch by...

fix mjpega bitfilter when dht, dqt, sof0 are not ordered as expected, patch by Jay Freeman, saurik at saurik com

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@16074 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 346424ce
...@@ -35,6 +35,7 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av ...@@ -35,6 +35,7 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av
const uint8_t *buf, int buf_size, int keyframe) const uint8_t *buf, int buf_size, int keyframe)
{ {
uint8_t *poutbufp; uint8_t *poutbufp;
unsigned dqt = 0, dht = 0, sof0 = 0;
int i; int i;
if (avctx->codec_id != CODEC_ID_MJPEG) { if (avctx->codec_id != CODEC_ID_MJPEG) {
...@@ -59,12 +60,13 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av ...@@ -59,12 +60,13 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av
for (i = 0; i < buf_size - 1; i++) { for (i = 0; i < buf_size - 1; i++) {
if (buf[i] == 0xff) { if (buf[i] == 0xff) {
switch (buf[i + 1]) { switch (buf[i + 1]) {
case DQT: /* quant off */ case DQT: dqt = i + 46; break;
case DHT: /* huff off */ case DHT: dht = i + 46; break;
case SOF0: /* image off */ case SOF0: sof0 = i + 46; break;
bytestream_put_be32(&poutbufp, i + 46);
break;
case SOS: 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); /* scan off */
bytestream_put_be32(&poutbufp, i + 46 + AV_RB16(buf + i + 2)); /* data 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 */ bytestream_put_buffer(&poutbufp, buf + 2, buf_size - 2); /* skip already written SOI */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment