1 /*
2  * t_backend.c
3  *
4  * backends functions for tagutil
5  */
6 #include "t_config.h"
7 #include "t_toolkit.h"
8 
9 #include "t_backend.h"
10 
11 
12 struct t_backend	*t_ftflac_backend(void) t__weak;
13 struct t_backend	*t_ftoggvorbis_backend(void) t__weak;
14 struct t_backend	*t_fttaglib_backend(void) t__weak;
15 struct t_backend	*t_ftid3v1_backend(void) t__weak;
16 
17 
18 const struct t_backendQ *
t_all_backends(void)19 t_all_backends(void)
20 {
21 	static int initialized = 0;
22 	static struct t_backendQ bQ = TAILQ_HEAD_INITIALIZER(bQ);
23 
24 	if (!initialized) {
25 		/* add each available backend (order matter) */
26 
27 		/* FLAC files support using libflac */
28 		if (t_ftflac_backend != NULL)
29 			TAILQ_INSERT_TAIL(&bQ, t_ftflac_backend(), entries);
30 
31 		/* Ogg/Vorbis files support using libogg/libvorbis */
32 		if (t_ftoggvorbis_backend != NULL)
33 			TAILQ_INSERT_TAIL(&bQ, t_ftoggvorbis_backend(), entries);
34 
35 		/* Multiple files types support using TagLib */
36 		if (t_fttaglib_backend != NULL)
37 			TAILQ_INSERT_TAIL(&bQ, t_fttaglib_backend(), entries);
38 
39 		/* mp3 ID3v1.1 files types support */
40 		if (t_ftid3v1_backend != NULL)
41 			TAILQ_INSERT_TAIL(&bQ, t_ftid3v1_backend(), entries);
42 
43 		initialized = 1;
44 	}
45 
46 	return (&bQ);
47 }
48