doc
m4
scripts
src
AudioCompress
archive
cue
db
decoder
dsd2pcm
encoder
filter
input
mixer
output
playlist
protocol
util
win
ack.h
aiff.c
aiff.h
ape.c
ape.h
archive_api.c
archive_api.h
archive_internal.h
archive_list.c
archive_list.h
archive_plugin.c
archive_plugin.h
audio_check.c
audio_check.h
audio_config.c
audio_config.h
audio_format.c
audio_format.h
audio_parser.c
audio_parser.h
buffer.c
buffer.h
check.h
chunk.c
chunk.h
client.c
client.h
client_event.c
client_expire.c
client_file.c
client_file.h
client_global.c
client_idle.c
client_idle.h
client_internal.h
client_list.c
client_message.c
client_message.h
client_new.c
client_process.c
client_read.c
client_subscribe.c
client_subscribe.h
client_write.c
cmdline.c
cmdline.h
command.c
command.h
conf.c
conf.h
crossfade.c
crossfade.h
daemon.c
daemon.h
database.c
database.h
dbUtils.c
dbUtils.h
db_error.h
db_internal.h
db_lock.c
db_lock.h
db_plugin.h
db_print.c
db_print.h
db_save.c
db_save.h
db_selection.h
db_visitor.h
decoder_api.c
decoder_api.h
decoder_buffer.c
decoder_buffer.h
decoder_command.h
decoder_control.c
decoder_control.h
decoder_internal.c
decoder_internal.h
decoder_list.c
decoder_list.h
decoder_plugin.c
decoder_plugin.h
decoder_print.c
decoder_print.h
decoder_thread.c
decoder_thread.h
despotify_utils.c
despotify_utils.h
directory.c
directory.h
directory_save.c
directory_save.h
dummy.cxx
encoder_api.h
encoder_list.c
encoder_list.h
encoder_plugin.h
event_pipe.c
event_pipe.h
exclude.c
exclude.h
fd_util.c
fd_util.h
fifo_buffer.c
fifo_buffer.h
filter_config.c
filter_config.h
filter_internal.h
filter_plugin.c
filter_plugin.h
filter_registry.c
filter_registry.h
gcc.h
glib_compat.h
glib_socket.h
growing_fifo.c
growing_fifo.h
icy_metadata.c
icy_metadata.h
icy_server.c
icy_server.h
idle.c
idle.h
inotify_queue.c
inotify_queue.h
inotify_source.c
inotify_source.h
inotify_update.c
inotify_update.h
input_init.c
input_init.h
input_internal.c
input_internal.h
input_plugin.h
input_registry.c
input_registry.h
input_stream.c
input_stream.h
io_thread.c
io_thread.h
listen.c
listen.h
locate.c
locate.h
log.c
log.h
ls.c
ls.h
main.c
main.h
main_win32.c
mapper.c
mapper.h
mixer_all.c
mixer_all.h
mixer_api.c
mixer_api.h
mixer_control.c
mixer_control.h
mixer_list.h
mixer_plugin.h
mixer_type.c
mixer_type.h
mpd_error.h
notify.c
notify.h
ntp_server.c
ntp_server.h
open.h
output_all.c
output_all.h
output_api.h
output_command.c
output_command.h
output_control.c
output_control.h
output_finish.c
output_init.c
output_internal.h
output_list.c
output_list.h
output_plugin.c
output_plugin.h
output_print.c
output_print.h
output_state.c
output_state.h
output_thread.c
output_thread.h
page.c
page.h
path.c
path.h
pcm_buffer.c
pcm_buffer.h
pcm_byteswap.c
pcm_byteswap.h
pcm_channels.c
pcm_channels.h
pcm_convert.c
pcm_convert.h
pcm_dither.c
pcm_dither.h
pcm_dsd.c
pcm_dsd.h
pcm_format.c
pcm_format.h
pcm_mix.c
pcm_mix.h
pcm_pack.c
pcm_pack.h
pcm_prng.h
pcm_resample.c
pcm_resample.h
pcm_resample_fallback.c
pcm_resample_internal.h
pcm_resample_libsamplerate.c
pcm_utils.h
pcm_volume.c
pcm_volume.h
permission.c
permission.h
pipe.c
pipe.h
player_control.c
player_control.h
player_thread.c
player_thread.h
playlist.c
playlist.h
playlist_any.c
playlist_any.h
playlist_control.c
playlist_database.c
playlist_database.h
playlist_edit.c
playlist_error.h
playlist_global.c
playlist_internal.h
playlist_list.c
playlist_list.h
playlist_mapper.c
playlist_mapper.h
playlist_plugin.h
playlist_print.c
playlist_print.h
playlist_queue.c
playlist_queue.h
playlist_save.c
playlist_save.h
playlist_song.c
playlist_song.h
playlist_state.c
playlist_state.h
playlist_vector.c
playlist_vector.h
poison.h
queue.c
queue.h
queue_print.c
queue_print.h
queue_save.c
queue_save.h
refcount.h
replay_gain_ape.c
replay_gain_ape.h
replay_gain_config.c
replay_gain_config.h
replay_gain_info.c
replay_gain_info.h
resolver.c
resolver.h
riff.c
riff.h
rtsp_client.c
rtsp_client.h
server_socket.c
server_socket.h
sig_handlers.c
sig_handlers.h
socket_util.c
socket_util.h
song.c
song.h
song_print.c
song_print.h
song_save.c
song_save.h
song_sort.c
song_sort.h
song_sticker.c
song_sticker.h
song_update.c
state_file.c
state_file.h
stats.c
stats.h
sticker.c
sticker.h
sticker_print.c
sticker_print.h
stored_playlist.c
stored_playlist.h
string_util.c
string_util.h
strset.c
strset.h
tag.c
tag.h
tag_ape.c
tag_ape.h
tag_file.c
tag_file.h
tag_handler.c
tag_handler.h
tag_id3.c
tag_id3.h
tag_internal.h
tag_pool.c
tag_pool.h
tag_print.c
tag_print.h
tag_rva2.c
tag_rva2.h
tag_save.c
tag_save.h
tag_table.h
tcp_connect.c
tcp_connect.h
tcp_socket.c
tcp_socket.h
text_file.c
text_file.h
text_input_stream.c
text_input_stream.h
timer.c
timer.h
tokenizer.c
tokenizer.h
udp_server.c
udp_server.h
update.c
update.h
update_db.c
update_db.h
update_internal.h
update_io.c
update_io.h
update_queue.c
update_remove.c
update_remove.h
update_walk.c
uri.c
uri.h
utils.c
utils.h
volume.c
volume.h
zeroconf-avahi.c
zeroconf-bonjour.c
zeroconf-internal.h
zeroconf.c
zeroconf.h
test
.gitignore
AUTHORS
COPYING
INSTALL
Makefile.am
NEWS
README
UPGRADING
autogen.sh
configure.ac
mpd.service.in
valgrind.suppressions

