[FFmpeg-cvslog] Fix qdm2 decoder packet handling to match the api
Baptiste Coudurier
git at videolan.org
Sun Dec 25 01:22:18 CET 2011
ffmpeg | branch: release/0.5 | Baptiste Coudurier <baptiste.coudurier at gmail.com> | Fri Nov 19 06:52:30 2010 +0000| [30ee6c1995cdc2ccc9cdc79cc51172c141fd24bf] | committer: Reinhard Tartler
Fix qdm2 decoder packet handling to match the api
Originally committed as revision 25767 to svn://svn.ffmpeg.org/ffmpeg/trunk
(cherry picked from commit b26c1a8b7ed1a199b19f92bb5d62c61f1c149215)
Signed-off-by: Reinhard Tartler <siretart at tauware.de>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30ee6c1995cdc2ccc9cdc79cc51172c141fd24bf
---
libavcodec/qdm2.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index a3373a1..95c8c97 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1906,7 +1906,7 @@ static av_cold int qdm2_decode_close(AVCodecContext *avctx)
}
-static void qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out)
+static int qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out)
{
int ch, i;
const int frame_size = (q->frame_size * q->channels);
@@ -1942,7 +1942,7 @@ static void qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out)
if (!q->has_errors && q->sub_packet_list_C[0].packet != NULL) {
SAMPLES_NEEDED_2("has errors, and C list is not empty")
- return;
+ return -1;
}
}
@@ -1963,6 +1963,8 @@ static void qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out)
out[i] = value;
}
+
+ return 0;
}
@@ -1971,25 +1973,26 @@ static int qdm2_decode_frame(AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
{
QDM2Context *s = avctx->priv_data;
+ int16_t *out = data;
+ int i;
if(!buf)
return 0;
if(buf_size < s->checksum_size)
return -1;
- *data_size = s->channels * s->frame_size * sizeof(int16_t);
-
av_log(avctx, AV_LOG_DEBUG, "decode(%d): %p[%d] -> %p[%d]\n",
buf_size, buf, s->checksum_size, data, *data_size);
- qdm2_decode(s, buf, data);
-
- // reading only when next superblock found
- if (s->sub_packet == 0) {
- return s->checksum_size;
+ for (i = 0; i < 16; i++) {
+ if (qdm2_decode(s, buf, out) < 0)
+ return -1;
+ out += s->channels * s->frame_size;
}
- return 0;
+ *data_size = (uint8_t*)out - (uint8_t*)data;
+
+ return buf_size;
}
AVCodec qdm2_decoder =
More information about the ffmpeg-cvslog
mailing list