summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-05 22:35:43 +0200
committerwm4 <wm4@nowhere>2015-06-05 22:42:59 +0200
commit57048c7393e94820520a395e569d05cdcc085224 (patch)
tree329ff5bbeb7ca13076dfa653f03cbc4aa5736730 /common
parent14ac4f0bd66d05665f43f3e65138f035be06e29e (diff)
downloadmpv-57048c7393e94820520a395e569d05cdcc085224.tar.bz2
mpv-57048c7393e94820520a395e569d05cdcc085224.tar.xz
audio: add --audio-spdif as new method for enabling passthrough
This provides a new method for enabling spdif passthrough. The old method via --ad (--ad=spdif:ac3 etc.) is deprecated. The deprecated method will probably stop working at some point. This also supports PCM fallback. One caveat is that it will lose at least 1 audio packet in doing so. (I don't care enough to prevent this.) (This is named after the old S/PDIF connector, because it uses the same underlying technology as far as the higher level protoco is concerned. Also, the user should be renamed that passthrough is backwards.)
Diffstat (limited to 'common')
-rw-r--r--common/codecs.c22
-rw-r--r--common/codecs.h7
2 files changed, 29 insertions, 0 deletions
diff --git a/common/codecs.c b/common/codecs.c
index f89ef0c318..35d270989d 100644
--- a/common/codecs.c
+++ b/common/codecs.c
@@ -130,6 +130,28 @@ struct mp_decoder_list *mp_select_decoders(struct mp_decoder_list *all,
return list;
}
+// selection is a ","-separated list of decoders, all in the given family.
+struct mp_decoder_list *mp_select_decoder_list(struct mp_decoder_list *all,
+ const char *codec,
+ const char *family,
+ const char *selection)
+{
+ struct mp_decoder_list *list = talloc_zero(NULL, struct mp_decoder_list);
+ bstr sel = bstr0(selection);
+ while (sel.len) {
+ bstr decoder;
+ bstr_split_tok(sel, ",", &decoder, &sel);
+ add_new(list, find_decoder(all, bstr0(family), decoder), codec);
+ }
+ return list;
+}
+
+void mp_append_decoders(struct mp_decoder_list *list, struct mp_decoder_list *a)
+{
+ for (int n = 0; n < a->num_entries; n++)
+ add_new(list, &a->entries[n], NULL);
+}
+
void mp_print_decoders(struct mp_log *log, int msgl, const char *header,
struct mp_decoder_list *list)
{
diff --git a/common/codecs.h b/common/codecs.h
index 105aab5a82..a262ed6582 100644
--- a/common/codecs.h
+++ b/common/codecs.h
@@ -37,6 +37,13 @@ struct mp_decoder_list *mp_select_decoders(struct mp_decoder_list *all,
const char *codec,
const char *selection);
+struct mp_decoder_list *mp_select_decoder_list(struct mp_decoder_list *all,
+ const char *codec,
+ const char *family,
+ const char *selection);
+
+void mp_append_decoders(struct mp_decoder_list *list, struct mp_decoder_list *a);
+
struct mp_log;
void mp_print_decoders(struct mp_log *log, int msgl, const char *header,
struct mp_decoder_list *list);