Mercurial > audlegacy-plugins
changeset 1359:32cdf1af58f2
Automated merge with ssh://majeru@hg.atheme.org//hg/audacious-plugins
author | Cristi Magherusan <majeru@atheme-project.org> |
---|---|
date | Tue, 24 Jul 2007 03:34:09 +0300 |
parents | d2050220659a (current diff) cf46ed0ee590 (diff) |
children | 62ba1e18d1bb |
files | |
diffstat | 14 files changed, 48 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aac/src/libmp4.c Tue Jul 24 03:33:13 2007 +0300 +++ b/src/aac/src/libmp4.c Tue Jul 24 03:34:09 2007 +0300 @@ -125,7 +125,8 @@ { buffer_playing = TRUE; playback->playing = 1; //XXX should acquire lock? - decodeThread = g_thread_create((GThreadFunc)mp4_decode, playback, TRUE, NULL); + decodeThread = g_thread_self(); + mp4_decode(playback); } static void mp4_stop(InputPlayback *playback) @@ -593,8 +594,6 @@ buffer_playing = FALSE; playback->playing = 0; g_static_mutex_unlock(&mutex); - g_thread_exit(NULL); - return FALSE; } rc= mp4ff_read_sample(mp4file, mp4track, @@ -675,7 +674,7 @@ buffer_playing = FALSE; playback->playing = 0; g_static_mutex_unlock(&mutex); - g_thread_exit(NULL); + return; } if((buffervalid = vfs_fread(streambuffer, 1, BUFFER_SIZE, file))==0){ g_print("AAC: Error reading file\n"); @@ -684,7 +683,7 @@ playback->playing = 0; faacDecClose(decoder); g_static_mutex_unlock(&mutex); - g_thread_exit(NULL); + return; } if(!strncmp((char*)streambuffer, "ID3", 3)){ gint size = 0; @@ -733,7 +732,7 @@ buffer_playing = FALSE; playback->playing = 0; g_static_mutex_unlock(&mutex); - g_thread_exit(NULL); + return; } mp4_ip.set_info(xmmstitle, -1, -1, samplerate, channels); @@ -827,7 +826,6 @@ buffer_playing = FALSE; playback->playing = 0; g_static_mutex_unlock(&mutex); - g_thread_exit(NULL); } static void *mp4_decode( void *args ) @@ -848,7 +846,7 @@ g_static_mutex_unlock(&mutex); if (mp4fh == NULL) - g_thread_exit(NULL); + return NULL; ret = parse_aac_stream(mp4fh);
--- a/src/alac/plugin.c Tue Jul 24 03:33:13 2007 +0300 +++ b/src/alac/plugin.c Tue Jul 24 03:34:09 2007 +0300 @@ -179,7 +179,8 @@ char *filename = data->filename; going = 1; playback = data; - playback_thread = g_thread_create(decode_thread, filename, TRUE, NULL); + playback_thread = g_thread_self(); + decode_thread(filename); } static void stop(InputPlayback * data)
--- a/src/cdaudio-ng/Makefile Tue Jul 24 03:33:13 2007 +0300 +++ b/src/cdaudio-ng/Makefile Tue Jul 24 03:34:09 2007 +0300 @@ -10,6 +10,6 @@ OBJECTS = ${SOURCES:.c=.o} -CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(CDIO_CFLAGS) $(CDDB_CFLAGS) -I../../intl -I../.. -Wall -g3 -ggdb +CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(CDIO_CFLAGS) $(CDDB_CFLAGS) -I../../intl -I../.. include ../../mk/objective.mk
--- a/src/cdaudio-ng/cdaudio-ng.c Tue Jul 24 03:33:13 2007 +0300 +++ b/src/cdaudio-ng/cdaudio-ng.c Tue Jul 24 03:34:09 2007 +0300 @@ -66,7 +66,8 @@ static void cdaudio_get_song_info(gchar *filename, gchar **title, gint *length); static TitleInput *cdaudio_get_song_tuple(gchar *filename); -static void *dae_playing_thread_core(dae_params_t *pdae_params); +static TitleInput *create_tuple_from_trackinfo(char *filename); +static void dae_play_loop(dae_params_t *pdae_params); static int calculate_track_length(int startlsn, int endlsn); static int find_trackno_from_filename(char *filename); static void cleanup_on_error(); @@ -475,15 +476,18 @@ return; } + /* if (debug) printf("cdaudio-ng: starting dae thread...\n"); + */ pdae_params = (dae_params_t *) malloc(sizeof(dae_params_t)); pdae_params->startlsn = trackinfo[trackno].startlsn; pdae_params->endlsn = trackinfo[trackno].endlsn; pdae_params->pplayback = pinputplayback; pdae_params->seektime = -1; pdae_params->currlsn = trackinfo[trackno].startlsn; - pdae_params->thread = g_thread_create((GThreadFunc) dae_playing_thread_core, pdae_params, TRUE, NULL); + pdae_params->thread = g_thread_self(); + dae_play_loop(pdae_params); } else { if (debug) @@ -499,17 +503,10 @@ } } - char title[DEF_STRING_LEN]; - - if (strlen(trackinfo[trackno].performer) > 0) { - strcpy(title, trackinfo[trackno].performer); - strcat(title, " - "); - } - else - strcpy(title, ""); - strcat(title, trackinfo[trackno].name); + char *title = xmms_get_titlestring(xmms_get_gentitle_format(), create_tuple_from_trackinfo(pinputplayback->filename)); inputplugin.set_info(title, calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn), 128000, 44100, 2); + free(title); } void cdaudio_stop(InputPlayback *pinputplayback) @@ -709,17 +706,8 @@ printf("cdaudio-ng: cdaudio_get_song_info(\"%s\")\n", filename); int trackno = find_trackno_from_filename(filename); - char *thetitle = (char *) malloc(DEF_STRING_LEN); - if (strlen(trackinfo[trackno].performer) > 0) { - strcpy(thetitle, trackinfo[trackno].performer); - strcat(thetitle, " - "); - } - else - strcpy(thetitle, ""); - strcat(thetitle, trackinfo[trackno].name); - - *title = thetitle; + *title = xmms_get_titlestring(xmms_get_gentitle_format(), create_tuple_from_trackinfo(filename)); *length = calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn); } @@ -728,10 +716,17 @@ if (debug) printf("cdaudio-ng: cdaudio_get_song_tuple(\"%s\")\n", filename); - TitleInput *tuple = bmp_title_input_new(); + return create_tuple_from_trackinfo(filename); +} + + + /* auxiliar functions */ - /* return information about the requested track */ +TitleInput *create_tuple_from_trackinfo(char *filename) +{ + TitleInput *tuple = bmp_title_input_new(); int trackno = find_trackno_from_filename(filename); + if (trackno < firsttrackno || trackno > lasttrackno) return NULL; @@ -749,15 +744,12 @@ return tuple; } - - /* auxiliar functions */ - -void *dae_playing_thread_core(dae_params_t *pdae_params) +void dae_play_loop(dae_params_t *pdae_params) { unsigned char *buffer = (unsigned char *) malloc(CDDA_DAE_FRAMES * CDIO_CD_FRAMESIZE_RAW); if (debug) - printf("cdaudio-ng: dae thread started\n"); + printf("cdaudio-ng: dae started\n"); cdio_lseek(pcdio, pdae_params->startlsn * CDIO_CD_FRAMESIZE_RAW, SEEK_SET); gboolean output_paused = FALSE; @@ -829,7 +821,7 @@ pdae_params->currlsn += lsncount; } if (debug) - printf("cdaudio-ng: dae thread ended\n"); + printf("cdaudio-ng: dae ended\n"); pdae_params->pplayback->playing = FALSE; pdae_params->pplayback->output->close_audio(); @@ -837,9 +829,6 @@ pdae_params->pplayback->output->close_audio(); free(buffer); - - g_thread_exit(NULL); - return NULL; } int calculate_track_length(int startlsn, int endlsn)
--- a/src/console/Audacious_Driver.cxx Tue Jul 24 03:33:13 2007 +0300 +++ b/src/console/Audacious_Driver.cxx Tue Jul 24 03:34:09 2007 +0300 @@ -310,8 +310,6 @@ playback->output->close_audio(); console_ip_is_going = 0; g_static_mutex_unlock( &playback_mutex ); - // TODO: should decode_thread be cleared here? - g_thread_exit( NULL ); return NULL; } @@ -396,7 +394,8 @@ pending_seek = -1; console_ip_is_going = 1; - decode_thread = g_thread_create( play_loop_track, playback, TRUE, NULL ); + decode_thread = g_thread_self(); + play_loop_track( playback ); } static void seek( InputPlayback * data, gint time )
--- a/src/flacng/plugin.c Tue Jul 24 03:33:13 2007 +0300 +++ b/src/flacng/plugin.c Tue Jul 24 03:34:09 2007 +0300 @@ -541,8 +541,6 @@ */ g_mutex_unlock(flac_pl_mutex); - g_thread_exit(NULL); - _LEAVE NULL; } @@ -600,7 +598,8 @@ flac_ip.set_info(get_title(input->filename, main_info), l, -1, main_info->stream.samplerate, main_info->stream.channels); - thread = g_thread_create(flac_play_loop, input, TRUE, NULL); + thread = g_thread_self(); + flac_play_loop(input); _LEAVE; }
--- a/src/madplug/decoder.c Tue Jul 24 03:33:13 2007 +0300 +++ b/src/madplug/decoder.c Tue Jul 24 03:34:09 2007 +0300 @@ -711,6 +711,5 @@ g_mutex_lock(mad_mutex); info->playback->playing = 0; g_mutex_unlock(mad_mutex); - g_thread_exit(0); return NULL; /* dummy */ }
--- a/src/madplug/plugin.c Tue Jul 24 03:33:13 2007 +0300 +++ b/src/madplug/plugin.c Tue Jul 24 03:34:09 2007 +0300 @@ -464,7 +464,8 @@ info.playback->playing = 1; g_mutex_unlock(pb_mutex); - decode_thread = g_thread_create(decode_loop, (void *) &info, TRUE, NULL); + decode_thread = g_thread_self(); + decode_loop(&info); } static void audmad_pause(InputPlayback *playback, short paused)
--- a/src/metronom/metronom.c Tue Jul 24 03:33:13 2007 +0300 +++ b/src/metronom/metronom.c Tue Jul 24 03:34:09 2007 +0300 @@ -150,7 +150,6 @@ /* Make sure the output plugin stops prebuffering */ playback->output->buffer_free(); playback->output->buffer_free(); - g_thread_exit(NULL); } static void metronom_play(InputPlayback *playback) @@ -199,7 +198,8 @@ metronom_ip.set_info(name, -1, 16 * 44100, 44100, 1); g_free(name); playback->data = pmetronom; - play_thread = g_thread_create((GThreadFunc)play_loop, playback, TRUE, NULL); + play_thread = g_thread_self(); + play_loop(playback); } static void metronom_stop(InputPlayback *playback)
--- a/src/modplug/modplugbmp.cxx Tue Jul 24 03:33:13 2007 +0300 +++ b/src/modplug/modplugbmp.cxx Tue Jul 24 03:34:09 2007 +0300 @@ -221,12 +221,6 @@ return false; } -void* ModplugXMMS::PlayThread(void* arg) -{ - ((ModplugXMMS*)arg)->PlayLoop(); - return NULL; -} - void ModplugXMMS::PlayLoop() { uint32 lLength; @@ -316,8 +310,6 @@ mPaused = false; mStopped = true; - - g_thread_exit(NULL); } void ModplugXMMS::PlayFile(const string& aFilename) @@ -453,12 +445,8 @@ mModProps.mChannels ); - mDecodeThread = g_thread_create( - (GThreadFunc)PlayThread, - this, - TRUE, - NULL - ); + mDecodeThread = g_thread_self(); + this->PlayLoop(); } void ModplugXMMS::Stop(void)
--- a/src/musepack/libmpc.cxx Tue Jul 24 03:33:13 2007 +0300 +++ b/src/musepack/libmpc.cxx Tue Jul 24 03:34:09 2007 +0300 @@ -304,7 +304,8 @@ mpcDecoder.isAlive = true; mpcDecoder.isOutput = false; mpcDecoder.isPause = false; - threadHandle = g_thread_create(GThreadFunc(decodeStream), (void *) g_strdup(data->filename), TRUE, NULL); + threadHandle = g_thread_self(); + decodeStream((void *) g_strdup(data->filename)); } static void mpcStop(InputPlayback *data) @@ -763,7 +764,6 @@ free(track.display); track.display = NULL; } - g_thread_exit(NULL); return 0; }
--- a/src/sexypsf/plugin.c Tue Jul 24 03:33:13 2007 +0300 +++ b/src/sexypsf/plugin.c Tue Jul 24 03:34:09 2007 +0300 @@ -53,7 +53,6 @@ return 0; } - void sexypsf_update(unsigned char *buffer, long count) { const int mask = ~((((16 / 8) * 2)) - 1); @@ -157,8 +156,8 @@ g_free(name); playing = 1; - dethread = g_thread_create((GThreadFunc)sexypsf_playloop, - NULL, TRUE, NULL); + dethread = g_thread_self(); + sexypsf_playloop(NULL); } }
--- a/src/vorbis/vorbis.c Tue Jul 24 03:33:13 2007 +0300 +++ b/src/vorbis/vorbis.c Tue Jul 24 03:34:09 2007 +0300 @@ -583,7 +583,8 @@ playback->eof = 0; playback->error = FALSE; - thread = g_thread_create(vorbis_play_loop, playback, TRUE, NULL); + thread = g_thread_self(); + vorbis_play_loop(playback); } static void
--- a/src/wavpack/libwavpack.cxx Tue Jul 24 03:33:13 2007 +0300 +++ b/src/wavpack/libwavpack.cxx Tue Jul 24 03:34:09 2007 +0300 @@ -349,7 +349,8 @@ isSeek = -1; killDecodeThread = false; AudioError = false; - thread_handle = g_thread_create(DecodeThread, (void *) data->filename, TRUE, NULL); + thread_handle = g_thread_self(); + DecodeThread((void *) data->filename); return; }