changeset 896:f0846bdd9de6 trunk

[svn] - small cleanups.
author yaz
date Sat, 24 Mar 2007 09:44:44 -0700
parents 5d7e6f06c9b7
children 44a922a4a591
files ChangeLog src/madplug/decoder.c
diffstat 2 files changed, 30 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Mar 24 09:29:41 2007 -0700
+++ b/ChangeLog	Sat Mar 24 09:44:44 2007 -0700
@@ -1,3 +1,13 @@
+2007-03-24 16:29:41 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [1890]
+  - now wma can handle wide characters in metadata.
+  - wma no longer returns tuple with empty strings. (these should be NULL instead.)
+  
+  trunk/src/wma/libffwma/asf.c |   24 +++++++++++--------
+  trunk/src/wma/wma.c          |   52 +++++++++++++++++++++++--------------------
+  2 files changed, 43 insertions(+), 33 deletions(-)
+
+
 2007-03-24 16:08:58 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [1888]
   maintenance of build system:
--- a/src/madplug/decoder.c	Sat Mar 24 09:29:41 2007 -0700
+++ b/src/madplug/decoder.c	Sat Mar 24 09:44:44 2007 -0700
@@ -377,6 +377,19 @@
     return (info->frames != 0 || info->remote == TRUE);
 }
 
+// sanity check for audio open parameters
+static gboolean check_audio_param(struct mad_info_t *info)
+{
+    if(info->fmt < FMT_U8 || info->fmt > FMT_S16_NE)
+        return FALSE;
+    if(info->freq < 0) // not sure about maximum frequency. --yaz
+        return FALSE;
+    if(info->channels < 1 || info->channels > 2)
+        return FALSE;
+
+    return TRUE;
+}
+
 gpointer decode_loop(gpointer arg)
 {
     unsigned char buffer[BUFFER_SIZE];
@@ -413,14 +426,10 @@
 #ifdef DEBUG
     g_message("decode: fmt = %d freq = %d channels = %d", info->fmt, info->freq, info->channels);
 #endif
-    // sanity check.
-    if(info->fmt < FMT_U8 || info->fmt > FMT_S16_NE)
+
+    if(check_audio_param(info) == FALSE)
         return NULL;
-    if(info->freq < 0) // not sure about maximum frequency. --yaz
-        return NULL;
-    if(info->channels < 1 || info->channels > 2)
-        return NULL;
-    
+
     if (!info->playback->output->open_audio(info->fmt, info->freq, info->channels)) {
         g_mutex_lock(pb_mutex);
         info->playback->error = TRUE;
@@ -506,7 +515,7 @@
         while (info->playback->playing) {
             if (info->seek != -1 && info->size > 0) {
 #ifdef DEBUG
-                g_message("seeking: %d", info->seek);
+                g_message("seeking: %ld", info->seek);
 #endif
                 int new_position;
                 gulong milliseconds =
@@ -598,12 +607,7 @@
                 info->channels = MAD_NCHANNELS(&frame.header);
                 info->playback->output->close_audio();
 
-                // sanity check.
-                if(info->fmt < FMT_U8 || info->fmt > FMT_S16_NE)
-                    return NULL;
-                if(info->freq < 0) // not sure about maximum frequency. --yaz
-                    return NULL;
-                if(info->channels < 1 || info->channels > 2)
+                if(check_audio_param(info) == FALSE)
                     return NULL;
 
                 if (!info->playback->output->open_audio(info->fmt, info->freq,
@@ -648,11 +652,11 @@
             
             g_mutex_lock(mad_mutex);
             g_cond_timed_wait(mad_cond, mad_mutex, &sleeptime);
+            g_mutex_unlock(mad_mutex);
             if (!info->playback->playing) {
-                g_mutex_unlock(mad_mutex);
                 break;
             }
-            g_mutex_unlock(mad_mutex);
+
         }
     }
 #ifdef DEBUG