mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Support downmix of AC-3 to stero.
This commit is contained in:
parent
5d8dea1b6b
commit
2f869884ba
@ -1,6 +1,7 @@
|
||||
User johns
|
||||
Date:
|
||||
|
||||
Support downmix of AC-3 to stero.
|
||||
New audio PES packet parser.
|
||||
Fix bug: Grabbing a JPG image fails while suspended.
|
||||
Add support for hot keys.
|
||||
|
@ -139,12 +139,17 @@ Setup: /etc/vdr/setup.conf
|
||||
|
||||
softhddevice.AudioDelay = 0
|
||||
+n or -n ms
|
||||
delay audio or delay video
|
||||
|
||||
softhddevice.AudioPassthrough = 0
|
||||
0 = none, 1 = AC-3
|
||||
|
||||
for AC-3 the pass-through device is used.
|
||||
|
||||
softhddevice.AudioDownmix = 0
|
||||
0 = none, 1 = downmix
|
||||
downmix AC-3 to stero.
|
||||
|
||||
softhddevice.AutoCrop.Interval = 0
|
||||
0 disables auto-crop
|
||||
n each 'n' frames auto-crop is checked.
|
||||
|
19
codec.c
19
codec.c
@ -628,6 +628,7 @@ static char CodecPassthroughAC3; ///< pass ac3 through
|
||||
|
||||
static const int CodecPassthroughAC3 = 0;
|
||||
#endif
|
||||
static char CodecDownmix; ///< enable ac-3 downmix
|
||||
|
||||
/**
|
||||
** Allocate a new audio decoder context.
|
||||
@ -678,6 +679,12 @@ void CodecAudioOpen(AudioDecoder * audio_decoder, const char *name,
|
||||
if (!(audio_decoder->AudioCtx = avcodec_alloc_context3(audio_codec))) {
|
||||
Fatal(_("codec: can't allocate audio codec context\n"));
|
||||
}
|
||||
|
||||
if (CodecDownmix) {
|
||||
audio_decoder->AudioCtx->request_channels = 2;
|
||||
audio_decoder->AudioCtx->request_channel_layout =
|
||||
AV_CH_LAYOUT_STEREO_DOWNMIX;
|
||||
}
|
||||
pthread_mutex_lock(&CodecLockMutex);
|
||||
// open codec
|
||||
#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(53,5,0)
|
||||
@ -748,6 +755,16 @@ void CodecSetAudioPassthrough(int mask)
|
||||
(void)mask;
|
||||
}
|
||||
|
||||
/**
|
||||
** Set audio downmix.
|
||||
**
|
||||
** @param onoff enable/disable downmix.
|
||||
*/
|
||||
void CodecSetAudioDownmix(int onoff)
|
||||
{
|
||||
CodecDownmix = onoff;
|
||||
}
|
||||
|
||||
/**
|
||||
** Reorder audio frame.
|
||||
**
|
||||
@ -889,7 +906,6 @@ void CodecAudioDecodeOld(AudioDecoder * audio_decoder, const AVPacket * avpkt)
|
||||
|
||||
audio_decoder->PassthroughAC3 = CodecPassthroughAC3;
|
||||
// FIXME: use swr_convert from swresample (only in ffmpeg!)
|
||||
// FIXME: tell ac3 decoder to use downmix
|
||||
if (audio_decoder->ReSample) {
|
||||
audio_resample_close(audio_decoder->ReSample);
|
||||
audio_decoder->ReSample = NULL;
|
||||
@ -1118,7 +1134,6 @@ void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
|
||||
|
||||
audio_decoder->PassthroughAC3 = CodecPassthroughAC3;
|
||||
// FIXME: use swr_convert from swresample (only in ffmpeg!)
|
||||
// FIXME: tell ac3 decoder to use downmix
|
||||
if (audio_decoder->ReSample) {
|
||||
audio_resample_close(audio_decoder->ReSample);
|
||||
audio_decoder->ReSample = NULL;
|
||||
|
@ -38,6 +38,7 @@ extern "C"
|
||||
#include "video.h"
|
||||
extern void AudioPoller(void);
|
||||
extern void CodecSetAudioPassthrough(int);
|
||||
extern void CodecSetAudioDownmix(int);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -84,6 +85,7 @@ static int ConfigVideoScaling[RESOLUTIONS];
|
||||
|
||||
static int ConfigVideoAudioDelay; ///< config audio delay
|
||||
static int ConfigAudioPassthrough; ///< config audio pass-through
|
||||
static int ConfigAudioDownmix; ///< config audio downmix
|
||||
|
||||
static int ConfigAutoCropInterval; ///< auto crop detection interval
|
||||
static int ConfigAutoCropDelay; ///< auto crop detection delay
|
||||
@ -414,6 +416,7 @@ class cMenuSetupSoft:public cMenuSetupPage
|
||||
int Sharpen[RESOLUTIONS];
|
||||
int AudioDelay;
|
||||
int AudioPassthrough;
|
||||
int AudioDownmix;
|
||||
int AutoCropInterval;
|
||||
int AutoCropDelay;
|
||||
int AutoCropTolerance;
|
||||
@ -511,6 +514,9 @@ cMenuSetupSoft::cMenuSetupSoft(void)
|
||||
AudioPassthrough = ConfigAudioPassthrough;
|
||||
Add(new cMenuEditStraItem(tr("Audio pass-through"), &AudioPassthrough, 2,
|
||||
passthrough));
|
||||
AudioDownmix = ConfigAudioDownmix;
|
||||
Add(new cMenuEditBoolItem(tr("Enable AC-3 downmix"), &AudioDownmix,
|
||||
trVDR("no"), trVDR("yes")));
|
||||
//
|
||||
// auto-crop
|
||||
//
|
||||
@ -581,6 +587,8 @@ void cMenuSetupSoft::Store(void)
|
||||
VideoSetAudioDelay(ConfigVideoAudioDelay);
|
||||
SetupStore("AudioPassthrough", ConfigAudioPassthrough = AudioPassthrough);
|
||||
CodecSetAudioPassthrough(ConfigAudioPassthrough);
|
||||
SetupStore("AudioDownmix", ConfigAudioDownmix = AudioDownmix);
|
||||
CodecSetAudioDownmix(ConfigAudioDownmix);
|
||||
|
||||
SetupStore("AutoCrop.Interval", ConfigAutoCropInterval = AutoCropInterval);
|
||||
SetupStore("AutoCrop.Delay", ConfigAutoCropDelay = AutoCropDelay);
|
||||
@ -1527,6 +1535,10 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
|
||||
CodecSetAudioPassthrough(ConfigAudioPassthrough = atoi(value));
|
||||
return true;
|
||||
}
|
||||
if (!strcmp(name, "AudioDownmix")) {
|
||||
CodecSetAudioDownmix(ConfigAudioDownmix = atoi(value));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!strcmp(name, "AutoCrop.Interval")) {
|
||||
VideoSetAutoCrop(ConfigAutoCropInterval =
|
||||
|
Loading…
Reference in New Issue
Block a user