summaryrefslogtreecommitdiff
path: root/libavcodec/libopusdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-02 14:38:01 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-02 14:58:19 +0200
commit82db8ee3211014a38db6b8cae03f1c3246938eee (patch)
treeacac8aa9b5b38bcbcb5c34a77f076adee3c28465 /libavcodec/libopusdec.c
parentf7f5370b4b413c05f6ed848bffb85d28c5f44b9c (diff)
parentfd41cb43702498948ff14ba8c284fd5c15fc729d (diff)
downloadffmpeg-82db8ee3211014a38db6b8cae03f1c3246938eee.tar.gz
Merge commit 'fd41cb43702498948ff14ba8c284fd5c15fc729d'
* commit 'fd41cb43702498948ff14ba8c284fd5c15fc729d': avconv: improve sample format negotiation for decoder request Opus encoder using libopus mpegts: Drop pointless casting of hex_dump_debug arguments avformat: const correctness for av_hex_dump / av_hex_dump_log wmadec: Adjust debug printf argument length modifier Conflicts: Changelog ffmpeg.c libavcodec/libopusdec.c libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libopusdec.c')
-rw-r--r--libavcodec/libopusdec.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/libavcodec/libopusdec.c b/libavcodec/libopusdec.c
index 24488fe9dd..f3cad25f76 100644
--- a/libavcodec/libopusdec.c
+++ b/libavcodec/libopusdec.c
@@ -22,13 +22,13 @@
#include <opus.h>
#include <opus_multistream.h>
-#include "libavutil/common.h"
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "internal.h"
#include "vorbis.h"
#include "mathops.h"
+#include "libopus.h"
struct libopus_context {
OpusMSDecoder *dec;
@@ -39,20 +39,6 @@ struct libopus_context {
#endif
};
-static int opus_error_to_averror(int err)
-{
- switch (err) {
- case OPUS_BAD_ARG: return AVERROR(EINVAL);
- case OPUS_BUFFER_TOO_SMALL: return AVERROR_BUFFER_TOO_SMALL;
- case OPUS_INTERNAL_ERROR: return AVERROR(EFAULT);
- case OPUS_INVALID_PACKET: return AVERROR_INVALIDDATA;
- case OPUS_UNIMPLEMENTED: return AVERROR(ENOSYS);
- case OPUS_INVALID_STATE: return AVERROR_EXTERNAL;
- case OPUS_ALLOC_FAIL: return AVERROR(ENOMEM);
- default: return AVERROR(EINVAL);
- }
-}
-
#define OPUS_HEAD_SIZE 19
static av_cold int libopus_decode_init(AVCodecContext *avc)
@@ -105,7 +91,7 @@ static av_cold int libopus_decode_init(AVCodecContext *avc)
if (!opus->dec) {
av_log(avc, AV_LOG_ERROR, "Unable to create decoder: %s\n",
opus_strerror(ret));
- return opus_error_to_averror(ret);
+ return ff_opus_error_to_averror(ret);
}
#ifdef OPUS_SET_GAIN
@@ -165,7 +151,7 @@ static int libopus_decode(AVCodecContext *avc, void *frame,
if (nb_samples < 0) {
av_log(avc, AV_LOG_ERROR, "Decoding error: %s\n",
opus_strerror(nb_samples));
- return opus_error_to_averror(nb_samples);
+ return ff_opus_error_to_averror(nb_samples);
}
#ifndef OPUS_SET_GAIN