aboutsummaryrefslogtreecommitdiffhomepage
path: root/audio/decode
diff options
context:
space:
mode:
authorGravatar Wessel Dankers <wsl@fruit.je>2013-03-03 18:48:20 +0100
committerGravatar wm4 <wm4@nowhere>2013-03-04 21:18:20 +0100
commit879ebe06554fdd5ed968c3b7ba35488fe0e6017b (patch)
treee25e89b5055119f29854ac19d54c1871002e82a5 /audio/decode
parent7bab84050f168685b42fcee494f07f5ae4cf4d78 (diff)
Add a --dtshd option
The spdif decoder was hardcoded to assume that the spdif output is capable of accepting high (>1.5Mbps) bitrates. While this is true for modern HDMI spdif interfaces, the original coax/toslink system cannot deal with this and will fail to work. This patch adds an option --dtshd which can be enabled if you use a DTS-capable receiver behind a HDMI link.
Diffstat (limited to 'audio/decode')
-rw-r--r--audio/decode/ad_spdif.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/audio/decode/ad_spdif.c b/audio/decode/ad_spdif.c
index e20566a265..128b1bd8a9 100644
--- a/audio/decode/ad_spdif.c
+++ b/audio/decode/ad_spdif.c
@@ -27,6 +27,7 @@
#include "config.h"
#include "core/mp_msg.h"
#include "core/av_common.h"
+#include "core/options.h"
#include "ad_internal.h"
LIBAD_EXTERN(spdif)
@@ -162,19 +163,27 @@ static int init(sh_audio_t *sh, const char *decoder)
sh->channels = 2;
sh->i_bps = bps;
break;
- case CODEC_ID_DTS: // FORCE USE DTS-HD
- opt = av_opt_find(&lavf_ctx->oformat->priv_class,
- "dtshd_rate", NULL, 0, 0);
- if (!opt)
- goto fail;
- dtshd_rate = (int*)(((uint8_t*)lavf_ctx->priv_data) +
- opt->offset);
- *dtshd_rate = 192000*4;
- spdif_ctx->iec61937_packet_size = 32768;
- sh->sample_format = AF_FORMAT_IEC61937_LE;
- sh->samplerate = 192000; // DTS core require 48000
- sh->channels = 2*4;
- sh->i_bps = bps;
+ case CODEC_ID_DTS:
+ if(sh->opts->dtshd) {
+ opt = av_opt_find(&lavf_ctx->oformat->priv_class,
+ "dtshd_rate", NULL, 0, 0);
+ if (!opt)
+ goto fail;
+ dtshd_rate = (int*)(((uint8_t*)lavf_ctx->priv_data) +
+ opt->offset);
+ *dtshd_rate = 192000*4;
+ spdif_ctx->iec61937_packet_size = 32768;
+ sh->sample_format = AF_FORMAT_IEC61937_LE;
+ sh->samplerate = 192000; // DTS core require 48000
+ sh->channels = 2*4;
+ sh->i_bps = bps;
+ } else {
+ spdif_ctx->iec61937_packet_size = 32768;
+ sh->sample_format = AF_FORMAT_AC3_LE;
+ sh->samplerate = srate;
+ sh->channels = 2;
+ sh->i_bps = bps;
+ }
break;
case CODEC_ID_EAC3:
spdif_ctx->iec61937_packet_size = 24576;