changeset 77:c2981235af26 trunk

[svn] - thread safety
author nenolod
date Mon, 02 Oct 2006 18:14:15 -0700
parents 0b53b7f1959d
children 096db10ce25f
files ChangeLog src/alac/demux.c src/alac/demux.h src/alac/plugin.c
diffstat 4 files changed, 22 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Oct 02 15:52:47 2006 -0700
+++ b/ChangeLog	Mon Oct 02 18:14:15 2006 -0700
@@ -1,3 +1,11 @@
+2006-10-02 22:52:47 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [152]
+  - too much was reverted here, only the if (!ext) return TRUE; was wrong.
+  
+  trunk/src/cue/cuesheet.c |    6 ++----
+  1 file changed, 2 insertions(+), 4 deletions(-)
+
+
 2006-10-02 18:40:03 +0000  Jonathan Schleifer <js@h3c.de>
   revision [150]
   Typo in ChangeLog fixed.
--- a/src/alac/demux.c	Mon Oct 02 15:52:47 2006 -0700
+++ b/src/alac/demux.c	Mon Oct 02 18:14:15 2006 -0700
@@ -557,8 +557,7 @@
     qtmovie = (qtmovie_t*)malloc(sizeof(qtmovie_t));
 
     /* construct the stream */
-    qtmovie->stream = file;
-
+    demux_res->stream = qtmovie->stream = file;
     qtmovie->res = demux_res;
 
     memset(demux_res, 0, sizeof(demux_res_t));
--- a/src/alac/demux.h	Mon Oct 02 15:52:47 2006 -0700
+++ b/src/alac/demux.h	Mon Oct 02 18:14:15 2006 -0700
@@ -2,6 +2,7 @@
 #define DEMUX_H
 
 #include <stdint.h>
+#include "decomp.h"
 #include "stream.h"
 
 typedef uint32_t fourcc_t;
@@ -30,6 +31,9 @@
 #if 0
     void *mdat;
 #endif
+
+    stream_t *stream;
+    alac_file *alac;
 } demux_res_t;
 
 int qtmovie_read(stream_t *stream, demux_res_t *demux_res);
--- a/src/alac/plugin.c	Mon Oct 02 15:52:47 2006 -0700
+++ b/src/alac/plugin.c	Mon Oct 02 18:14:15 2006 -0700
@@ -44,11 +44,7 @@
 #include "decomp.h"
 #include "stream.h"
 
-alac_file *alac = NULL;
-
-static VFSFile *input_file = NULL;
 static int input_opened = 0;
-static stream_t *input_stream;
 
 gpointer decode_thread(void *args);
 static GThread *playback_thread;
@@ -81,6 +77,9 @@
 gboolean is_our_file(char *filename)
 {
     demux_res_t demux_res;
+    VFSFile *input_file;
+    stream_t *input_stream;
+
     input_file = vfs_fopen(filename, "rb");
     input_stream = stream_create_file(input_file, 1);
 
@@ -217,12 +216,11 @@
         if (buffer_size < sample_byte_size)
             return;
 
-        stream_read(input_stream, sample_byte_size,
-                    buffer);
+        stream_read(demux_res->stream, sample_byte_size, buffer);
 
         /* now fetch */
         outputBytes = destBufferSize;
-        decode_frame(alac, buffer, pDestBuffer, &outputBytes);
+        decode_frame(demux_res->alac, buffer, pDestBuffer, &outputBytes);
 
         /* write */
         bytes_read += outputBytes;
@@ -236,9 +234,6 @@
 
 static void init_sound_converter(demux_res_t *demux_res)
 {
-    alac = create_alac(demux_res->sample_size, demux_res->num_channels);
-
-    alac_set_info(alac, demux_res->codecdata);
 }
 
 gpointer decode_thread(void *args)
@@ -247,6 +242,8 @@
     unsigned int output_size, i;
     gulong duration = 0;	/* samples added up */
     gint framesize;
+    VFSFile *input_file;
+    stream_t *input_stream;
 
     set_endian();
 
@@ -262,7 +259,8 @@
         return 0;
 
     /* initialise the sound converter */
-    init_sound_converter(&demux_res);
+    demux_res.alac = create_alac(demux_res.sample_size, demux_res.num_channels);
+    alac_set_info(demux_res.alac, demux_res.codecdata);
 
     /* Sample rates are multiples of 251?! Apple is *fucking* *insane*! -nenolod */
     duration = (demux_res.num_sample_byte_sizes * (float)((1024 * demux_res.sample_size) - 1.0) /