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