Add GMutex, GCond attributes which will be used by callers to conditionally wait on the stream. Remove the (now-useless) plugin method buffer(), wait on GCond instead. Lock the input_stream before each method call. Do the same with the playlist plugins.
95 lines
2.4 KiB
C
95 lines
2.4 KiB
C
/*
|
|
* Copyright (C) 2003-2011 The Music Player Daemon Project
|
|
* http://www.musicpd.org
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*/
|
|
|
|
#include "archive_plugin.h"
|
|
#include "archive_internal.h"
|
|
|
|
#include <assert.h>
|
|
|
|
struct archive_file *
|
|
archive_file_open(const struct archive_plugin *plugin, const char *path,
|
|
GError **error_r)
|
|
{
|
|
struct archive_file *file;
|
|
|
|
assert(plugin != NULL);
|
|
assert(plugin->open != NULL);
|
|
assert(path != NULL);
|
|
assert(error_r == NULL || *error_r == NULL);
|
|
|
|
file = plugin->open(path, error_r);
|
|
|
|
if (file != NULL) {
|
|
assert(file->plugin != NULL);
|
|
assert(file->plugin->close != NULL);
|
|
assert(file->plugin->scan_reset != NULL);
|
|
assert(file->plugin->scan_next != NULL);
|
|
assert(file->plugin->open_stream != NULL);
|
|
assert(error_r == NULL || *error_r == NULL);
|
|
} else {
|
|
assert(error_r == NULL || *error_r != NULL);
|
|
}
|
|
|
|
return file;
|
|
}
|
|
|
|
void
|
|
archive_file_close(struct archive_file *file)
|
|
{
|
|
assert(file != NULL);
|
|
assert(file->plugin != NULL);
|
|
assert(file->plugin->close != NULL);
|
|
|
|
file->plugin->close(file);
|
|
}
|
|
|
|
void
|
|
archive_file_scan_reset(struct archive_file *file)
|
|
{
|
|
assert(file != NULL);
|
|
assert(file->plugin != NULL);
|
|
assert(file->plugin->scan_reset != NULL);
|
|
assert(file->plugin->scan_next != NULL);
|
|
|
|
file->plugin->scan_reset(file);
|
|
}
|
|
|
|
char *
|
|
archive_file_scan_next(struct archive_file *file)
|
|
{
|
|
assert(file != NULL);
|
|
assert(file->plugin != NULL);
|
|
assert(file->plugin->scan_next != NULL);
|
|
|
|
return file->plugin->scan_next(file);
|
|
}
|
|
|
|
struct input_stream *
|
|
archive_file_open_stream(struct archive_file *file, const char *path,
|
|
GMutex *mutex, GCond *cond,
|
|
GError **error_r)
|
|
{
|
|
assert(file != NULL);
|
|
assert(file->plugin != NULL);
|
|
assert(file->plugin->open_stream != NULL);
|
|
|
|
return file->plugin->open_stream(file, path, mutex, cond,
|
|
error_r);
|
|
}
|