MPD
Main Page
Data Structures
Files
File List
Globals
src
playlist_plugin.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2003-2010 The Music Player Daemon Project
3
* http://www.musicpd.org
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License along
16
* with this program; if not, write to the Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
*/
19
20
#ifndef MPD_PLAYLIST_PLUGIN_H
21
#define MPD_PLAYLIST_PLUGIN_H
22
23
#include <stdbool.h>
24
#include <stddef.h>
25
26
struct
config_param
;
27
struct
input_stream
;
28
struct
tag
;
29
33
struct
playlist_provider
{
34
const
struct
playlist_plugin
*
plugin
;
35
};
36
37
static
inline
void
38
playlist_provider_init
(
struct
playlist_provider
*
playlist
,
39
const
struct
playlist_plugin
*plugin)
40
{
41
playlist->
plugin
= plugin;
42
}
43
44
struct
playlist_plugin
{
45
const
char
*
name
;
46
55
bool (*
init
)(
const
struct
config_param
*param);
56
61
void (*
finish
)(void);
62
67
struct
playlist_provider
*(*open_uri)(
const
char
*uri);
68
74
struct
playlist_provider
*(*open_stream)(
struct
input_stream
*is);
75
76
void (*
close
)(
struct
playlist_provider
*
playlist
);
77
78
struct
song
*(*read)(
struct
playlist_provider
*
playlist
);
79
80
const
char
*
const
*
schemes
;
81
const
char
*
const
*
suffixes
;
82
const
char
*
const
*
mime_types
;
83
};
84
93
static
inline
bool
94
playlist_plugin_init
(
const
struct
playlist_plugin
*
plugin
,
95
const
struct
config_param
*param)
96
{
97
return
plugin->
init
!= NULL
98
? plugin->
init
(param)
99
:
true
;
100
}
101
105
static
inline
void
106
playlist_plugin_finish
(
const
struct
playlist_plugin
*
plugin
)
107
{
108
if
(plugin->
finish
!= NULL)
109
plugin->
finish
();
110
}
111
112
static
inline
struct
playlist_provider
*
113
playlist_plugin_open_uri
(
const
struct
playlist_plugin
*
plugin
,
const
char
*uri)
114
{
115
return
plugin->
open_uri
(uri);
116
}
117
118
static
inline
struct
playlist_provider
*
119
playlist_plugin_open_stream
(
const
struct
playlist_plugin
*
plugin
,
120
struct
input_stream
*is)
121
{
122
return
plugin->
open_stream
(is);
123
}
124
125
static
inline
void
126
playlist_plugin_close
(
struct
playlist_provider
*
playlist
)
127
{
128
playlist->
plugin
->
close
(playlist);
129
}
130
131
static
inline
struct
song
*
132
playlist_plugin_read
(
struct
playlist_provider
*
playlist
)
133
{
134
return
playlist->
plugin
->
read
(playlist);
135
}
136
137
#endif
Generated on Sun Aug 12 2012 21:58:04 for MPD by
1.8.2