Mercurial > audlegacy-plugins
changeset 1403:d7a0b7f3b8c0
- Branch merge
author | Ralf Ertzinger <ralf@skytale.net> |
---|---|
date | Sat, 04 Aug 2007 18:51:04 +0200 |
parents | ce121ac96279 (diff) fe0a9cf95642 (current diff) |
children | ab7d89bb8fcb |
files | |
diffstat | 4 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/flacng/flacng.h Sat Aug 04 15:48:58 2007 +0900 +++ b/src/flacng/flacng.h Sat Aug 04 18:51:04 2007 +0200 @@ -79,6 +79,7 @@ typedef struct callback_info { + GMutex* mutex; gint32* output_buffer; gint32* write_pointer; guint buffer_free;
--- a/src/flacng/plugin.c Sat Aug 04 15:48:58 2007 +0900 +++ b/src/flacng/plugin.c Sat Aug 04 18:51:04 2007 +0200 @@ -180,8 +180,11 @@ _DEBUG("Testing fd for file: %s", filename); + INFO_LOCK(test_info); + if (FALSE == read_metadata(fd, test_decoder, test_info)) { _DEBUG("File not handled by this plugin!"); + INFO_UNLOCK(test_info); _LEAVE FALSE; } @@ -190,6 +193,7 @@ */ if (FALSE == test_info->metadata_changed) { _DEBUG("No metadata found in stream"); + INFO_UNLOCK(test_info); _LEAVE FALSE; } @@ -207,6 +211,7 @@ if (MAX_SUPPORTED_CHANNELS < test_info->stream.channels) { _ERROR("This number of channels (%d) is currently not supported, stream not handled by this plugin", test_info->stream.channels); + INFO_UNLOCK(test_info); _LEAVE FALSE; } @@ -215,6 +220,7 @@ (8 != test_info->stream.bits_per_sample)) { _ERROR("This number of bits (%d) is currently not supported, stream not handled by this plugin", test_info->stream.bits_per_sample); + INFO_UNLOCK(test_info); _LEAVE FALSE; } @@ -225,6 +231,7 @@ _DEBUG("Accepting file %s", filename); reset_info(test_info, FALSE); + INFO_UNLOCK(test_info); _LEAVE TRUE; } @@ -647,11 +654,14 @@ _LEAVE; } + INFO_LOCK(test_info); + if (FALSE == read_metadata(fd, test_decoder, test_info)) { _ERROR("Could not read file info!"); *length = -1; *title = g_strdup(""); reset_info(test_info, TRUE); + INFO_UNLOCK(test_info); _LEAVE; } @@ -670,6 +680,7 @@ *title = get_title(filename, test_info); reset_info(test_info, TRUE); + INFO_UNLOCK(test_info); _LEAVE; } @@ -692,15 +703,19 @@ _LEAVE NULL; } + INFO_LOCK(test_info); + if (FALSE == read_metadata(fd, test_decoder, test_info)) { _ERROR("Could not read metadata tuple for file <%s>", filename); reset_info(test_info, TRUE); + INFO_UNLOCK(test_info); _LEAVE NULL; } tuple = get_tuple(filename, test_info); reset_info(test_info, TRUE); + INFO_UNLOCK(test_info); _LEAVE tuple; }
--- a/src/flacng/tools.c Sat Aug 04 15:48:58 2007 +0900 +++ b/src/flacng/tools.c Sat Aug 04 18:51:04 2007 +0200 @@ -66,6 +66,8 @@ info->replaygain.album_peak = NULL; reset_info(info, FALSE); + info->mutex = g_mutex_new(); + _DEBUG("Playback buffer allocated for %d samples, %d bytes", BUFFER_SIZE_SAMP, BUFFER_SIZE_BYTE); _LEAVE info;
--- a/src/flacng/tools.h Sat Aug 04 15:48:58 2007 +0900 +++ b/src/flacng/tools.h Sat Aug 04 18:51:04 2007 +0200 @@ -23,6 +23,21 @@ #include <FLAC/all.h> #include "flacng.h" #include "flac_compat.h" +#include "debug.h" + +#define INFO_LOCK(__info) \ + do { \ + _DEBUG("Trying to lock info %s", (__info)->name); \ + g_mutex_lock((__info)->mutex); \ + _DEBUG("Locked info %s", (__info)->name); \ + } while(0) + +#define INFO_UNLOCK(__info) \ + do { \ + _DEBUG("Unlocking info %s", (__info)->name); \ + g_mutex_unlock((__info)->mutex); \ + _DEBUG("Unlocked info %s", (__info)->name); \ + } while(0) callback_info* init_callback_info(gchar* name); void reset_info(callback_info* info, gboolean close_fd);