~ubuntu-branches/ubuntu/trusty/mpd/trusty

« back to all changes in this revision

Viewing changes to src/output_plugin.h

  • Committer: Bazaar Package Importer
  • Author(s): Angel Abad
  • Date: 2011-02-02 12:26:30 UTC
  • mfrom: (1.5.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20110202122630-bdyx8w4k94doz4fs
Tags: 0.16.1-1ubuntu1
* Merge from debian unstable. Remaining changes:
  - debian/control:
    + Don't build-depend on libmikmod2-dev (Debian bug #510675).
    + Move avahi-daemon from Suggests field to Recommends field.
  - debian/mpd.init.d:
    + Read mpd user from mpd.conf.
  - debian/control, debian/rules:
    + Add libmp3lame-dev to the build dependencies and enable lame.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2003-2009 The Music Player Daemon Project
 
2
 * Copyright (C) 2003-2010 The Music Player Daemon Project
3
3
 * http://www.musicpd.org
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or modify
67
67
        void (*finish)(void *data);
68
68
 
69
69
        /**
 
70
         * Enable the device.  This may allocate resources, preparing
 
71
         * for the device to be opened.  Enabling a device cannot
 
72
         * fail: if an error occurs during that, it should be reported
 
73
         * by the open() method.
 
74
         *
 
75
         * @param error_r location to store the error occuring, or
 
76
         * NULL to ignore errors
 
77
         * @return true on success, false on error
 
78
         */
 
79
        bool (*enable)(void *data, GError **error_r);
 
80
 
 
81
        /**
 
82
         * Disables the device.  It is closed before this method is
 
83
         * called.
 
84
         */
 
85
        void (*disable)(void *data);
 
86
 
 
87
        /**
70
88
         * Really open the device.
71
89
         *
72
90
         * @param audio_format the audio format in which data is going
83
101
        void (*close)(void *data);
84
102
 
85
103
        /**
 
104
         * Returns a positive number if the output thread shall delay
 
105
         * the next call to play() or pause().  This should be
 
106
         * implemented instead of doing a sleep inside the plugin,
 
107
         * because this allows MPD to listen to commands meanwhile.
 
108
         *
 
109
         * @return the number of milliseconds to wait
 
110
         */
 
111
        unsigned (*delay)(void *data);
 
112
 
 
113
        /**
86
114
         * Display metadata for the next chunk.  Optional method,
87
115
         * because not all devices can display metadata.
88
116
         */
99
127
                       GError **error);
100
128
 
101
129
        /**
 
130
         * Wait until the device has finished playing.
 
131
         */
 
132
        void (*drain)(void *data);
 
133
 
 
134
        /**
102
135
         * Try to cancel data which may still be in the device's
103
136
         * buffers.
104
137
         */
150
183
}
151
184
 
152
185
static inline bool
 
186
ao_plugin_enable(const struct audio_output_plugin *plugin, void *data,
 
187
                 GError **error_r)
 
188
{
 
189
        return plugin->enable != NULL
 
190
                ? plugin->enable(data, error_r)
 
191
                : true;
 
192
}
 
193
 
 
194
static inline void
 
195
ao_plugin_disable(const struct audio_output_plugin *plugin, void *data)
 
196
{
 
197
        if (plugin->disable != NULL)
 
198
                plugin->disable(data);
 
199
}
 
200
 
 
201
static inline bool
153
202
ao_plugin_open(const struct audio_output_plugin *plugin,
154
203
               void *data, struct audio_format *audio_format,
155
204
               GError **error)
163
212
        plugin->close(data);
164
213
}
165
214
 
 
215
static inline unsigned
 
216
ao_plugin_delay(const struct audio_output_plugin *plugin, void *data)
 
217
{
 
218
        return plugin->delay != NULL
 
219
                ? plugin->delay(data)
 
220
                : 0;
 
221
}
 
222
 
166
223
static inline void
167
224
ao_plugin_send_tag(const struct audio_output_plugin *plugin,
168
225
                   void *data, const struct tag *tag)
180
237
}
181
238
 
182
239
static inline void
 
240
ao_plugin_drain(const struct audio_output_plugin *plugin, void *data)
 
241
{
 
242
        if (plugin->drain != NULL)
 
243
                plugin->drain(data);
 
244
}
 
245
 
 
246
static inline void
183
247
ao_plugin_cancel(const struct audio_output_plugin *plugin, void *data)
184
248
{
185
249
        if (plugin->cancel != NULL)