From b800951399e9ea2d83dabac78e554cf196d4cfc5 Mon Sep 17 00:00:00 2001 From: Bram Verweij Date: Fri, 1 Jun 2007 09:05:56 +0200 Subject: Prioritise the musepack demuxer over mpgaudio, as sometimes the latter can misfire and report a good file as unplayable. --- src/demuxers/group_audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/group_audio.c b/src/demuxers/group_audio.c index b8f0e1ed4..a498a3799 100644 --- a/src/demuxers/group_audio.c +++ b/src/demuxers/group_audio.c @@ -68,7 +68,7 @@ static const demuxer_info_t demux_info_mpgaudio = { }; static const demuxer_info_t demux_info_mpc = { - 0 /* priority */ + 1 /* priority */ }; static const demuxer_info_t demux_info_nsf = { -- cgit v1.2.3 From 40bb772fadfdad2d08c4b5c7c8c02d9fdc1963b5 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 1 Jun 2007 17:48:18 +0100 Subject: Port Simon Farnsworth's xv deinterlacing fix to xcbxv. --- src/video_out/video_out_xcbxv.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c index 432d93416..68b6a934b 100644 --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -443,17 +443,17 @@ static void xv_deinterlace_frame (xv_driver_t *this) { else recent_bitmaps[i] = NULL; - deinterlace_yuv( this->deinterlace_frame.image+frame->width*frame->height, - recent_bitmaps, frame->width/2, frame->height/2, this->deinterlace_method ); + deinterlace_yuv( this->deinterlace_frame.image + this->deinterlace_frame.xv_width * frame->height, + recent_bitmaps, this->deinterlace_frame.xv_width/2, frame->height/2, this->deinterlace_method ); for( i = 0; i < VO_NUM_RECENT_FRAMES; i++ ) if( this->recent_frames[i] && this->recent_frames[i]->width == frame->width && this->recent_frames[i]->height == frame->height ) - recent_bitmaps[i] = this->recent_frames[i]->image + frame->width*frame->height*5/4; + recent_bitmaps[i] = this->recent_frames[i]->image + this->deinterlace_frame.xv_width*frame->height*5/4; else recent_bitmaps[i] = NULL; - deinterlace_yuv( this->deinterlace_frame.image+frame->width*frame->height*5/4, - recent_bitmaps, frame->width/2, frame->height/2, this->deinterlace_method ); + deinterlace_yuv( this->deinterlace_frame.image + this->deinterlace_frame.xv_width*frame->height*5/4, + recent_bitmaps, this->deinterlace_frame.xv_width/2, frame->height/2, this->deinterlace_method ); #else @@ -472,7 +472,7 @@ static void xv_deinterlace_frame (xv_driver_t *this) { recent_bitmaps[i] = NULL; deinterlace_yuv( this->deinterlace_frame.image, recent_bitmaps, - frame->width, frame->height, this->deinterlace_method ); + this->deinterlace_frame.xv_width, frame->height, this->deinterlace_method ); } else { /* -- cgit v1.2.3 From a3caa5974f860b9702089c4ffea54e22f658fb49 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Sun, 3 Jun 2007 02:43:07 +0100 Subject: [patch] Nasty mmap problem with huge files Hi, I've been tracking down a very odd bug this afternoon. As it turns out it is caused by enabling xine's mmap() support for the input_file.c. I'm running 32 bit linux 2.6.21. The file in question is 0x10e4da000 bytes long (you can probably guess what kind of bug this is by now :) Anyway, the issue stems from the definition of mmap(): void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset); compare this to the definition of st_size in struct stat: off_t st_size; /* total size, in bytes */ On my machine (in input_file.c) sizeof(size_t) ==4, whilst sizeof(off_t) == 8. However the compiler doesn't generate a warning when the following is done in xine's code: if ( (this->mmap_base = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, this->fh, 0)) != (void*)-1 So it silently truncates the upper part of the length. Obviously you cannot mmap() a file that large into (32 bit) memory anyway, but as it turns out, mmapping() 0xe4da000 succeeds, which causes... problems. The patch (against xine-lib 1.1.6) does two things: * Check that the length will not be truncated, while still allowing for mmap()s of large files under 64 bit OSes. * A correctness fix: if mmap() fails, this->mmap_base will be set to 0xffffffff. Later on when the file is closed, this means it was attempting to do munmap(0xffffffff). --- src/input/input_file.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/input_file.c b/src/input/input_file.c index fd2b0e733..d57eaacb9 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -359,6 +359,9 @@ static int file_plugin_open (input_plugin_t *this_gen ) { file_input_plugin_t *this = (file_input_plugin_t *) this_gen; char *filename; struct stat sbuf; +#ifdef HAVE_MMAP + size_t tmp_size; +#endif lprintf("file_plugin_open\n"); @@ -423,10 +426,14 @@ static int file_plugin_open (input_plugin_t *this_gen ) { } #ifdef HAVE_MMAP - if ( (this->mmap_base = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, this->fh, 0)) != (void*)-1 ) { + tmp_size = sbuf.st_size; + if ((tmp_size == sbuf.st_size) && + ( (this->mmap_base = mmap(NULL, tmp_size, PROT_READ, MAP_SHARED, this->fh, 0)) != (void*)-1 )) { this->mmap_on = 1; this->mmap_curr = this->mmap_base; this->mmap_len = sbuf.st_size; + } else { + this->mmap_base = NULL; } #endif -- cgit v1.2.3 From f398c68b695ee3dad829d95a724573ca42926205 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 3 Jun 2007 03:01:31 +0100 Subject: Add a comment & changelog entry for the mmap bug fix. --- src/input/input_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/input_file.c b/src/input/input_file.c index d57eaacb9..c755a84a8 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -426,7 +426,7 @@ static int file_plugin_open (input_plugin_t *this_gen ) { } #ifdef HAVE_MMAP - tmp_size = sbuf.st_size; + tmp_size = sbuf.st_size; /* may cause truncation - if it does, DON'T mmap! */ if ((tmp_size == sbuf.st_size) && ( (this->mmap_base = mmap(NULL, tmp_size, PROT_READ, MAP_SHARED, this->fh, 0)) != (void*)-1 )) { this->mmap_on = 1; -- cgit v1.2.3 From 3e2ed6d0263c021644041ad3928ba4e7074360d7 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Sun, 3 Jun 2007 17:47:19 +0100 Subject: [patch] Fix video pid misdetection Hi, the next bug that has been annoying me is as follows. I have some streams recorded from BBC4 on UK DVB-T. BBC4 only actually starts transmitting at about 7pm; prior to that there is a static picture saying it is not playing just now. With these streams and xine, I would get audio, but no picture. Looking at the PMT table during the static picture, all the streams have type 0x0b. However there IS a video stream in there, but there are also several streams of binary data. Xine's current video PID auto-detection code was locking on to one of these streams of binary data because it contained the magic sequence 00 00 01 e0 at one of the PUS. *HOWEVER* it is NOT a PES stream; this sequence is just an accident. The other problem is that xine can only handle one video stream; so once it was misdetected once, it was stuck at that PID. The attached patch changes the corrupted_pes flag into a counter. If a video stream has more than CORRUPT_PES_THRESHOLD corrupt PES packets in a row, then it is deselected as the video stream, and auto-detection is kicked off again. Auto-detection will now also ignore any streams seen previously which have a nonzero corrupted_pes count. This works very well; I can now see the video fine. One possible issue might be that if you get a lot of corrupt PES in a stream which really IS the video stream, it will be deselected. However, this is not actually a problem: once the corruption goes away, the corrupted_pes counter will be reset to 0, and the stream will once again be autodetected as the video stream (and playback will continue from there). --- src/demuxers/demux_ts.c | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index f2da5f268..57925deff 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -180,6 +180,8 @@ #define MAX_PES_BUF_SIZE 2048 +#define CORRUPT_PES_THRESHOLD 10 + #define NULL_PID 0x1fff #define INVALID_PID ((unsigned int)(-1)) #define INVALID_PROGRAM ((unsigned int)(-1)) @@ -913,12 +915,17 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, m->buf = m->fifo->buffer_pool_alloc(m->fifo); if (!demux_ts_parse_pes_header(this->stream->xine, m, ts, len, this->stream)) { - m->corrupted_pes = 1; m->buf->free_buffer(m->buf); m->buf = NULL; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + + if (m->corrupted_pes > CORRUPT_PES_THRESHOLD) { + if (this->videoPid == m->pid) + this->videoPid = INVALID_PID; + } else { + m->corrupted_pes++; + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: PID 0x%.4x: corrupted pes encountered\n", m->pid); - + } } else { m->corrupted_pes = 0; @@ -1784,13 +1791,27 @@ static void demux_ts_parse_packet (demux_ts_t*this) { if ( (pes_stream_id >= VIDEO_STREAM_S) && (pes_stream_id <= VIDEO_STREAM_E) ) { if ( this->videoPid == INVALID_PID) { - - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, - "demux_ts: auto-detected video pid 0x%.4x\n", pid); - - this->videoPid = pid; - this->videoMedia = this->media_num; - demux_ts_pes_new(this, this->media_num++, pid, this->video_fifo, pes_stream_id); + int i, found = 0; + for(i = 0; i < this->media_num; i++) { + if (this->media[i].pid == pid) { + found = 1; + break; + } + } + + if (found && (this->media[i].corrupted_pes == 0)) { + this->videoPid = pid; + this->videoMedia = i; + } else if (!found) { + this->videoPid = pid; + this->videoMedia = this->media_num; + demux_ts_pes_new(this, this->media_num++, pid, this->video_fifo, pes_stream_id); + } + + if (this->videoPid != INVALID_PID) { + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: auto-detected video pid 0x%.4x\n", pid); + } } } else if ( (pes_stream_id >= AUDIO_STREAM_S) && (pes_stream_id <= AUDIO_STREAM_E) ) { if (this->audio_tracks_count < MAX_AUDIO_TRACKS) { -- cgit v1.2.3 From 22dd2d33da401a9d876725fbe36e86552aa16fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 4 Jun 2007 13:16:48 +0200 Subject: Remove redundant nested #ifdef __svr4__. --- src/audio_out/audio_sun_out.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c index 5923eb658..486c06342 100644 --- a/src/audio_out/audio_sun_out.c +++ b/src/audio_out/audio_sun_out.c @@ -248,13 +248,11 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev) error: if (silence != NULL) free(silence); if (fd >= 0) { -#ifdef __svr4__ /* * remove the 0 bytes from the above measurement from the * audio driver's STREAMS queue */ ioctl(fd, I_FLUSH, FLUSHW); -#endif close(fd); } -- cgit v1.2.3 From 4bc3f24d3a85f682707851e6865a2c890c326c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 4 Jun 2007 13:19:00 +0200 Subject: Mark audiocs_rates static and const. --- src/audio_out/audio_sun_out.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c index 486c06342..ca91a8fe6 100644 --- a/src/audio_out/audio_sun_out.c +++ b/src/audio_out/audio_sun_out.c @@ -332,7 +332,7 @@ find_close_samplerate_match(int dev, int sample_rate) #else int i, err; - int audiocs_rates[] = { + static const int audiocs_rates[] = { 5510, 6620, 8000, 9600, 11025, 16000, 18900, 22050, 27420, 32000, 33075, 37800, 44100, 48000, 0 }; -- cgit v1.2.3 From 24b7171dff5bdbb05dd7ab343e718814aaba9186 Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Mon, 4 Jun 2007 21:18:49 +0200 Subject: handle unplugged devices in audio_alsa_out (return -1) and in audio_out close the driver on a return value <0 --- src/audio_out/audio_alsa_out.c | 12 +++++++++--- src/xine-engine/audio_out.c | 16 +++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 6ad78da2a..ce3e7fb2b 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -752,6 +752,9 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { if (res < 0) return 0; state = snd_pcm_state(this->audio_fd); + } else if (state == SND_PCM_STATE_DISCONNECTED) { + /* the device is gone. audio_out.c handles it if we return something < 0 */ + return -1; } if (state == SND_PCM_STATE_XRUN) { #ifdef LOG_DEBUG @@ -784,11 +787,11 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { #endif snd_pcm_status(this->audio_fd, pcm_stat); if ( snd_pcm_status_get_avail(pcm_stat) < number_of_frames) { - wait_result = snd_pcm_wait(this->audio_fd, 1000000); + wait_result = snd_pcm_wait(this->audio_fd, 1000); #ifdef LOG_DEBUG printf("audio_alsa_out:write:loop:wait_result=%d\n",wait_result); #endif - if (wait_result < 0) return 0; + if (wait_result <= 0) return 0; } } if (this->mmap != 0) { @@ -808,7 +811,10 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { return 0; continue; } - if ( (state != SND_PCM_STATE_PREPARED) && + if (state == SND_PCM_STATE_DISCONNECTED) { + /* the device is gone. audio_out.c handles it if we return something < 0 */ + return -1; + } else if ( (state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && (state != SND_PCM_STATE_DRAINING) ) { xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 66e28d80d..2655d495a 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -1211,13 +1211,15 @@ static void *ao_loop (void *this_gen) { } if( result < 0 ) { - /* FIXME: USB device unplugged. - * We should get the card into a closed state here, that involves closing - * the PCM as well as the MIXER. - * Maybe we should pause the stream until the USB device is plugged in again. - * Return values 0 happen even if usb not unplugged, so needs further investigation. - */ - xprintf(this->xine, XINE_VERBOSITY_LOG, _("write to sound card failed. Was a USB device unplugged ?\n")); + /* device unplugged. */ + xprintf(this->xine, XINE_VERBOSITY_LOG, _("write to sound card failed. Assuming the device was unplugged.\n")); + + pthread_mutex_lock( &this->driver_lock ); + if(this->driver_open) + this->driver->close(this->driver); + this->driver_open = 0; + pthread_mutex_unlock( &this->driver_lock ); + /* closing the driver will result in XINE_MSG_AUDIO_OUT_UNAVAILABLE to be emitted */ } lprintf ("loop: next buf from fifo\n"); -- cgit v1.2.3 From 6d72cf30f29689035eddbe95d35fd39fcf5d70ca Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Mon, 4 Jun 2007 21:18:49 +0200 Subject: fallback to none output when the device is unplugged --- src/xine-engine/audio_out.c | 18 +++++++++++++++--- src/xine-engine/load_plugins.c | 32 ++++++++++++++++++++++++++++++++ src/xine-engine/xine_internal.h | 2 +- 3 files changed, 48 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 2655d495a..75cef4ce6 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -1213,11 +1213,23 @@ static void *ao_loop (void *this_gen) { if( result < 0 ) { /* device unplugged. */ xprintf(this->xine, XINE_VERBOSITY_LOG, _("write to sound card failed. Assuming the device was unplugged.\n")); + _x_message (in_buf->stream, XINE_MSG_AUDIO_OUT_UNAVAILABLE, NULL); pthread_mutex_lock( &this->driver_lock ); - if(this->driver_open) - this->driver->close(this->driver); - this->driver_open = 0; + if(this->driver_open) { + this->driver->close(this->driver); + this->driver_open = 0; + this->driver->exit(this->driver); + this->driver = _x_load_audio_output_plugin (this->xine, "none"); + if (this->driver && !in_buf->stream->emergency_brake && + ao_change_settings(this, + in_buf->format.bits, + in_buf->format.rate, + in_buf->format.mode) == 0) { + in_buf->stream->emergency_brake = 1; + _x_message (in_buf->stream, XINE_MSG_AUDIO_OUT_UNAVAILABLE, NULL); + } + } pthread_mutex_unlock( &this->driver_lock ); /* closing the driver will result in XINE_MSG_AUDIO_OUT_UNAVAILABLE to be emitted */ } diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index ca1f87c7a..750ec21e7 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -1721,6 +1721,38 @@ static ao_driver_t *_load_audio_driver (xine_t *this, plugin_node_t *node, return driver; } +ao_driver_t *_x_load_audio_output_plugin (xine_t *this, const char *id) +{ + plugin_node_t *node; + ao_driver_t *driver = NULL; + ao_info_t *ao_info; + plugin_catalog_t *catalog = this->plugin_catalog; + int list_id, list_size; + + pthread_mutex_lock (&catalog->lock); + + list_size = xine_sarray_size (this->plugin_catalog->plugin_lists[PLUGIN_AUDIO_OUT - 1]); + for (list_id = 0; list_id < list_size; list_id++) { + + node = xine_sarray_get (this->plugin_catalog->plugin_lists[PLUGIN_AUDIO_OUT - 1], list_id); + + ao_info = (ao_info_t *)node->info->special_info; + + if (!strcasecmp(node->info->id, id)) { + driver = _load_audio_driver (this, node, NULL); + break; + } + } + + pthread_mutex_unlock (&catalog->lock); + + if (!driver) { + xprintf (this, XINE_VERBOSITY_LOG, + _("load_plugins: failed to load audio output plugin <%s>\n"), id); + } + return driver; +} + xine_audio_port_t *xine_open_audio_driver (xine_t *this, const char *id, void *data) { diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 208ef7647..fc142d44b 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -500,7 +500,7 @@ vo_driver_t *_x_load_video_output_plugin(xine_t *this, * load a specific audio output plugin */ -ao_driver_t *_x_load_audio_output_plugin (xine_t *self, char *id) XINE_PROTECTED; +ao_driver_t *_x_load_audio_output_plugin (xine_t *self, const char *id) XINE_PROTECTED; void _x_set_speed (xine_stream_t *stream, int speed) XINE_PROTECTED; -- cgit v1.2.3 From 7fc8916e6231e4cd7ed55c0fc7423f1ff705e497 Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Mon, 4 Jun 2007 23:30:16 +0200 Subject: handle unplugged devices in audio_alsa_out (return -1) and in audio_out close the driver on a return value <0 --- src/audio_out/audio_alsa_out.c | 12 +++++++++--- src/xine-engine/audio_out.c | 16 +++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 6ad78da2a..ce3e7fb2b 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -752,6 +752,9 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { if (res < 0) return 0; state = snd_pcm_state(this->audio_fd); + } else if (state == SND_PCM_STATE_DISCONNECTED) { + /* the device is gone. audio_out.c handles it if we return something < 0 */ + return -1; } if (state == SND_PCM_STATE_XRUN) { #ifdef LOG_DEBUG @@ -784,11 +787,11 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { #endif snd_pcm_status(this->audio_fd, pcm_stat); if ( snd_pcm_status_get_avail(pcm_stat) < number_of_frames) { - wait_result = snd_pcm_wait(this->audio_fd, 1000000); + wait_result = snd_pcm_wait(this->audio_fd, 1000); #ifdef LOG_DEBUG printf("audio_alsa_out:write:loop:wait_result=%d\n",wait_result); #endif - if (wait_result < 0) return 0; + if (wait_result <= 0) return 0; } } if (this->mmap != 0) { @@ -808,7 +811,10 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { return 0; continue; } - if ( (state != SND_PCM_STATE_PREPARED) && + if (state == SND_PCM_STATE_DISCONNECTED) { + /* the device is gone. audio_out.c handles it if we return something < 0 */ + return -1; + } else if ( (state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && (state != SND_PCM_STATE_DRAINING) ) { xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index d39c99aba..fddae2dfe 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -1211,13 +1211,15 @@ static void *ao_loop (void *this_gen) { } if( result < 0 ) { - /* FIXME: USB device unplugged. - * We should get the card into a closed state here, that involves closing - * the PCM as well as the MIXER. - * Maybe we should pause the stream until the USB device is plugged in again. - * Return values 0 happen even if usb not unplugged, so needs further investigation. - */ - xprintf(this->xine, XINE_VERBOSITY_LOG, _("write to sound card failed. Was a USB device unplugged ?\n")); + /* device unplugged. */ + xprintf(this->xine, XINE_VERBOSITY_LOG, _("write to sound card failed. Assuming the device was unplugged.\n")); + + pthread_mutex_lock( &this->driver_lock ); + if(this->driver_open) + this->driver->close(this->driver); + this->driver_open = 0; + pthread_mutex_unlock( &this->driver_lock ); + /* closing the driver will result in XINE_MSG_AUDIO_OUT_UNAVAILABLE to be emitted */ } lprintf ("loop: next buf from fifo\n"); -- cgit v1.2.3 From d121d898bd4a4061cb95162ecb886bd4d8d2e79b Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Mon, 4 Jun 2007 23:30:47 +0200 Subject: fallback to none output when the device is unplugged --- src/xine-engine/audio_out.c | 18 +++++++++++++++--- src/xine-engine/load_plugins.c | 32 ++++++++++++++++++++++++++++++++ src/xine-engine/xine_internal.h | 2 +- 3 files changed, 48 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index fddae2dfe..6f5351986 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -1213,11 +1213,23 @@ static void *ao_loop (void *this_gen) { if( result < 0 ) { /* device unplugged. */ xprintf(this->xine, XINE_VERBOSITY_LOG, _("write to sound card failed. Assuming the device was unplugged.\n")); + _x_message (in_buf->stream, XINE_MSG_AUDIO_OUT_UNAVAILABLE, NULL); pthread_mutex_lock( &this->driver_lock ); - if(this->driver_open) - this->driver->close(this->driver); - this->driver_open = 0; + if(this->driver_open) { + this->driver->close(this->driver); + this->driver_open = 0; + this->driver->exit(this->driver); + this->driver = _x_load_audio_output_plugin (this->xine, "none"); + if (this->driver && !in_buf->stream->emergency_brake && + ao_change_settings(this, + in_buf->format.bits, + in_buf->format.rate, + in_buf->format.mode) == 0) { + in_buf->stream->emergency_brake = 1; + _x_message (in_buf->stream, XINE_MSG_AUDIO_OUT_UNAVAILABLE, NULL); + } + } pthread_mutex_unlock( &this->driver_lock ); /* closing the driver will result in XINE_MSG_AUDIO_OUT_UNAVAILABLE to be emitted */ } diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index c72241487..912455b18 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -1681,6 +1681,38 @@ static ao_driver_t *_load_audio_driver (xine_t *this, plugin_node_t *node, return driver; } +ao_driver_t *_x_load_audio_output_plugin (xine_t *this, const char *id) +{ + plugin_node_t *node; + ao_driver_t *driver = NULL; + ao_info_t *ao_info; + plugin_catalog_t *catalog = this->plugin_catalog; + int list_id, list_size; + + pthread_mutex_lock (&catalog->lock); + + list_size = xine_sarray_size (this->plugin_catalog->plugin_lists[PLUGIN_AUDIO_OUT - 1]); + for (list_id = 0; list_id < list_size; list_id++) { + + node = xine_sarray_get (this->plugin_catalog->plugin_lists[PLUGIN_AUDIO_OUT - 1], list_id); + + ao_info = (ao_info_t *)node->info->special_info; + + if (!strcasecmp(node->info->id, id)) { + driver = _load_audio_driver (this, node, NULL); + break; + } + } + + pthread_mutex_unlock (&catalog->lock); + + if (!driver) { + xprintf (this, XINE_VERBOSITY_LOG, + _("load_plugins: failed to load audio output plugin <%s>\n"), id); + } + return driver; +} + xine_audio_port_t *xine_open_audio_driver (xine_t *this, const char *id, void *data) { diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index c88bcc904..8230dfb13 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -484,7 +484,7 @@ vo_driver_t *_x_load_video_output_plugin(xine_t *this, * load a specific audio output plugin */ -ao_driver_t *_x_load_audio_output_plugin (xine_t *self, char *id) XINE_PROTECTED; +ao_driver_t *_x_load_audio_output_plugin (xine_t *self, const char *id) XINE_PROTECTED; void _x_set_speed (xine_stream_t *stream, int speed) XINE_PROTECTED; -- cgit v1.2.3 From 71f48c6e91419fc7161f8a75fbaebd2adc58ed77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 5 Jun 2007 20:28:08 +0200 Subject: Use XINE_PACKED rather than __attribute__((__packed__)). --- src/demuxers/demux_tta.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 724404a5b..4d53c5d3f 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -32,6 +32,7 @@ #include "buffer.h" #include "bswap.h" #include "group_audio.h" +#include "attributes.h" typedef struct { demux_plugin_t demux_plugin; @@ -56,7 +57,7 @@ typedef struct { uint32_t samplerate; uint32_t data_length; uint32_t crc32; - } __attribute__((__packed__)) tta; + } XINE_PACKED tta; uint8_t buffer[22]; /* This is the size of the header */ } header; } demux_tta_t; -- cgit v1.2.3 From 6f430a25e9cd653fdb6995ae4e427ea6be0d8c3a Mon Sep 17 00:00:00 2001 From: Steve Freeland Date: Wed, 6 Jun 2007 00:39:12 +0100 Subject: [PATCH] video_out_fb crash I discovered some problems with the framebuffer output driver. The first problem I had was a segfault when trying to play a 480x360 clip on a 640x480 display. I traced it to the yuv420_rgb16() color conversion function, which was overrunning the input buffer (the "y" part of the image). The reason was that it was being called downstack from fb_frame_proc_slice(), multiple times for each 16-pixel high horizontal slice of the image. When it got to the last slice, only 8 pixels were left to the bottom but it still tried to process a 16-pixel high slice. Nosing around a bit, I compared the configuration of the color converter as used by the fb driver to the xshm driver and found some oddities: 1) The color converter was configured with a "source height" of 16 pixels no matter what the size of the image, and a "dest height" based on what was referred to within video_out_fb.c as a "stripe" -- essentially an input slice scaled up or down as required by the output size. 2) Apparently to prevent the above from causing problems, the position in the output buffer was managed by special code -- see the "stripe_incr" variable. 3) The xshm driver calls yuv2rgb_next_slice() with a NULL argument at the beginning of each frame to allow the color converter to reset its tracking of the slice-by-slice progress through the image; the fb driver does not. I'm not sure exactly why it was done that way, but my best guess would be that whoever coded it didn't know about the need to call yuv2rgb_next_slice() with a NULL argument, and the rest was built up to get it to mostly work without that. The attached patch changes the behaviour to match that of the xshm driver, and also removes the reset_dest_pointers() function, replacing its single invocation with one to fb_frame_field(), which is identical after removing the "stripe" management. It fixed my crash. Can anyone see if I've misunderstood what was going on? If not, it should probably be applied to the official version. --- src/video_out/video_out_fb.c | 44 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index e88def112..3c53adf4d 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -99,7 +99,6 @@ typedef struct fb_frame_s yuv2rgb_t *yuv2rgb; /* yuv2rgb converter for this frame */ uint8_t *rgb_dst; int yuv_stride; - int stripe_height, stripe_inc; int bytes_per_line; @@ -182,7 +181,6 @@ static void fb_frame_proc_slice(vo_frame_t *vo_img, uint8_t **src) else frame->yuv2rgb->yuy22rgb_fun(frame->yuv2rgb, frame->rgb_dst, src[0]); - frame->rgb_dst += frame->stripe_inc; } static void fb_frame_field(vo_frame_t *vo_img, int which_field) @@ -193,21 +191,18 @@ static void fb_frame_field(vo_frame_t *vo_img, int which_field) { case VO_TOP_FIELD: frame->rgb_dst = frame->data; - frame->stripe_inc = 2*frame->stripe_height * - frame->bytes_per_line; break; case VO_BOTTOM_FIELD: frame->rgb_dst = frame->data + frame->bytes_per_line ; - frame->stripe_inc = 2*frame->stripe_height * - frame->bytes_per_line; break; case VO_BOTH_FIELDS: frame->rgb_dst = frame->data; break; } + frame->yuv2rgb->next_slice (frame->yuv2rgb, NULL); } static void fb_frame_dispose(vo_frame_t *vo_img) @@ -304,11 +299,11 @@ static void setup_colorspace_converter(fb_frame_t *frame, int flags) frame->yuv2rgb-> configure(frame->yuv2rgb, frame->sc.delivered_width, - 16, + frame->sc.delivered_height, 2 * frame->vo_frame.pitches[0], 2 * frame->vo_frame.pitches[1], frame->sc.output_width, - frame->stripe_height, + frame->sc.output_height, frame->bytes_per_line * 2); frame->yuv_stride = frame->bytes_per_line * 2; break; @@ -317,42 +312,17 @@ static void setup_colorspace_converter(fb_frame_t *frame, int flags) frame->yuv2rgb-> configure(frame->yuv2rgb, frame->sc.delivered_width, - 16, + frame->sc.delivered_height, frame->vo_frame.pitches[0], frame->vo_frame.pitches[1], frame->sc.output_width, - frame->stripe_height, + frame->sc.output_height, frame->bytes_per_line); frame->yuv_stride = frame->bytes_per_line; break; } } -static void reset_dest_pointers(fb_frame_t *frame, int flags) -{ - switch(flags) - { - case VO_TOP_FIELD: - frame->rgb_dst = frame->data; - frame->stripe_inc = 2 * frame->stripe_height * - frame->bytes_per_line; - break; - - case VO_BOTTOM_FIELD: - frame->rgb_dst = frame->data + - frame->bytes_per_line ; - frame->stripe_inc = 2 * frame->stripe_height * - frame->bytes_per_line; - break; - - case VO_BOTH_FIELDS: - frame->rgb_dst = frame->data; - frame->stripe_inc = frame->stripe_height * - frame->bytes_per_line; - break; - } -} - static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, uint32_t width, uint32_t height, int format) { @@ -457,8 +427,6 @@ static void fb_update_frame_format(vo_driver_t *this_gen, frame_reallocate(this, frame, width, height, format); - frame->stripe_height = 16 * frame->sc.output_height / - frame->sc.delivered_height; if(this->use_zero_copy) frame->bytes_per_line = this->fb_bytes_per_line; else @@ -468,7 +436,7 @@ static void fb_update_frame_format(vo_driver_t *this_gen, setup_colorspace_converter(frame, flags); } - reset_dest_pointers(frame, flags); + fb_frame_field(frame_gen, flags); } static void fb_overlay_clut_yuv2rgb(fb_driver_t *this, -- cgit v1.2.3 From 7f249d1dde1e0c4f7023926ce96a87bb7734c57b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 6 Jun 2007 21:40:50 +0200 Subject: Remove aRTs output plugin. ALSA's DMix can allow to run both xine and aRTs at the same time for Linux, and if other operating systems lacks a proper software mixing facility you can consider alternative daemons. Note: aRTs will not be present in KDE 4. --- src/audio_out/Makefile.am | 9 - src/audio_out/audio_arts_out.c | 418 ----------------------------------------- 2 files changed, 427 deletions(-) delete mode 100644 src/audio_out/audio_arts_out.c (limited to 'src') diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am index 8759b123f..cb3eb79d3 100644 --- a/src/audio_out/Makefile.am +++ b/src/audio_out/Makefile.am @@ -32,10 +32,6 @@ endif #irixal_module = xineplug_ao_out_irixal.la #endif -if ENABLE_ARTS -arts_module = xineplug_ao_out_arts.la -endif - if ENABLE_DIRECTX directx_module = xineplug_ao_out_directx.la directx2_module = xineplug_ao_out_directx2.la @@ -63,7 +59,6 @@ xineplug_LTLIBRARIES = \ $(oss_module) \ $(alsa_module) \ $(sun_module) \ - $(arts_module) \ $(esd_module) \ $(directx_module) \ $(coreaudio_module) \ @@ -96,10 +91,6 @@ xineplug_ao_out_sun_la_LIBADD = $(XINE_LIB) #xineplug_ao_out_irixal_la_LIBADD = $(IRIXAL_LIBS) #xineplug_ao_out_irixal_la_CFLAGS = $(AM_CFLAGS) $(IRIXAL_CFLAGS) -xineplug_ao_out_arts_la_SOURCES = audio_arts_out.c -xineplug_ao_out_arts_la_LIBADD = $(ARTS_LIBS) $(XINE_LIB) -xineplug_ao_out_arts_la_CFLAGS = $(AM_CFLAGS) $(ARTS_CFLAGS) - xineplug_ao_out_directx_la_SOURCES = audio_directx_out.c xineplug_ao_out_directx_la_LIBADD = $(DIRECTX_AUDIO_LIBS) $(XINE_LIB) xineplug_ao_out_directx_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIRECTX_CPPFLAGS) diff --git a/src/audio_out/audio_arts_out.c b/src/audio_out/audio_arts_out.c deleted file mode 100644 index f38575aff..000000000 --- a/src/audio_out/audio_arts_out.c +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Copyright (C) 2000-2003 the xine project - * - * This file is part of xine, a free video player. - * - * xine is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * xine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * $Id: audio_arts_out.c,v 1.32 2006/07/16 16:18:09 dsalt Exp $ - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "xine_internal.h" -#include "xineutils.h" -#include "audio_out.h" -#include "bswap.h" - -#define AO_OUT_ARTS_IFACE_VERSION 8 - -#define AUDIO_NUM_FRAGMENTS 15 -#define AUDIO_FRAGMENT_SIZE 8192 - -#define GAP_TOLERANCE AO_MAX_GAP - -typedef struct arts_driver_s { - - ao_driver_t ao_driver; - - xine_t *xine; - - arts_stream_t audio_stream; - int capabilities; - int mode; - - int32_t sample_rate; - uint32_t num_channels; - uint32_t bits_per_sample; - uint32_t bytes_per_frame; - - uint32_t latency; - - struct { - int volume; - int mute; - int vol_scale; - int v_mixer; - } mixer; - -} arts_driver_t; - -typedef struct { - audio_driver_class_t driver_class; - - xine_t *xine; - int inited; -} arts_class_t; - -/* - * Software stereo volume control..... - * Igor Mokrushin - */ -static void ao_arts_volume(void *buffer, int length, int volume) { - int v; - short *data = (short *)buffer; - - while (length--) { - v=(int) ((*(data) * volume) / 100); - *(data)=(v>32767) ? 32767 : ((v<-32768) ? -32768 : v); - *(data)=LE_16(data); - data++; - } -} -/* End volume control */ - -/* - * open the audio device for writing to - */ -static int ao_arts_open(ao_driver_t *this_gen, - uint32_t bits, uint32_t rate, int mode) -{ - arts_driver_t *this = (arts_driver_t *) this_gen; - - xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "audio_arts_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); - - if ( (mode & this->capabilities) == 0 ) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out: unsupported mode %08x\n", mode); - return 0; - } - - if (this->audio_stream) { - - if ( (mode == this->mode) && (rate == this->sample_rate) ) - return this->sample_rate; - - sleep(2); /* arts might segfault if we are still playing */ - arts_close_stream(this->audio_stream); - } - - this->mode = mode; - this->sample_rate = rate; - this->bits_per_sample = bits; - - switch (mode) { - case AO_CAP_MODE_MONO: - this->num_channels = 1; - break; - case AO_CAP_MODE_STEREO: - this->num_channels = 2; - break; - } - - this->bytes_per_frame=(this->bits_per_sample*this->num_channels)/8; - - xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out: %d channels output\n", this->num_channels); - - this->audio_stream=arts_play_stream(this->sample_rate, bits, this->num_channels, "xine"); - - this->latency = arts_stream_get (this->audio_stream, ARTS_P_TOTAL_LATENCY); - - /* try to keep latency low, if we don't do this we might end - with very high latencies for low quality sound and audio_out will - try to fill gaps every time...(values in ms) */ - if( this->latency > 800 ) - { - this->latency = 800 - arts_stream_get (this->audio_stream, ARTS_P_SERVER_LATENCY); - if( this->latency < 100 ) - this->latency = 100; - arts_stream_set( this->audio_stream, ARTS_P_BUFFER_TIME, this->latency ); - this->latency = arts_stream_get (this->audio_stream, ARTS_P_TOTAL_LATENCY); - } - - xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out : latency %d ms\n", this->latency); - - return this->sample_rate; -} - - -static int ao_arts_num_channels(ao_driver_t *this_gen) -{ - arts_driver_t *this = (arts_driver_t *) this_gen; - return this->num_channels; -} - -static int ao_arts_bytes_per_frame(ao_driver_t *this_gen) -{ - arts_driver_t *this = (arts_driver_t *) this_gen; - return this->bytes_per_frame; -} - -static int ao_arts_get_gap_tolerance (ao_driver_t *this_gen) -{ - return GAP_TOLERANCE; -} - -static int ao_arts_write(ao_driver_t *this_gen, int16_t *data, - uint32_t num_frames) -{ - arts_driver_t *this = (arts_driver_t *) this_gen; - int size = num_frames * this->bytes_per_frame; - - ao_arts_volume(data, num_frames * this->num_channels, this->mixer.vol_scale ); - arts_write(this->audio_stream, data, size ); - - return 1; -} - - -static int ao_arts_delay (ao_driver_t *this_gen) -{ - arts_driver_t *this = (arts_driver_t *) this_gen; - - /* Just convert latency (ms) to frame units. - please note that there is no function in aRts C API to - get the current buffer utilization. This is, at best, - a very roughly aproximation. - */ - - return this->latency * this->sample_rate / 1000; -} - -static void ao_arts_close(ao_driver_t *this_gen) -{ - arts_driver_t *this = (arts_driver_t *) this_gen; - - if (this->audio_stream) { - sleep(2); /* arts might segfault if we are still playing */ - arts_close_stream(this->audio_stream); - this->audio_stream = NULL; - } -} - -static uint32_t ao_arts_get_capabilities (ao_driver_t *this_gen) { - arts_driver_t *this = (arts_driver_t *) this_gen; - return this->capabilities; -} - -static void ao_arts_exit(ao_driver_t *this_gen) -{ - arts_driver_t *this = (arts_driver_t *) this_gen; - - ao_arts_close(this_gen); - /* FIXME: arts_free() freezes on BSD, so don't use it there */ -#if !defined(__OpenBSD__) && !defined (__FreeBSD__) && !defined(__NetBSD__) - arts_free(); -#endif - - free (this); -} - -static int ao_arts_get_property (ao_driver_t *this_gen, int property) { - - arts_driver_t *this = (arts_driver_t *) this_gen; - - switch(property) { - case AO_PROP_PCM_VOL: - case AO_PROP_MIXER_VOL: - if(!this->mixer.mute) - this->mixer.volume = this->mixer.vol_scale; - return this->mixer.volume; - break; - case AO_PROP_MUTE_VOL: - return this->mixer.mute; - break; - } - return 0; -} - -static int ao_arts_set_property (ao_driver_t *this_gen, int property, int value) { - - arts_driver_t *this = (arts_driver_t *) this_gen; - int mute = (value) ? 1 : 0; - - switch(property) { - case AO_PROP_PCM_VOL: - case AO_PROP_MIXER_VOL: - if(!this->mixer.mute) - this->mixer.volume = value; - this->mixer.vol_scale = this->mixer.volume; - return this->mixer.volume; - break; - case AO_PROP_MUTE_VOL: - if(mute) { - this->mixer.v_mixer = this->mixer.volume; - this->mixer.volume = 0; - this->mixer.vol_scale = this->mixer.volume; - } else { - this->mixer.volume = this->mixer.v_mixer; - this->mixer.vol_scale = this->mixer.volume; - } - this->mixer.mute = mute; - return value; - break; - } - - return ~value; -} - -static int ao_arts_ctrl(ao_driver_t *this_gen, int cmd, ...) { - /*arts_driver_t *this = (arts_driver_t *) this_gen;*/ - - switch (cmd) { - - case AO_CTRL_PLAY_PAUSE: - break; - - case AO_CTRL_PLAY_RESUME: - break; - - case AO_CTRL_FLUSH_BUFFERS: - break; - } - - return 0; -} - -static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { - arts_class_t *class = (arts_class_t *) class_gen; - arts_driver_t *this; - int rc; - - lprintf ("audio_arts_out: open_plugin called\n"); - - this = (arts_driver_t *) xine_xmalloc (sizeof (arts_driver_t)); - if (!this) - return NULL; - - this->xine = class->xine; - - if (class->inited == 0) { - rc = arts_init(); - class->inited++; - } else { - xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_arts_out: not trying to initialise a second time\n"); - free(this); - return NULL; - } - - if (rc < 0) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG,"audio_arts_out: arts_init failed: %s\n", arts_error_text(rc)); - free(this); - return NULL; - } - - /* - * set volume control - */ - this->mixer.mute = 0; - this->mixer.vol_scale = 60; - this->mixer.v_mixer = 0; - /* - * set capabilities - */ - this->capabilities = 0; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out : supported modes are "); - this->capabilities |= AO_CAP_MODE_MONO | AO_CAP_MIXER_VOL | AO_CAP_PCM_VOL | AO_CAP_MUTE_VOL; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, "mono "); - this->capabilities |= AO_CAP_MODE_STEREO | AO_CAP_MIXER_VOL | AO_CAP_PCM_VOL | AO_CAP_MUTE_VOL; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, "stereo "); - - this->sample_rate = 0; - this->audio_stream = NULL; - - this->ao_driver.get_capabilities = ao_arts_get_capabilities; - this->ao_driver.get_property = ao_arts_get_property; - this->ao_driver.set_property = ao_arts_set_property; - this->ao_driver.open = ao_arts_open; - this->ao_driver.num_channels = ao_arts_num_channels; - this->ao_driver.bytes_per_frame = ao_arts_bytes_per_frame; - this->ao_driver.delay = ao_arts_delay; - this->ao_driver.write = ao_arts_write; - this->ao_driver.close = ao_arts_close; - this->ao_driver.exit = ao_arts_exit; - this->ao_driver.get_gap_tolerance = ao_arts_get_gap_tolerance; - this->ao_driver.control = ao_arts_ctrl; - - return &this->ao_driver; -} - -/* - * class functions - */ - -static char* get_identifier (audio_driver_class_t *this_gen) { - return "arts"; -} - -static char* get_description (audio_driver_class_t *this_gen) { - return _("xine audio output plugin using kde artsd"); -} - -static void dispose_class (audio_driver_class_t *this_gen) { - - arts_class_t *this = (arts_class_t *) this_gen; - - free (this); -} - -static void *init_class (xine_t *xine, void *data) { - - arts_class_t *this; - - lprintf ("audio_arts_out: init class\n"); - - this = (arts_class_t *) xine_xmalloc (sizeof (arts_class_t)); - if (!this) - return NULL; - - this->inited = 0; - - this->driver_class.open_plugin = open_plugin; - this->driver_class.get_identifier = get_identifier; - this->driver_class.get_description = get_description; - this->driver_class.dispose = dispose_class; - - this->xine = xine; - - return this; -} - -static ao_info_t ao_info_arts = { - 5 -}; - -/* - * exported plugin catalog entry - */ - -const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ - { PLUGIN_AUDIO_OUT, AO_OUT_ARTS_IFACE_VERSION, "arts", XINE_VERSION_CODE, &ao_info_arts, init_class }, - { PLUGIN_NONE, 0, "", 0, NULL, NULL } -}; - -- cgit v1.2.3 From 9a5c7569df986181a089c33fbd4eeae0122a512d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 6 Jun 2007 21:52:15 +0200 Subject: Don't return integer, the function is expected to return a pointer. --- src/xine-engine/metronom.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index fa33da9e1..50720e157 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -851,7 +851,8 @@ static void metronom_unregister_scr (metronom_clock_t *this, scr_plugin_t *scr) this->scr_master = get_master_scr(this); } -static int metronom_sync_loop (metronom_clock_t *this) { +static void *metronom_sync_loop (void *const this_gen) { + metronom_clock_t *const this = (metronom_clock_t *const)this_gen; struct timeval tv; struct timespec ts; @@ -874,7 +875,7 @@ static int metronom_sync_loop (metronom_clock_t *this) { pthread_mutex_unlock (&this->lock); } - return 0; + return NULL; } static void metronom_exit (metronom_t *this) { @@ -990,7 +991,7 @@ metronom_clock_t *_x_metronom_clock_init(xine_t *xine) this->thread_running = 1; if ((err = pthread_create(&this->sync_thread, NULL, - (void*(*)(void*)) metronom_sync_loop, this)) != 0) + metronom_sync_loop, this)) != 0) xprintf(this->xine, XINE_VERBOSITY_NONE, "cannot create sync thread (%s)\n", strerror(err)); -- cgit v1.2.3 From e026dc188cfa93f778e7f1db9ef58d115d91417e Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 6 Jun 2007 23:48:52 +0100 Subject: Fix RealPlayer codec detection and a nearby logging build failure. Both typos. --- src/libreal/real_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 22c33aa03..e2a4ee3d6 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -79,7 +79,7 @@ void _x_real_codecs_init(xine_t *const xine) { struct stat s; #define try_real_path(path) \ - if (!stat (path "/dvrc.so", &s)) \ + if (!stat (path "/drvc.so", &s)) \ default_real_codecs_path = path; #define try_real_subpath(path) \ try_real_path("/usr/" path) \ @@ -114,7 +114,7 @@ void _x_real_codecs_init(xine_t *const xine) { "how to install the codecs."), 10, NULL, NULL); - lprintf ("real codecs path : %s\n", real_codec_path); + lprintf ("real codecs path : %s\n", real_codecs_path); } void *_x_real_codec_open(xine_stream_t *const stream, const char *const path, -- cgit v1.2.3 From 9043d0680a6e15ab0058e8cabc48610de50cc29a Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 8 Jun 2007 00:40:11 +0100 Subject: Fix build issues on systems which need our internal asprintf. config.h is now include/configure.h and no longer #includes os_internals.h. A new file, include/config.h, #includes both; this breaks a #include loop. Other files are updated accordingly. --- src/libfaad/common.h | 2 +- src/xine-utils/attributes.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libfaad/common.h b/src/libfaad/common.h index 47832e648..31f07708a 100644 --- a/src/libfaad/common.h +++ b/src/libfaad/common.h @@ -36,7 +36,7 @@ extern "C" { #define __STRICT_ANSI__ #endif -#include "../config.h" +#include "config.h" #define INLINE __inline #if 0 //defined(_WIN32) && !defined(_WIN32_WCE) diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h index 13c787925..2a7029522 100644 --- a/src/xine-utils/attributes.h +++ b/src/xine-utils/attributes.h @@ -45,7 +45,7 @@ #endif #ifdef XINE_COMPILE -# include "config.h" +# include "configure.h" #endif /* Export protected only for libxine functions */ -- cgit v1.2.3 From 800682ecc936445468fb411c636255b43e07db3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 8 Jun 2007 17:38:47 +0200 Subject: Update parse_meta_atom to use a switch case rather than a series of if. By the way, the code is totally broken and does not work as intended. --- src/demuxers/demux_qt.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 1b82a288d..1aa736870 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -729,50 +729,53 @@ static int is_qt_file(input_plugin_t *qt_file) { /* parse out a meta data atom */ static void parse_meta_atom(qt_info *info, unsigned char *meta_atom) { - int i; - unsigned int meta_atom_size = BE_32(&meta_atom[0]); - qt_atom current_atom; - int string_size; + uint32_t i = 4; + uint32_t meta_atom_size = BE_32(&meta_atom[0]); - for (i = 0; i < meta_atom_size - 4; i++) { - current_atom = BE_32(&meta_atom[i]); - - if (current_atom == ART_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + while ( i < meta_atom_size ) { + qt_atom current_atom = BE_32(&meta_atom[i]); + uint32_t sub_atom_size = BE_32(&meta_atom[i + 4]); + uint32_t string_size = sub_atom_size - 16 + 1; + + switch (current_atom) { + case ART_ATOM: info->artist = xine_xmalloc(string_size); strncpy(info->artist, &meta_atom[i + 20], string_size - 1); info->artist[string_size - 1] = 0; - } else if (current_atom == NAM_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + break; + case NAM_ATOM: info->name = xine_xmalloc(string_size); strncpy(info->name, &meta_atom[i + 20], string_size - 1); info->name[string_size - 1] = 0; - } else if (current_atom == ALB_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + break; + case ALB_ATOM: info->album = xine_xmalloc(string_size); strncpy(info->album, &meta_atom[i + 20], string_size - 1); info->album[string_size - 1] = 0; - } else if (current_atom == GEN_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + break; + case GEN_ATOM: info->genre = xine_xmalloc(string_size); strncpy(info->genre, &meta_atom[i + 20], string_size - 1); info->genre[string_size - 1] = 0; - } else if (current_atom == TOO_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + break; + case TOO_ATOM: info->comment = xine_xmalloc(string_size); strncpy(info->comment, &meta_atom[i + 20], string_size - 1); info->comment[string_size - 1] = 0; - } else if (current_atom == WRT_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + break; + case WRT_ATOM: info->composer = xine_xmalloc(string_size); strncpy(info->composer, &meta_atom[i + 20], string_size - 1); info->composer[string_size - 1] = 0; - } else if (current_atom == DAY_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + break; + case DAY_ATOM: info->year = xine_xmalloc(string_size); strncpy(info->year, &meta_atom[i + 20], string_size - 1); info->year[string_size - 1] = 0; + break; } + + i += sub_atom_size; } } -- cgit v1.2.3 From 5968a05988d5640c4e787b8365b01a614d57561d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 8 Jun 2007 17:57:30 +0200 Subject: Use a switch statement even for the parsing of trak atom. --- src/demuxers/demux_qt.c | 58 ++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 1aa736870..f583db28c 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -886,10 +886,12 @@ static qt_error parse_trak_atom (qt_trak *trak, current_atom_size = BE_32(&trak_atom[i - 4]); current_atom = BE_32(&trak_atom[i]); - if (current_atom == TKHD_ATOM) { + switch(current_atom) { + case TKHD_ATOM: trak->flags = BE_16(&trak_atom[i + 6]); - } else if (current_atom == ELST_ATOM) { + break; + case ELST_ATOM: /* there should only be one edit list table */ if (trak->edit_list_table) { last_error = QT_HEADER_TROUBLE; @@ -919,17 +921,19 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->edit_list_table[j].track_duration, trak->edit_list_table[j].media_time); } + break; - } else if (current_atom == MDHD_ATOM) { - int version; + case MDHD_ATOM: debug_atom_load ("demux_qt: mdhd atom\n"); - - version = trak_atom[i+4]; - if ( version > 1 ) continue; /* unsupported, undocumented */ + { + const int version = trak_atom[i+4]; + if ( version > 1 ) continue; /* unsupported, undocumented */ - trak->timescale = BE_32(&trak_atom[i + (version == 0 ? 0x10 : 0x18) ]); - } else if (current_atom == STSD_ATOM) { + trak->timescale = BE_32(&trak_atom[i + (version == 0 ? 0x10 : 0x18) ]); + } + break; + case STSD_ATOM: debug_atom_load ("demux_qt: stsd atom\n"); #if DEBUG_ATOM_LOAD xine_hexdump (&trak_atom[i], current_atom_size); @@ -1278,15 +1282,15 @@ static qt_error parse_trak_atom (qt_trak *trak, atom_pos += current_stsd_atom_size; properties_offset += current_stsd_atom_size; } - - } else if (current_atom == ESDS_ATOM) { - - uint32_t len; + break; + + case ESDS_ATOM: debug_atom_load(" qt/mpeg-4 esds atom\n"); if ((trak->type == MEDIA_VIDEO) || (trak->type == MEDIA_AUDIO)) { + uint32_t len; j = i + 8; if( trak_atom[j++] == 0x03 ) { @@ -1309,17 +1313,17 @@ static qt_error parse_trak_atom (qt_trak *trak, } } } + break; - } else if (current_atom == AVCC_ATOM) { - + case AVCC_ATOM: debug_atom_load(" avcC atom\n"); trak->decoder_config_len = current_atom_size - 8; trak->decoder_config = realloc(trak->decoder_config, trak->decoder_config_len); memcpy(trak->decoder_config, &trak_atom[i + 4], trak->decoder_config_len); + break; - } else if (current_atom == STSZ_ATOM) { - + case STSZ_ATOM: /* there should only be one of these atoms */ if (trak->sample_size_table) { last_error = QT_HEADER_TROUBLE; @@ -1351,9 +1355,9 @@ static qt_error parse_trak_atom (qt_trak *trak, /* set the pointer to non-NULL to indicate that the atom type has * already been seen for this trak atom */ trak->sample_size_table = (void *)-1; + break; - } else if (current_atom == STSS_ATOM) { - + case STSS_ATOM: /* there should only be one of these atoms */ if (trak->sync_sample_table) { last_error = QT_HEADER_TROUBLE; @@ -1380,9 +1384,9 @@ static qt_error parse_trak_atom (qt_trak *trak, j, trak->sync_sample_table[j], trak->sync_sample_table[j] - 1); } + break; - } else if (current_atom == STCO_ATOM) { - + case STCO_ATOM: /* there should only be one of either stco or co64 */ if (trak->chunk_offset_table) { last_error = QT_HEADER_TROUBLE; @@ -1408,9 +1412,9 @@ static qt_error parse_trak_atom (qt_trak *trak, debug_atom_load(" chunk %d @ 0x%"PRIX64"\n", j, trak->chunk_offset_table[j]); } + break; - } else if (current_atom == CO64_ATOM) { - + case CO64_ATOM: /* there should only be one of either stco or co64 */ if (trak->chunk_offset_table) { last_error = QT_HEADER_TROUBLE; @@ -1439,9 +1443,9 @@ static qt_error parse_trak_atom (qt_trak *trak, debug_atom_load(" chunk %d @ 0x%"PRIX64"\n", j, trak->chunk_offset_table[j]); } + break; - } else if (current_atom == STSC_ATOM) { - + case STSC_ATOM: /* there should only be one of these atoms */ if (trak->sample_to_chunk_table) { last_error = QT_HEADER_TROUBLE; @@ -1474,9 +1478,9 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->sample_to_chunk_table[j].first_chunk - 1, trak->sample_to_chunk_table[j].media_id); } + break; - } else if (current_atom == STTS_ATOM) { - + case STTS_ATOM: /* there should only be one of these atoms */ if (trak->time_to_sample_table) { last_error = QT_HEADER_TROUBLE; -- cgit v1.2.3 From d15cedf35c0fb1b920e37f9efd441e8fb9036d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 8 Jun 2007 18:01:55 +0200 Subject: More switches in parse_reference_atom. --- src/demuxers/demux_qt.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index f583db28c..bb107c59e 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -1540,9 +1540,7 @@ static qt_error parse_reference_atom (reference_t *ref, char *base_mrl) { int i, j; - unsigned int ref_atom_size = BE_32(&ref_atom[0]); - qt_atom current_atom; - unsigned int current_atom_size; + const unsigned int ref_atom_size = BE_32(&ref_atom[0]); /* initialize reference atom */ ref->url = NULL; @@ -1551,11 +1549,11 @@ static qt_error parse_reference_atom (reference_t *ref, /* traverse through the atom looking for the key atoms */ for (i = ATOM_PREAMBLE_SIZE; i < ref_atom_size - 4; i++) { + const uint32_t current_atom_size = BE_32(&ref_atom[i - 4]); + const qt_atom current_atom = BE_32(&ref_atom[i]); - current_atom_size = BE_32(&ref_atom[i - 4]); - current_atom = BE_32(&ref_atom[i]); - - if (current_atom == RDRF_ATOM) { + switch (current_atom) { + case RDRF_ATOM: /* if the URL starts with "http://", copy it */ if (strncmp(&ref_atom[i + 16], "http://", 7) == 0 @@ -1584,17 +1582,17 @@ static qt_error parse_reference_atom (reference_t *ref, } debug_atom_load(" qt rdrf URL reference:\n %s\n", ref->url); + break; - } else if (current_atom == RMDR_ATOM) { - + case RMDR_ATOM: /* load the data rate */ ref->data_rate = BE_32(&ref_atom[i + 8]); ref->data_rate *= 10; debug_atom_load(" qt rmdr data rate = %"PRId64"\n", ref->data_rate); + break; - } else if (current_atom == RMVC_ATOM) { - + case RMVC_ATOM: debug_atom_load(" qt rmvc atom\n"); /* search the rmvc atom for 'qtim'; 2 bytes will follow the qtim -- cgit v1.2.3 From 2e3c87592773b39e1b4978f0d3a7ea6053bcfbb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 8 Jun 2007 18:08:35 +0200 Subject: More conversion to switches. --- src/demuxers/demux_qt.c | 55 +++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index bb107c59e..65bf81f4d 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -817,9 +817,7 @@ static qt_error parse_trak_atom (qt_trak *trak, unsigned char *trak_atom) { int i, j, k; - unsigned int trak_atom_size = BE_32(&trak_atom[0]); - qt_atom current_atom; - unsigned int current_atom_size; + const unsigned int trak_atom_size = BE_32(&trak_atom[0]); unsigned int atom_pos; unsigned int properties_offset; unsigned int current_stsd_atom_size; @@ -866,12 +864,13 @@ static qt_error parse_trak_atom (qt_trak *trak, /* search for media type atoms */ for (i = ATOM_PREAMBLE_SIZE; i < trak_atom_size - 4; i++) { - current_atom = BE_32(&trak_atom[i]); + const qt_atom current_atom = BE_32(&trak_atom[i]); - if (current_atom == VMHD_ATOM) { + switch (current_atom) { + case VMHD_ATOM: trak->type = MEDIA_VIDEO; break; - } else if (current_atom == SMHD_ATOM) { + case SMHD_ATOM: trak->type = MEDIA_AUDIO; break; } @@ -883,8 +882,8 @@ static qt_error parse_trak_atom (qt_trak *trak, /* search for the useful atoms */ for (i = ATOM_PREAMBLE_SIZE; i < trak_atom_size - 4; i++) { - current_atom_size = BE_32(&trak_atom[i - 4]); - current_atom = BE_32(&trak_atom[i]); + const current_atom_size = BE_32(&trak_atom[i - 4]); + const current_atom = BE_32(&trak_atom[i]); switch(current_atom) { case TKHD_ATOM: @@ -1920,7 +1919,6 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, int64_t bandwidth) { int i, j; unsigned int moov_atom_size = BE_32(&moov_atom[0]); - qt_atom current_atom; int string_size, error; unsigned int max_video_frames = 0; unsigned int max_audio_frames = 0; @@ -1935,15 +1933,17 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, /* prowl through the moov atom looking for very specific targets */ for (i = ATOM_PREAMBLE_SIZE + 4; i < moov_atom_size - 4; i += BE_32(&moov_atom[i - 4])) { - current_atom = BE_32(&moov_atom[i]); + const qt_atom current_atom = BE_32(&moov_atom[i]); - if (current_atom == MVHD_ATOM) { + switch (current_atom) { + case MVHD_ATOM: parse_mvhd_atom(info, &moov_atom[i - 4]); if (info->last_error != QT_OK) return; - } else if (current_atom == TRAK_ATOM) { + break; + case TRAK_ATOM: /* create a new trak structure */ info->trak_count++; info->traks = (qt_trak *)realloc(info->traks, @@ -1955,44 +1955,44 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, info->trak_count--; return; } - - } else if (current_atom == META_ATOM) { - + break; + + case META_ATOM: parse_meta_atom(info, &moov_atom[i - 4]); if (info->last_error != QT_OK) return; + break; - } else if (current_atom == NAM_ATOM) { - + case NAM_ATOM: string_size = BE_16(&moov_atom[i + 4]) + 1; info->name = realloc (info->name, string_size); strncpy(info->name, &moov_atom[i + 8], string_size - 1); info->name[string_size - 1] = 0; + break; - } else if (current_atom == CPY_ATOM) { - + case CPY_ATOM: string_size = BE_16(&moov_atom[i + 4]) + 1; info->copyright = realloc (info->copyright, string_size); strncpy(info->copyright, &moov_atom[i + 8], string_size - 1); info->copyright[string_size - 1] = 0; + break; - } else if (current_atom == DES_ATOM) { - + case DES_ATOM: string_size = BE_16(&moov_atom[i + 4]) + 1; info->description = realloc (info->description, string_size); strncpy(info->description, &moov_atom[i + 8], string_size - 1); info->description[string_size - 1] = 0; + break; - } else if (current_atom == CMT_ATOM) { - + case CMT_ATOM: string_size = BE_16(&moov_atom[i + 4]) + 1; info->comment = realloc (info->comment, string_size); strncpy(info->comment, &moov_atom[i + 8], string_size - 1); info->comment[string_size - 1] = 0; + break; - } else if (current_atom == RMDA_ATOM || - current_atom == RMRA_ATOM) { - + case RMDA_ATOM: + case RMRA_ATOM: /* create a new reference structure */ info->reference_count++; info->references = (reference_t *)realloc(info->references, @@ -2000,8 +2000,9 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, parse_reference_atom(&info->references[info->reference_count - 1], &moov_atom[i - 4], info->base_mrl); + break; - } else { + default: debug_atom_load(" qt: unknown atom into the moov atom (0x%08X)\n", current_atom); } } -- cgit v1.2.3 From fa73605943a34d50491ecd1fe74d6d9a1dc27874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 8 Jun 2007 18:11:58 +0200 Subject: Mark some stuff constant, reduce scope of a few other variables. --- src/demuxers/demux_qt.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 65bf81f4d..e6867c246 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -820,20 +820,8 @@ static qt_error parse_trak_atom (qt_trak *trak, const unsigned int trak_atom_size = BE_32(&trak_atom[0]); unsigned int atom_pos; unsigned int properties_offset; - unsigned int current_stsd_atom_size; qt_error last_error = QT_OK; - /* for palette traversal */ - int color_depth; - int color_flag; - int color_start; - int color_count; - int color_end; - int color_index; - int color_dec; - int color_greyscale; - const unsigned char *color_table; - /* initialize trak structure */ trak->edit_list_count = 0; trak->edit_list_table = NULL; @@ -950,7 +938,18 @@ static qt_error parse_trak_atom (qt_trak *trak, properties_offset = 0x0C; for (k = 0; k < trak->stsd_atoms_count; k++) { - current_stsd_atom_size = BE_32(&trak_atom[atom_pos - 4]); + const uint32_t current_stsd_atom_size = BE_32(&trak_atom[atom_pos - 4]); + + /* for palette traversal */ + int color_depth; + int color_flag; + int color_start; + int color_count; + int color_end; + int color_index; + int color_dec; + int color_greyscale; + const unsigned char *color_table; if (trak->type == MEDIA_VIDEO) { @@ -1231,7 +1230,7 @@ static qt_error parse_trak_atom (qt_trak *trak, (BE_32(&trak_atom[atom_pos + 0x34]) == WAVE_ATOM) && (BE_32(&trak_atom[atom_pos + 0x3C]) == FRMA_ATOM) && (ME_32(&trak_atom[atom_pos + 0x48]) == trak->stsd_atoms[k].audio.codec_fourcc)) { - int wave_size = BE_32(&trak_atom[atom_pos + 0x44]) - 8; + const int wave_size = BE_32(&trak_atom[atom_pos + 0x44]) - 8; if ((wave_size >= sizeof(xine_waveformatex)) && (current_atom_size >= (0x4C + wave_size))) { -- cgit v1.2.3 From 6b67a249152f3da003cee871ae9ecf6ffdf3b559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 8 Jun 2007 18:56:12 +0200 Subject: Fix metadata parser. --- src/demuxers/demux_qt.c | 104 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 75 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index e6867c246..69a1635b9 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -110,6 +110,7 @@ typedef unsigned int qt_atom; #define UDTA_ATOM QT_ATOM('u', 'd', 't', 'a') #define META_ATOM QT_ATOM('m', 'e', 't', 'a') +#define HDLR_ATOM QT_ATOM('h', 'd', 'l', 'r') #define NAM_ATOM QT_ATOM(0xA9, 'n', 'a', 'm') #define CPY_ATOM QT_ATOM(0xA9, 'c', 'p', 'y') #define DES_ATOM QT_ATOM(0xA9, 'd', 'e', 's') @@ -406,6 +407,10 @@ typedef struct { * demuxer is sending off to the audio decoder */ #define DEBUG_AUDIO_DEMUX 0 +/* define DEBUG_META_LOAD as 1 to see details about the metadata chunks the + * demuxer is reading from the file */ +#define DEBUG_META_LOAD 0 + /* Define DEBUG_DUMP_MOOV as 1 to dump the raw moov atom to disk. This is * particularly useful in debugging a file with a compressed moov (cmov) * atom. The atom will be dumped to the filename specified as @@ -443,6 +448,12 @@ static inline void XINE_FORMAT_PRINTF(1, 2) debug_video_demux(const char *format static inline void XINE_FORMAT_PRINTF(1, 2) debug_audio_demux(const char *format, ...) {} #endif +#if DEBUG_META_LOAD +#define debug_audio_demux printf +#else +static inline void XINE_FORMAT_PRINTF(1, 2) debug_meta_load(const char *format, ...) {} +#endif + static inline void dump_moov_atom(unsigned char *moov_atom, int moov_atom_size) { #if DEBUG_DUMP_MOOV @@ -727,55 +738,90 @@ static int is_qt_file(input_plugin_t *qt_file) { } } +static char *parse_data_atom(unsigned char *data_atom) { + const uint32_t data_atom_size = BE_32(&data_atom[0]); + + static const int data_atom_max_version = 0; + const int data_atom_version = data_atom[4]; + + const size_t alloc_size = data_atom_size - 8 + 1; + char *alloc_str = NULL; + + if ( data_atom_version > data_atom_max_version ) { + debug_meta_load("demux_qt: version %d for data atom is higher than the highest supported version (%d)", + data_atom_version, data_atom_max_version); + return; + } + + alloc_str = xine_xmalloc(alloc_size); + xine_fast_memcpy(alloc_str, &data_atom[12], alloc_size-1); + return alloc_str; +} + /* parse out a meta data atom */ static void parse_meta_atom(qt_info *info, unsigned char *meta_atom) { - uint32_t i = 4; - uint32_t meta_atom_size = BE_32(&meta_atom[0]); + static const uint32_t meta_atom_preamble_size = 8; + + const uint32_t meta_atom_size = BE_32(&meta_atom[0]); + + static const int meta_atom_max_version = 0; + const int meta_atom_version = meta_atom[4]; + /* const uint32_t flags = BE_24(&meta_atom[5]); */ + + uint32_t i = meta_atom_preamble_size; + + if ( meta_atom_version > meta_atom_max_version ) { + debug_meta_load("demux_qt: version %d for meta atom is higher than the highest supported version (%d)", + meta_atom_version, meta_atom_max_version); + return; + } while ( i < meta_atom_size ) { - qt_atom current_atom = BE_32(&meta_atom[i]); - uint32_t sub_atom_size = BE_32(&meta_atom[i + 4]); - uint32_t string_size = sub_atom_size - 16 + 1; + const uint8_t *const current_atom = &meta_atom[i]; + const qt_atom current_atom_code = BE_32(¤t_atom[0]); + const uint32_t current_atom_size = BE_32(¤t_atom[4]); + uint32_t handler_type = 0; - switch (current_atom) { + switch (current_atom_code) { + case HDLR_ATOM: { + static const int hdlr_atom_max_version = 0; + const int hdlr_atom_version = current_atom[8]; + + /* const uint32_t hdlr_atom_flags = BE_24(¤t_atom[9]); */ + + if ( hdlr_atom_version > hdlr_atom_max_version ) { + debug_meta_load("demux_qt: version %d for hdlr atom is higher than the highest supported version (%d)", + hdlr_atom_version, hdlr_atom_max_version); + return; + } + + handler_type = BE_32(¤t_atom[12]); + } + case ART_ATOM: - info->artist = xine_xmalloc(string_size); - strncpy(info->artist, &meta_atom[i + 20], string_size - 1); - info->artist[string_size - 1] = 0; + info->artist = parse_data_atom(¤t_atom[8]); break; case NAM_ATOM: - info->name = xine_xmalloc(string_size); - strncpy(info->name, &meta_atom[i + 20], string_size - 1); - info->name[string_size - 1] = 0; + info->name = parse_data_atom(¤t_atom[8]); break; case ALB_ATOM: - info->album = xine_xmalloc(string_size); - strncpy(info->album, &meta_atom[i + 20], string_size - 1); - info->album[string_size - 1] = 0; + info->album = parse_data_atom(¤t_atom[8]); break; case GEN_ATOM: - info->genre = xine_xmalloc(string_size); - strncpy(info->genre, &meta_atom[i + 20], string_size - 1); - info->genre[string_size - 1] = 0; + info->genre = parse_data_atom(¤t_atom[8]); break; - case TOO_ATOM: - info->comment = xine_xmalloc(string_size); - strncpy(info->comment, &meta_atom[i + 20], string_size - 1); - info->comment[string_size - 1] = 0; + case CMT_ATOM: + info->comment = parse_data_atom(¤t_atom[8]); break; case WRT_ATOM: - info->composer = xine_xmalloc(string_size); - strncpy(info->composer, &meta_atom[i + 20], string_size - 1); - info->composer[string_size - 1] = 0; + info->composer = parse_data_atom(¤t_atom[8]); break; case DAY_ATOM: - info->year = xine_xmalloc(string_size); - strncpy(info->year, &meta_atom[i + 20], string_size - 1); - info->year[string_size - 1] = 0; + info->year = parse_data_atom(¤t_atom[8]); break; } - i += sub_atom_size; + i += current_atom_size; } } -- cgit v1.2.3 From 4f2f35a3d9164cc0485bb728f8ca4f2668cbcee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 8 Jun 2007 20:47:34 +0200 Subject: Properly read metadata for the file, the structure is more complex than it was previously implemented. --- src/demuxers/demux_qt.c | 95 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 69a1635b9..4ce55502e 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -111,6 +111,7 @@ typedef unsigned int qt_atom; #define UDTA_ATOM QT_ATOM('u', 'd', 't', 'a') #define META_ATOM QT_ATOM('m', 'e', 't', 'a') #define HDLR_ATOM QT_ATOM('h', 'd', 'l', 'r') +#define ILST_ATOM QT_ATOM('i', 'l', 's', 't') #define NAM_ATOM QT_ATOM(0xA9, 'n', 'a', 'm') #define CPY_ATOM QT_ATOM(0xA9, 'c', 'p', 'y') #define DES_ATOM QT_ATOM(0xA9, 'd', 'e', 's') @@ -449,7 +450,7 @@ static inline void XINE_FORMAT_PRINTF(1, 2) debug_audio_demux(const char *format #endif #if DEBUG_META_LOAD -#define debug_audio_demux printf +#define debug_meta_load printf #else static inline void XINE_FORMAT_PRINTF(1, 2) debug_meta_load(const char *format, ...) {} #endif @@ -742,44 +743,48 @@ static char *parse_data_atom(unsigned char *data_atom) { const uint32_t data_atom_size = BE_32(&data_atom[0]); static const int data_atom_max_version = 0; - const int data_atom_version = data_atom[4]; + const int data_atom_version = data_atom[8]; const size_t alloc_size = data_atom_size - 8 + 1; char *alloc_str = NULL; if ( data_atom_version > data_atom_max_version ) { - debug_meta_load("demux_qt: version %d for data atom is higher than the highest supported version (%d)", + debug_meta_load("demux_qt: version %d for data atom is higher than the highest supported version (%d)\n", data_atom_version, data_atom_max_version); - return; + return NULL; } alloc_str = xine_xmalloc(alloc_size); - xine_fast_memcpy(alloc_str, &data_atom[12], alloc_size-1); + xine_fast_memcpy(alloc_str, &data_atom[16], alloc_size-1); + alloc_str[alloc_size-1] = '\0'; + + debug_meta_load("demux_qt: got a string of size %d (%s)\n", alloc_size, alloc_str); + return alloc_str; } /* parse out a meta data atom */ static void parse_meta_atom(qt_info *info, unsigned char *meta_atom) { - static const uint32_t meta_atom_preamble_size = 8; + static const uint32_t meta_atom_preamble_size = 12; const uint32_t meta_atom_size = BE_32(&meta_atom[0]); static const int meta_atom_max_version = 0; - const int meta_atom_version = meta_atom[4]; - /* const uint32_t flags = BE_24(&meta_atom[5]); */ + const int meta_atom_version = meta_atom[8]; + /* const uint32_t flags = BE_24(&meta_atom[9]); */ uint32_t i = meta_atom_preamble_size; if ( meta_atom_version > meta_atom_max_version ) { - debug_meta_load("demux_qt: version %d for meta atom is higher than the highest supported version (%d)", + debug_meta_load("demux_qt: version %d for meta atom is higher than the highest supported version (%d)\n", meta_atom_version, meta_atom_max_version); return; } while ( i < meta_atom_size ) { const uint8_t *const current_atom = &meta_atom[i]; - const qt_atom current_atom_code = BE_32(¤t_atom[0]); - const uint32_t current_atom_size = BE_32(¤t_atom[4]); + const qt_atom current_atom_code = BE_32(¤t_atom[4]); + const uint32_t current_atom_size = BE_32(¤t_atom[0]); uint32_t handler_type = 0; switch (current_atom_code) { @@ -790,35 +795,55 @@ static void parse_meta_atom(qt_info *info, unsigned char *meta_atom) { /* const uint32_t hdlr_atom_flags = BE_24(¤t_atom[9]); */ if ( hdlr_atom_version > hdlr_atom_max_version ) { - debug_meta_load("demux_qt: version %d for hdlr atom is higher than the highest supported version (%d)", + debug_meta_load("demux_qt: version %d for hdlr atom is higher than the highest supported version (%d)\n", hdlr_atom_version, hdlr_atom_max_version); return; } handler_type = BE_32(¤t_atom[12]); } - - case ART_ATOM: - info->artist = parse_data_atom(¤t_atom[8]); - break; - case NAM_ATOM: - info->name = parse_data_atom(¤t_atom[8]); - break; - case ALB_ATOM: - info->album = parse_data_atom(¤t_atom[8]); - break; - case GEN_ATOM: - info->genre = parse_data_atom(¤t_atom[8]); - break; - case CMT_ATOM: - info->comment = parse_data_atom(¤t_atom[8]); break; - case WRT_ATOM: - info->composer = parse_data_atom(¤t_atom[8]); - break; - case DAY_ATOM: - info->year = parse_data_atom(¤t_atom[8]); + + case ILST_ATOM: { + uint32_t j = i + 8; + while ( j < current_atom_size ) { + const uint8_t *const sub_atom = &meta_atom[j]; + const qt_atom sub_atom_code = BE_32(&sub_atom[4]); + const uint32_t sub_atom_size = BE_32(&sub_atom[0]); + + switch(sub_atom_code) { + case ART_ATOM: + info->artist = parse_data_atom(&sub_atom[8]); + break; + case NAM_ATOM: + info->name = parse_data_atom(&sub_atom[8]); + break; + case ALB_ATOM: + info->album = parse_data_atom(&sub_atom[8]); + break; + case GEN_ATOM: + info->genre = parse_data_atom(&sub_atom[8]); + break; + case CMT_ATOM: + info->comment = parse_data_atom(&sub_atom[8]); + break; + case WRT_ATOM: + info->composer = parse_data_atom(&sub_atom[8]); + break; + case DAY_ATOM: + info->year = parse_data_atom(&sub_atom[8]); + break; + default: + debug_meta_load("unknown atom %08x in ilst\n", sub_atom_code); + } + + j += sub_atom_size; + } + } break; + + default: + debug_meta_load("unknown atom %08x in meta\n", current_atom_code); } i += current_atom_size; @@ -2002,6 +2027,12 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, } break; + case UDTA_ATOM: + parse_meta_atom(info, &moov_atom[i + 4]); + if (info->last_error != QT_OK) + return; + break; + case META_ATOM: parse_meta_atom(info, &moov_atom[i - 4]); if (info->last_error != QT_OK) -- cgit v1.2.3 From 72c64cd5c76febda45d95452276e11d60477103e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 11:23:10 +0200 Subject: Make the read() function of input plugins be declared with void pointer as buf parameter, so that any kind of variable can be passed through it. --- src/input/input_plugin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index 11e1303e7..66b3abbb9 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -118,7 +118,7 @@ struct input_plugin_s { * Should block until some bytes available for read; * a return value of 0 indicates no data available */ - off_t (*read) (input_plugin_t *this, char *buf, off_t nlen); + off_t (*read) (input_plugin_t *this, void *buf, off_t nlen); /* -- cgit v1.2.3 From 4d7e574abefe9cd15c04cf0145faf55c9e282e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 11:44:00 +0200 Subject: Convert all input plugins to use void * as type for the buf parameter of read() function, and declare a new buf variable in the function as needed. --- src/input/input_cdda.c | 2 +- src/input/input_dvb.c | 4 +++- src/input/input_dvd.c | 3 ++- src/input/input_file.c | 2 +- src/input/input_gnome_vfs.c | 3 ++- src/input/input_http.c | 3 ++- src/input/input_mms.c | 3 ++- src/input/input_net.c | 3 ++- src/input/input_pnm.c | 3 ++- src/input/input_pvr.c | 3 ++- src/input/input_rtp.c | 3 ++- src/input/input_rtsp.c | 2 +- src/input/input_smb.c | 3 ++- src/input/input_stdin_fifo.c | 3 ++- src/input/input_v4l.c | 2 +- src/input/input_vcd.c | 9 ++++++--- src/vdr/input_vdr.c | 3 ++- src/xine-engine/input_cache.c | 3 ++- src/xine-engine/input_rip.c | 3 ++- 19 files changed, 39 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index b85bc534e..e35ee5b9c 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -2243,7 +2243,7 @@ static uint32_t cdda_plugin_get_capabilities (input_plugin_t *this_gen) { } -static off_t cdda_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { +static off_t cdda_plugin_read (input_plugin_t *this_gen, void *buf, off_t len) { /* only allow reading in block-sized chunks */ diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 50162c7db..38ad0be82 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -2468,8 +2468,10 @@ static void ts_rewrite_packets (dvb_input_plugin_t *this, unsigned char * origin } static off_t dvb_plugin_read (input_plugin_t *this_gen, - char *buf, off_t len) { + void *buf_gen, off_t len) { dvb_input_plugin_t *this = (dvb_input_plugin_t *) this_gen; + char *buf = (char *)buf_gen; + off_t n=0, total=0; int have_mutex=0; struct pollfd pfd; diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 1a8861289..dc38ceecd 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -853,8 +853,9 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, return buf; } -static off_t dvd_plugin_read (input_plugin_t *this_gen, char *ch_buf, off_t len) { +static off_t dvd_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len) { /* dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; */ + char *ch_buf = (char *)buf_gen; /* FIXME: Tricking the demux_mpeg_block plugin */ ch_buf[0] = 0; diff --git a/src/input/input_file.c b/src/input/input_file.c index 1dce8baad..cc1e55c87 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -144,7 +144,7 @@ static int check_mmap_file(file_input_plugin_t *this) { } #endif -static off_t file_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { +static off_t file_plugin_read (input_plugin_t *this_gen, void *buf, off_t len) { file_input_plugin_t *this = (file_input_plugin_t *) this_gen; #ifdef HAVE_MMAP diff --git a/src/input/input_gnome_vfs.c b/src/input/input_gnome_vfs.c index 540abd0f4..1fe29fbcd 100644 --- a/src/input/input_gnome_vfs.c +++ b/src/input/input_gnome_vfs.c @@ -75,8 +75,9 @@ gnomevfs_plugin_get_capabilities (input_plugin_t *this_gen) #define SSH_BUFFER_SIZE 256 * 1024 static off_t -gnomevfs_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) +gnomevfs_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len) { + char *buf = (char *)buf_gen; gnomevfs_input_t *this = (gnomevfs_input_t *) this_gen; off_t n, num_bytes; diff --git a/src/input/input_http.c b/src/input/input_http.c index d1202ae14..3db5af002 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -404,8 +404,9 @@ error: } static off_t http_plugin_read (input_plugin_t *this_gen, - char *buf, off_t nlen) { + void *buf_gen, off_t nlen) { http_input_plugin_t *this = (http_input_plugin_t *) this_gen; + char *buf = (char *)buf_gen; off_t n, num_bytes; num_bytes = 0; diff --git a/src/input/input_mms.c b/src/input/input_mms.c index 739d81a59..23102ac18 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -98,8 +98,9 @@ typedef struct { } mms_input_class_t; static off_t mms_plugin_read (input_plugin_t *this_gen, - char *buf, off_t len) { + void *buf_gen, off_t len) { mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; + char *buf = (char *)buf_gen; off_t n = 0; lprintf ("mms_plugin_read: %"PRId64" bytes ...\n", len); diff --git a/src/input/input_net.c b/src/input/input_net.c index 0ce2e1340..dd318c37c 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -249,8 +249,9 @@ static int host_connect(const char *host, int port, xine_t *xine) { #define HIGH_WATER_MARK 100 static off_t net_plugin_read (input_plugin_t *this_gen, - char *buf, off_t len) { + void *buf_gen, off_t len) { net_input_plugin_t *this = (net_input_plugin_t *) this_gen; + char *buf = (char *)buf_gen; off_t n, total; lprintf("reading %" PRIdMAX " bytes...\n", (intmax_t)len); diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c index e1413b0f7..29d65da2d 100644 --- a/src/input/input_pnm.c +++ b/src/input/input_pnm.c @@ -76,8 +76,9 @@ typedef struct { static off_t pnm_plugin_read (input_plugin_t *this_gen, - char *buf, off_t len) { + void *buf_gen, off_t len) { pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; + char *buf = (char *)buf_gen; off_t n; lprintf ("pnm_plugin_read: %"PRId64" bytes ...\n", len); diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index bcf93af2b..48b69c8f5 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -423,8 +423,9 @@ static uint32_t pvr_plugin_get_capabilities (input_plugin_t *this_gen) { } -static off_t pvr_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { +static off_t pvr_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len) { /*pvr_input_plugin_t *this = (pvr_input_plugin_t *) this_gen;*/ + char *buf = (char *)buf_gen; /* FIXME: Tricking the demux_mpeg_block plugin */ buf[0] = 0; diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index d4ba804c6..2c6c581c2 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -432,8 +432,9 @@ static void * input_plugin_read_loop(void *arg) { /* ***************************************************************** */ static off_t rtp_plugin_read (input_plugin_t *this_gen, - char *buf, off_t length) { + void *buf_gen, off_t length) { rtp_input_plugin_t *this = (rtp_input_plugin_t *) this_gen; + char *buf = (char *)buf_gen; struct timeval tv; struct timespec timeout; diff --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c index 693e8af66..cd2209baa 100644 --- a/src/input/input_rtsp.c +++ b/src/input/input_rtsp.c @@ -77,7 +77,7 @@ typedef struct { static off_t rtsp_plugin_read (input_plugin_t *this_gen, - char *buf, off_t len) { + void *buf, off_t len) { rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; off_t n; diff --git a/src/input/input_smb.c b/src/input/input_smb.c index 4cacebf89..87f2a81fa 100644 --- a/src/input/input_smb.c +++ b/src/input/input_smb.c @@ -66,9 +66,10 @@ smb_plugin_get_capabilities (input_plugin_t *this_gen) static off_t -smb_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) +smb_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len) { smb_input_t *this = (smb_input_t *) this_gen; + char *buf = (char *)buf_gen; off_t n, num_bytes; num_bytes = 0; diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index 939f56f25..2b3cf1376 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.c @@ -81,9 +81,10 @@ static off_t stdin_plugin_get_current_pos (input_plugin_t *this_gen); static off_t stdin_plugin_read (input_plugin_t *this_gen, - char *buf, off_t len) { + void *buf_gen, off_t len) { stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; + char *buf = (char *)buf_gen; off_t n, total; lprintf ("reading %"PRId64" bytes...\n", len); diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index 6829470ff..959874b14 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -1192,7 +1192,7 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi * Plugin read. * This function is not supported by the plugin. */ -static off_t v4l_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { +static off_t v4l_plugin_read (input_plugin_t *this_gen, void *buf, off_t len) { lprintf("Read not supported\n"); return 0; } diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index bcd50ecc1..7d2ea0063 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -340,9 +340,10 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) #if defined (__linux__) static off_t vcd_plugin_read (input_plugin_t *this_gen, - char *buf, off_t nlen) { + void *buf_gen, off_t nlen) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; + char *buf = (char *)buf_gen; static struct cdrom_msf msf ; static cdsector_t data; struct cdrom_msf0 *end_msf; @@ -398,8 +399,9 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, } #elif defined (__FreeBSD__) static off_t vcd_plugin_read (input_plugin_t *this_gen, - char *buf, off_t nlen) { + void *buf_gen, off_t nlen) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; + char *buf = (char *)buf_gen; static cdsector_t data; int bsize = 2352; @@ -422,9 +424,10 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, } #elif defined (__sun) static off_t vcd_plugin_read (input_plugin_t *this_gen, - char *buf, off_t nlen) { + void *buf_gen, off_t nlen) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; + char *buf = (char *)buf_gen; static cdsector_t data; struct cdrom_msf0 *end_msf; long lba; diff --git a/src/vdr/input_vdr.c b/src/vdr/input_vdr.c index 1f82def28..97da8e834 100644 --- a/src/vdr/input_vdr.c +++ b/src/vdr/input_vdr.c @@ -1308,9 +1308,10 @@ static int internal_write_event_play_external(vdr_input_plugin_t *this, uint32_t } static off_t vdr_plugin_read(input_plugin_t *this_gen, - char *buf, off_t len) + void *buf_gen, off_t len) { vdr_input_plugin_t *this = (vdr_input_plugin_t *) this_gen; + char *buf = (char *)buf_gen; off_t n, total; #ifdef LOG_READ lprintf ("reading %lld bytes...\n", len); diff --git a/src/xine-engine/input_cache.c b/src/xine-engine/input_cache.c index 75c4beb43..7537c4d16 100644 --- a/src/xine-engine/input_cache.c +++ b/src/xine-engine/input_cache.c @@ -62,8 +62,9 @@ typedef struct { /* * read data from input plugin and write it into file */ -static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { +static off_t cache_plugin_read(input_plugin_t *this_gen, void *buf_gen, off_t len) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; + char *buf = (char *)buf_gen; off_t read_len = 0; off_t main_read; diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c index 56850ba2d..774ef82c5 100644 --- a/src/xine-engine/input_rip.c +++ b/src/xine-engine/input_rip.c @@ -100,8 +100,9 @@ static off_t min_off(off_t a, off_t b) { /* * read data from input plugin and write it into file */ -static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { +static off_t rip_plugin_read(input_plugin_t *this_gen, void *buf_gen, off_t len) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; + char *buf = (char *)buf_gen; off_t retlen, npreview, nread, nwrite, nread_orig, nread_file; lprintf("reading %"PRId64" bytes (curpos = %"PRId64", savepos = %"PRId64")\n", len, this->curpos, this->savepos); -- cgit v1.2.3 From 106dee09c13aae60a589c511e6499f8e8d049ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 11:46:03 +0200 Subject: Remove unused variable. --- src/xine-engine/scratch.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/xine-engine/scratch.c b/src/xine-engine/scratch.c index 4b694699f..ddca0cfaf 100644 --- a/src/xine-engine/scratch.c +++ b/src/xine-engine/scratch.c @@ -108,7 +108,6 @@ static void scratch_dispose (scratch_buffer_t *this) { scratch_buffer_t *_x_new_scratch_buffer (int num_lines) { scratch_buffer_t *this; - int i; this = xine_xmalloc (sizeof (scratch_buffer_t)); -- cgit v1.2.3 From fbbcbdc0f8c9effae987db271b0bca71098fe5c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 11:46:22 +0200 Subject: Remove unused and orphan label and code. --- src/audio_out/audio_pulse_out.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index 9e6089730..cd80318b6 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -626,12 +626,6 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->pa_class = class; return &this->ao_driver; - - fail: - pthread_mutex_unlock(&this->pa_class->pa_mutex); - free(this); - xprintf (class->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: open_plugin failed.\n"); - return NULL; } /* -- cgit v1.2.3 From 3a399036b466bbfc1ad3c379e0cc1c7d2f05e91c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 11:47:30 +0200 Subject: Remove unused variable. --- src/input/input_cdda.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index e35ee5b9c..029658fe1 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -1566,7 +1566,6 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) { */ static void _cdda_save_cached_cddb_infos(cdda_input_plugin_t *this, char *filecontent) { FILE *fd; - DIR *dir; char *cfile; const char *const xdg_cache_home = xdgCacheHome(this->stream->xine->basedir_handle); -- cgit v1.2.3 From 5a6de3347ef0da6c51f936a8d94ab58404453300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 11:48:09 +0200 Subject: Remove unused variable. --- src/demuxers/demux_realaudio.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c index bf8de0dad..0f8528a22 100644 --- a/src/demuxers/demux_realaudio.c +++ b/src/demuxers/demux_realaudio.c @@ -313,8 +313,6 @@ static int demux_ra_get_status (demux_plugin_t *this_gen) { /* return the approximate length in miliseconds */ static int demux_ra_get_stream_length (demux_plugin_t *this_gen) { - demux_ra_t *this = (demux_ra_t *) this_gen; - return 0; } -- cgit v1.2.3 From 72b3ce11eb673800237497eb74736ac092e9ee0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 11:48:53 +0200 Subject: Remove unused variables. --- src/demuxers/demux_ts.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 0c8b4e974..2b3f77d11 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -1305,7 +1305,6 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num case ISO_13818_PES_PRIVATE: for (i = 5; i < coded_length; i += stream[i+1] + 2) { if ((stream[i] == 0x6a) && (this->audio_tracks_count < MAX_AUDIO_TRACKS)) { - uint32_t format_identifier=0; int i, found = 0; for(i = 0; i < this->audio_tracks_count; i++) { if(this->audio_tracks[i].pid == pid) { @@ -2081,7 +2080,6 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, demux_ts_t *this = (demux_ts_t *) this_gen; char *str = data; int channel = *((int *)data); - int track_num; /* be a bit paranoid */ if (this == NULL || this->stream == NULL) -- cgit v1.2.3 From 9cfd704b3b6eadf2c5532908440c214edc6788f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 11:49:35 +0200 Subject: Fix %d -> %zd for size_t parameter. --- src/demuxers/demux_qt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 4ce55502e..bfacd1410 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -758,7 +758,7 @@ static char *parse_data_atom(unsigned char *data_atom) { xine_fast_memcpy(alloc_str, &data_atom[16], alloc_size-1); alloc_str[alloc_size-1] = '\0'; - debug_meta_load("demux_qt: got a string of size %d (%s)\n", alloc_size, alloc_str); + debug_meta_load("demux_qt: got a string of size %zd (%s)\n", alloc_size, alloc_str); return alloc_str; } -- cgit v1.2.3 From e198fcdc4ace3f3c61f294e25a62a0aa308a1973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 12:05:19 +0200 Subject: Add an nsf_combined.h header file with declarations of decoder_nsf_init_plugin and demux_nsf_init_plugin. --- src/combined/Makefile.am | 2 +- src/combined/nsf_combined.c | 4 +--- src/combined/nsf_combined.h | 22 ++++++++++++++++++++++ src/combined/nsf_decoder.c | 2 ++ src/combined/nsf_demuxer.c | 2 ++ 5 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 src/combined/nsf_combined.h (limited to 'src') diff --git a/src/combined/Makefile.am b/src/combined/Makefile.am index c1e590fd7..47a42039f 100644 --- a/src/combined/Makefile.am +++ b/src/combined/Makefile.am @@ -28,7 +28,7 @@ xineplug_flac_la_SOURCES = flac_demuxer.c flac_decoder.c xineplug_flac_la_LIBADD = $(XINE_LIB) $(LIBFLAC_LIBS) xineplug_flac_la_CFLAGS = $(AM_CFLAGS) $(LIBFLAC_CFLAGS) -xineplug_nsf_la_SOURCES = nsf_decoder.c nsf_demuxer.c nsf_combined.c +xineplug_nsf_la_SOURCES = nsf_decoder.c nsf_demuxer.c nsf_combined.c nsf_combined.h xineplug_nsf_la_LIBADD = $(XINE_LIB) $(top_builddir)/contrib/nosefart/libnosefart.la -lm xineplug_nsf_la_CFLAGS = $(AM_CFLAGS) -fno-strict-aliasing xineplug_nsf_la_CPPFLAGS = $(AM_CPPFLAGS) -DNSF_PLAYER -I$(top_srcdir)/contrib/nosefart -I$(top_srcdir)/src/demuxers diff --git a/src/combined/nsf_combined.c b/src/combined/nsf_combined.c index 855b8d2a5..474064213 100644 --- a/src/combined/nsf_combined.c +++ b/src/combined/nsf_combined.c @@ -21,9 +21,7 @@ */ #include "xine_internal.h" - -void *decoder_nsf_init_plugin (xine_t *xine, void *data); -void *demux_nsf_init_plugin (xine_t *xine, void *data); +#include "nsf_combined.h" static const demuxer_info_t demux_info_nsf = { 10 /* priority */ diff --git a/src/combined/nsf_combined.h b/src/combined/nsf_combined.h new file mode 100644 index 000000000..36a0abe71 --- /dev/null +++ b/src/combined/nsf_combined.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2000-2001 the xine project + * + * This file is part of xine, a free video player. + * + * xine is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * xine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +void *decoder_nsf_init_plugin (xine_t *xine, void *data); +void *demux_nsf_init_plugin (xine_t *xine, void *data); diff --git a/src/combined/nsf_decoder.c b/src/combined/nsf_decoder.c index e8b5dd96a..01884f267 100644 --- a/src/combined/nsf_decoder.c +++ b/src/combined/nsf_decoder.c @@ -39,6 +39,8 @@ #include "types.h" #include "nsf.h" +#include "nsf_combined.h" + typedef struct { audio_decoder_class_t decoder_class; } nsf_class_t; diff --git a/src/combined/nsf_demuxer.c b/src/combined/nsf_demuxer.c index b598b9e1c..3ebacc217 100644 --- a/src/combined/nsf_demuxer.c +++ b/src/combined/nsf_demuxer.c @@ -54,6 +54,8 @@ #include "demux.h" #include "bswap.h" +#include "nsf_combined.h" + #define NSF_HEADER_SIZE 0x80 #define NSF_SAMPLERATE 44100 #define NSF_BITS 8 -- cgit v1.2.3 From 14d1a63dc30aa4590c30b24b824b4cc76e869183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 12:22:54 +0200 Subject: Define sigill_return and sigill_handler only on x86, as there is where they only are used. --- src/xine-utils/cpu_accel.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c index b32733fba..ddada94d3 100644 --- a/src/xine-utils/cpu_accel.c +++ b/src/xine-utils/cpu_accel.c @@ -24,8 +24,6 @@ #include #include #include -#include -#include #include #if defined (__SVR4) && defined (__sun) @@ -42,11 +40,16 @@ #if defined(ARCH_X86) || defined(ARCH_X86_64) +#ifndef __x86_64__ +#include +#include + static jmp_buf sigill_return; static void sigill_handler (int n) { longjmp(sigill_return, 1); } +#endif static uint32_t arch_accel (void) { -- cgit v1.2.3 From 1164322fc326fd8023c9a01823092eac105ccba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 12:30:11 +0200 Subject: Include dlfcn.h only when dlopen() is needed. --- src/xine-utils/cpu_accel.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c index ddada94d3..9285148b8 100644 --- a/src/xine-utils/cpu_accel.c +++ b/src/xine-utils/cpu_accel.c @@ -24,7 +24,10 @@ #include #include #include + +#if defined(HAVE_MLIB) && defined(MLIB_LAZYLOAD) #include +#endif #if defined (__SVR4) && defined (__sun) #include -- cgit v1.2.3 From 2c5cfbc4e033c3959f5e3c9707b71044adadbd55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 12:50:55 +0200 Subject: If 3dNOW is enabled at build-time, mark it as present on x86-64; it's not always there because Intel EM64T machines does not have it. --- src/xine-utils/cpu_accel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c index 9285148b8..147a32ac5 100644 --- a/src/xine-utils/cpu_accel.c +++ b/src/xine-utils/cpu_accel.c @@ -61,7 +61,11 @@ static uint32_t arch_accel (void) #ifdef __x86_64__ /* No need to test for this on AMD64, we know what the platform has. */ - caps = MM_ACCEL_X86_MMX | MM_ACCEL_X86_SSE | MM_ACCEL_X86_MMXEXT | MM_ACCEL_X86_SSE2; + caps = MM_ACCEL_X86_MMX | MM_ACCEL_X86_SSE | MM_ACCEL_X86_MMXEXT | MM_ACCEL_X86_SSE2 +# if defined(__3dNOW__) + | MM_ACCEL_X86_3DNOW +# endif + ; #else #ifndef _MSC_VER -- cgit v1.2.3 From 13cb1497c43a5bffc29ca27933c37c5e3e898d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 12:56:14 +0200 Subject: If SSE, SSE2 and MMX are enabled at build-time, enable them and skip over the cpuid tests; a runtime CPU detection option could be supplied by configure, for instance. --- src/xine-utils/cpu_accel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c index 147a32ac5..e350898eb 100644 --- a/src/xine-utils/cpu_accel.c +++ b/src/xine-utils/cpu_accel.c @@ -58,7 +58,8 @@ static uint32_t arch_accel (void) { uint32_t caps; -#ifdef __x86_64__ +#if defined(__x86_64__) || \ + ( defined(__SSE__) && defined(__SSE2__) && defined(__MMX__) ) /* No need to test for this on AMD64, we know what the platform has. */ caps = MM_ACCEL_X86_MMX | MM_ACCEL_X86_SSE | MM_ACCEL_X86_MMXEXT | MM_ACCEL_X86_SSE2 @@ -158,6 +159,9 @@ static uint32_t arch_accel (void) caps = 0; #endif /* _MSC_VER */ +#endif /* x86_64 or built-in options */ + +#ifndef __x86_64__ /* test OS support for SSE */ if (caps & MM_ACCEL_X86_SSE) { void (*old_sigill_handler)(int); -- cgit v1.2.3 From 71895542f37568218e6c479c9036218e856c8fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 13:04:05 +0200 Subject: Use __i386__ and __x86_64__ instead of ARCH_X86 and ARCH_X86_64; the ARCH_* defines comes from FFmpeg, but they can easily stay there. --- src/xine-utils/cpu_accel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c index e350898eb..87d7aee77 100644 --- a/src/xine-utils/cpu_accel.c +++ b/src/xine-utils/cpu_accel.c @@ -41,7 +41,7 @@ #include "xineutils.h" -#if defined(ARCH_X86) || defined(ARCH_X86_64) +#if defined(__i386__) || defined(__x86_64__) #ifndef __x86_64__ #include @@ -183,7 +183,7 @@ static uint32_t arch_accel (void) return caps; } -#endif /* ARCH_X86 */ +#endif /* i386 or x86_64 */ #if defined(ARCH_PPC) && defined(ENABLE_ALTIVEC) static sigjmp_buf jmpbuf; @@ -340,7 +340,7 @@ uint32_t xine_mm_accel (void) #endif #endif -#if defined(ARCH_X86) || defined(ARCH_X86_64) || (defined(ARCH_PPC) && defined(ENABLE_ALTIVEC)) || (defined(ARCH_SPARC) && defined(ENABLE_VIS)) +#if defined(__i386__) || defined(__x86_64__) || (defined(ARCH_PPC) && defined(ENABLE_ALTIVEC)) || (defined(ARCH_SPARC) && defined(ENABLE_VIS)) accel |= arch_accel(); #endif -- cgit v1.2.3 From d5d3776bf7e2733d382c5811b317bcdb7c2c9e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 9 Jun 2007 13:04:43 +0200 Subject: signal.h and setjmp.h are needed on PPC and SPARC too. --- src/xine-utils/cpu_accel.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c index 87d7aee77..06ee90cd3 100644 --- a/src/xine-utils/cpu_accel.c +++ b/src/xine-utils/cpu_accel.c @@ -186,6 +186,9 @@ static uint32_t arch_accel (void) #endif /* i386 or x86_64 */ #if defined(ARCH_PPC) && defined(ENABLE_ALTIVEC) +#include +#include + static sigjmp_buf jmpbuf; static volatile sig_atomic_t canjump = 0; @@ -270,6 +273,9 @@ static uint32_t arch_accel (void) return flags; } #else +#include +#include + static sigjmp_buf jmpbuf; static volatile sig_atomic_t canjump = 0; -- cgit v1.2.3