mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 12:17:12 +00:00
audio: remove mp_chmap_contains()
It's unsued now.
This commit is contained in:
parent
8b7035c8ff
commit
8d5924f2c9
@ -417,16 +417,6 @@ int mp_chmap_diffn(const struct mp_chmap *a, const struct mp_chmap *b)
|
|||||||
return diff.num;
|
return diff.num;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks whether a contains all the speakers in b
|
|
||||||
bool mp_chmap_contains(const struct mp_chmap *a, const struct mp_chmap *b)
|
|
||||||
{
|
|
||||||
struct mp_chmap d1;
|
|
||||||
struct mp_chmap d2;
|
|
||||||
mp_chmap_diff(a, b, &d1);
|
|
||||||
mp_chmap_diff(b, a, &d2);
|
|
||||||
return a->num >= b->num && d1.num >= 0 && d2.num == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns something like "fl-fr-fc". If there's a standard layout in lavc
|
// Returns something like "fl-fr-fc". If there's a standard layout in lavc
|
||||||
// order, return that, e.g. "3.0" instead of "fl-fr-fc".
|
// order, return that, e.g. "3.0" instead of "fl-fr-fc".
|
||||||
// Unassigned but valid speakers get names like "sp28".
|
// Unassigned but valid speakers get names like "sp28".
|
||||||
|
@ -127,8 +127,6 @@ void mp_chmap_diff(const struct mp_chmap *a, const struct mp_chmap *b,
|
|||||||
struct mp_chmap *diff);
|
struct mp_chmap *diff);
|
||||||
int mp_chmap_diffn(const struct mp_chmap *a, const struct mp_chmap *b);
|
int mp_chmap_diffn(const struct mp_chmap *a, const struct mp_chmap *b);
|
||||||
|
|
||||||
bool mp_chmap_contains(const struct mp_chmap *a, const struct mp_chmap *b);
|
|
||||||
|
|
||||||
char *mp_chmap_to_str_buf(char *buf, size_t buf_size, const struct mp_chmap *src);
|
char *mp_chmap_to_str_buf(char *buf, size_t buf_size, const struct mp_chmap *src);
|
||||||
#define mp_chmap_to_str(m) mp_chmap_to_str_buf((char[64]){0}, 64, (m))
|
#define mp_chmap_to_str(m) mp_chmap_to_str_buf((char[64]){0}, 64, (m))
|
||||||
|
|
||||||
|
24
test/chmap.c
24
test/chmap.c
@ -24,33 +24,9 @@ static void test_mp_chmap_diff(void **state) {
|
|||||||
assert_int_equal(diff.speaker[2], MP_SPEAKER_ID_BC);
|
assert_int_equal(diff.speaker[2], MP_SPEAKER_ID_BC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_mp_chmap_contains_with_related_chmaps(void **state) {
|
|
||||||
struct mp_chmap a;
|
|
||||||
struct mp_chmap b;
|
|
||||||
|
|
||||||
mp_chmap_from_str(&a, bstr0("3.1"));
|
|
||||||
mp_chmap_from_str(&b, bstr0("2.1"));
|
|
||||||
|
|
||||||
assert_true(mp_chmap_contains(&a, &b));
|
|
||||||
assert_false(mp_chmap_contains(&b, &a));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_mp_chmap_contains_with_unrelated_chmaps(void **state) {
|
|
||||||
struct mp_chmap a;
|
|
||||||
struct mp_chmap b;
|
|
||||||
|
|
||||||
mp_chmap_from_str(&a, bstr0("mono"));
|
|
||||||
mp_chmap_from_str(&b, bstr0("stereo"));
|
|
||||||
|
|
||||||
assert_false(mp_chmap_contains(&a, &b));
|
|
||||||
assert_false(mp_chmap_contains(&b, &a));
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
const UnitTest tests[] = {
|
const UnitTest tests[] = {
|
||||||
unit_test(test_mp_chmap_diff),
|
unit_test(test_mp_chmap_diff),
|
||||||
unit_test(test_mp_chmap_contains_with_related_chmaps),
|
|
||||||
unit_test(test_mp_chmap_contains_with_unrelated_chmaps),
|
|
||||||
};
|
};
|
||||||
return run_tests(tests);
|
return run_tests(tests);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user