From 13add62cf075cc48a2a1b65c84fc1b5798361bf8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 19 Jan 2017 15:38:58 +0100 Subject: options: drop deprecated --vd/--ad codecs selection features Only simple selection works now. Using "-" to terminate codec selection remains in the code (might get undeprecated). --- DOCS/interface-changes.rst | 1 + DOCS/man/options.rst | 14 ++-------- common/codecs.c | 69 ++++++++-------------------------------------- 3 files changed, 14 insertions(+), 70 deletions(-) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 90b7720a51..ec1bf02d9e 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -25,6 +25,7 @@ Interface changes A minor difference is that --hwdec-api=no (which used to be the default) now actually does not preload any interop layer, while the new default ("") uses the value of --hwdec. + - drop deprecated --ad/--vd features --- mpv 0.23.0 --- - remove deprecated vf_vdpaurb (use "--hwdec=vdpau-copy" instead) - the following properties now have new semantics: diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 079672533f..7e9e304be5 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -1145,41 +1145,31 @@ Audio multichannel PCM, and mpv supports lossless DTS-HD decoding via FFmpeg's new DCA decoder (based on libdcadec). -``--ad=<[+|-]family1:(*|decoder1),[+|-]family2:(*|decoder2),...[-]>`` +``--ad=`` Specify a priority list of audio decoders to be used, according to their decoder name. When determining which decoder to use, the first decoder that matches the audio format is selected. If that is unavailable, the next decoder is used. Finally, it tries all other decoders that are not explicitly selected or rejected by the option. - Specifying family names is deprecated. Entries like ``family:*`` prioritize - all decoders of the given family. - ``-`` at the end of the list suppresses fallback on other available decoders not on the ``--ad`` list. ``+`` in front of an entry forces the decoder. Both of these should not normally be used, because they break normal decoder auto-selection! Both of these methods are deprecated. - ``-`` in front of an entry disables selection of the decoder. This is - deprecated. - .. admonition:: Examples ``--ad=mp3float`` Prefer the FFmpeg/Libav ``mp3float`` decoder over all other MP3 decoders. - ``--ad=lavc:mp3float`` - Prefer the FFmpeg/Libav ``mp3float`` decoder over all other MP3 - decoders. (Using deprecated family syntax.) - ``--ad=help`` List all available decoders. .. admonition:: Warning Enabling compressed audio passthrough (AC3 and DTS via SPDIF/HDMI) with - this option is deprecated. Use ``--audio-spdif`` instead. + this option is not possible. Use ``--audio-spdif`` instead. ``--volume=`` Set the startup volume. 0 means silence, 100 means no volume reduction or diff --git a/common/codecs.c b/common/codecs.c index 5e744da5de..7985501869 100644 --- a/common/codecs.c +++ b/common/codecs.c @@ -33,26 +33,6 @@ void mp_add_decoder(struct mp_decoder_list *list, const char *family, MP_TARRAY_APPEND(list, list->entries, list->num_entries, entry); } -static void mp_add_decoder_entry(struct mp_decoder_list *list, - struct mp_decoder_entry *entry) -{ - mp_add_decoder(list, entry->family, entry->codec, entry->decoder, - entry->desc); -} - -static struct mp_decoder_entry *find_decoder(struct mp_decoder_list *list, - bstr family, bstr decoder) -{ - for (int n = 0; n < list->num_entries; n++) { - struct mp_decoder_entry *cur = &list->entries[n]; - if (bstr_equals0(decoder, cur->decoder)) { - if (bstr_equals0(family, "*") || bstr_equals0(family, cur->family)) - return cur; - } - } - return NULL; -} - // Add entry, but only if it's not yet on the list, and if the codec matches. // If codec == NULL, don't compare codecs. static void add_new(struct mp_decoder_list *to, struct mp_decoder_entry *entry, @@ -60,8 +40,7 @@ static void add_new(struct mp_decoder_list *to, struct mp_decoder_entry *entry, { if (!entry || (codec && strcmp(entry->codec, codec) != 0)) return; - if (!find_decoder(to, bstr0(entry->family), bstr0(entry->decoder))) - mp_add_decoder_entry(to, entry); + mp_add_decoder(to, entry->family, entry->codec, entry->decoder, entry->desc); } // Select a decoder from the given list for the given codec. The selection @@ -71,10 +50,8 @@ static void add_new(struct mp_decoder_list *to, struct mp_decoder_entry *entry, // The selection string corresponds to --vd/--ad directly, and has the // following syntax: // selection = [ ("," )*] -// entry = [ ":"] // prefer decoder -// entry = ":*" // prefer all decoders -// entry = "+" [ ":"] // force a decoder -// entry = "-" [ ":"] // exclude a decoder +// entry = // prefer decoder +// entry = "-" // exclude a decoder // entry = "-" // don't add fallback decoders // Forcing a decoder means it's added even if the codec mismatches. struct mp_decoder_list *mp_select_decoders(struct mp_log *log, @@ -83,7 +60,6 @@ struct mp_decoder_list *mp_select_decoders(struct mp_log *log, const char *selection) { struct mp_decoder_list *list = talloc_zero(NULL, struct mp_decoder_list); - struct mp_decoder_list *remove = talloc_zero(NULL, struct mp_decoder_list); if (!codec) codec = "unknown"; bool stop = false; @@ -96,28 +72,15 @@ struct mp_decoder_list *mp_select_decoders(struct mp_log *log, stop = true; break; } - bool force = bstr_eatstart0(&entry, "+"); - bool exclude = !force && bstr_eatstart0(&entry, "-"); - if (exclude || force) - mp_warn(log, "Forcing or excluding codecs is deprecated.\n"); - struct mp_decoder_list *dest = exclude ? remove : list; - bstr family, decoder; - if (bstr_split_tok(entry, ":", &family, &decoder)) { - mp_warn(log, "Codec family selection is deprecated. " - "Pass the codec name directly.\n"); - } else { - family = bstr0("*"); - decoder = entry; + if (bstr_find0(entry, ":") >= 0) { + mp_err(log, "Codec family selection was removed. " + "Pass the codec name directly.\n"); + break; } - if (bstr_equals0(decoder, "*")) { - for (int n = 0; n < all->num_entries; n++) { - struct mp_decoder_entry *cur = &all->entries[n]; - if (bstr_equals0(family, cur->family)) - add_new(dest, cur, codec); - } - } else { - add_new(dest, find_decoder(all, family, decoder), - force ? NULL : codec); + for (int n = 0; n < all->num_entries; n++) { + struct mp_decoder_entry *cur = &all->entries[n]; + if (bstr_equals0(entry, cur->decoder)) + add_new(list, cur, codec); } } if (!stop) { @@ -125,16 +88,6 @@ struct mp_decoder_list *mp_select_decoders(struct mp_log *log, for (int n = 0; n < all->num_entries; n++) add_new(list, &all->entries[n], codec); } - for (int n = 0; n < remove->num_entries; n++) { - struct mp_decoder_entry *ex = &remove->entries[n]; - struct mp_decoder_entry *del = - find_decoder(list, bstr0(ex->family), bstr0(ex->decoder)); - if (del) { - int index = del - &list->entries[0]; - MP_TARRAY_REMOVE_AT(list->entries, list->num_entries, index); - } - } - talloc_free(remove); return list; } -- cgit v1.2.3