Mercurial > audlegacy
changeset 3710:602002306969
generic playback control API
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Mon, 08 Oct 2007 02:26:42 -0500 |
parents | a89a12aa4f2c |
children | 21d58602af29 |
files | src/audacious/playback.c src/audacious/playback.h |
diffstat | 2 files changed, 35 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/playback.c Mon Oct 08 01:43:58 2007 -0500 +++ b/src/audacious/playback.c Mon Oct 08 02:26:42 2007 -0500 @@ -355,6 +355,34 @@ return NULL; } +InputPlayback * +playback_new(void) +{ + playback = g_slice_new0(InputPlayback); + + playback->pb_ready_mutex = g_mutex_new(); + playback->pb_ready_cond = g_cond_new(); + playback->pb_ready_val = 0; + + playback->pb_change_mutex = g_mutex_new(); + playback->pb_change_cond = g_cond_new(); + + /* init vtable functors */ + playback->set_pb_ready = playback_set_pb_ready; + playback->set_pb_change = playback_set_pb_change; + playback->set_params = playback_set_pb_params; + playback->set_title = playback_set_pb_title; + playback->pass_audio = output_pass_audio; + + return playback; +} + +void +playback_run(InputPlayback *playback) +{ + playback->thread = g_thread_create(playback_monitor_thread, playback, TRUE, NULL); +} + gboolean playback_play_file(PlaylistEntry *entry) { @@ -393,30 +421,18 @@ ip_data.playing = TRUE; - playback = g_slice_new0(InputPlayback); + playback = playback_new(); entry->decoder->output = &psuedo_output_plugin; playback->plugin = entry->decoder; + playback->filename = g_strdup(entry->filename); playback->output = &psuedo_output_plugin; - playback->filename = g_strdup(entry->filename); - playback->pb_ready_mutex = g_mutex_new(); - playback->pb_ready_cond = g_cond_new(); - playback->pb_ready_val = 0; - - playback->pb_change_mutex = g_mutex_new(); - playback->pb_change_cond = g_cond_new(); - - /* init vtable functors */ - playback->set_pb_ready = playback_set_pb_ready; - playback->set_pb_change = playback_set_pb_change; - playback->set_params = playback_set_pb_params; - playback->set_title = playback_set_pb_title; - playback->pass_audio = output_pass_audio; set_current_input_playback(playback); - playback->thread = g_thread_create(playback_monitor_thread, playback, TRUE, NULL); + playback_run(playback); + #ifdef USE_DBUS mpris_emit_status_change(mpris, MPRIS_STATUS_PLAY); #endif
--- a/src/audacious/playback.h Mon Oct 08 01:43:58 2007 -0500 +++ b/src/audacious/playback.h Mon Oct 08 02:26:42 2007 -0500 @@ -26,6 +26,7 @@ #include <glib.h> #include "playlist.h" +#include "plugin.h" gint playback_get_time(void); void playback_initiate(void); @@ -38,5 +39,7 @@ void playback_seek_relative(gint offset); void playback_eof(void); void playback_error(void); +InputPlayback *playback_new(void); +void playback_run(InputPlayback *); #endif