mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-16 22:40:53 +08:00
chmap_avchannel: remove mp_chmap_to_av_layout_custom()
No longer used, might be restored later.
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
*/
|
||||
|
||||
#include <libavutil/channel_layout.h>
|
||||
#include <libavutil/error.h>
|
||||
#include <libavutil/mem.h>
|
||||
|
||||
#include "chmap.h"
|
||||
#include "chmap_avchannel.h"
|
||||
@@ -51,56 +49,3 @@ void mp_chmap_to_av_layout(AVChannelLayout *dst, const struct mp_chmap *src)
|
||||
av_channel_layout_from_mask(dst, mp_chmap_to_lavc(src));
|
||||
}
|
||||
}
|
||||
|
||||
static int custom_init(AVChannelLayout *dst, int nb_channels)
|
||||
{
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(58, 37, 100)
|
||||
return av_channel_layout_custom_init(dst, nb_channels);
|
||||
#else
|
||||
AVChannelCustom *map = av_calloc(nb_channels, sizeof(*map));
|
||||
if (!map)
|
||||
return AVERROR(ENOMEM);
|
||||
dst->order = AV_CHANNEL_ORDER_CUSTOM;
|
||||
dst->nb_channels = nb_channels;
|
||||
dst->u.map = map;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void mp_chmap_to_av_layout_custom(AVChannelLayout *dst,
|
||||
const struct mp_chmap *src)
|
||||
{
|
||||
*dst = (AVChannelLayout){0};
|
||||
|
||||
if (mp_chmap_is_unknown(src) || src->num <= 0) {
|
||||
dst->order = AV_CHANNEL_ORDER_UNSPEC;
|
||||
dst->nb_channels = src->num;
|
||||
return;
|
||||
}
|
||||
|
||||
// A map in canonical (libavutil) order is exactly a native layout, which
|
||||
// every libswresample version can remix. A custom order is only needed to
|
||||
// preserve a non-canonical order or NA channels.
|
||||
if (mp_chmap_is_lavc(src)) {
|
||||
av_channel_layout_from_mask(dst, mp_chmap_to_lavc(src));
|
||||
return;
|
||||
}
|
||||
|
||||
if (custom_init(dst, src->num) < 0) {
|
||||
dst->order = AV_CHANNEL_ORDER_UNSPEC;
|
||||
dst->nb_channels = src->num;
|
||||
return;
|
||||
}
|
||||
|
||||
// mp_speaker_id values < 64 match the AVChannel enum directly. NA maps to
|
||||
// AV_CHAN_UNUSED. Anything else is unknown.
|
||||
for (int n = 0; n < src->num; n++) {
|
||||
if (src->speaker[n] == MP_SPEAKER_ID_NA) {
|
||||
dst->u.map[n].id = AV_CHAN_UNUSED;
|
||||
} else if (src->speaker[n] < 64) {
|
||||
dst->u.map[n].id = src->speaker[n];
|
||||
} else {
|
||||
dst->u.map[n].id = AV_CHAN_UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,3 @@
|
||||
bool mp_chmap_from_av_layout(struct mp_chmap *dst, const AVChannelLayout *src);
|
||||
|
||||
void mp_chmap_to_av_layout(AVChannelLayout *dst, const struct mp_chmap *src);
|
||||
|
||||
// Like mp_chmap_to_av_layout(), but always exact. Emits a native layout when
|
||||
// the map is in native order, otherwise a custom order layout that preserves
|
||||
// the original channel order, with NA channels as AV_CHAN_UNUSED.
|
||||
void mp_chmap_to_av_layout_custom(AVChannelLayout *dst,
|
||||
const struct mp_chmap *src);
|
||||
|
||||
Reference in New Issue
Block a user