diff options
author | Marton Balint <cus@passwd.hu> | 2024-03-09 22:30:21 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2024-03-16 19:49:39 +0100 |
commit | a4fc3311181a037b381e207fef23f853bc00c64a (patch) | |
tree | 00d244e8f58dd4d4bdf7f485fcf0579b38e60030 /libavutil | |
parent | a688fbfb88779b3b06ef91c196b70996c7fad5f4 (diff) | |
download | ffmpeg-a4fc3311181a037b381e207fef23f853bc00c64a.tar.gz |
avutil/channel_layout: add specific text versions for unknown and unused channels
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/channel_layout.c | 13 | ||||
-rw-r--r-- | libavutil/tests/channel_layout.c | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c index 9e8a1c12e6..a83618bcc7 100644 --- a/libavutil/channel_layout.c +++ b/libavutil/channel_layout.c @@ -86,6 +86,10 @@ void av_channel_name_bprint(AVBPrint *bp, enum AVChannel channel_id) av_bprintf(bp, "%s", channel_names[channel_id].name); else if (channel_id == AV_CHAN_NONE) av_bprintf(bp, "NONE"); + else if (channel_id == AV_CHAN_UNKNOWN) + av_bprintf(bp, "UNK"); + else if (channel_id == AV_CHAN_UNUSED) + av_bprintf(bp, "UNSD"); else av_bprintf(bp, "USR%d", channel_id); } @@ -115,6 +119,10 @@ void av_channel_description_bprint(AVBPrint *bp, enum AVChannel channel_id) av_bprintf(bp, "%s", channel_names[channel_id].description); else if (channel_id == AV_CHAN_NONE) av_bprintf(bp, "none"); + else if (channel_id == AV_CHAN_UNKNOWN) + av_bprintf(bp, "unknown"); + else if (channel_id == AV_CHAN_UNUSED) + av_bprintf(bp, "unused"); else av_bprintf(bp, "user %d", channel_id); } @@ -151,6 +159,11 @@ enum AVChannel av_channel_from_string(const char *str) if (channel_names[i].name && !strcmp(str, channel_names[i].name)) return i; } + if (!strcmp(str, "UNK")) + return AV_CHAN_UNKNOWN; + if (!strcmp(str, "UNSD")) + return AV_CHAN_UNUSED; + if (!strncmp(str, "USR", 3)) { const char *p = str + 3; id = strtol(p, &endptr, 0); diff --git a/libavutil/tests/channel_layout.c b/libavutil/tests/channel_layout.c index 14d36c71b5..8132b83434 100644 --- a/libavutil/tests/channel_layout.c +++ b/libavutil/tests/channel_layout.c @@ -348,6 +348,8 @@ int main(void) CHANNEL_LAYOUT_FROM_STRING("Dummy@FL"); CHANNEL_LAYOUT_FROM_STRING("FR+Dummy"); CHANNEL_LAYOUT_FROM_STRING("FR+Dummy@FL"); + CHANNEL_LAYOUT_FROM_STRING("UNK+UNSD"); + CHANNEL_LAYOUT_FROM_STRING("NONE"); CHANNEL_LAYOUT_FROM_STRING("FR+@FL"); CHANNEL_LAYOUT_FROM_STRING("FL+@"); CHANNEL_LAYOUT_FROM_STRING("FR+FL@Foo+USR63@Foo"); |