# HG changeset patch # User nenolod # Date 1159844145 25200 # Node ID 096db10ce25f1e222e30e18e8f8fe4dd47ef93a0 # Parent c2981235af26b16d5fa7b79937b2db1d3a32ad58 [svn] - a few concurrency fixes diff -r c2981235af26 -r 096db10ce25f ChangeLog --- a/ChangeLog Mon Oct 02 18:14:15 2006 -0700 +++ b/ChangeLog Mon Oct 02 19:55:45 2006 -0700 @@ -1,3 +1,13 @@ +2006-10-03 01:14:15 +0000 William Pitcock + revision [154] + - thread safety + + trunk/src/alac/demux.c | 3 +-- + trunk/src/alac/demux.h | 4 ++++ + trunk/src/alac/plugin.c | 20 +++++++++----------- + 3 files changed, 14 insertions(+), 13 deletions(-) + + 2006-10-02 22:52:47 +0000 William Pitcock revision [152] - too much was reverted here, only the if (!ext) return TRUE; was wrong. diff -r c2981235af26 -r 096db10ce25f src/alac/demux.c --- a/src/alac/demux.c Mon Oct 02 18:14:15 2006 -0700 +++ b/src/alac/demux.c Mon Oct 02 19:55:45 2006 -0700 @@ -35,6 +35,8 @@ #include #include +#include + #include "stream.h" #include "demux.h" @@ -480,6 +482,32 @@ size_t size_remaining = chunk_len - 8; /* FIXME WRONG */ stream_skip(qtmovie->stream, size_remaining); +#if 0 + while (size_remaining) + { + size_t sub_chunk_len; + fourcc_t sub_chunk_id; + + sub_chunk_len = stream_read_uint32(qtmovie->stream); + if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining) + return; + + sub_chunk_id = stream_read_uint32(qtmovie->stream); + + switch (sub_chunk_id) + { + case MAKEFOURCC('m','e','t','a'): + stream_skip(qtmovie->stream, sub_chunk_len); + break; + default: + fprintf(stderr, "read_chunk_udta(%p, %lu): unknown chunk: %c%c%c%c\n", + qtmovie, chunk_len, SPLITFOURCC(sub_chunk_id)); + return; + } + + size_remaining -= sub_chunk_len; + } +#endif } /* 'moov' movie atom - contains other atoms */ @@ -557,7 +585,7 @@ qtmovie = (qtmovie_t*)malloc(sizeof(qtmovie_t)); /* construct the stream */ - demux_res->stream = qtmovie->stream = file; + qtmovie->stream = file; qtmovie->res = demux_res; memset(demux_res, 0, sizeof(demux_res_t)); diff -r c2981235af26 -r 096db10ce25f src/alac/demux.h --- a/src/alac/demux.h Mon Oct 02 18:14:15 2006 -0700 +++ b/src/alac/demux.h Mon Oct 02 19:55:45 2006 -0700 @@ -9,6 +9,9 @@ typedef struct { + stream_t *stream; + alac_file *alac; + uint16_t num_channels; uint16_t sample_size; uint32_t sample_rate; @@ -31,9 +34,6 @@ #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); diff -r c2981235af26 -r 096db10ce25f src/alac/plugin.c --- a/src/alac/plugin.c Mon Oct 02 18:14:15 2006 -0700 +++ b/src/alac/plugin.c Mon Oct 02 19:55:45 2006 -0700 @@ -232,10 +232,6 @@ free(pDestBuffer); } -static void init_sound_converter(demux_res_t *demux_res) -{ -} - gpointer decode_thread(void *args) { demux_res_t demux_res; @@ -245,6 +241,8 @@ VFSFile *input_file; stream_t *input_stream; + memset(&demux_res, '\0', sizeof(demux_res_t)); + set_endian(); input_file = vfs_fopen((char *) args, "rb"); @@ -258,6 +256,8 @@ if (!qtmovie_read(input_stream, &demux_res)) return 0; + demux_res.stream = input_stream; + /* initialise the sound converter */ demux_res.alac = create_alac(demux_res.sample_size, demux_res.num_channels); alac_set_info(demux_res.alac, demux_res.codecdata);