summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-05 22:34:48 +0200
committerwm4 <wm4@nowhere>2015-06-05 22:34:48 +0200
commit14ac4f0bd66d05665f43f3e65138f035be06e29e (patch)
treeaff7feb2d07474d294b17c8681a36a98bdf7172a
parent68aaffc7117e2d1f7ff5ce89bb7c027b0e1c028c (diff)
downloadmpv-14ac4f0bd66d05665f43f3e65138f035be06e29e.tar.bz2
mpv-14ac4f0bd66d05665f43f3e65138f035be06e29e.tar.xz
ad_spdif: use a pseudo codec entry to select DTS-HD instead of an option
This deprecates the --ad-spdif-dtshd option, and replaces it with a pseudo decoder. This means ad_spdif will report two decoders, "dts" and "dts-hd", of which the second simply enables what the option did. The --ad-spdif-dtshd option will actually be deprecated in the next commit.
-rw-r--r--audio/decode/ad_spdif.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/audio/decode/ad_spdif.c b/audio/decode/ad_spdif.c
index e126520fb1..88f3f2ba2b 100644
--- a/audio/decode/ad_spdif.c
+++ b/audio/decode/ad_spdif.c
@@ -39,6 +39,7 @@ struct spdifContext {
int out_buffer_len;
uint8_t out_buffer[OUTBUF_SIZE];
bool need_close;
+ bool use_dts_hd;
struct mp_audio fmt;
};
@@ -77,6 +78,12 @@ static int init(struct dec_audio *da, const char *decoder)
struct spdifContext *spdif_ctx = talloc_zero(NULL, struct spdifContext);
da->priv = spdif_ctx;
spdif_ctx->log = da->log;
+ spdif_ctx->use_dts_hd = da->opts->dtshd;
+
+ if (strcmp(decoder, "dts-hd") == 0) {
+ decoder = "dts";
+ spdif_ctx->use_dts_hd = true;
+ }
spdif_ctx->codec_id = mp_codec_to_av_codec_id(decoder);
return spdif_ctx->codec_id != AV_CODEC_ID_NONE;
@@ -183,7 +190,7 @@ static int init_filter(struct dec_audio *da, AVPacket *pkt)
case AV_CODEC_ID_DTS: {
bool is_hd = profile == FF_PROFILE_DTS_HD_HRA ||
profile == FF_PROFILE_DTS_HD_MA;
- if (da->opts->dtshd && is_hd) {
+ if (spdif_ctx->use_dts_hd && is_hd) {
av_dict_set(&format_opts, "dtshd_rate", "768000", 0); // 4*192000
sample_format = AF_FORMAT_S_DTSHD;
samplerate = 192000;
@@ -297,6 +304,8 @@ static void add_decoders(struct mp_decoder_list *list)
"libavformat/spdifenc audio pass-through decoder");
}
}
+ mp_add_decoder(list, "spdif", "dts", "dts-hd",
+ "libavformat/spdifenc audio pass-through decoder");
}
const struct ad_functions ad_spdif = {