[FFmpeg-cvslog] 8svx: decode directly to the user-provided AVFrame
Justin Ruggles
git at videolan.org
Wed Feb 13 11:31:58 CET 2013
ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Sun Dec 23 16:28:03 2012 -0500| [a3de4010c2d018ce37a1bfa50b35a17b958d670e] | committer: Justin Ruggles
8svx: decode directly to the user-provided AVFrame
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a3de4010c2d018ce37a1bfa50b35a17b958d670e
---
libavcodec/8svx.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c
index dda181b..4f2a897 100644
--- a/libavcodec/8svx.c
+++ b/libavcodec/8svx.c
@@ -34,7 +34,6 @@
/** decoder context */
typedef struct EightSvxContext {
- AVFrame frame;
uint8_t fib_acc[2];
const int8_t *table;
@@ -85,6 +84,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
EightSvxContext *esc = avctx->priv_data;
+ AVFrame *frame = data;
int buf_size;
int ch, ret;
int is_compr = (avctx->codec_id != AV_CODEC_ID_PCM_S8_PLANAR);
@@ -136,26 +136,25 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
}
/* get output buffer */
- esc->frame.nb_samples = buf_size * (is_compr + 1);
- if ((ret = ff_get_buffer(avctx, &esc->frame)) < 0) {
+ frame->nb_samples = buf_size * (is_compr + 1);
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
for (ch = 0; ch < avctx->channels; ch++) {
if (is_compr) {
- delta_decode(esc->frame.data[ch], &esc->data[ch][esc->data_idx],
+ delta_decode(frame->data[ch], &esc->data[ch][esc->data_idx],
buf_size, &esc->fib_acc[ch], esc->table);
} else {
- raw_decode(esc->frame.data[ch], &esc->data[ch][esc->data_idx],
+ raw_decode(frame->data[ch], &esc->data[ch][esc->data_idx],
buf_size);
}
}
esc->data_idx += buf_size;
- *got_frame_ptr = 1;
- *(AVFrame *)data = esc->frame;
+ *got_frame_ptr = 1;
return avpkt->size;
}
@@ -184,9 +183,6 @@ static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
}
avctx->sample_fmt = AV_SAMPLE_FMT_U8P;
- avcodec_get_frame_defaults(&esc->frame);
- avctx->coded_frame = &esc->frame;
-
return 0;
}
More information about the ffmpeg-cvslog
mailing list