-
Notifications
You must be signed in to change notification settings - Fork 0
/
audio_decoder.c
54 lines (42 loc) · 1.15 KB
/
audio_decoder.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//SPDX-License-Identifier: GPL-2.0-or-later
/*
Copyright (C) 2007-2024 Cyril Hrubis <[email protected]>
*/
#include <string.h>
#include <core/gp_debug.h>
#include "config.h"
#include "audio_decoder.h"
const struct audio_decoder audio_decoders[] = {
#ifdef HAVE_MPV_CLIENT_H
{.name = "mpv", .init = audio_decoder_mpv},
#endif
#ifdef HAVE_MPG123_H
{.name = "mpg123", .init = audio_decoder_mpg123},
#endif
{}
};
const struct audio_decoder_ops *audio_decoder_init(const char *name, const struct audio_decoder_callbacks *cbs)
{
unsigned int i;
if (!name || !name[0])
return audio_decoders[0].init(cbs);
for (i = 0; audio_decoders[i].name; i++) {
if (!strcmp(name, audio_decoders[i].name))
return audio_decoders[i].init(cbs);
}
GP_WARN("Audio decoder '%s' not available falling back to '%s'",
name, audio_decoders[0].name);
return audio_decoders[0].init(cbs);
}
__attribute__((weak))
const struct audio_decoder_ops *audio_decoder_mpg123(const struct audio_decoder_callbacks *cbs)
{
(void) cbs;
return NULL;
}
__attribute__((weak))
const struct audio_decoder_ops *audio_decoder_mpv(const struct audio_decoder_callbacks *cbs)
{
(void) cbs;
return NULL;
}