summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDiego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-12-15 19:13:59 +0100
committerDiego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-12-15 19:13:59 +0100
commit4c90da28e5dd01cb5fa01a293c418690d395d9f6 (patch)
treea7f262652b9a62bab6ec567bfced62528f4e4b9d /src
parent9c92484c911e0f3d401a0230c90c4bcf40b84c05 (diff)
parente5be769581739cdafd385d55896abca4816ea29e (diff)
downloadxine-lib-4c90da28e5dd01cb5fa01a293c418690d395d9f6.tar.gz
xine-lib-4c90da28e5dd01cb5fa01a293c418690d395d9f6.tar.bz2
Merge from 1.1; update PO files; make buildable.
--HG-- rename : include/xine.h.in => include/xine.h rename : src/xine-utils/attributes.h => include/xine/attributes.h rename : src/xine-engine/buffer.h => include/xine/buffer.h rename : m4/_xine.m4 => m4/types.m4 rename : po/libxine1.pot => po/libxine2.pot rename : src/libfaad/xine_faad_decoder.c => src/audio_dec/xine_faad_decoder.c rename : src/libspucc/cc_decoder.h => src/spu_dec/cc_decoder.h rename : src/libspucmml/xine_cmml_decoder.c => src/spu_dec/cmml_decoder.c rename : src/libspudec/xine_spu_decoder.c => src/spu_dec/spu_decoder.c rename : src/libspudvb/xine_spudvb_decoder.c => src/spu_dec/spudvb_decoder.c rename : src/libspucc/xine_cc_decoder.c => src/spu_dec/xine_cc_decoder.c rename : src/libmpeg2/mpeg2.h => src/video_dec/libmpeg2/mpeg2.h
Diffstat (limited to 'src')
-rw-r--r--src/audio_dec/xine_faad_decoder.c27
-rw-r--r--src/audio_out/audio_directx2_out.c459
-rw-r--r--src/audio_out/audio_oss_out.c4
-rw-r--r--src/audio_out/audio_pulse_out.c6
-rw-r--r--src/combined/ffmpeg/ff_audio_decoder.c4
-rw-r--r--src/combined/ffmpeg/ff_video_decoder.c6
-rw-r--r--src/demuxers/demux_dts.c8
-rw-r--r--src/demuxers/demux_flac.c43
-rw-r--r--src/demuxers/demux_fli.c2
-rw-r--r--src/demuxers/demux_matroska.c14
-rw-r--r--src/demuxers/demux_mpeg_pes.c3
-rw-r--r--src/demuxers/demux_real.c6
-rw-r--r--src/demuxers/demux_str.c5
-rw-r--r--src/demuxers/demux_ts.c9
-rw-r--r--src/demuxers/demux_wav.c8
-rw-r--r--src/demuxers/id3.c1
-rw-r--r--src/demuxers/matroska.h2
-rw-r--r--src/input/input_cdda.c16
-rw-r--r--src/input/input_dvb.c3
-rw-r--r--src/input/input_smb.c6
-rw-r--r--src/input/input_v4l.c4
-rw-r--r--src/input/input_vcd.c4
-rw-r--r--src/input/vcd/xineplug_inp_vcd.c6
-rw-r--r--src/libreal/xine_real_audio_decoder.c3
-rw-r--r--src/libreal/xine_real_video_decoder.c3
-rw-r--r--src/libw32dll/wine/win32.c7
-rw-r--r--src/post/audio/filter.c2
-rw-r--r--src/post/audio/filter.h2
-rw-r--r--src/post/audio/volnorm.c3
-rw-r--r--src/post/goom/convolve_fx.c2
-rw-r--r--src/post/goom/diff_against_release.patch37
-rw-r--r--src/post/goom/goom_core.c8
-rw-r--r--src/post/planar/eq2.c4
-rw-r--r--src/spu_dec/cc_decoder.h8
-rw-r--r--src/spu_dec/cmml_decoder.c4
-rw-r--r--src/spu_dec/spu_decoder.c3
-rw-r--r--src/spu_dec/spudvb_decoder.c81
-rw-r--r--src/spu_dec/xine_cc_decoder.c10
-rw-r--r--src/video_dec/libmpeg2/mpeg2.h6
-rw-r--r--src/video_out/video_out_caca.c10
-rw-r--r--src/video_out/video_out_directx.c10
-rw-r--r--src/video_out/video_out_raw.c6
-rw-r--r--src/video_out/video_out_sdl.c16
-rw-r--r--src/video_out/video_out_xv.c2
-rw-r--r--src/video_out/video_out_xvmc.c2
-rw-r--r--src/video_out/video_out_xxmc.c7
-rw-r--r--src/xine-engine/buffer_types.c8
-rw-r--r--src/xine-engine/configfile.c34
-rw-r--r--src/xine-engine/load_plugins.c25
-rw-r--r--src/xine-utils/monitor.c2
-rw-r--r--src/xine-utils/utils.c20
51 files changed, 536 insertions, 435 deletions
diff --git a/src/audio_dec/xine_faad_decoder.c b/src/audio_dec/xine_faad_decoder.c
index 30850c903..9e0fd9546 100644
--- a/src/audio_dec/xine_faad_decoder.c
+++ b/src/audio_dec/xine_faad_decoder.c
@@ -276,7 +276,32 @@ static void faad_decode_audio ( faad_decoder_t *this, int end_frame ) {
lprintf("decoded %d/%d output %ld\n",
used, this->size, this->faac_finfo.samples );
-
+
+ /* Performing necessary channel reordering because aac uses a different
+ * layout than alsa:
+ *
+ * aac 5.1 channel layout: c l r ls rs lfe
+ * alsa 5.1 channel layout: l r ls rs c lfe
+ *
+ * Reordering is only necessary for 5.0 and above. Currently only 5.0
+ * and 5.1 is being taken care of, the rest will stay in the wrong order
+ * for now.
+ *
+ * WARNING: the following needs a output format of 16 bits per sample.
+ * TODO: - reorder while copying (in the while() loop) and optimizing
+ */
+ if(this->num_channels == 5 || this->num_channels == 6)
+ {
+ int i = 0;
+ uint16_t* buf = (uint16_t*)(sample_buffer);
+
+ for(; i < this->faac_finfo.samples; i += this->num_channels) {
+ uint16_t center = buf[i];
+ *((uint64_t*)(buf + i)) = *((uint64_t*)(buf + i + 1));
+ buf[i + 4] = center;
+ }
+ }
+
while( decoded ) {
audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out);
diff --git a/src/audio_out/audio_directx2_out.c b/src/audio_out/audio_directx2_out.c
index 301a23226..d853837ab 100644
--- a/src/audio_out/audio_directx2_out.c
+++ b/src/audio_out/audio_directx2_out.c
@@ -31,6 +31,9 @@
*
* Authors:
* - Frantisek Dvorak <valtri@atlas.cz>
+ * - Original version with slotted ring buffer
+ * - Matthias Ringald <mringwal@inf.ethz.ch>
+ * - non-slotted simpler version for ring buffer handling
*
* Inspiration:
* - mplayer for workarounding -lguid idea
@@ -55,8 +58,8 @@
#define LOG_MODULE "audio_directx2_out"
#define LOG_VERBOSE
/*
-#define LOG
-*/
+ #define LOG
+ */
#include <xine/xine_internal.h>
#include <xine/audio_out.h>
@@ -64,29 +67,32 @@
#define AO_OUT_DIRECTX2_IFACE_VERSION 9
+/*
+ * If GAP_TOLERANCE is lower than AO_MAX_GAP, xine will
+ * try to smooth playback without skipping frames or
+ * inserting silence.
+ */
+#define GAP_TOLERANCE (AO_MAX_GAP/3)
+
/*
* buffer size in miliseconds
* (one second takes 11-192 KB)
*/
#define BUFFER_MS 1000
-/*
- * number of parts in the buffer,
- * one is always locked for playing
+/*
+ * buffer below this threshold is considered a buffer underrun
*/
-#define PARTS 3
+#define BUFFER_MIN_MS 200
/*
* base power factor for volume remapping
*/
#define FACTOR 60.0
-
-/* experiments */
-/*#define EXACT_WAIT*/
-/*#define EXACT_SLEEP*/
-/*#define PANIC_OVERRUN*/
-
+/*
+ * buffer handler status
+ */
#define STATUS_START 0
#define STATUS_WAIT 1
#define STATUS_RUNNING 2
@@ -108,12 +114,14 @@ typedef struct {
LPDIRECTSOUND ds; /* DirectSound device */
LPDIRECTSOUNDBUFFER dsbuffer; /* DirectSound buffer */
- DSBPOSITIONNOTIFY events[PARTS]; /* position events */
- LPDIRECTSOUNDNOTIFY notify; /* notify interface */
size_t buffer_size; /* size of the buffer */
- size_t part_size; /* second half of buffer */
- size_t read_size; /* size of prepared data */
+ size_t write_pos; /* positition in ring buffer for writing*/
+
+ int status; /* current status of the driver */
+ int paused; /* paused mode */
+ int finished; /* driver finished */
+ int failed; /* don't open modal dialog again */
uint32_t bits;
uint32_t rate;
@@ -123,12 +131,6 @@ typedef struct {
int volume;
int muted;
- int status; /* current status of the driver */
- int paused; /* paused mode */
- int finished; /* driver finished */
- int failed; /* don't open modal dialog again */
- int count; /* current free part number */
-
pthread_t buffer_service; /* service thread for operating with DSB */
pthread_cond_t data_cond; /* signals on data */
pthread_mutex_t data_mutex; /* data lock */
@@ -141,16 +143,14 @@ typedef struct {
* the linking stage.
*****************************************************************************/
static const GUID IID_IDirectSoundNotify = {
- 0xB0210783, 0x89CD, 0x11D0, {0xAF, 0x08, 0x00, 0xA0, 0xC9, 0x25, 0xCD, 0x16}
+0xB0210783, 0x89CD, 0x11D0, {0xAF, 0x08, 0x00, 0xA0, 0xC9, 0x25, 0xCD, 0x16}
};
-static int buffer_ready(dx2_driver_t *this);
-
/* popup a dialog with error */
static void XINE_FORMAT_PRINTF(1, 2)
- error_message(const char *fmt, ...) {
+error_message(const char *fmt, ...) {
char message[256];
va_list ap;
@@ -214,7 +214,7 @@ static LPDIRECTSOUND dsound_create() {
/* destroy direct sound object */
static void dsound_destroy(LPDIRECTSOUND ds) {
- IDirectSound_Release(ds);
+ IDirectSound_Release(ds);
}
@@ -266,12 +266,10 @@ static int audio_create_buffers(dx2_driver_t *this) {
HRESULT err;
size_t buffer_size;
- buffer_size = this->rate * this->frame_size * BUFFER_MS / 1000;
+ buffer_size = this->rate * BUFFER_MS / 1000 * this->frame_size;
if (buffer_size > DSBSIZE_MAX) buffer_size = DSBSIZE_MAX;
if (buffer_size < DSBSIZE_MIN) buffer_size = DSBSIZE_MIN;
- this->part_size = (buffer_size / PARTS / this->frame_size) * this->frame_size;
- if (!this->part_size) this->part_size = this->frame_size;
- this->buffer_size = this->part_size * PARTS;
+ this->buffer_size = buffer_size;
flags = DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY;
dsound_fill_wfx(&wfx, this->bits, this->rate, this->channels, this->frame_size);
@@ -282,7 +280,7 @@ static int audio_create_buffers(dx2_driver_t *this) {
return 0;
}
- lprintf("created direct sound buffer, size = %u, part = %u\n", this->buffer_size, this->part_size);
+ lprintf("created direct sound buffer, size = %u\n", this->buffer_size);
return 1;
}
@@ -293,43 +291,6 @@ static void audio_destroy_buffers(dx2_driver_t *this) {
}
-/* create position events */
-static int audio_create_events(dx2_driver_t *this) {
- HANDLE handle[PARTS];
- HRESULT err;
- int i;
-
- for (i = 0; i < PARTS; i++) {
- handle[i] = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (!handle[i]) {
- error_message(_("Unable to create buffer position events."));
- return 0;
- }
- this->events[i].dwOffset = i * this->part_size;
- this->events[i].hEventNotify = handle[i];
- }
-
- if ((err = IDirectSoundBuffer_QueryInterface(this->dsbuffer, &IID_IDirectSoundNotify, (void **)&this->notify)) != DS_OK) {
- audio_error(this, err, _("Unable to get notification interface"));
- return 0;
- }
-
- if ((err = IDirectSoundNotify_SetNotificationPositions(this->notify, PARTS, this->events)) != DS_OK) {
- audio_error(this, err, _("Unable to set notification positions"));
- IDirectSoundNotify_Release(this->notify);
- return 0;
- }
-
- return 1;
-}
-
-
-/* destroy notification interface */
-static void audio_destroy_events(dx2_driver_t *this) {
- IDirectSoundNotify_Release(this->notify);
-}
-
-
/* start playback */
static int audio_play(dx2_driver_t *this) {
HRESULT err;
@@ -385,8 +346,7 @@ static int audio_seek(dx2_driver_t *this, size_t pos) {
/* flush audio buffers */
static int audio_flush(dx2_driver_t *this) {
this->status = STATUS_WAIT;
- this->count = 0;
- this->read_size = 0;
+ this->write_pos = 0;
return audio_seek(this, 0);
}
@@ -421,12 +381,12 @@ static int audio_fill(dx2_driver_t *this, char *data, size_t size) {
HRESULT err;
/* lock a part of the buffer, begin position on free space */
- err = IDirectSoundBuffer_Lock(this->dsbuffer, (this->count * this->part_size + this->read_size) % this->buffer_size, size, &ptr1, &size1, &ptr2, &size2, 0);
+ err = IDirectSoundBuffer_Lock(this->dsbuffer, this->write_pos, size, &ptr1, &size1, &ptr2, &size2, 0);
/* try to restore the buffer, if necessary */
if (err == DSERR_BUFFERLOST) {
xine_log(this->class->xine, XINE_LOG_MSG, _(LOG_MODULE ": buffer lost, tryig to restore\n"));
IDirectSoundBuffer_Restore(this->dsbuffer);
- err = IDirectSoundBuffer_Lock(this->dsbuffer, (this->count * this->part_size + this->read_size) % this->buffer_size, size, &ptr1, &size1, &ptr2, &size2, 0); }
+ err = IDirectSoundBuffer_Lock(this->dsbuffer, this->write_pos, size, &ptr1, &size1, &ptr2, &size2, 0); }
if (err != DS_OK) {
audio_error(this, err, _("Couldn't lock direct sound buffer"));
return 0;
@@ -436,19 +396,15 @@ static int audio_fill(dx2_driver_t *this, char *data, size_t size) {
if (ptr1 && size1) xine_fast_memcpy(ptr1, data, size1);
if (ptr2 && size2) xine_fast_memcpy(ptr2, data + size1, size2);
- this->read_size += size;
+ // this->read_size += size;
+ this->write_pos = (this->write_pos + size ) % this->buffer_size;
+ lprintf("size %u, write_pos %u\n", size, this->write_pos);
if ((err = IDirectSoundBuffer_Unlock(this->dsbuffer, ptr1, size1, ptr2, size2)) != DS_OK) {
audio_error(this, err, _("Couldn't unlock direct sound buffer"));
return 0;
}
- /* signal, if are waiting and need wake up */
- if ((this->status == STATUS_WAIT) && buffer_ready(this)) {
- lprintf("buffer ready, waking up\n");
- pthread_cond_signal(&this->data_cond);
- }
-
return 1;
}
@@ -458,28 +414,28 @@ static int mode2channels(uint32_t mode) {
int channels;
switch(mode) {
- case AO_CAP_MODE_MONO:
- channels = 1;
- break;
-
- case AO_CAP_MODE_STEREO:
- channels = 2;
- break;
-
- case AO_CAP_MODE_4CHANNEL:
- channels = 4;
- break;
-
- case AO_CAP_MODE_5CHANNEL:
- channels = 5;
- break;
-
- case AO_CAP_MODE_5_1CHANNEL:
- channels = 6;
- break;
-
- default:
- return 0;
+ case AO_CAP_MODE_MONO:
+ channels = 1;
+ break;
+
+ case AO_CAP_MODE_STEREO:
+ channels = 2;
+ break;
+
+ case AO_CAP_MODE_4CHANNEL:
+ channels = 4;
+ break;
+
+ case AO_CAP_MODE_5CHANNEL:
+ channels = 5;
+ break;
+
+ case AO_CAP_MODE_5_1CHANNEL:
+ channels = 6;
+ break;
+
+ default:
+ return 0;
}
return channels;
@@ -556,109 +512,96 @@ static int test_capabilities(dx2_driver_t *this) {
/* size of free space in the ring buffer */
static size_t buffer_free_size(dx2_driver_t *this) {
- size_t used_full_size;
+
+ int ret;
+ size_t play_pos;
+ size_t free_space;
- used_full_size = this->read_size + ((this->status != STATUS_WAIT) ? this->part_size : 0);
- _x_assert(used_full_size <= this->buffer_size);
- return this->buffer_size - used_full_size;
+ // get current play pos
+ ret = audio_tell(this, &play_pos);
+ if (!ret)
+ return 0;
+
+ // calc free space (-1)
+ free_space = (this->buffer_size + play_pos - this->write_pos - 1) % this->buffer_size;
+
+ return free_space;
}
-/* enough data in the ring buffer for playing next part? */
-static int buffer_ready(dx2_driver_t *this) {
- return this->read_size >= this->part_size;
+/* size of occupied space in the ring buffer */
+static size_t buffer_occupied_size(dx2_driver_t *this) {
+ int ret;
+ size_t play_pos;
+ size_t used_space;
+
+ // get current play pos
+ ret = audio_tell(this, &play_pos);
+ if (!ret) return 0;
+
+ // calc used space
+ used_space = (this->buffer_size + this->write_pos - play_pos) % this->buffer_size;
+
+ return used_space;
}
/* service thread working with direct sound buffer */
static void *buffer_service(void *data) {
dx2_driver_t *this = (dx2_driver_t *)data;
- HANDLE handles[PARTS];
DWORD ret;
- int i;
-#if defined(EXACT_SLEEP) || defined(EXACT_WAIT)
- size_t play_pos, req_delay;
-#endif
+ size_t play_pos;
+ size_t buffer_min;
+ size_t data_in_buffer;
/* prepare empty buffer */
audio_flush(this);
- for (i = 0; i < PARTS; i++) handles[i] = this->events[i].hEventNotify;
-
+ /* prepare min buffer fill */
+ buffer_min = BUFFER_MIN_MS * this->rate / 1000 * this->frame_size;
+
/* we live! */
pthread_mutex_lock(&this->data_mutex);
pthread_cond_signal(&this->data_cond);
pthread_mutex_unlock(&this->data_mutex);
while (!this->finished) {
+
pthread_mutex_lock(&this->data_mutex);
- if (!buffer_ready(this)) {
- if (!audio_stop(this)) goto fail;
- lprintf("no data (count=%d,free=%" PRIsizet ",avail=%" PRIsizet "), sleeping...\n", this->count, buffer_free_size(this), this->read_size);
- this->status = STATUS_WAIT;
- pthread_cond_wait(&this->data_cond, &this->data_mutex);
- lprintf("wake up (count=%d,free=%" PRIsizet "--,avail=%" PRIsizet ")\n", this->count, buffer_free_size(this), this->read_size);
- if (this->finished) goto finished;
- if (!audio_seek(this, this->count * this->part_size)) goto fail;
- if (!this->paused) {
- if (!audio_play(this)) goto fail;
- }
- this->status = STATUS_RUNNING;
- this->count = (this->count + 1) % PARTS;
- this->read_size -= this->part_size;
- pthread_mutex_unlock(&this->data_mutex);
- lprintf("wait for playback (newcount=%d,free=%" PRIsizet ",avail=%" PRIsizet ")\n", this->count, buffer_free_size(this), this->read_size);
- do {
- ret = WaitForMultipleObjects(PARTS, handles, FALSE, 250) - WAIT_OBJECT_0;
+ switch( this->status){
+
+ case STATUS_WAIT:
+
+ // pre: stop/buffer flushed
+ lprintf("no data, sleeping...\n");
+ pthread_cond_wait(&this->data_cond, &this->data_mutex);
+ lprintf("woke up (write_pos=%d,free=%" PRIsizet")\n", this->write_pos, buffer_free_size(this));
if (this->finished) goto finished;
- } while (ret > PARTS);
- lprintf("playback started (newcount=%d,ev=%d,free=%" PRIsizet ",avail=%" PRIsizet ")\n", this->count, ret, buffer_free_size(this), this->read_size);
- _x_assert(ret == ((PARTS + this->count - 1) % PARTS));
- } else {
- this->count = (this->count + 1) % PARTS;
- this->read_size -= this->part_size;
- pthread_mutex_unlock(&this->data_mutex);
- }
- lprintf("waiting for sound event(count=%d,free=%" PRIsizet ",avail=%" PRIsizet ")...\n", this->count, buffer_free_size(this), this->read_size);
- do {
- ret = WaitForMultipleObjects(PARTS, handles, FALSE, 250) - WAIT_OBJECT_0;
- if (this->finished) goto finished;
- } while (ret > PARTS);
- lprintf("end wait(ev=%" PRIdword ",count=%d,free=%" PRIsizet ",avail=%" PRIsizet ")\n", ret, this->count, buffer_free_size(this), this->read_size);
-#ifdef PANIC_OVERRUN
- _x_abort(ret == this->count);
-#else
- if (ret != this->count) {
- xine_log(this->class->xine, XINE_LOG_MSG, _(LOG_MODULE ": play cursor overran, flushing buffers\n"));
- pthread_mutex_lock(&this->data_mutex);
- if (!audio_stop(this)) goto fail;
- if (!audio_flush(this)) goto fail;
- pthread_mutex_unlock(&this->data_mutex);
+ if (!audio_seek(this, 0)) goto fail;
+ if (!this->paused) {
+ if (!audio_play(this)) goto fail;
+ }
+ this->status = STATUS_RUNNING;
+ pthread_mutex_unlock(&this->data_mutex);
+ break;
+
+ case STATUS_RUNNING:
+
+ // check for buffer underrun
+ data_in_buffer = buffer_occupied_size(this);
+ if ( data_in_buffer < buffer_min){
+ xine_log(this->class->xine, XINE_LOG_MSG, _(LOG_MODULE ": play cursor overran (data %u, min %u), flushing buffers\n"),
+ data_in_buffer, buffer_min);
+ if (!audio_stop(this)) goto fail;
+ if (!audio_flush(this)) goto fail;
+ }
+ pthread_mutex_unlock(&this->data_mutex);
+
+ // just wait BUFFER_MIN_MS before next check
+ xine_usec_sleep(BUFFER_MIN_MS * 1000);
+ break;
}
-#endif
-
-#if defined(EXACT_SLEEP) || defined(EXACT_WAIT)
- /* ugly hack: wait for right time, + little over for sure */
- pthread_mutex_lock(&this->data_mutex);
- if (!audio_tell(this, &play_pos)) goto fail;
- req_delay = (this->buffer_size + play_pos - this->count * this->part_size) % this->buffer_size;
- pthread_mutex_unlock(&this->data_mutex);
- if (req_delay > (this->buffer_size >> 1)) {
- long delay;
-
- delay = 1000 * (this->buffer_size - req_delay) / (this->frame_size * this->rate) + 1 + BUFFER_MS / PARTS / 4;
- xine_log(this->class->xine, XINE_LOG_MSG, _(LOG_MODULE ": delayed by %ld msec\n"), delay);
- printf("should be delayed %ld msec\n", delay);
-#ifdef EXACT_SLEEP
- xine_usec_sleep(delay * 1000);
-#endif
-#ifdef EXACT_WAIT
- WaitForMultipleObjects(PARTS, handles, FALSE, delay);
-#endif
- }
-#endif
}
-
return NULL;
fail:
@@ -683,15 +626,15 @@ static int ao_dx2_get_property(ao_driver_t *this_gen, int property) {
switch(property) {
- case AO_PROP_MIXER_VOL:
- case AO_PROP_PCM_VOL:
- return this->volume;
+ case AO_PROP_MIXER_VOL:
+ case AO_PROP_PCM_VOL:
+ return this->volume;
- case AO_PROP_MUTE_VOL:
- return this->muted;
+ case AO_PROP_MUTE_VOL:
+ return this->muted;
- default:
- return 0;
+ default:
+ return 0;
}
}
@@ -702,26 +645,26 @@ static int ao_dx2_set_property(ao_driver_t *this_gen, int property, int value) {
switch(property) {
- case AO_PROP_MIXER_VOL:
- case AO_PROP_PCM_VOL:
- lprintf("set volume to %d\n", value);
- pthread_mutex_lock(&this->data_mutex);
- if (!this->muted) {
- if (this->dsbuffer && !audio_set_volume(this, value)) return ~value;
- }
- this->volume = value;
- pthread_mutex_unlock(&this->data_mutex);
- break;
+ case AO_PROP_MIXER_VOL:
+ case AO_PROP_PCM_VOL:
+ lprintf("set volume to %d\n", value);
+ pthread_mutex_lock(&this->data_mutex);
+ if (!this->muted) {
+ if (this->dsbuffer && !audio_set_volume(this, value)) return ~value;
+ }
+ this->volume = value;
+ pthread_mutex_unlock(&this->data_mutex);
+ break;
- case AO_PROP_MUTE_VOL:
- pthread_mutex_lock(&this->data_mutex);
- if (this->dsbuffer && !audio_set_volume(this, value ? 0 : this->volume)) return ~value;
- this->muted = value;
- pthread_mutex_unlock(&this->data_mutex);
- break;
+ case AO_PROP_MUTE_VOL:
+ pthread_mutex_lock(&this->data_mutex);
+ if (this->dsbuffer && !audio_set_volume(this, value ? 0 : this->volume)) return ~value;
+ this->muted = value;
+ pthread_mutex_unlock(&this->data_mutex);
+ break;
- default:
- return ~value;
+ default:
+ return ~value;
}
@@ -747,18 +690,17 @@ static int ao_dx2_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
this->status = STATUS_START;
if (!audio_create_buffers(this)) return 0;
- if (!audio_create_events(this)) goto fail_buffers;
- if (!audio_set_volume(this, this->volume)) goto fail_events;
+ if (!audio_set_volume(this, this->volume)) goto fail_buffers;
if (pthread_cond_init(&this->data_cond, NULL) != 0) {
xine_log(this->class->xine, XINE_LOG_MSG, _(LOG_MODULE ": can't create pthread condition: %s\n"), strerror(errno));
- goto fail_events;
+ goto fail_buffers;
}
if (pthread_mutex_init(&this->data_mutex, NULL) != 0) {
xine_log(this->class->xine, XINE_LOG_MSG, _(LOG_MODULE ": can't create pthread mutex: %s\n"), strerror(errno));
goto fail_cond;
}
-
+
/* creating the service thread and waiting for its signal */
pthread_mutex_lock(&this->data_mutex);
if (pthread_create(&this->buffer_service, NULL, buffer_service, this) != 0) {
@@ -775,8 +717,6 @@ fail_mutex:
pthread_mutex_destroy(&this->data_mutex);
fail_cond:
pthread_cond_destroy(&this->data_cond);
-fail_events:
- audio_destroy_events(this);
fail_buffers:
audio_destroy_buffers(this);
return 0;
@@ -803,22 +743,26 @@ static int ao_dx2_bytes_per_frame(ao_driver_t *this_gen) {
static int ao_dx2_delay(ao_driver_t *this_gen) {
dx2_driver_t *this = (dx2_driver_t *)this_gen;
- int frames;
- size_t final_pos, play_pos;
-
- if (this->status != STATUS_RUNNING) return this->read_size / this->frame_size;
+ int frames = 0;
+ int ret;
+ size_t play_pos;
pthread_mutex_lock(&this->data_mutex);
- if (!audio_tell(this, &play_pos)) {
- pthread_mutex_unlock(&this->data_mutex);
- return 0;
- }
- final_pos = this->read_size + (((PARTS + this->count - 1) % PARTS) + 1) * this->part_size - 1;
- frames = (this->buffer_size + final_pos - play_pos) % this->buffer_size / this->frame_size;
+
+ if (this->status != STATUS_RUNNING){
+ frames = this->write_pos / this->frame_size;
+ } else {
+ ret = audio_tell(this, &play_pos);
+ if (ret){
+ frames = buffer_occupied_size(this) / this->frame_size;
+ }
+ }
+
pthread_mutex_unlock(&this->data_mutex);
#ifdef LOG
- if ((rand() % 10) == 0) lprintf("frames=%d, play_pos=%" PRIdword ", block=%" PRIsizet "..%" PRIsizet "\n", frames, play_pos, final_pos - this->part_size + 1, final_pos);
+ if ((rand() % 10) == 0)
+ lprintf("frames=%d, play_pos=%" PRIdword ", write_pos=%u\n", frames, play_pos, this->write_pos);
#endif
return frames;
@@ -840,7 +784,7 @@ static int ao_dx2_write(ao_driver_t *this_gen, int16_t* audio_data, uint32_t num
while (((free_size = buffer_free_size(this)) == 0) && !this->finished) {
lprintf("buffer full, waiting\n");
pthread_mutex_unlock(&this->data_mutex);
- xine_usec_sleep(1000 * BUFFER_MS / PARTS / 5);
+ xine_usec_sleep(1000 * BUFFER_MS / 10);
pthread_mutex_lock(&this->data_mutex);
}
if (free_size >= input_size) size = input_size;
@@ -856,6 +800,12 @@ static int ao_dx2_write(ao_driver_t *this_gen, int16_t* audio_data, uint32_t num
input_size -= size;
}
+ /* signal, if are waiting and need wake up */
+ if ((this->status == STATUS_WAIT) && (buffer_occupied_size(this) > BUFFER_MIN_MS * this->rate / 1000 * this->frame_size)) {
+ lprintf("buffer ready, waking up\n");
+ pthread_cond_signal(&this->data_cond);
+ }
+
return 1;
}
@@ -881,7 +831,6 @@ static void ao_dx2_close(ao_driver_t *this_gen) {
if (pthread_mutex_destroy(&this->data_mutex) != 0) {
xine_log(this->class->xine, XINE_LOG_MSG, _(LOG_MODULE ": can't destroy pthread mutex: %s\n"), strerror(errno));
}
- audio_destroy_events(this);
audio_destroy_buffers(this);
}
@@ -896,12 +845,8 @@ static void ao_dx2_exit(ao_driver_t *this_gen) {
}
-/*
- * TODO: check
- */
static int ao_dx2_get_gap_tolerance(ao_driver_t *this_gen) {
- /* half of part of the buffer in pts (1 msec = 90 pts) */
- return (90 * (BUFFER_MS / PARTS)) >> 1;
+ return GAP_TOLERANCE;
}
@@ -910,36 +855,36 @@ static int ao_dx2_control(ao_driver_t *this_gen, int cmd, ...) {
switch(cmd) {
- case AO_CTRL_PLAY_PAUSE:
- lprintf("control pause\n");
- pthread_mutex_lock(&this->data_mutex);
- if (!this->paused) {
- audio_stop(this);
- this->paused = 1;
- }
- pthread_mutex_unlock(&this->data_mutex);
- break;
+ case AO_CTRL_PLAY_PAUSE:
+ lprintf("control pause\n");
+ pthread_mutex_lock(&this->data_mutex);
+ if (!this->paused) {
+ audio_stop(this);
+ this->paused = 1;
+ }
+ pthread_mutex_unlock(&this->data_mutex);
+ break;
- case AO_CTRL_PLAY_RESUME:
- lprintf("control resume\n");
- pthread_mutex_lock(&this->data_mutex);
- if (this->paused) {
- if (this->status != STATUS_WAIT) audio_play(this);
- this->paused = 0;
- }
- pthread_mutex_unlock(&this->data_mutex);
- break;
-
- case AO_CTRL_FLUSH_BUFFERS:
- lprintf("control flush\n");
- pthread_mutex_lock(&this->data_mutex);
- audio_stop(this);
- audio_flush(this);
- pthread_mutex_unlock(&this->data_mutex);
- break;
+ case AO_CTRL_PLAY_RESUME:
+ lprintf("control resume\n");
+ pthread_mutex_lock(&this->data_mutex);
+ if (this->paused) {
+ if (this->status != STATUS_WAIT) audio_play(this);
+ this->paused = 0;
+ }
+ pthread_mutex_unlock(&this->data_mutex);
+ break;
+
+ case AO_CTRL_FLUSH_BUFFERS:
+ lprintf("control flush\n");
+ pthread_mutex_lock(&this->data_mutex);
+ audio_stop(this);
+ audio_flush(this);
+ pthread_mutex_unlock(&this->data_mutex);
+ break;
- default:
- xine_log(this->class->xine, XINE_LOG_MSG, _(LOG_MODULE ": unknown control command %d\n"), cmd);
+ default:
+ xine_log(this->class->xine, XINE_LOG_MSG, _(LOG_MODULE ": unknown control command %d\n"), cmd);
}
diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c
index 4ec7544a5..615281454 100644
--- a/src/audio_out/audio_oss_out.c
+++ b/src/audio_out/audio_oss_out.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -666,7 +666,7 @@ static int probe_audio_devices(oss_driver_t *this) {
int base_num, i;
int audio_fd, rate;
int best_rate;
- char *devname[30];
+ char devname[30];
strcpy(this->audio_dev, "auto");
diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c
index a7a7437e4..1f4b6fa87 100644
--- a/src/audio_out/audio_pulse_out.c
+++ b/src/audio_out/audio_pulse_out.c
@@ -218,7 +218,8 @@ static void __xine_pa_sink_info_callback(pa_context *c, const pa_sink_input_info
this->cvolume = info->volume;
this->swvolume = pa_cvolume_avg(&info->volume);
-#ifdef HAVE_PULSEAUDIO_0_9_7
+#if PA_PROTOCOL_VERSION >= 11
+ /* PulseAudio 0.9.7 and newer */
this->muted = info->mute;
#else
this->muted = pa_cvolume_is_muted (&this->cvolume);
@@ -665,7 +666,8 @@ static int ao_pulse_set_property (ao_driver_t *this_gen, int property, int value
this->muted = value;
-#ifdef HAVE_PULSEAUDIO_0_9_7
+#if PA_PROTOCOL_VERSION >= 11
+ /* PulseAudio 0.9.7 and newer */
o = pa_context_set_sink_input_mute(this->context, pa_stream_get_index(this->stream),
value, __xine_pa_context_success_callback, this);
#else
diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c
index 476553e10..e12778fc7 100644
--- a/src/combined/ffmpeg/ff_audio_decoder.c
+++ b/src/combined/ffmpeg/ff_audio_decoder.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001-2005 the xine project
+ * Copyright (C) 2001-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -442,7 +442,7 @@ static void ff_audio_dispose (audio_decoder_t *this_gen) {
free(this->context->extradata);
if(this->context)
- free(this->context);
+ av_free(this->context);
free (this_gen);
}
diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c
index 8afbde890..26abf1787 100644
--- a/src/combined/ffmpeg/ff_video_decoder.c
+++ b/src/combined/ffmpeg/ff_video_decoder.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001-2007 the xine project
+ * Copyright (C) 2001-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -1529,10 +1529,10 @@ static void ff_dispose (video_decoder_t *this_gen) {
free_yuv_planes(&this->yuv);
if( this->context )
- free( this->context );
+ av_free( this->context );
if( this->av_frame )
- free( this->av_frame );
+ av_free( this->av_frame );
if (this->buf)
free(this->buf);
diff --git a/src/demuxers/demux_dts.c b/src/demuxers/demux_dts.c
index a7d7bce9a..e16d78f64 100644
--- a/src/demuxers/demux_dts.c
+++ b/src/demuxers/demux_dts.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 the xine project
+ * Copyright (C) 2005-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -199,6 +199,12 @@ static int open_dts_file(demux_dts_t *this) {
sfreq = peak[this->data_start+8] & 0x0f;
break;
+ default:
+ xprintf (this->stream->xine, XINE_VERBOSITY_LOG,
+ LOG_MODULE ": unsupported DTS bitstream encoding %d\n",
+ dts_version);
+ return 0;
+
}
if ((sfreq > sizeof(dts_sample_rates)/sizeof(int)) ||
diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c
index f011f2822..9a01c9adf 100644
--- a/src/demuxers/demux_flac.c
+++ b/src/demuxers/demux_flac.c
@@ -231,6 +231,9 @@ static int open_flac_file(demux_flac_t *flac) {
} else if ((strncasecmp ("ARTIST=", comment, 7) == 0)
&& (length - 7 > 0)) {
_x_meta_info_set_utf8 (flac->stream, XINE_META_INFO_ARTIST, comment + 7);
+ } else if ((strncasecmp ("COMPOSER=", comment, 9) == 0)
+ && (length - 9 > 0)) {
+ _x_meta_info_set_utf8 (flac->stream, XINE_META_INFO_COMPOSER, comment + 9);
} else if ((strncasecmp ("ALBUM=", comment, 6) == 0)
&& (length - 6 > 0)) {
_x_meta_info_set_utf8 (flac->stream, XINE_META_INFO_ALBUM, comment + 6);
@@ -389,12 +392,13 @@ static int demux_flac_seek (demux_plugin_t *this_gen,
demux_flac_t *this = (demux_flac_t *) this_gen;
int seekpoint_index = 0;
int64_t start_pts;
+ unsigned char buf[4];
start_pos = (off_t) ( (double) start_pos / 65535 *
this->data_size );
/* if thread is not running, initialize demuxer */
- if( !playing ) {
+ if( !playing && !start_pos) {
/* send new pts */
_x_demux_control_newpts(this->stream, 0, 0);
@@ -402,28 +406,39 @@ static int demux_flac_seek (demux_plugin_t *this_gen,
this->status = DEMUX_OK;
} else {
- if (this->seekpoints == NULL) {
+ if (this->seekpoints == NULL && !start_pos) {
/* cannot seek if there is no seekpoints */
this->status = DEMUX_OK;
return this->status;
}
- /* do a lazy, linear seek based on the assumption that there are not
- * that many seek points */
+ /* Don't use seekpoints if start_pos != 0. This allows smooth seeking */
if (start_pos) {
/* offset-based seek */
- if (start_pos < this->seekpoints[0].offset)
- seekpoint_index = 0;
- else {
- for (seekpoint_index = 0; seekpoint_index < this->seekpoint_count - 1;
- seekpoint_index++) {
- if (start_pos < this->seekpoints[seekpoint_index + 1].offset) {
- break;
- }
- }
+ this->status = DEMUX_OK;
+ start_pos += this->data_start;
+ this->input->seek(this->input, start_pos, SEEK_SET);
+ while(1){ /* here we try to find something that resembles a frame header */
+
+ if (this->input->read(this->input, buf, 2) != 2){
+ this->status = DEMUX_FINISHED; /* we sought past the end of stream ? */
+ break;
+ }
+
+ if (buf[0] == 0xff && buf[1] == 0xf8)
+ break; /* this might be the frame header... or it may be not. We pass it to the decoder
+ * to decide, but this way we reduce the number of warnings */
+ start_pos +=2;
}
+
+ _x_demux_flush_engine(this->stream);
+ this->input->seek(this->input, start_pos, SEEK_SET);
+ _x_demux_control_newpts(this->stream, 0, BUF_FLAG_SEEK);
+ return this->status;
+
} else {
- /* time-based seek */
+ /* do a lazy, linear seek based on the assumption that there are not
+ * that many seek points; time-based seek */
start_pts = start_time;
start_pts *= 90;
if (start_pts < this->seekpoints[0].pts)
diff --git a/src/demuxers/demux_fli.c b/src/demuxers/demux_fli.c
index c097b11b2..18c475cff 100644
--- a/src/demuxers/demux_fli.c
+++ b/src/demuxers/demux_fli.c
@@ -244,7 +244,7 @@ static void demux_fli_send_headers(demux_plugin_t *this_gen) {
BUF_FLAG_FRAME_END;
buf->decoder_info[0] = this->frame_pts_inc; /* initial video_step */
buf->size = this->bih.biSize;
- memcpy(buf->content, &this->bih, sizeof(xine_bmiheader) + this->bih.biSize);
+ memcpy(buf->content, &this->bih, this->bih.biSize);
buf->type = BUF_VIDEO_FLI;
this->video_fifo->put (this->video_fifo, buf);
}
diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c
index 9bba40155..18fb23f55 100644
--- a/src/demuxers/demux_matroska.c
+++ b/src/demuxers/demux_matroska.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2007 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -676,7 +676,11 @@ static void init_codec_aac(demux_matroska_t *this, matroska_track_t *track) {
/* Create a DecoderSpecificInfo for initialising libfaad */
sr_index = aac_get_sr_index(atrack->sampling_freq);
- if (!strncmp (&track->codec_id[12], "MAIN", 4))
+ /* newer specification with appended CodecPrivate */
+ if (strlen(track->codec_id) <= 12)
+ profile = 3;
+ /* older specification */
+ else if (!strncmp (&track->codec_id[12], "MAIN", 4))
profile = 0;
else if (!strncmp (&track->codec_id[12], "LC", 2))
profile = 1;
@@ -1300,7 +1304,7 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) {
lprintf("MATROSKA_CODEC_ID_V_MPEG4_*\n");
/* create a bitmap info header struct for MPEG 4 */
- bih = malloc(sizeof(xine_bmiheader) + track->codec_private_len);
+ bih = calloc(1, sizeof(xine_bmiheader) + track->codec_private_len);
bih->biSize = sizeof(xine_bmiheader) + track->codec_private_len;
bih->biCompression = ME_FOURCC('M', 'P', '4', 'S');
bih->biWidth = track->video_track->pixel_width;
@@ -1321,7 +1325,7 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) {
lprintf("MATROSKA_CODEC_ID_V_MPEG4_AVC\n");
/* create a bitmap info header struct for h264 */
- bih = malloc(sizeof(xine_bmiheader) + track->codec_private_len);
+ bih = calloc(1, sizeof(xine_bmiheader) + track->codec_private_len);
bih->biSize = sizeof(xine_bmiheader) + track->codec_private_len;
bih->biCompression = ME_FOURCC('a', 'v', 'c', '1');
bih->biWidth = track->video_track->pixel_width;
@@ -1897,7 +1901,7 @@ static int parse_block (demux_matroska_t *this, size_t block_size,
lprintf("no lacing\n");
block_size_left = (this->block_data + block_size) - data;
- lprintf("size: %d, block_size: %" PRIu64 "\n", block_size_left, block_size);
+ lprintf("size: %d, block_size: %u\n", block_size_left, block_size);
if (track->handle_content != NULL) {
track->handle_content((demux_plugin_t *)this, track,
diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c
index 83173ce9a..0fd62197b 100644
--- a/src/demuxers/demux_mpeg_pes.c
+++ b/src/demuxers/demux_mpeg_pes.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2006 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -262,7 +262,6 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode)
uint8_t *p;
int32_t result;
off_t i;
- int32_t n;
uint8_t buf6[ 6 ];
this->scr = 0;
diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c
index 00e5f49fe..5a3a463ae 100644
--- a/src/demuxers/demux_real.c
+++ b/src/demuxers/demux_real.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2005 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -1067,7 +1067,7 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
/* read the packet information */
const uint16_t stream = _X_BE_16(&header[4]);
- const off_t offset = this->input->get_current_pos(this->input);
+ const off_t offset __attr_unused = this->input->get_current_pos(this->input);
uint16_t size = _X_BE_16(&header[2]) - DATA_PACKET_HEADER_SIZE;
const uint32_t timestamp= _X_BE_32(&header[6]);
int64_t pts = (int64_t) timestamp * 90;
@@ -1111,7 +1111,7 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
* seems to be a very short header
* 2 bytes, purpose of the second byte yet unknown
*/
- const int bummer = stream_read_char (this);
+ const int bummer __attr_unused = stream_read_char (this);
lprintf ("bummer == %02X\n",bummer);
vpkg_offset = 0;
diff --git a/src/demuxers/demux_str.c b/src/demuxers/demux_str.c
index ca1acd6e7..33d2e7952 100644
--- a/src/demuxers/demux_str.c
+++ b/src/demuxers/demux_str.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -139,8 +139,7 @@
#define CD_RAW_SECTOR_SIZE 2352
-static const uint8_t STR_MAGIC =
- { 0x60, 0x01, 0x01, 0x80 };
+#define STR_MAGIC "\x60\x01\x01\x80"
#define STR_MAX_CHANNELS 32
#define CDXA_TYPE_MASK 0x0E
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index 4c2c11cae..ef55499e0 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.c
@@ -255,6 +255,7 @@ typedef struct {
int64_t packet_count;
int corrupted_pes;
uint32_t buffered_bytes;
+ int autodetected;
} demux_ts_media;
@@ -917,9 +918,11 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts,
m->buf->free_buffer(m->buf);
m->buf = NULL;
- if (m->corrupted_pes > CORRUPT_PES_THRESHOLD) {
- if (this->videoPid == m->pid)
+ if (m->corrupted_pes > CORRUPT_PES_THRESHOLD && m->autodetected) {
+ if (this->videoPid == m->pid) {
this->videoPid = INVALID_PID;
+ this->last_pmt_crc = 0;
+ }
} else {
m->corrupted_pes++;
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
@@ -1840,6 +1843,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) {
} else if (!found) {
this->videoPid = pid;
this->videoMedia = this->media_num;
+ this->media[this->videoMedia].autodetected = 1;
demux_ts_pes_new(this, this->media_num++, pid, this->video_fifo, 0x100 + pes_stream_id);
}
@@ -2226,6 +2230,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
for (i = 0; i < MAX_PIDS; i++) {
this->media[i].pid = INVALID_PID;
this->media[i].buf = NULL;
+ this->media[i].autodetected = 0;
}
for (i = 0; i < MAX_PMTS; i++) {
diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c
index 3fff4ef3d..280288baa 100644
--- a/src/demuxers/demux_wav.c
+++ b/src/demuxers/demux_wav.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001-2005 the xine project
+ * Copyright (C) 2001-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -112,6 +112,7 @@ static int find_chunk_by_tag(demux_wav_t *this, const uint32_t given_chunk_tag,
static int open_wav_file(demux_wav_t *this) {
uint8_t signature[WAV_SIGNATURE_SIZE];
off_t wave_pos;
+ uint32_t wave_size;
/* check the signature */
if (_x_demux_read_header(this->input, signature, WAV_SIGNATURE_SIZE) != WAV_SIGNATURE_SIZE)
@@ -122,8 +123,9 @@ static int open_wav_file(demux_wav_t *this) {
/* search for the 'fmt ' chunk first */
wave_pos = 0;
- if (find_chunk_by_tag(this, fmt_TAG, &this->wave_size, &wave_pos)==0)
+ if (find_chunk_by_tag(this, fmt_TAG, &wave_size, &wave_pos)==0)
return 0;
+ this->wave_size = wave_size;
this->input->seek(this->input, wave_pos, SEEK_SET);
this->wave = malloc( this->wave_size );
@@ -146,7 +148,7 @@ static int open_wav_file(demux_wav_t *this) {
/* search for the 'data' chunk */
this->data_start = this->data_size = 0;
- if (find_chunk_by_tag(this, data_TAG, &this->data_size, &this->data_start)==0)
+ if (find_chunk_by_tag(this, data_TAG, NULL, &this->data_start)==0)
{
free (this->wave);
return 0;
diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c
index b57d1bd82..db04b89c4 100644
--- a/src/demuxers/id3.c
+++ b/src/demuxers/id3.c
@@ -737,6 +737,7 @@ static int id3v24_interp_frame(input_plugin_t *input,
break;
case ( BE_FOURCC('T', 'Y', 'E', 'R') ):
+ case ( BE_FOURCC('T', 'D', 'R', 'C') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_YEAR, buf + 1, id3_encoding[enc]);
break;
diff --git a/src/demuxers/matroska.h b/src/demuxers/matroska.h
index 215c63dd0..387205723 100644
--- a/src/demuxers/matroska.h
+++ b/src/demuxers/matroska.h
@@ -235,7 +235,7 @@ struct matroska_track_s {
void (*handle_content) (demux_plugin_t *this_gen,
matroska_track_t *track,
int decoder_flags,
- uint8_t *data, int data_len,
+ uint8_t *data, size_t data_len,
int64_t data_pts, int data_duration,
int input_normpos, int input_time);
};
diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c
index 23378a8b1..f058c3699 100644
--- a/src/input/input_cdda.c
+++ b/src/input/input_cdda.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2005 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -1043,13 +1043,13 @@ network_command( xine_stream_t *stream, int socket, void *data_buf, const char *
#ifndef WIN32
-static int network_connect(xine_stream_t *stream, const char *_url )
+static int network_connect(xine_stream_t *stream, const char *got_url )
{
char *host;
int port;
int fd;
- char *url = strdup(_url);
+ char *url = strdup(got_url);
parse_url(url, &host, &port);
if( !host || !strlen(host) || !port )
@@ -1429,7 +1429,7 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) {
while((pdir = readdir(dir)) != NULL) {
char discid[9];
- snprintf(discid, sizeof(discid), "%08lx", this->cddb.disc_id);
+ snprintf(discid, sizeof(discid), "%08" PRIx32, this->cddb.disc_id);
if(!strcasecmp(pdir->d_name, discid)) {
FILE *fd;
@@ -1528,7 +1528,7 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) {
}
}
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
- "input_cdda: cached entry for disc ID %08lx not found.\n", this->cddb.disc_id);
+ "input_cdda: cached entry for disc ID %08" PRIx32 " not found.\n", this->cddb.disc_id);
closedir(dir);
}
@@ -1555,7 +1555,7 @@ static void _cdda_save_cached_cddb_infos(cdda_input_plugin_t *this, char *fileco
/* Ensure the cache directory exists */
_cdda_mkdir_recursive_safe(this->stream->xine, cfile);
- sprintf(cfile, "%s/%08lx", cfile, this->cddb.disc_id);
+ sprintf(cfile, "%s/%08" PRIx32, cfile, this->cddb.disc_id);
if((fd = fopen(cfile, "w")) == NULL) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
@@ -1694,7 +1694,7 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) {
/* Send query command */
memset(&buffer, 0, sizeof(buffer));
- size_t size = sprintf(buffer, "cddb query %08lx %d ", this->cddb.disc_id, this->cddb.num_tracks);
+ size_t size = sprintf(buffer, "cddb query %08" PRIx32 " %d ", this->cddb.disc_id, this->cddb.num_tracks);
for (i = 0; i < this->cddb.num_tracks; i++) {
size += snprintf(buffer + size, sizeof(buffer) - size, "%d ", this->cddb.track[i].start);
}
@@ -1978,7 +1978,7 @@ static void _cdda_free_cddb_info(cdda_input_plugin_t *this) {
*/
static int cdda_open(cdda_input_plugin_t *this_gen,
- char *cdda_device, cdrom_toc *toc, int *fdd) {
+ const char *cdda_device, cdrom_toc *toc, int *fdd) {
#ifndef WIN32
int fd = -1;
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c
index 03ab71bd9..d1b23d5da 100644
--- a/src/input/input_dvb.c
+++ b/src/input/input_dvb.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2005 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -3171,7 +3171,6 @@ static char **dvb_class_get_autoplay_list(input_class_t * this_gen,
{
dvb_input_class_t *class = (dvb_input_class_t *) this_gen;
channel_t *channels=NULL;
- char foobuffer[BUFSIZE];
int ch, apch, num_channels = 0;
int default_channel = -1;
xine_cfg_entry_t lastchannel_enable = {0};
diff --git a/src/input/input_smb.c b/src/input/input_smb.c
index 2c7fb3bc9..9d6f3d9a6 100644
--- a/src/input/input_smb.c
+++ b/src/input/input_smb.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004 the xine project
+ * Copyright (C) 2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -139,7 +139,7 @@ smb_plugin_get_length (input_plugin_t *this_gen)
return st.st_size;
}
-static char*
+static const char*
smb_plugin_get_mrl (input_plugin_t *this_gen)
{
smb_input_t *this = (smb_input_t *) this_gen;
@@ -269,7 +269,7 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen,
dir_files[num_dir_files].link = NULL;
dir_files[num_dir_files].type = mrl_file | mrl_file_directory;
dir_files[num_dir_files].origin = strdup("smb:/");
- asprintf(*(dir_files[num_dir_files].mrl), "%s/%s", "smb:/", pdirent->name);
+ asprintf(&(dir_files[num_dir_files].mrl), "%s/%s", "smb:/", pdirent->name);
dir_files[num_dir_files].size = pdirent->dirlen;
num_dir_files ++;
} else if (pdirent->smbc_type == SMBC_FILE_SHARE){
diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c
index 753c99543..c89653050 100644
--- a/src/input/input_v4l.c
+++ b/src/input/input_v4l.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2004 the xine project
+ * Copyright (C) 2003-2008 the xine project
* Copyright (C) 2003 J.Asselman <j.asselman@itsec-ps.nl>
*
* This file is part of xine, a free video player.
@@ -865,7 +865,7 @@ static int open_video_capture_device(v4l_input_plugin_t *this)
{
int found = 0;
int tuner_found = 0;
- int i, ret;
+ int ret;
unsigned int j;
cfg_entry_t *entry;
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c
index 18cc55ab8..26eb6344b 100644
--- a/src/input/input_vcd.c
+++ b/src/input/input_vcd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2006 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -933,7 +933,6 @@ static void vcd_filelist_dispose(vcd_input_class_t *this) {
static void vcd_class_dispose (input_class_t *this_gen) {
vcd_input_class_t *this = (vcd_input_class_t *) this_gen;
- int i;
config_values_t *config = this->xine->config;
config->unregister_callback(config, "media.vcd.device");
@@ -1062,7 +1061,6 @@ static void *init_class (xine_t *xine, void *data) {
vcd_input_class_t *this;
config_values_t *config = xine->config;
- int i;
this = calloc(1, sizeof (vcd_input_class_t));
diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c
index 8c222c7ab..569634e08 100644
--- a/src/input/vcd/xineplug_inp_vcd.c
+++ b/src/input/vcd/xineplug_inp_vcd.c
@@ -966,7 +966,7 @@ vcd_class_eject_media (input_class_t *this_gen)
* From spec:
* return current MRL
*/
-static char *
+static const char *
vcd_plugin_get_mrl (input_plugin_t *this_gen)
{
vcd_input_plugin_t *t = (vcd_input_plugin_t *) this_gen;
@@ -987,7 +987,7 @@ vcd_plugin_get_mrl (input_plugin_t *this_gen)
/* Bad type. */
LOG_ERR("%s %d", _("Invalid current entry type"),
vcdplayer->play_item.type);
- return strdup("");
+ return "";
} else {
n += offset;
if (n < t->class->num_mrls) {
@@ -995,7 +995,7 @@ vcd_plugin_get_mrl (input_plugin_t *this_gen)
t->class->mrls[n]->mrl);
return t->class->mrls[n]->mrl;
} else {
- return strdup("");
+ return "";
}
}
}
diff --git a/src/libreal/xine_real_audio_decoder.c b/src/libreal/xine_real_audio_decoder.c
index e59941379..d8117e78c 100644
--- a/src/libreal/xine_real_audio_decoder.c
+++ b/src/libreal/xine_real_audio_decoder.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -497,7 +497,6 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen,
void *init_realadec (xine_t *xine, void *data) {
real_class_t *this;
- config_values_t *config = xine->config;
this = (real_class_t *) calloc(1, sizeof(real_class_t));
diff --git a/src/libreal/xine_real_video_decoder.c b/src/libreal/xine_real_video_decoder.c
index 56e9fad01..86cfc09dc 100644
--- a/src/libreal/xine_real_video_decoder.c
+++ b/src/libreal/xine_real_video_decoder.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -520,7 +520,6 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen,
void *init_realvdec (xine_t *xine, void *data) {
real_class_t *this;
- config_values_t *config = xine->config;
this = (real_class_t *) calloc(1, sizeof(real_class_t));
diff --git a/src/libw32dll/wine/win32.c b/src/libw32dll/wine/win32.c
index 2ce05b970..274c78de3 100644
--- a/src/libw32dll/wine/win32.c
+++ b/src/libw32dll/wine/win32.c
@@ -1430,7 +1430,7 @@ static void WINAPI expDeleteCriticalSection(CRITICAL_SECTION *c)
}
static int WINAPI expGetCurrentThreadId()
{
- dbgprintf("GetCurrentThreadId() => %ld\n", pthread_self());
+ dbgprintf("GetCurrentThreadId() => %ld\n", (long int)pthread_self());
return (int)pthread_self();
}
static int WINAPI expGetCurrentProcess()
@@ -2134,7 +2134,6 @@ static const char* WINAPI expGetCommandLineA()
dbgprintf("GetCommandLineA() => \"c:\\aviplay.exe\"\n");
return "c:\\aviplay.exe";
}
-static short envs[]={'p', 'a', 't', 'h', ' ', 'c', ':', '\\', 0, 0};
static LPWSTR WINAPI expGetEnvironmentStringsW()
{
dbgprintf("GetEnvironmentStringsW() => 0\n");
@@ -3998,7 +3997,7 @@ static int XINE_FORMAT_PRINTF(2, 3) expsprintf(char* str, const char* format, ..
va_end(args);
return r;
}
-static int XINE_FORMAT_PRINTF(2, 3) expsscanf(const char* str, const char* format, ...)
+static int XINE_FORMAT_SCANF(2, 3) expsscanf(const char* str, const char* format, ...)
{
va_list args;
int r;
@@ -4162,7 +4161,7 @@ static void* expmemset(void* dest, int c, size_t n)
static time_t exptime(time_t* t)
{
time_t result = time(t);
- dbgprintf("time(%p) => %ld\n", t, result);
+ dbgprintf("time(%p) => %ld\n", t, (long int)result);
return result;
}
diff --git a/src/post/audio/filter.c b/src/post/audio/filter.c
index c5602736c..55d75e1e4 100644
--- a/src/post/audio/filter.c
+++ b/src/post/audio/filter.c
@@ -414,7 +414,7 @@ void bilinear(_ftype_t* a, _ftype_t* b, _ftype_t* k, _ftype_t fs, _ftype_t *coef
*
* return -1 if fail 0 if success.
*/
-int szxform(_ftype_t* a, _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftype_t fs, _ftype_t *k, _ftype_t *coef)
+int szxform(const _ftype_t* a, const _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftype_t fs, _ftype_t *k, _ftype_t *coef)
{
_ftype_t at[3];
_ftype_t bt[3];
diff --git a/src/post/audio/filter.h b/src/post/audio/filter.h
index 0b0ce1c1b..0e08aa2b9 100644
--- a/src/post/audio/filter.h
+++ b/src/post/audio/filter.h
@@ -55,7 +55,7 @@ extern int design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** p
extern void prewarp(_ftype_t* a, _ftype_t fc, _ftype_t fs);
void bilinear(_ftype_t* a, _ftype_t* b, _ftype_t* k, _ftype_t fs, _ftype_t *coef);
-extern int szxform(_ftype_t* a, _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftype_t fs, _ftype_t *k, _ftype_t *coef);
+extern int szxform(const _ftype_t* a, const _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftype_t fs, _ftype_t *k, _ftype_t *coef);
/* Add new data to circular queue designed to be used with a FIR
* filter. xq is the circular queue, in pointing at the new sample, xi
diff --git a/src/post/audio/volnorm.c b/src/post/audio/volnorm.c
index 9ea774564..f42d712f1 100644
--- a/src/post/audio/volnorm.c
+++ b/src/post/audio/volnorm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2005 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -412,7 +412,6 @@ static post_plugin_t *volnorm_open_plugin(post_class_t *class_gen, int inputs,
post_out_t *output;
xine_post_in_t *input_api;
post_audio_port_t *port;
- int i;
if (!this || !audio_target || !audio_target[0] ) {
free(this);
diff --git a/src/post/goom/convolve_fx.c b/src/post/goom/convolve_fx.c
index c394f3bf8..ee36dfd0b 100644
--- a/src/post/goom/convolve_fx.c
+++ b/src/post/goom/convolve_fx.c
@@ -73,7 +73,7 @@ static void set_motif(ConvData *data, Motif motif)
static void convolve_init(VisualFX *_this, PluginInfo *info) {
ConvData *data;
- data = (ConvData*)malloc(sizeof(ConvData));
+ data = (ConvData*)calloc(1, sizeof(ConvData));
_this->fx_data = (void*)data;
data->light = secure_f_param("Screen Brightness");
diff --git a/src/post/goom/diff_against_release.patch b/src/post/goom/diff_against_release.patch
index bde85c285..a5e84b8d1 100644
--- a/src/post/goom/diff_against_release.patch
+++ b/src/post/goom/diff_against_release.patch
@@ -653,3 +653,40 @@ diff -u -p -r1.2 -r1.3
#endif
+diff -r 96c7f8460d61 src/post/goom/convolve_fx.c
+--- convolve_fx.c Mon Nov 10 16:33:51 2008 +0100
++++ convolve_fx.c Sun Nov 16 21:14:29 2008 +0100
+@@ -73,7 +73,7 @@ static void set_motif(ConvData *data, Mo
+
+ static void convolve_init(VisualFX *_this, PluginInfo *info) {
+ ConvData *data;
+- data = (ConvData*)malloc(sizeof(ConvData));
++ data = (ConvData*)calloc(1, sizeof(ConvData));
+ _this->fx_data = (void*)data;
+
+ data->light = secure_f_param("Screen Brightness");
+diff -r 96c7f8460d61 src/post/goom/goom_core.c
+--- goom_core.c Mon Nov 10 16:33:51 2008 +0100
++++ goom_core.c Sun Nov 16 21:14:29 2008 +0100
+@@ -76,6 +76,10 @@ PluginInfo *goom_init (guint32 resx, gui
+ goomInfo->tentacles_fx = tentacle_fx_create();
+ goomInfo->tentacles_fx.init(&goomInfo->tentacles_fx, goomInfo);
+
++ goomInfo->screen.width = resx;
++ goomInfo->screen.height = resy;
++ goomInfo->screen.size = resx * resy;
++
+ goomInfo->convolve_fx = convolve_create();
+ goomInfo->convolve_fx.init(&goomInfo->convolve_fx, goomInfo);
+
+@@ -83,10 +87,6 @@ PluginInfo *goom_init (guint32 resx, gui
+ plugin_info_add_visual (goomInfo, 1, &goomInfo->tentacles_fx);
+ plugin_info_add_visual (goomInfo, 2, &goomInfo->star_fx);
+ plugin_info_add_visual (goomInfo, 3, &goomInfo->convolve_fx);
+-
+- goomInfo->screen.width = resx;
+- goomInfo->screen.height = resy;
+- goomInfo->screen.size = resx * resy;
+
+ init_buffers(goomInfo, goomInfo->screen.size);
+ goomInfo->gRandom = goom_random_init((uintptr_t)goomInfo->pixel);
diff --git a/src/post/goom/goom_core.c b/src/post/goom/goom_core.c
index b69994d8f..7d40c0f86 100644
--- a/src/post/goom/goom_core.c
+++ b/src/post/goom/goom_core.c
@@ -76,6 +76,10 @@ PluginInfo *goom_init (guint32 resx, guint32 resy)
goomInfo->tentacles_fx = tentacle_fx_create();
goomInfo->tentacles_fx.init(&goomInfo->tentacles_fx, goomInfo);
+ goomInfo->screen.width = resx;
+ goomInfo->screen.height = resy;
+ goomInfo->screen.size = resx * resy;
+
goomInfo->convolve_fx = convolve_create();
goomInfo->convolve_fx.init(&goomInfo->convolve_fx, goomInfo);
@@ -84,10 +88,6 @@ PluginInfo *goom_init (guint32 resx, guint32 resy)
plugin_info_add_visual (goomInfo, 2, &goomInfo->star_fx);
plugin_info_add_visual (goomInfo, 3, &goomInfo->convolve_fx);
- goomInfo->screen.width = resx;
- goomInfo->screen.height = resy;
- goomInfo->screen.size = resx * resy;
-
init_buffers(goomInfo, goomInfo->screen.size);
goomInfo->gRandom = goom_random_init((uintptr_t)goomInfo->pixel);
diff --git a/src/post/planar/eq2.c b/src/post/planar/eq2.c
index c47270c2f..cd3ad36d7 100644
--- a/src/post/planar/eq2.c
+++ b/src/post/planar/eq2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2006 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -429,8 +429,6 @@ static post_plugin_t *eq2_open_plugin(post_class_t *class_gen, int inputs,
xine_post_in_t *input_api;
post_out_t *output;
post_video_port_t *port;
- vf_eq2_t *eq2;
- int i;
if (!this || !video_target || !video_target[0]) {
free(this);
diff --git a/src/spu_dec/cc_decoder.h b/src/spu_dec/cc_decoder.h
index a1130953f..97aa037ae 100644
--- a/src/spu_dec/cc_decoder.h
+++ b/src/spu_dec/cc_decoder.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* Copyright (C) Christian Vogler
* cvogler@gradient.cis.upenn.edu - December 2001
@@ -31,12 +31,6 @@ typedef struct cc_decoder_s cc_decoder_t;
typedef struct cc_renderer_s cc_renderer_t;
#define NUM_CC_PALETTES 2
-static const char *const cc_schemes[NUM_CC_PALETTES + 1] = {
- "White/Gray/Translucent",
- "White/Black/Solid",
- NULL
-};
-
#define CC_FONT_MAX 256
typedef struct cc_config_s {
diff --git a/src/spu_dec/cmml_decoder.c b/src/spu_dec/cmml_decoder.c
index da59ed8ae..7f800cf20 100644
--- a/src/spu_dec/cmml_decoder.c
+++ b/src/spu_dec/cmml_decoder.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -446,7 +446,7 @@ static spu_decoder_t *spucmml_class_open_plugin (spu_decoder_class_t *class_gen,
this->spu_decoder.set_button = NULL;
this->spu_decoder.dispose = spudec_dispose;
- this->class = class_gen;
+ this->class = class;
this->stream = stream;
this->event_queue = xine_event_new_queue (this->stream);
diff --git a/src/spu_dec/spu_decoder.c b/src/spu_dec/spu_decoder.c
index b77c5b493..6257c4f06 100644
--- a/src/spu_dec/spu_decoder.c
+++ b/src/spu_dec/spu_decoder.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* Copyright (C) James Courtier-Dutton James@superbug.demon.co.uk - July 2001
*
@@ -71,7 +71,6 @@ static const clut_t default_clut[] = {
static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
spudec_decoder_t *this = (spudec_decoder_t *) this_gen;
const uint8_t stream_id = buf->type & 0x1f ;
- spudec_seq_t *cur_seq = &this->spudec_stream_state[stream_id].ra_seq;
#ifdef LOG_DEBUG
printf("libspudec:got buffer type = %x\n", buf->type);
diff --git a/src/spu_dec/spudvb_decoder.c b/src/spu_dec/spudvb_decoder.c
index ee4b0142d..6c3909505 100644
--- a/src/spu_dec/spudvb_decoder.c
+++ b/src/spu_dec/spudvb_decoder.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004 the xine project
+ * Copyright (C) 2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -48,6 +48,7 @@ typedef struct {
} page_t;
typedef struct {
+ int version_number;
int width, height;
int empty;
int depth;
@@ -170,20 +171,18 @@ static void update_region (dvb_spu_decoder_t * this, int region_id, int region_w
lprintf( "can't allocate mem for region %d\n", region_id );
return;
}
- fill_color = 15;
fill = 1;
}
-
+
if ( fill ) {
memset( reg->img, fill_color, region_width*region_height );
reg->empty = 1;
#ifdef LOG
- printf("SPUDVB : FILL REGION %d\n", region_id);
+ printf("SPUDVB : FILL REGION %d\n", region_id);
#endif
}
reg->width = region_width;
reg->height = region_height;
- page->regions[region_id].is_visible = 1;
}
@@ -438,8 +437,6 @@ static void process_page_composition_segment (dvb_spu_decoder_t * this)
{
int segment_length;
int region_id, region_x, region_y;
- int j;
- int r;
dvbsub_func_t *dvbsub = this->dvbsub;
dvbsub->page.page_id = (dvbsub->buf[dvbsub->i] << 8) | dvbsub->buf[dvbsub->i + 1];
@@ -447,19 +444,22 @@ static void process_page_composition_segment (dvb_spu_decoder_t * this)
segment_length = (dvbsub->buf[dvbsub->i] << 8) | dvbsub->buf[dvbsub->i + 1];
dvbsub->i += 2;
- j = dvbsub->i + segment_length;
+ int j = dvbsub->i + segment_length;
dvbsub->page.page_time_out = dvbsub->buf[dvbsub->i++];
+ if ( dvbsub->page.page_time_out>6 ) /* some timeout are insane, e.g. 65s ! */
+ dvbsub->page.page_time_out = 6;
- dvbsub->page.page_version_number = (dvbsub->buf[dvbsub->i] & 0xf0) >> 4;
+ int version = (dvbsub->buf[dvbsub->i] & 0xf0) >> 4;
+ if ( version == dvbsub->page.page_version_number )
+ return;
+ dvbsub->page.page_version_number = version;
dvbsub->page.page_state = (dvbsub->buf[dvbsub->i] & 0x0c) >> 2;
dvbsub->i++;
- if (dvbsub->page.page_state==2) {
- for (r=0; r<MAX_REGIONS; r++)
- dvbsub->page.regions[r].is_visible = 0;
- }
- else if ( dvbsub->page.page_state!=0 && dvbsub->page.page_state!=1 ) {
- return;
+
+ int r;
+ for (r=0; r<MAX_REGIONS; r++) { /* reset */
+ dvbsub->page.regions[r].is_visible = 0;
}
while (dvbsub->i < j) {
@@ -472,6 +472,7 @@ static void process_page_composition_segment (dvb_spu_decoder_t * this)
dvbsub->page.regions[region_id].x = region_x;
dvbsub->page.regions[region_id].y = region_y;
+ dvbsub->page.regions[region_id].is_visible = 1;
}
}
@@ -512,6 +513,11 @@ static void process_region_composition_segment (dvb_spu_decoder_t * this)
if(region_id>=MAX_REGIONS)
return;
+
+ if ( dvbsub->regions[region_id].version_number == region_version_number )
+ return;
+
+ dvbsub->regions[region_id].version_number = region_version_number;
/* Check if region size has changed and fill background. */
update_region (this, region_id, region_width, region_height, region_fill_flag, region_4_bit_pixel_code);
@@ -561,7 +567,6 @@ static void process_object_data_segment (dvb_spu_decoder_t * this)
dvbsub->i += 2;
segment_length = (dvbsub->buf[dvbsub->i] << 8) | dvbsub->buf[dvbsub->i + 1];
dvbsub->i += 2;
- j = dvbsub->i + segment_length;
object_id = (dvbsub->buf[dvbsub->i] << 8) | dvbsub->buf[dvbsub->i + 1];
dvbsub->i += 2;
@@ -715,6 +720,9 @@ static void draw_subtitles (dvb_spu_decoder_t * this)
printf("SPUDVB: this->vpts=%llu\n",this->vpts);
#endif
for ( r=0; r<MAX_REGIONS; r++ ) {
+#ifdef LOG
+ printf("SPUDVB : region=%d, visible=%d, osd=%d, empty=%d\n", r, this->dvbsub->page.regions[r].is_visible, this->dvbsub->regions[r].osd?1:0, this->dvbsub->regions[r].empty );
+#endif
if ( this->dvbsub->page.regions[r].is_visible && this->dvbsub->regions[r].osd && !this->dvbsub->regions[r].empty ) {
this->stream->osd_renderer->set_position( this->dvbsub->regions[r].osd, this->dvbsub->page.regions[r].x, this->dvbsub->page.regions[r].y );
this->stream->osd_renderer->show( this->dvbsub->regions[r].osd, this->vpts );
@@ -808,13 +816,15 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf)
this->vpts = vpts;
}
+ /* completely ignore pts since it makes a lot of problems with various providers */
+ this->vpts = 0;
+
/* process the pes section */
PES_packet_length = this->pes_pkt_size;
this->dvbsub->buf = this->pes_pkt;
- PES_header_data_length = 0;
this->dvbsub->i = 0;
data_identifier = this->dvbsub->buf[this->dvbsub->i++];
@@ -860,7 +870,31 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf)
this->dvbsub->i = new_i;
}
- return;
+ /* verify we've the right segment */
+ if(this->dvbsub->page.page_id==this->spu_descriptor->comp_page_id) {
+ /* SEGMENT_DATA_FIELD */
+ switch (segment_type) {
+ case 0x10:
+ process_page_composition_segment(this);
+ break;
+ case 0x11:
+ process_region_composition_segment(this);
+ break;
+ case 0x12:
+ process_CLUT_definition_segment(this);
+ break;
+ case 0x13:
+ process_object_data_segment (this);
+ break;
+ case 0x80:
+ draw_subtitles( this ); /* Page is now completely rendered */
+ break;
+ default:
+ return;
+ break;
+ }
+ }
+ this->dvbsub->i = new_i;
}
static void spudec_reset (spu_decoder_t * this_gen)
@@ -873,7 +907,9 @@ static void spudec_reset (spu_decoder_t * this_gen)
for ( i=0; i<MAX_REGIONS; i++ ) {
if ( this->dvbsub->regions[i].osd )
this->stream->osd_renderer->hide(this->dvbsub->regions[i].osd, 0);
+ this->dvbsub->regions[i].version_number = -1;
}
+ this->dvbsub->page.page_version_number = -1;
pthread_mutex_unlock(&this->dvbsub_osd_mutex);
}
@@ -916,12 +952,8 @@ static void spudec_dispose (spu_decoder_t * this_gen)
static spu_decoder_t *dvb_spu_class_open_plugin (spu_decoder_class_t * class_gen, xine_stream_t * stream)
{
-
- int i;
- dvb_spu_decoder_t *this;
- dvb_spu_class_t *class = (dvb_spu_class_t *) class_gen;
-
- this = calloc(1, sizeof (dvb_spu_decoder_t));
+ dvb_spu_decoder_t *this = calloc(1, sizeof (dvb_spu_decoder_t));
+ dvb_spu_class_t *class = (dvb_spu_class_t *)class_gen;
this->spu_decoder.decode_data = spudec_decode_data;
this->spu_decoder.reset = spudec_reset;
@@ -938,6 +970,7 @@ static spu_decoder_t *dvb_spu_class_open_plugin (spu_decoder_class_t * class_gen
this->dvbsub = calloc(1, sizeof (dvbsub_func_t));
+ int i;
for (i = 0; i < MAX_REGIONS; i++) {
this->dvbsub->page.regions[i].is_visible = 0;
this->dvbsub->regions[i].img = NULL;
diff --git a/src/spu_dec/xine_cc_decoder.c b/src/spu_dec/xine_cc_decoder.c
index 31ca5413b..62193758b 100644
--- a/src/spu_dec/xine_cc_decoder.c
+++ b/src/spu_dec/xine_cc_decoder.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -33,6 +33,12 @@
#define LOG_DEBUG 1
*/
+static const char *const cc_schemes[NUM_CC_PALETTES + 1] = {
+ "White/Gray/Translucent",
+ "White/Black/Solid",
+ NULL
+};
+
typedef struct spucc_decoder_s {
spu_decoder_t spu_decoder;
@@ -193,7 +199,7 @@ static void spucc_register_cfg_vars(spucc_class_t *this,
cc_vars->cc_scheme = xine_cfg->register_enum(xine_cfg,
"subtitles.closedcaption.scheme", 0,
- cc_schemes,
+ (char **)cc_schemes,
_("closed-captioning foreground/background scheme"),
_("Choose your favourite rendering of the closed "
"captions."),
diff --git a/src/video_dec/libmpeg2/mpeg2.h b/src/video_dec/libmpeg2/mpeg2.h
index 253f300a2..ae69688f5 100644
--- a/src/video_dec/libmpeg2/mpeg2.h
+++ b/src/video_dec/libmpeg2/mpeg2.h
@@ -31,7 +31,8 @@ typedef struct mpeg2dec_s {
uint32_t frame_format;
/* this is where we keep the state of the decoder */
- struct picture_s * picture, *picture_base;
+ struct picture_s * picture;
+ void *picture_base;
uint32_t shift;
int new_sequence;
@@ -45,7 +46,8 @@ typedef struct mpeg2dec_s {
/* which is 224K for MP@ML streams. */
/* (we make no pretenses of decoding anything more than that) */
/* allocated in init - gcc has problems allocating such big structures */
- uint8_t * chunk_buffer, *chunk_base;
+ uint8_t * chunk_buffer;
+ void *chunk_base;
/* pointer to current position in chunk_buffer */
uint8_t * chunk_ptr;
/* last start code ? */
diff --git a/src/video_out/video_out_caca.c b/src/video_out/video_out_caca.c
index 084b43a7a..e995cead4 100644
--- a/src/video_out/video_out_caca.c
+++ b/src/video_out/video_out_caca.c
@@ -262,6 +262,7 @@ static int caca_redraw_needed (vo_driver_t *this_gen) {
static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *visual_gen) {
caca_class_t *class = (caca_class_t *) class_gen;
+ caca_display_t *dp = (caca_display_t *)visual_gen;
caca_driver_t *this;
this = calloc(1, sizeof (caca_driver_t));
@@ -286,8 +287,13 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
this->yuv2rgb_factory = yuv2rgb_factory_init(MODE_32_RGB, 0, NULL);
this->yuv2rgb_factory->set_csc_levels(this->yuv2rgb_factory, 0, 128, 128);
- this->cv = cucul_create_canvas(0, 0);
- this->dp = caca_create_display(this->cv);
+ if (dp) {
+ this->cv = caca_get_canvas(dp);
+ this->dp = dp;
+ } else {
+ this->cv = cucul_create_canvas(0, 0);
+ this->dp = caca_create_display(this->cv);
+ }
caca_refresh_display(this->dp);
return &this->vo_driver;
diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c
index 7c63f93e9..9570135b0 100644
--- a/src/video_out/video_out_directx.c
+++ b/src/video_out/video_out_directx.c
@@ -117,7 +117,7 @@ typedef struct {
yuv2rgb_t *yuv2rgb; /* used for format conversion */
int mode; /* rgb mode */
int bytespp; /* rgb bits per pixel */
-
+ DDPIXELFORMAT primary_pixel_format;
alphablend_t alphablend_extra_data;
} win32_driver_t;
@@ -367,8 +367,9 @@ static boolean CreateSecondary( win32_driver_t * win32_driver, int width, int he
lprintf("CreateSecondary() - Falling back to back buffer same as primary\n");
lprintf("CreateSecondary() - act_format = (NATIVE) %d\n", IMGFMT_NATIVE);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
+ ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
+ ddsd.ddpfPixelFormat = win32_driver->primary_pixel_format;
win32_driver->act_format = IMGFMT_NATIVE;
if( IDirectDraw_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->secondary, 0 ) == DD_OK )
@@ -429,6 +430,10 @@ static boolean CheckPixelFormat( win32_driver_t * win32_driver )
Error( 0, "IDirectDrawSurface_GetPixelFormat ( CheckPixelFormat ) : error 0x%lx", result );
return 0;
}
+
+ /* store pixel format for CreateSecondary */
+
+ win32_driver->primary_pixel_format = ddpf;
/* TODO : support paletized video modes */
@@ -478,6 +483,7 @@ static boolean CheckPixelFormat( win32_driver_t * win32_driver )
win32_driver->mode = MODE_15_BGR;
}
+ lprintf("win32 mode: %u\n", win32_driver->mode);
return TRUE;
}
diff --git a/src/video_out/video_out_raw.c b/src/video_out/video_out_raw.c
index e6961c4a7..ad7c783ef 100644
--- a/src/video_out/video_out_raw.c
+++ b/src/video_out/video_out_raw.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 the xine project
+ * Copyright (C) 2007-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -215,7 +215,7 @@ static void raw_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img)
if ( !this->ovl_changed )
return;
- this->raw_overlay_cb( this->user_data, this->ovl_changed-1, &this->overlays );
+ this->raw_overlay_cb( this->user_data, this->ovl_changed-1, this->overlays );
this->ovl_changed = 0;
}
@@ -475,7 +475,7 @@ static int raw_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *da
static uint32_t raw_get_capabilities (vo_driver_t *this_gen)
{
- uint32_t capabilities = VO_CAP_YV12 | VO_CAP_YUY2;
+ uint32_t capabilities = VO_CAP_YV12 | VO_CAP_YUY2 | VO_CAP_CROP;
return capabilities;
}
diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c
index b96a4ba23..32c0c41cf 100644
--- a/src/video_out/video_out_sdl.c
+++ b/src/video_out/video_out_sdl.c
@@ -469,9 +469,11 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
sdl_driver_t *this;
const SDL_VideoInfo *vidInfo;
-#ifdef HAVE_X11
+#if defined(HAVE_X11) || defined(WIN32)
static char SDL_windowhack[32];
x11_visual_t *visual = (x11_visual_t *) visual_gen;
+#endif
+#ifdef HAVE_X11
XWindowAttributes window_attributes;
#endif
@@ -502,14 +504,18 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
_x_vo_scale_init( &this->sc, 0, 0, config);
this->sc.frame_output_cb = visual->frame_output_cb;
this->sc.user_data = visual->user_data;
-
- /* set SDL to use our existing X11 window */
- sprintf(SDL_windowhack,"SDL_WINDOWID=0x%x", (uint32_t) this->drawable );
- putenv(SDL_windowhack);
#else
_x_vo_scale_init( &this->sc, 0, 0, config );
#endif
+#if defined(HAVE_X11) || defined(WIN32)
+ /* set SDL to use our existing X11/win32 window */
+ if (visual->d){
+ sprintf(SDL_windowhack,"SDL_WINDOWID=0x%x", (uint32_t) visual->d);
+ putenv(SDL_windowhack);
+ }
+#endif
+
if ((SDL_Init (SDL_INIT_VIDEO)) < 0) {
xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_sdl: open_plugin - sdl video initialization failed.\n");
return NULL;
diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c
index c78200077..5d53fa95b 100644
--- a/src/video_out/video_out_xv.c
+++ b/src/video_out/video_out_xv.c
@@ -939,7 +939,7 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen,
return 0;
}
-static void xv_store_port_attribute(xv_driver_t *this, char *name) {
+static void xv_store_port_attribute(xv_driver_t *this, const char *name) {
Atom atom;
xv_portattribute_t *attr;
diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c
index 5caf58fae..b6cae552e 100644
--- a/src/video_out/video_out_xvmc.c
+++ b/src/video_out/video_out_xvmc.c
@@ -692,6 +692,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this,
return NULL;
}
+#if 0
static XvImage *create_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo,
int width, int height, int format) {
unsigned int xvmc_format;
@@ -747,6 +748,7 @@ static void dispose_ximage (xvmc_driver_t *this,
lprintf ("dispose_ximage\n");
XFree(myimage);
}
+#endif
static void xvmc_update_frame_format (vo_driver_t *this_gen,
vo_frame_t *frame_gen,
diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c
index 297d4ad49..ba83b7fe7 100644
--- a/src/video_out/video_out_xxmc.c
+++ b/src/video_out/video_out_xxmc.c
@@ -159,7 +159,6 @@ static void xxmc_xvmc_dump_subpictures(xxmc_driver_t *this)
static void xxmc_xvmc_surface_handler_construct(xxmc_driver_t *this)
{
- int i;
xvmc_surface_handler_t *handler = &this->xvmc_surf_handler;
pthread_mutex_init(&handler->mutex,NULL);
@@ -1648,8 +1647,8 @@ static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen)
* other than 100 %, so let's disable deinterlacing at all for this frame
*/
if (this->deinterlace_enabled && this->bob) {
- disable_deinterlace = this->disable_bob_for_progressive_frames && frame->vo_frame.progressive_frame
- || this->disable_bob_for_scaled_osd && this->scaled_osd_active
+ disable_deinterlace = (this->disable_bob_for_progressive_frames && frame->vo_frame.progressive_frame)
+ || (this->disable_bob_for_scaled_osd && this->scaled_osd_active)
|| !frame->vo_frame.stream
|| xine_get_param(frame->vo_frame.stream, XINE_PARAM_FINE_SPEED) != XINE_FINE_SPEED_NORMAL;
if (!disable_deinterlace) {
@@ -2442,7 +2441,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
x11_visual_t *visual = (x11_visual_t *) visual_gen;
XColor dummy;
XvImage *myimage;
- unsigned int adaptors, j;
+ unsigned int adaptors;
unsigned int ver,rel,req,ev,err;
XShmSegmentInfo myshminfo;
XvPortID xv_port;
diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c
index 7601e5d7f..9e7c8084b 100644
--- a/src/xine-engine/buffer_types.c
+++ b/src/xine-engine/buffer_types.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2005 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -661,6 +661,8 @@ static const video_db_t video_db[] = {
ME_FOURCC('a','v','c','1'),
ME_FOURCC('h','2','6','4'),
ME_FOURCC('H','2','6','4'),
+ ME_FOURCC('x','2','6','4'),
+ ME_FOURCC('X','2','6','4'),
0
},
BUF_VIDEO_H264,
@@ -1200,7 +1202,7 @@ static uint32_t cached_buf_type=0;
return 0;
}
-const char *_x_buf_video_name( uint32_t buf_type ) {
+const char * _x_buf_video_name( uint32_t buf_type ) {
int i;
buf_type &= 0xffff0000;
@@ -1234,7 +1236,7 @@ static uint32_t cached_buf_type=0;
return 0;
}
-const char *_x_buf_audio_name( uint32_t buf_type ) {
+const char * _x_buf_audio_name( uint32_t buf_type ) {
int i;
buf_type &= 0xffff0000;
diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c
index f18cf6661..a3742bb68 100644
--- a/src/xine-engine/configfile.c
+++ b/src/xine-engine/configfile.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -360,21 +360,22 @@ static char *config_xlate_internal (const char *key, const xine_config_entry_tra
return NULL;
}
-static const char *config_translate_key (const char *key) {
+static const char *config_translate_key (const char *key, char **tmp) {
/* Returns translated key or, if no translation found, NULL.
* Translated key may be in a static buffer allocated within this function.
* NOT re-entrant; assumes that config_lock is held.
*/
unsigned trans;
- static char *newkey = NULL;
+ const char *newkey = NULL;
/* first, special-case the decoder entries (so that new ones can be added
* without requiring modification of the translation table)
*/
+ *tmp = NULL;
if (!strncmp (key, "decoder.", 8) &&
!strcmp (key + (trans = strlen (key)) - 9, "_priority")) {
- asprintf (&newkey, "engine.decoder_priorities.%.*s", trans - 17, key + 8);
- return newkey;
+ asprintf (tmp, "engine.decoder_priorities.%.*s", trans - 17, key + 8);
+ return *tmp;
}
/* search the translation table... */
@@ -389,6 +390,7 @@ static void config_lookup_entry_int (config_values_t *this, const char *key,
cfg_entry_t **entry, cfg_entry_t **prev) {
int trans;
+ char *tmp = NULL;
/* try twice at most (second time with translation from old key name) */
for (trans = 2; trans; --trans) {
@@ -400,14 +402,18 @@ static void config_lookup_entry_int (config_values_t *this, const char *key,
*entry = (*entry)->next;
}
- if (*entry)
+ if (*entry) {
+ free(tmp);
return;
+ }
/* we did not find a match, maybe this is an old config entry name
* trying to translate */
- key = config_translate_key(key);
- if (!key)
+ key = config_translate_key(key, &tmp);
+ if (!key) {
+ free(tmp);
return;
+ }
}
}
@@ -761,7 +767,7 @@ static int config_register_enum (config_values_t *this,
entry->type = XINE_CONFIG_TYPE_ENUM;
if (entry->unknown_value)
- entry->num_value = config_parse_enum (entry->unknown_value, values);
+ entry->num_value = config_parse_enum (entry->unknown_value, (const char **)values);
else
entry->num_value = def_value;
@@ -769,14 +775,14 @@ static int config_register_enum (config_values_t *this,
entry->num_default = def_value;
/* allocate and copy the enum values */
- value_src = values;
+ value_src = (const char **)values;
value_count = 0;
while (*value_src) {
value_src++;
value_count++;
}
entry->enum_values = malloc (sizeof(char*) * (value_count + 1));
- value_src = values;
+ value_src = (const char **)values;
value_dest = entry->enum_values;
while (*value_src) {
*value_dest = strdup(*value_src);
@@ -875,7 +881,7 @@ static void config_update_string (config_values_t *this,
/* if an enum is updated with a string, we convert the string to
* its index and use update number */
if (entry->type == XINE_CONFIG_TYPE_ENUM) {
- config_update_num(this, key, config_parse_enum(value, entry->enum_values));
+ config_update_num(this, key, config_parse_enum(value, (const char **)entry->enum_values));
return;
}
@@ -957,15 +963,17 @@ void xine_config_load (xine_t *xine, const char *filename) {
if (!(entry = config_lookup_entry(this, line))) {
const char *key = line;
+ char *tmp = NULL;
pthread_mutex_lock(&this->config_lock);
if (this->current_version < CONFIG_FILE_VERSION) {
/* old config file -> let's see if we have to rename this one */
- key = config_translate_key(key);
+ key = config_translate_key(key, &tmp);
if (!key)
key = line; /* no translation? fall back on untranslated key */
}
entry = config_add (this, key, 50);
entry->unknown_value = strdup(value);
+ free(tmp);
pthread_mutex_unlock(&this->config_lock);
} else {
switch (entry->type) {
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 7f0497e78..6f5653cb9 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2006 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -1261,15 +1261,23 @@ void _x_scan_plugins (xine_t *this) {
XINE_PROFILE(load_cached_catalog (this));
if ((pluginpath = getenv("XINE_PLUGIN_PATH")) != NULL && *pluginpath) {
- char *p = pluginpath - 1;
- while (p[1])
+ char *p = pluginpath;
+ while (p && p[0])
{
- char *dir, *q = p;
- p = strchr (p + 1, XINE_PATH_SEPARATOR_CHAR);
+ size_t len;
+ char *dir, *q;
+
+ q = p;
+ p = strchr (p, XINE_PATH_SEPARATOR_CHAR);
+ if (p) {
+ p++;
+ len = p - q;
+ } else
+ len = strlen(q);
if (q[0] == '~' && q[1] == '/')
- asprintf (&dir, "%s%.*s", homedir, (int)(p - q - 1), q + 1);
+ asprintf (&dir, "%s%.*s", homedir, (int)(len - 1), q + 1);
else
- dir = strndup (q, p - q);
+ dir = strndup (q, len);
push_if_dir (plugindirs, dir); /* store or free it */
}
} else {
@@ -2599,12 +2607,11 @@ void xine_post_dispose(xine_t *xine, xine_post_t *post_gen) {
* @param joining String to use to join the various strings together.
* @param final_length The pre-calculated final length of the string.
*/
-static char *_x_concatenate_with_string(char **strings, size_t count, char *joining, size_t final_length) {
+static char *_x_concatenate_with_string(char const **strings, size_t count, char *joining, size_t final_length) {
size_t i;
char *const result = malloc(final_length+1); /* Better be safe */
char *str = result;
- size_t pos = 0;
for(i = 0; i < count; i++, strings++) {
if ( *strings ) {
int offset = snprintf(str, final_length, "%s%s", *strings, joining);
diff --git a/src/xine-utils/monitor.c b/src/xine-utils/monitor.c
index 8cbfdaa72..59d8a63d2 100644
--- a/src/xine-utils/monitor.c
+++ b/src/xine-utils/monitor.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c
index 8a9774b3d..2fb6ea554 100644
--- a/src/xine-utils/utils.c
+++ b/src/xine-utils/utils.c
@@ -478,23 +478,22 @@ char *xine_chomp(char *str) {
* a thread-safe usecond sleep
*/
void xine_usec_sleep(unsigned usec) {
-#if 0
-#if HAVE_NANOSLEEP
+#ifdef WIN32
+ /* select does not work on win32 */
+ Sleep(usec / 1000);
+#else
+# if 0
+# if HAVE_NANOSLEEP
/* nanosleep is prefered on solaris, because it's mt-safe */
struct timespec ts, remaining;
-
ts.tv_sec = usec / 1000000;
ts.tv_nsec = (usec % 1000000) * 1000;
while (nanosleep (&ts, &remaining) == -1 && errno == EINTR)
ts = remaining;
-#else
-# if WIN32
- Sleep(usec / 1000);
-# else
+# else
usleep(usec);
-# endif
-#endif
-#else
+# endif
+# else
if (usec < 10000) {
usec = 10000;
}
@@ -502,6 +501,7 @@ void xine_usec_sleep(unsigned usec) {
tm.tv_sec = usec / 1000000;
tm.tv_usec = usec % 1000000;
select(0, 0, 0, 0, &tm);
+# endif
#endif
}