xmms_mediainfo_reader_t * xmms_mediainfo_reader_start (void) { xmms_mediainfo_reader_t *mrt; mrt = xmms_object_new (xmms_mediainfo_reader_t, xmms_mediainfo_reader_stop); xmms_ipc_object_register (XMMS_IPC_OBJECT_MEDIAINFO_READER, XMMS_OBJECT (mrt)); xmms_ipc_broadcast_register (XMMS_OBJECT (mrt), XMMS_IPC_SIGNAL_MEDIAINFO_READER_STATUS); xmms_ipc_signal_register (XMMS_OBJECT (mrt), XMMS_IPC_SIGNAL_MEDIAINFO_READER_UNINDEXED); mrt->mutex = g_mutex_new (); mrt->cond = g_cond_new (); mrt->running = TRUE; mrt->thread = g_thread_create (xmms_mediainfo_reader_thread, mrt, TRUE, NULL); return mrt; }
/** * Allocate a new #xmms_output_t */ xmms_output_t * xmms_output_new (xmms_output_plugin_t *plugin, xmms_playlist_t *playlist) { xmms_output_t *output; xmms_config_property_t *prop; gint size; g_return_val_if_fail (playlist, NULL); XMMS_DBG ("Trying to open output"); output = xmms_object_new (xmms_output_t, xmms_output_destroy); output->playlist = playlist; output->status_mutex = g_mutex_new (); output->playtime_mutex = g_mutex_new (); prop = xmms_config_property_register ("output.buffersize", "32768", NULL, NULL); size = xmms_config_property_get_int (prop); XMMS_DBG ("Using buffersize %d", size); output->filler_mutex = g_mutex_new (); output->filler_state = FILLER_STOP; output->filler_state_cond = g_cond_new (); output->filler_buffer = xmms_ringbuf_new (size); output->filler_thread = g_thread_create (xmms_output_filler, output, TRUE, NULL); xmms_config_property_register ("output.flush_on_pause", "1", NULL, NULL); xmms_ipc_object_register (XMMS_IPC_OBJECT_OUTPUT, XMMS_OBJECT (output)); /* Broadcasts are always transmitted to the client if he * listens to them. */ xmms_ipc_broadcast_register (XMMS_OBJECT (output), XMMS_IPC_SIGNAL_OUTPUT_VOLUME_CHANGED); xmms_ipc_broadcast_register (XMMS_OBJECT (output), XMMS_IPC_SIGNAL_PLAYBACK_STATUS); xmms_ipc_broadcast_register (XMMS_OBJECT (output), XMMS_IPC_SIGNAL_OUTPUT_CURRENTID); /* Signals are only emitted if the client has a pending question to it * after the client recivies a signal, he must ask for it again */ xmms_ipc_signal_register (XMMS_OBJECT (output), XMMS_IPC_SIGNAL_OUTPUT_PLAYTIME); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_START, XMMS_CMD_FUNC (start)); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_STOP, XMMS_CMD_FUNC (stop)); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_PAUSE, XMMS_CMD_FUNC (pause)); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_DECODER_KILL, XMMS_CMD_FUNC (xform_kill)); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_CPLAYTIME, XMMS_CMD_FUNC (playtime)); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_SEEKMS, XMMS_CMD_FUNC (seekms)); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_SEEKMS_REL, XMMS_CMD_FUNC (seekms_rel)); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_SEEKSAMPLES, XMMS_CMD_FUNC (seeksamples)); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_SEEKSAMPLES_REL, XMMS_CMD_FUNC (seeksamples_rel)); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_OUTPUT_STATUS, XMMS_CMD_FUNC (output_status)); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_CURRENTID, XMMS_CMD_FUNC (currentid)); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_VOLUME_SET, XMMS_CMD_FUNC (volume_set)); xmms_object_cmd_add (XMMS_OBJECT (output), XMMS_IPC_CMD_VOLUME_GET, XMMS_CMD_FUNC (volume_get)); output->status = XMMS_PLAYBACK_STATUS_STOP; if (plugin) { if (!set_plugin (output, plugin)) { xmms_log_error ("Could not initialize output plugin"); } } else { xmms_log_error ("initalized output without a plugin, please fix!"); } return output; }