Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2012-05-08 23:29:46 +0400
committerHendrik Leppkes <h.leppkes@gmail.com>2012-05-09 00:18:19 +0400
commit1e0e6369476b03accc9622d3dcff244ae0354cc5 (patch)
treef0e1e50db2471fc36ce6a2ef00809f04619b024a
parent47c2a62e63bc6a1f61508a06b3cf8bd96f095c0d (diff)
Use OpenCore AMR for AMR-NB/WB decoding
-rw-r--r--build_ff_win32.sh3
-rw-r--r--build_ff_x64.sh3
-rw-r--r--decoder/LAVAudio/LAVAudio.cpp14
-rw-r--r--decoder/LAVAudio/Media.cpp2
-rw-r--r--thirdparty/include/opencore-amrnb/interf_dec.h34
-rw-r--r--thirdparty/include/opencore-amrnb/interf_enc.h50
-rw-r--r--thirdparty/include/opencore-amrwb/dec_if.h36
-rw-r--r--thirdparty/include/opencore-amrwb/if_rom.h33
-rw-r--r--thirdparty/lib32/libopencore-amrnb.abin0 -> 217554 bytes
-rw-r--r--thirdparty/lib32/libopencore-amrwb.abin0 -> 88096 bytes
-rw-r--r--thirdparty/lib64/libopencore-amrnb.abin0 -> 213306 bytes
-rw-r--r--thirdparty/lib64/libopencore-amrwb.abin0 -> 87740 bytes
12 files changed, 170 insertions, 5 deletions
diff --git a/build_ff_win32.sh b/build_ff_win32.sh
index fb5f8ed6..f9fe93af 100644
--- a/build_ff_win32.sh
+++ b/build_ff_win32.sh
@@ -17,6 +17,7 @@ make distclean
OPTIONS="
--enable-shared \
--enable-gpl \
+--enable-version3 \
--enable-w32threads \
--enable-runtime-cpudetect \
--enable-demuxers \
@@ -40,6 +41,8 @@ OPTIONS="
--enable-hwaccel=wmv3_dxva2 \
--enable-hwaccel=mpeg2_dxva2 \
--enable-libspeex \
+--enable-libopencore-amrnb \
+--enable-libopencore-amrwb \
--disable-avdevice \
--disable-avresample \
--disable-postproc \
diff --git a/build_ff_x64.sh b/build_ff_x64.sh
index 7aa5c288..cb9590e2 100644
--- a/build_ff_x64.sh
+++ b/build_ff_x64.sh
@@ -17,6 +17,7 @@ make distclean
OPTIONS="
--enable-shared \
--enable-gpl \
+--enable-version3 \
--enable-w32threads \
--enable-runtime-cpudetect \
--enable-demuxers \
@@ -40,6 +41,8 @@ OPTIONS="
--enable-hwaccel=wmv3_dxva2 \
--enable-hwaccel=mpeg2_dxva2 \
--enable-libspeex \
+--enable-libopencore-amrnb \
+--enable-libopencore-amrwb \
--disable-avdevice \
--disable-avresample \
--disable-postproc \
diff --git a/decoder/LAVAudio/LAVAudio.cpp b/decoder/LAVAudio/LAVAudio.cpp
index 150c4aab..94281304 100644
--- a/decoder/LAVAudio/LAVAudio.cpp
+++ b/decoder/LAVAudio/LAVAudio.cpp
@@ -988,12 +988,16 @@ HRESULT CLAVAudio::ffmpeg_init(CodecID codec, const void *format, const GUID for
InitDTSDecoder();
}
+ m_pAVCodec = NULL;
+
+ // Try codec overrides
const char *codec_override = find_codec_override(codec);
- if (codec_override) {
- m_pAVCodec = avcodec_find_decoder_by_name(codec_override);
- } else {
- m_pAVCodec = avcodec_find_decoder(codec);
- }
+ if (codec_override)
+ m_pAVCodec = avcodec_find_decoder_by_name(codec_override);
+
+ // Fallback to default
+ if (!m_pAVCodec)
+ m_pAVCodec = avcodec_find_decoder(codec);
CheckPointer(m_pAVCodec, VFW_E_UNSUPPORTED_AUDIO);
m_pAVCtx = avcodec_alloc_context3(m_pAVCodec);
diff --git a/decoder/LAVAudio/Media.cpp b/decoder/LAVAudio/Media.cpp
index d98ad548..960b7d0e 100644
--- a/decoder/LAVAudio/Media.cpp
+++ b/decoder/LAVAudio/Media.cpp
@@ -251,6 +251,8 @@ static const struct s_ffmpeg_codec_overrides {
{ CODEC_ID_MP1, "mp1float" },
{ CODEC_ID_MP2, "mp2float" },
{ CODEC_ID_MP3, "mp3float" },
+ { CODEC_ID_AMR_NB, "libopencore_amrnb" },
+ { CODEC_ID_AMR_WB, "libopencore_amrwb" },
};
const char *find_codec_override(CodecID codec)
diff --git a/thirdparty/include/opencore-amrnb/interf_dec.h b/thirdparty/include/opencore-amrnb/interf_dec.h
new file mode 100644
index 00000000..98051f40
--- /dev/null
+++ b/thirdparty/include/opencore-amrnb/interf_dec.h
@@ -0,0 +1,34 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OPENCORE_AMRNB_INTERF_DEC_H
+#define OPENCORE_AMRNB_INTERF_DEC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void* Decoder_Interface_init(void);
+void Decoder_Interface_exit(void* state);
+void Decoder_Interface_Decode(void* state, const unsigned char* in, short* out, int bfi);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/include/opencore-amrnb/interf_enc.h b/thirdparty/include/opencore-amrnb/interf_enc.h
new file mode 100644
index 00000000..b89b0c7c
--- /dev/null
+++ b/thirdparty/include/opencore-amrnb/interf_enc.h
@@ -0,0 +1,50 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OPENCORE_AMRNB_INTERF_ENC_H
+#define OPENCORE_AMRNB_INTERF_ENC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef AMRNB_WRAPPER_INTERNAL
+/* Copied from enc/src/gsmamr_enc.h */
+enum Mode {
+ MR475 = 0,/* 4.75 kbps */
+ MR515, /* 5.15 kbps */
+ MR59, /* 5.90 kbps */
+ MR67, /* 6.70 kbps */
+ MR74, /* 7.40 kbps */
+ MR795, /* 7.95 kbps */
+ MR102, /* 10.2 kbps */
+ MR122, /* 12.2 kbps */
+ MRDTX, /* DTX */
+ N_MODES /* Not Used */
+};
+#endif
+
+void* Encoder_Interface_init(int dtx);
+void Encoder_Interface_exit(void* state);
+int Encoder_Interface_Encode(void* state, enum Mode mode, const short* speech, unsigned char* out, int forceSpeech);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/include/opencore-amrwb/dec_if.h b/thirdparty/include/opencore-amrwb/dec_if.h
new file mode 100644
index 00000000..56acdaaf
--- /dev/null
+++ b/thirdparty/include/opencore-amrwb/dec_if.h
@@ -0,0 +1,36 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OPENCORE_AMRWB_DEC_IF_H
+#define OPENCORE_AMRWB_DEC_IF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define _good_frame 0
+
+void* D_IF_init(void);
+void D_IF_decode(void* state, const unsigned char* bits, short* synth, int bfi);
+void D_IF_exit(void* state);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/include/opencore-amrwb/if_rom.h b/thirdparty/include/opencore-amrwb/if_rom.h
new file mode 100644
index 00000000..8977e03a
--- /dev/null
+++ b/thirdparty/include/opencore-amrwb/if_rom.h
@@ -0,0 +1,33 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 2009 Martin Storsjo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OPENCORE_AMRWB_IF_ROM_H
+#define OPENCORE_AMRWB_IF_ROM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+typedef int16_t Word16;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/lib32/libopencore-amrnb.a b/thirdparty/lib32/libopencore-amrnb.a
new file mode 100644
index 00000000..4f007123
--- /dev/null
+++ b/thirdparty/lib32/libopencore-amrnb.a
Binary files differ
diff --git a/thirdparty/lib32/libopencore-amrwb.a b/thirdparty/lib32/libopencore-amrwb.a
new file mode 100644
index 00000000..75a7a552
--- /dev/null
+++ b/thirdparty/lib32/libopencore-amrwb.a
Binary files differ
diff --git a/thirdparty/lib64/libopencore-amrnb.a b/thirdparty/lib64/libopencore-amrnb.a
new file mode 100644
index 00000000..c21bfbb2
--- /dev/null
+++ b/thirdparty/lib64/libopencore-amrnb.a
Binary files differ
diff --git a/thirdparty/lib64/libopencore-amrwb.a b/thirdparty/lib64/libopencore-amrwb.a
new file mode 100644
index 00000000..6db3593b
--- /dev/null
+++ b/thirdparty/lib64/libopencore-amrwb.a
Binary files differ