summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2012-01-15 20:32:11 +0100
committerReinhard Tartler <siretart@tauware.de>2012-01-15 21:40:59 +0100
commite2ff436ef64589de8486517352e17f513886e15b (patch)
tree73a3cf85f848c9030c4da99f7b6188fccb0db27c /libavcodec/utils.c
parente6e7bfc11e93fe3499c576fa9466cb2e913b5965 (diff)
lavc: Relax API strictness in avcodec_decode_audio3 with a custom get_buffer()
Do not fail audio decoding with avcodec_decode_audio3 if user has set a custom get_buffer. Strictly speaking, this was never allowed by the API, but it seems that some software packages did so anyways. In order to unbreak applications (cf. http://bugs.debian.org/655890), this change clarifies the API and overrides the custom get_buffer() with the defaults. This change is inspired by a similar commit (c3846e3ebab610be691adb8b40d376dc2f675dc4) in FFmpeg. Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 6f4d7e68da..8473aacb4f 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -933,9 +933,11 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa
int ret, got_frame = 0;
if (avctx->get_buffer != avcodec_default_get_buffer) {
- av_log(avctx, AV_LOG_ERROR, "A custom get_buffer() cannot be used with "
- "avcodec_decode_audio3()\n");
- return AVERROR(EINVAL);
+ av_log(avctx, AV_LOG_ERROR, "Custom get_buffer() for use with"
+ "avcodec_decode_audio3() detected. Overriding with avcodec_default_get_buffer\n");
+ av_log(avctx, AV_LOG_ERROR, "Please port your application to "
+ "avcodec_decode_audio4()\n");
+ avctx->get_buffer = avcodec_default_get_buffer;
}
ret = avcodec_decode_audio4(avctx, &frame, &got_frame, avpkt);