summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Reufer <thomas@reufer.ch>2016-03-29 13:28:16 +0200
committerThomas Reufer <thomas@reufer.ch>2016-03-29 13:28:16 +0200
commit4f58ef78476716bea46d908918ea63d4ad90a824 (patch)
treeec3e1afbbc0ce60e9309d3c6e0f89332b8f45e1d
parent5e28e4ccd7515de3f102538e5ea486d5d81b6fab (diff)
downloadvdr-plugin-rpihddevice-4f58ef78476716bea46d908918ea63d4ad90a824.tar.gz
vdr-plugin-rpihddevice-4f58ef78476716bea46d908918ea63d4ad90a824.tar.bz2
experimental support for AAC-LATM, use "make ENABLE_AAC_LATM=1" to enable
-rw-r--r--HISTORY1
-rw-r--r--Makefile5
-rw-r--r--audio.c57
-rw-r--r--tools.h14
4 files changed, 52 insertions, 25 deletions
diff --git a/HISTORY b/HISTORY
index 6bfd8de..45e9dac 100644
--- a/HISTORY
+++ b/HISTORY
@@ -4,6 +4,7 @@ VDR Plugin 'rpihddevice' Revision History
- new:
- set device name
- add option for dual display usage, see README
+ - experimental support for AAC-LATM, use "make ENABLE_AAC_LATM=1" to enable
- fixed:
- fixed HDMI channel mapping and stream type (reported by RĂ¼diger Follmann)
- fixed drawing of cached images with high level OSD
diff --git a/Makefile b/Makefile
index 3d2167a..a0605b8 100644
--- a/Makefile
+++ b/Makefile
@@ -79,6 +79,11 @@ ifeq ($(DEBUG_BUFFERS), 1)
DEFINES += -DDEBUG_BUFFERS
endif
+ENABLE_AAC_LATM ?= 0
+ifeq ($(ENABLE_AAC_LATM), 1)
+ DEFINES += -DENABLE_AAC_LATM
+endif
+
# ffmpeg/libav configuration
ifdef EXT_LIBAV
LIBAV_PKGCFG = $(shell PKG_CONFIG_PATH=$(EXT_LIBAV)/lib/pkgconfig pkg-config $(1))
diff --git a/audio.c b/audio.c
index 835333b..bffd73e 100644
--- a/audio.c
+++ b/audio.c
@@ -29,6 +29,10 @@ extern "C" {
#include <libavutil/log.h>
#include <libavutil/opt.h>
+#ifdef ENABLE_AAC_LATM
+#warning "experimental AAC-LATM frame parser enabled, only 2ch/48kHz supported!"
+#endif
+
// ffmpeg's resampling
#ifdef HAVE_LIBSWRESAMPLE
# include <libswresample/swresample.h>
@@ -50,14 +54,15 @@ extern "C" {
// legacy libavcodec
#if LIBAVCODEC_VERSION_MAJOR < 55
-# define av_frame_alloc avcodec_alloc_frame
-# define av_frame_free avcodec_free_frame
-# define av_frame_unref avcodec_get_frame_defaults
-# define AV_CODEC_ID_MP3 CODEC_ID_MP3
-# define AV_CODEC_ID_AC3 CODEC_ID_AC3
-# define AV_CODEC_ID_EAC3 CODEC_ID_EAC3
-# define AV_CODEC_ID_AAC CODEC_ID_AAC
-# define AV_CODEC_ID_DTS CODEC_ID_DTS
+# define av_frame_alloc avcodec_alloc_frame
+# define av_frame_free avcodec_free_frame
+# define av_frame_unref avcodec_get_frame_defaults
+# define AV_CODEC_ID_MP3 CODEC_ID_MP3
+# define AV_CODEC_ID_AC3 CODEC_ID_AC3
+# define AV_CODEC_ID_EAC3 CODEC_ID_EAC3
+# define AV_CODEC_ID_AAC CODEC_ID_AAC
+# define AV_CODEC_ID_AAC_LATM CODEC_ID_AAC_LATM
+# define AV_CODEC_ID_DTS CODEC_ID_DTS
#endif
#if LIBAVCODEC_VERSION_MAJOR < 54
@@ -296,11 +301,19 @@ private:
codec = cAudioCodec::eEAC3;
}
break;
+
case cAudioCodec::eAAC:
if (AdtsCheck(p, n, frameSize, channels, samplingRate))
codec = cAudioCodec::eAAC;
break;
+#ifdef ENABLE_AAC_LATM
+ case cAudioCodec::eAAC_LATM:
+ if (LatmCheck(p, n, frameSize, channels, samplingRate))
+ codec = cAudioCodec::eAAC_LATM;
+ break;
+#endif
+
case cAudioCodec::eDTS:
if (DtsCheck(p, n, frameSize, channels, samplingRate))
codec = cAudioCodec::eDTS;
@@ -381,10 +394,13 @@ private:
static cAudioCodec::eCodec FastCheck(const uint8_t *p)
{
- return FastMpegCheck(p) ? cAudioCodec::eMPG :
- FastAc3Check (p) ? cAudioCodec::eAC3 :
- FastAdtsCheck(p) ? cAudioCodec::eAAC :
- FastDtsCheck (p) ? cAudioCodec::eDTS :
+ return FastMpegCheck(p) ? cAudioCodec::eMPG :
+ FastAc3Check (p) ? cAudioCodec::eAC3 :
+ FastAdtsCheck(p) ? cAudioCodec::eAAC :
+#ifdef ENABLE_AAC_LATM
+ FastLatmCheck(p) ? cAudioCodec::eAAC_LATM :
+#endif
+ FastDtsCheck (p) ? cAudioCodec::eDTS :
cAudioCodec::eInvalid;
}
@@ -590,7 +606,7 @@ private:
return true;
}
-#if 0
+#ifdef ENABLE_AAC_LATM
///
/// Fast check for AAC LATM audio.
///
@@ -1189,12 +1205,15 @@ int cRpiAudioDecoder::Init(void)
SysLogLevel > 1 ? AV_LOG_INFO : AV_LOG_ERROR);
av_log_set_callback(&Log);
- m_codecs[cAudioCodec::ePCM ].codec = NULL;
- m_codecs[cAudioCodec::eMPG ].codec = avcodec_find_decoder(AV_CODEC_ID_MP3);
- m_codecs[cAudioCodec::eAC3 ].codec = avcodec_find_decoder(AV_CODEC_ID_AC3);
- m_codecs[cAudioCodec::eEAC3].codec = avcodec_find_decoder(AV_CODEC_ID_EAC3);
- m_codecs[cAudioCodec::eAAC ].codec = avcodec_find_decoder(AV_CODEC_ID_AAC);
- m_codecs[cAudioCodec::eDTS ].codec = avcodec_find_decoder(AV_CODEC_ID_DTS);
+ m_codecs[cAudioCodec::ePCM ].codec = NULL;
+ m_codecs[cAudioCodec::eMPG ].codec = avcodec_find_decoder(AV_CODEC_ID_MP3);
+ m_codecs[cAudioCodec::eAC3 ].codec = avcodec_find_decoder(AV_CODEC_ID_AC3);
+ m_codecs[cAudioCodec::eEAC3 ].codec = avcodec_find_decoder(AV_CODEC_ID_EAC3);
+ m_codecs[cAudioCodec::eAAC ].codec = avcodec_find_decoder(AV_CODEC_ID_AAC);
+#ifdef ENABLE_AAC_LATM
+ m_codecs[cAudioCodec::eAAC_LATM].codec = avcodec_find_decoder(AV_CODEC_ID_AAC_LATM);
+#endif
+ m_codecs[cAudioCodec::eDTS ].codec = avcodec_find_decoder(AV_CODEC_ID_DTS);
for (int i = 0; i < cAudioCodec::eNumCodecs; i++)
{
diff --git a/tools.h b/tools.h
index edcf572..c6d198f 100644
--- a/tools.h
+++ b/tools.h
@@ -109,18 +109,20 @@ public:
eAC3,
eEAC3,
eAAC,
+ eAAC_LATM,
eDTS,
eNumCodecs,
eInvalid
};
static const char* Str(eCodec codec) {
- return (codec == ePCM) ? "PCM" :
- (codec == eMPG) ? "MPEG" :
- (codec == eAC3) ? "AC3" :
- (codec == eEAC3) ? "E-AC3" :
- (codec == eAAC) ? "AAC" :
- (codec == eDTS) ? "DTS" : "unknown";
+ return (codec == ePCM) ? "PCM" :
+ (codec == eMPG) ? "MPEG" :
+ (codec == eAC3) ? "AC3" :
+ (codec == eEAC3) ? "E-AC3" :
+ (codec == eAAC) ? "AAC" :
+ (codec == eAAC_LATM) ? "AAC-LATM" :
+ (codec == eDTS) ? "DTS" : "unknown";
}
};