From 443fcac477f3844b4e2dcd867f7e8818b83978a7 Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Thu, 15 Nov 2007 15:27:15 +0100 Subject: when the stream is paused fifo_wait_empty will wait forever. In that case we discard all buffers before calling fifo_wait_empty --- src/xine-engine/audio_out.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index fb2f495d5..1f54786fc 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -290,6 +290,7 @@ struct audio_fifo_s { int num_buffers; }; +static int ao_set_property (xine_audio_port_t *this_gen, int property, int value); static audio_fifo_t *fifo_new (xine_t *xine) { @@ -1599,6 +1600,11 @@ static void ao_close(xine_audio_port_t *this_gen, xine_stream_t *stream) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_out: no streams left, closing driver\n"); if (this->audio_loop_running) { + if (this->clock->speed == XINE_SPEED_PAUSE || + (this->clock->speed != XINE_FINE_SPEED_NORMAL && !this->slow_fast_audio)) { + /* discard buffers, otherwise we'll wait forever */ + ao_set_property(this_gen, AO_PROP_DISCARD_BUFFERS, 1); + } /* make sure there are no more buffers on queue */ fifo_wait_empty(this->out_fifo); } -- cgit v1.2.3 From 0d62b545fbba787e72596fcc30177a6e8596a892 Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Thu, 15 Nov 2007 15:28:04 +0100 Subject: assert that not more than the buffersize is read --- src/xine-engine/input_cache.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/xine-engine/input_cache.c b/src/xine-engine/input_cache.c index 75c4beb43..fea777a42 100644 --- a/src/xine-engine/input_cache.c +++ b/src/xine-engine/input_cache.c @@ -36,6 +36,7 @@ */ #include "xine_internal.h" +#include #define DEFAULT_BUFFER_SIZE 1024 @@ -192,6 +193,7 @@ static buf_element_t *cache_plugin_read_block(input_plugin_t *this_gen, fifo_buf if (buf) { buf->type = BUF_DEMUX_BLOCK; + assert(todo <= buf->max_size); read_len = cache_plugin_read (this_gen, buf->content, todo); buf->size = read_len; } -- cgit v1.2.3 From e4d811b726b85b7de83fafee24b5c1d05061bc1e Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Thu, 15 Nov 2007 15:29:33 +0100 Subject: using select instead of nanosleep the wakeup count reported by powertop is reduced by 50% --- src/xine-utils/utils.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index fa0c11dbe..ab5d9a2ec 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -434,6 +434,7 @@ char *xine_chomp(char *str) { * a thread-safe usecond sleep */ void xine_usec_sleep(unsigned usec) { +#if 0 #if HAVE_NANOSLEEP /* nanosleep is prefered on solaris, because it's mt-safe */ struct timespec ts, remaining; @@ -449,6 +450,15 @@ void xine_usec_sleep(unsigned usec) { usleep(usec); # endif #endif +#else + if (usec < 10000) { + usec = 10000; + } + struct timeval tm; + tm.tv_sec = usec / 1000000; + tm.tv_usec = usec % 1000000; + select(0, 0, 0, 0, &tm); +#endif } -- cgit v1.2.3 From ff8930972b4242d31e540a38f1d8053e846d68e6 Mon Sep 17 00:00:00 2001 From: "Petr Salinger ext:(%20)" Date: Mon, 19 Nov 2007 17:42:21 +0000 Subject: add support for GNU/kFreeBSD It changes some "defined (__FreeBSD__)" into "defined (__FreeBSD_kernel__)" and "__FreeBSD_version" into "__FreeBSD_kernel_version". The changes are performed on places, where feature of kernel is tested. On some other places, feature of userland/libc is tested, on them "defined (__FreeBSD__)" remains. As proposed, include/configure.h cause __FreeBSD_kernel__ be defined if __FreeBSD__ is defined. --HG-- extra : transplant_source : %25%96K%05%E4Y%B15%94%60%15%FE1%8Ah%26Xy%8C/ --- src/input/input_cdda.c | 23 ++++++++++------------- src/input/input_vcd.c | 18 +++++++++--------- src/input/libdvdnav/dvd_reader.c | 2 +- src/input/media_helper.c | 4 ++-- src/input/vcd/libcdio/FreeBSD/freebsd.c | 1 + src/input/vcd/libcdio/FreeBSD/freebsd.h | 2 +- src/libw32dll/wine/ldt_keeper.c | 10 +++++----- src/libw32dll/wine/win32.c | 4 ++-- src/video_out/libdha/ports.c | 2 +- src/xine-engine/xine.c | 2 +- src/xine-engine/xine_interface.c | 2 +- 11 files changed, 34 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 35650c858..5f830a1d3 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -612,7 +612,7 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f return 0; } -#elif defined(__FreeBSD__) || defined(__NetBSD__) +#elif defined(__FreeBSD_kernel__) || defined(__NetBSD__) #include @@ -623,7 +623,7 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f static int read_cdrom_toc(int fd, cdrom_toc *toc) { struct ioc_toc_header tochdr; -#if defined(__FreeBSD__) +#if defined(__FreeBSD_kernel__) struct ioc_read_toc_single_entry tocentry; #elif defined(__NetBSD__) struct ioc_read_toc_entry tocentry; @@ -654,7 +654,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { memset(&tocentry, 0, sizeof(tocentry)); -#if defined(__FreeBSD__) +#if defined(__FreeBSD_kernel__) tocentry.track = i; tocentry.address_format = CD_MSF_FORMAT; if (ioctl(fd, CDIOREADTOCENTRY, &tocentry) == -1) { @@ -673,7 +673,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { } #endif -#if defined(__FreeBSD__) +#if defined(__FreeBSD_kernel__) toc->toc_entries[i-1].track_mode = (tocentry.entry.control & 0x04) ? 1 : 0; toc->toc_entries[i-1].first_frame_minute = tocentry.entry.addr.msf.minute; toc->toc_entries[i-1].first_frame_second = tocentry.entry.addr.msf.second; @@ -697,7 +697,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { /* fetch the leadout as well */ memset(&tocentry, 0, sizeof(tocentry)); -#if defined(__FreeBSD__) +#if defined(__FreeBSD_kernel__) tocentry.track = CD_LEADOUT_TRACK; tocentry.address_format = CD_MSF_FORMAT; if (ioctl(fd, CDIOREADTOCENTRY, &tocentry) == -1) { @@ -716,7 +716,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { } #endif -#if defined(__FreeBSD__) +#if defined(__FreeBSD_kernel__) toc->leadout_track.track_mode = (tocentry.entry.control & 0x04) ? 1 : 0; toc->leadout_track.first_frame_minute = tocentry.entry.addr.msf.minute; toc->leadout_track.first_frame_second = tocentry.entry.addr.msf.second; @@ -745,8 +745,8 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f int fd = this_gen->fd; while( num_frames ) { -#if defined(__FreeBSD__) -#if __FreeBSD_version < 501106 +#if defined(__FreeBSD_kernel__) +#if __FreeBSD_kernel_version < 501106 struct ioc_read_audio cdda; cdda.address_format = CD_MSF_FORMAT; @@ -755,13 +755,10 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f cdda.address.msf.frame = frame % CD_FRAMES_PER_SECOND; cdda.nframes = 1; cdda.buffer = data; -#endif - -#if __FreeBSD_version >= 501106 - if (pread(fd, data, CD_RAW_FRAME_SIZE, frame * CD_RAW_FRAME_SIZE) != CD_RAW_FRAME_SIZE) { -#else /* read a frame */ if(ioctl(fd, CDIOCREADAUDIO, &cdda) < 0) { +#else + if (pread(fd, data, CD_RAW_FRAME_SIZE, frame * CD_RAW_FRAME_SIZE) != CD_RAW_FRAME_SIZE) { #endif perror("CDIOCREADAUDIO"); return -1; diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index 31ba90436..007fa5946 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -37,7 +37,7 @@ #ifdef HAVE_SYS_CDIO_H # include /* TODO: not clean yet */ -# if defined (__FreeBSD__) +# if defined (__FreeBSD_kernel__) # include # endif #endif @@ -92,7 +92,7 @@ typedef struct { #if defined (__linux__) || defined(__sun) struct cdrom_tochdr tochdr; struct cdrom_tocentry tocent[100]; -#elif defined (__FreeBSD__) +#elif defined (__FreeBSD_kernel__) struct ioc_toc_header tochdr; struct cd_toc_entry *tocent; off_t cur_sec; @@ -117,7 +117,7 @@ typedef struct { int cur_track; -#if defined (__linux__) || defined(__sun) || defined(__FreeBSD__) +#if defined (__linux__) || defined(__sun) || defined (__FreeBSD_kernel__) uint8_t cur_min, cur_sec, cur_frame; #endif @@ -177,7 +177,7 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { return 0; } -#elif defined (__FreeBSD__) +#elif defined (__FreeBSD_kernel__) static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { struct ioc_read_toc_entry te; @@ -393,7 +393,7 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, memcpy (buf, data.data, VCDSECTORSIZE); /* FIXME */ return VCDSECTORSIZE; } -#elif defined (__FreeBSD__) +#elif defined (__FreeBSD_kernel__) static off_t vcd_plugin_read (input_plugin_t *this_gen, char *buf, off_t nlen) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; @@ -531,7 +531,7 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, memcpy (buf->mem, data.data, VCDSECTORSIZE); /* FIXME */ return buf; } -#elif defined (__FreeBSD__) +#elif defined (__FreeBSD_kernel__) static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t nlen) { @@ -690,7 +690,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, return offset ; /* FIXME */ } -#elif defined (__FreeBSD__) +#elif defined (__FreeBSD_kernel__) static off_t vcd_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { @@ -764,7 +764,7 @@ static off_t vcd_plugin_get_length (input_plugin_t *this_gen) { return (off_t) 0; } -#elif defined (__FreeBSD__) +#elif defined (__FreeBSD_kernel__) static off_t vcd_plugin_get_length (input_plugin_t *this_gen) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; off_t len ; @@ -859,7 +859,7 @@ static int vcd_plugin_open (input_plugin_t *this_gen) { this->cur_min = this->cls->tocent[this->cur_track].cdte_addr.msf.minute; this->cur_sec = this->cls->tocent[this->cur_track].cdte_addr.msf.second; this->cur_frame = this->cls->tocent[this->cur_track].cdte_addr.msf.frame; -#elif defined (__FreeBSD__) +#elif defined (__FreeBSD_kernel__) { int bsize = 2352; if (ioctl (this->fd, CDRIOCSETBLOCKSIZE, &bsize) == -1) { diff --git a/src/input/libdvdnav/dvd_reader.c b/src/input/libdvdnav/dvd_reader.c index 1cf493ef1..200a1dbec 100644 --- a/src/input/libdvdnav/dvd_reader.c +++ b/src/input/libdvdnav/dvd_reader.c @@ -58,7 +58,7 @@ static inline int _private_gettimeofday( struct timeval *tv, void *tz ) #define lseek64 _lseeki64 #endif -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__) +#if defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__) #define SYS_BSD 1 #endif diff --git a/src/input/media_helper.c b/src/input/media_helper.c index d2b1772a4..288ed4205 100644 --- a/src/input/media_helper.c +++ b/src/input/media_helper.c @@ -36,7 +36,7 @@ #include #include -#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) +#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) #include /* CDIOCALLOW etc... */ #elif defined(HAVE_LINUX_CDROM_H) #include @@ -130,7 +130,7 @@ int media_eject_media (xine_t *xine, const char *device) return 0; } -#elif defined (__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD__) +#elif defined (__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD_kernel__) if (ioctl(fd, CDIOCALLOW) == -1) { xprintf(xine, XINE_VERBOSITY_DEBUG, "ioctl(cdromallow): %s\n", strerror(errno)); diff --git a/src/input/vcd/libcdio/FreeBSD/freebsd.c b/src/input/vcd/libcdio/FreeBSD/freebsd.c index daea9b3f5..5a3443e95 100644 --- a/src/input/vcd/libcdio/FreeBSD/freebsd.c +++ b/src/input/vcd/libcdio/FreeBSD/freebsd.c @@ -29,6 +29,7 @@ static const char _rcsid[] = "$Id: freebsd.c,v 1.1 2005/01/01 02:43:57 rockyb Exp $"; +#include #include "freebsd.h" #ifdef HAVE_FREEBSD_CDROM diff --git a/src/input/vcd/libcdio/FreeBSD/freebsd.h b/src/input/vcd/libcdio/FreeBSD/freebsd.h index 50894c912..bdbad406d 100644 --- a/src/input/vcd/libcdio/FreeBSD/freebsd.h +++ b/src/input/vcd/libcdio/FreeBSD/freebsd.h @@ -78,7 +78,7 @@ struct ioc_read_audio #include #include /* for __FreeBSD_version */ -#if __FreeBSD_version < 500000 +#if __FreeBSD_kernel_version < 500000 #define DEVICE_POSTFIX "c" #else #define DEVICE_POSTFIX "" diff --git a/src/libw32dll/wine/ldt_keeper.c b/src/libw32dll/wine/ldt_keeper.c index 0446d8634..39f1e0f49 100644 --- a/src/libw32dll/wine/ldt_keeper.c +++ b/src/libw32dll/wine/ldt_keeper.c @@ -78,7 +78,7 @@ int modify_ldt(int func, void *ptr, unsigned long bytecount); } #endif #else -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) #include #include #endif @@ -153,7 +153,7 @@ void Setup_FS_Segment(ldt_fs_t *ldt_fs) void Check_FS_Segment(ldt_fs_t *ldt_fs) { -#if defined(__FreeBSD__) && defined(LDT_AUTO_ALLOC) +#if defined(__FreeBSD_kernel__) && defined(LDT_AUTO_ALLOC) int fs; __asm__ __volatile__( "movw %%fs,%%ax; mov %%eax,%0" : "=r" (fs) :: "%eax" @@ -171,7 +171,7 @@ void Check_FS_Segment(ldt_fs_t *ldt_fs) #endif } -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content ) { *buffer++ = ((content->base_addr & 0x0000ffff) << 16) | @@ -202,12 +202,12 @@ static int _modify_ldt(ldt_fs_t *ldt_fs, struct modify_ldt_ldt_s array) } #endif /*linux*/ -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) { unsigned long d[2]; LDT_EntryToBytes( d, &array ); -#if defined(__FreeBSD__) && defined(LDT_AUTO_ALLOC) +#if defined(__FreeBSD_kernel__) && defined(LDT_AUTO_ALLOC) ret = i386_set_ldt(LDT_AUTO_ALLOC, (union descriptor *)d, 1); array.entry_number = ret; ldt_fs->teb_sel = LDT_SEL(ret); diff --git a/src/libw32dll/wine/win32.c b/src/libw32dll/wine/win32.c index 397779f72..3b0941391 100644 --- a/src/libw32dll/wine/win32.c +++ b/src/libw32dll/wine/win32.c @@ -894,7 +894,7 @@ static void WINAPI expGetSystemInfo(SYSTEM_INFO* si) /* FIXME: better values for the two entries below... */ static int cache = 0; static SYSTEM_INFO cachedsi; -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__) +#if defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__svr4__) unsigned int regs[4]; #endif dbgprintf("GetSystemInfo(%p) =>\n", si); @@ -958,7 +958,7 @@ static void WINAPI expGetSystemInfo(SYSTEM_INFO* si) /* disable cpuid based detection (mplayer's cpudetect.c does this - see above) */ #ifndef MPLAYER -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__) +#if defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__svr4__) do_cpuid(1, regs); switch ((regs[0] >> 8) & 0xf) { // cpu family case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386; diff --git a/src/video_out/libdha/ports.c b/src/video_out/libdha/ports.c index b531082d3..0424446c9 100644 --- a/src/video_out/libdha/ports.c +++ b/src/video_out/libdha/ports.c @@ -69,7 +69,7 @@ /* OS depended stuff */ #if defined (linux) #include "sysdep/pci_linux.c" -#elif defined (__FreeBSD__) +#elif defined (__FreeBSD_kernel__) #include "sysdep/pci_freebsd.c" #elif defined (__386BSD__) #include "sysdep/pci_386bsd.c" diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 301521e9b..41eeff02c 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -35,7 +35,7 @@ #include #include #include -#if defined (__linux__) +#if defined (__linux__) || defined (__GLIBC__) #include #elif defined (__FreeBSD__) #include diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 48f3a6df0..50d8796e8 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -32,7 +32,7 @@ #include #include #include -#if defined (__linux__) +#if defined (__linux__) || defined (__GLIBC__) #include #elif defined (__FreeBSD__) #include -- cgit v1.2.3 From cce0fd6bbc99da33f4064abeb453ade4ca11b05e Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Fri, 23 Nov 2007 18:00:34 +0100 Subject: fix read_ogg_packet to really read all of the data; don't go into DEMUX_FINISHED from send_header --- src/demuxers/demux_ogg.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index a23bfa6b6..d38b2de7a 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -236,13 +236,19 @@ static int64_t get_pts (demux_ogg_t *this, int stream_num , int64_t granulepos ) static int read_ogg_packet (demux_ogg_t *this) { char *buffer; long bytes; + long total = 0; while (ogg_sync_pageout(&this->oy,&this->og)!=1) { buffer = ogg_sync_buffer(&this->oy, CHUNKSIZE); bytes = this->input->read(this->input, buffer, CHUNKSIZE); - ogg_sync_wrote(&this->oy, bytes); - if (bytes < CHUNKSIZE/2) { - return 0; + if (bytes == 0) { + if (total == 0) { + printf("read_ogg_packet read nothing\n"); + return 0; + } + break; } + ogg_sync_wrote(&this->oy, bytes); + total += bytes; } return 1; } @@ -1349,7 +1355,6 @@ static void send_header (demux_ogg_t *this) { while (!done) { if (!read_ogg_packet(this)) { - this->status = DEMUX_FINISHED; return; } /* now we've got at least one new page */ -- cgit v1.2.3 From 3a6cd7956f573a2f81354467a038586e1df35d81 Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Fri, 23 Nov 2007 18:04:25 +0100 Subject: log if send_headers returned with DEMUX_FINISHED --- src/xine-engine/xine.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 01ca48aa2..5b790343b 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -1195,7 +1195,11 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { stream->demux_plugin->send_headers (stream->demux_plugin); if (stream->demux_plugin->get_status(stream->demux_plugin) != DEMUX_OK) { - xine_log (stream->xine, XINE_LOG_MSG, _("xine: demuxer failed to start\n")); + if (stream->demux_plugin->get_status(stream->demux_plugin) == DEMUX_FINISHED) { + xine_log (stream->xine, XINE_LOG_MSG, _("xine: demuxer is already done. that was fast!\n")); + } else { + xine_log (stream->xine, XINE_LOG_MSG, _("xine: demuxer failed to start\n")); + } _x_free_demux_plugin(stream, stream->demux_plugin); stream->demux_plugin = NULL; -- cgit v1.2.3 From c1f730ab426636b5fea1dc657d2278950ace5de6 Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Fri, 23 Nov 2007 18:06:26 +0100 Subject: fix one warning; remove unused variable; make float->int conversion a bit more accurate (compared to oggdec); fix one debug printf --- src/libxineadec/xine_vorbis_decoder.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/libxineadec/xine_vorbis_decoder.c b/src/libxineadec/xine_vorbis_decoder.c index c7b1e5761..297d16349 100644 --- a/src/libxineadec/xine_vorbis_decoder.c +++ b/src/libxineadec/xine_vorbis_decoder.c @@ -160,7 +160,7 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if( (res = vorbis_synthesis_headerin(&this->vi,&this->vc,&this->op)) < 0 ){ /* error case; not a vorbis header */ xine_log(this->stream->xine, XINE_LOG_MSG, "libvorbis: this bitstream does not contain vorbis audio data. Following first 64 bytes (return: %d).\n", res); - xine_hexdump(this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64); + xine_hexdump((char *)this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64); return; } @@ -221,7 +221,6 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { */ int i,j; - int clipflag=0; int bout=(samplesconvsize?samples:this->convsize); audio_buffer_t *audio_buffer; @@ -233,15 +232,13 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { ogg_int16_t *ptr=audio_buffer->mem+i; float *mono=pcm[i]; for(j=0;j32767){ val=32767; - clipflag=1; - } - if(val<-32768){ + } else if(val<-32768){ val=-32768; - clipflag=1; } *ptr=val; ptr+=this->vi.channels; @@ -259,8 +256,9 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { /* tell libvorbis how many samples we actually consumed */ vorbis_synthesis_read(&this->vd,bout); } - } - lprintf("output not open\n"); + } else { + lprintf("output not open\n"); + } } static void vorbis_dispose (audio_decoder_t *this_gen) { -- cgit v1.2.3 From 58e0ac62331612c9893b7b9054ac5ecaba677700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 24 Nov 2007 20:41:43 +0100 Subject: Add option to disable Nosefart/NSF plugin building. This way you can get a safer build for binary redistribution. --- src/demuxers/Makefile.am | 6 +++++- src/demuxers/group_audio.c | 4 ++++ src/demuxers/group_audio.h | 5 ++++- src/libxineadec/Makefile.am | 9 +++++++-- 4 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am index 83c29f4e3..1d2e41e38 100644 --- a/src/demuxers/Makefile.am +++ b/src/demuxers/Makefile.am @@ -11,6 +11,10 @@ if BUILD_ASF asf_module = xineplug_dmx_asf.la endif +if BUILD_NOSEFART +nsf_demuxer = demux_nsf.c +endif + if HAVE_LIBMNG mng_module = xineplug_dmx_mng.la endif @@ -104,7 +108,7 @@ xineplug_dmx_games_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) xineplug_dmx_games_la_LDFLAGS = -avoid-version -module xineplug_dmx_audio_la_SOURCES = group_audio.c demux_aud.c demux_aiff.c \ - demux_cdda.c demux_mpgaudio.c demux_nsf.c \ + demux_cdda.c demux_mpgaudio.c $(nsf_demuxer) \ demux_realaudio.c demux_snd.c demux_voc.c \ demux_vox.c demux_wav.c demux_ac3.c id3.c \ demux_aac.c demux_mod.c demux_flac.c \ diff --git a/src/demuxers/group_audio.c b/src/demuxers/group_audio.c index bd3932b36..2643a8b80 100644 --- a/src/demuxers/group_audio.c +++ b/src/demuxers/group_audio.c @@ -69,9 +69,11 @@ static const demuxer_info_t demux_info_mpc = { 1 /* priority */ }; +#ifdef HAVE_NOSEFART static const demuxer_info_t demux_info_nsf = { 10 /* priority */ }; +#endif static const demuxer_info_t demux_info_realaudio = { 10 /* priority */ @@ -118,7 +120,9 @@ const plugin_info_t xine_plugin_info[] EXPORTED = { { PLUGIN_DEMUX, 26, "flac", XINE_VERSION_CODE, &demux_info_flac, demux_flac_init_plugin }, { PLUGIN_DEMUX, 26, "mp3", XINE_VERSION_CODE, &demux_info_mpgaudio, demux_mpgaudio_init_class }, { PLUGIN_DEMUX, 26, "mpc", XINE_VERSION_CODE, &demux_info_mpc, demux_mpc_init_plugin }, +#ifdef HAVE_NOSEFART { PLUGIN_DEMUX, 26, "nsf", XINE_VERSION_CODE, &demux_info_nsf, demux_nsf_init_plugin }, +#endif { PLUGIN_DEMUX, 26, "realaudio", XINE_VERSION_CODE, &demux_info_realaudio, demux_realaudio_init_plugin }, { PLUGIN_DEMUX, 26, "shn", XINE_VERSION_CODE, &demux_info_shn, demux_shn_init_plugin }, { PLUGIN_DEMUX, 26, "snd", XINE_VERSION_CODE, &demux_info_snd, demux_snd_init_plugin }, diff --git a/src/demuxers/group_audio.h b/src/demuxers/group_audio.h index 6b74d9feb..424e5c8e0 100644 --- a/src/demuxers/group_audio.h +++ b/src/demuxers/group_audio.h @@ -32,7 +32,6 @@ void *demux_dts_init_plugin (xine_t *xine, void *data); void *demux_flac_init_plugin (xine_t *xine, void *data); void *demux_mpgaudio_init_class (xine_t *xine, void *data); void *demux_mpc_init_plugin (xine_t *xine, void *data); -void *demux_nsf_init_plugin (xine_t *xine, void *data); void *demux_realaudio_init_plugin (xine_t *xine, void *data); void *demux_shn_init_plugin (xine_t *xine, void *data); void *demux_snd_init_plugin (xine_t *xine, void *data); @@ -41,6 +40,10 @@ void *demux_voc_init_plugin (xine_t *xine, void *data); void *demux_vox_init_plugin (xine_t *xine, void *data); void *demux_wav_init_plugin (xine_t *xine, void *data); +#ifdef HAVE_NOSEFART +void *demux_nsf_init_plugin (xine_t *xine, void *data); +#endif + #ifdef HAVE_MODPLUG void *demux_mod_init_plugin (xine_t *xine, void *data); #endif diff --git a/src/libxineadec/Makefile.am b/src/libxineadec/Makefile.am index b2ffcf078..d502b7955 100644 --- a/src/libxineadec/Makefile.am +++ b/src/libxineadec/Makefile.am @@ -2,7 +2,12 @@ include $(top_srcdir)/misc/Makefile.common EXTRA_DIST = fooaudio.c -SUBDIRS = gsm610 nosefart +if BUILD_NOSEFART +nosefart_subdir = nosefart +nosefart_module = xineplug_decode_nsf.la +endif + +SUBDIRS = gsm610 $(nosefart_subdir) AM_LDFLAGS = $(xineplug_ldflags) @@ -16,7 +21,7 @@ endif xineplug_LTLIBRARIES = \ xineplug_decode_gsm610.la \ - xineplug_decode_nsf.la \ + $(nosefart_module) \ xineplug_decode_lpcm.la \ $(vorbis_module) \ $(speex_module) -- cgit v1.2.3 From e2c171334683d0888ce992d1e41c8019e7a7bbc8 Mon Sep 17 00:00:00 2001 From: Maximilian Schwerin Date: Sun, 25 Nov 2007 19:21:29 +0000 Subject: patch adding additional ID3 genres --- src/demuxers/id3.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 1613e3a19..bcb07e7e4 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -45,7 +45,7 @@ #include "bswap.h" #include "id3.h" -#define ID3_GENRE_COUNT 126 +#define ID3_GENRE_COUNT 148 static const char* const id3_genre[] = {"Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal", @@ -72,7 +72,11 @@ static const char* const id3_genre[] = "Satire", "Slow Jam", "Club", "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House", - "Dance Hall" }; + "Dance Hall", "Goa", "Drum & Bass", "Club-House", "Hardcore", "Terror", + "Indie", "BritPop", "Negerpunk", "Polsk Punk", "Beat", + "Christian Gangsta Rap", "Heavy Metal", "Black Metal", "Crossover", + "Contemporary Christian", "Christian Rock", "Merengue", "Salsa", + "Thrash Metal", "Anime", "JPop", "Synthpop" }; #define ID3_ENCODING_COUNT 4 static const char* const id3_encoding[] = { @@ -598,7 +602,7 @@ static int id3v24_parse_genre(char* dest, char *src, int len) { int index = 0; dest[0] = '\0'; - if (sscanf(src, "%2d", &index) == 1) { + if (sscanf(src, "%d", &index) == 1) { if (index < ID3_GENRE_COUNT) { strncpy(dest, id3_genre[index], len); dest[len - 1] = '\0'; -- cgit v1.2.3 From 70b092f7f0867bea62416ec9a86fe5e967829caa Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 25 Nov 2007 19:24:27 +0000 Subject: Avoid any future need to alter ID3_GENRE_COUNT. --- src/demuxers/id3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index bcb07e7e4..0287447ce 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -45,7 +45,7 @@ #include "bswap.h" #include "id3.h" -#define ID3_GENRE_COUNT 148 +#define ID3_GENRE_COUNT (sizeof (id3_genre) / sizeof (id3_genre[0])) static const char* const id3_genre[] = {"Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal", -- cgit v1.2.3 From 0e2e43f9050cde0fd5c34d4848cda31bb4ef6a2e Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 25 Nov 2007 21:19:49 +0000 Subject: Fix a signedness issue in genre number validation. Negative values would be accepted, resulting in junk in XINE_META_INFO_GENRE or a segfault. --- src/demuxers/id3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 0287447ce..6b36cc666 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -599,15 +599,15 @@ int id3v23_parse_tag(input_plugin_t *input, /* id3v2 "genre" parsing code. what a ugly format ! */ static int id3v24_parse_genre(char* dest, char *src, int len) { - int index = 0; + unsigned int index = 0; dest[0] = '\0'; - if (sscanf(src, "%d", &index) == 1) { + if (sscanf(src, "%u", &index) == 1) { if (index < ID3_GENRE_COUNT) { strncpy(dest, id3_genre[index], len); dest[len - 1] = '\0'; } else { - lprintf("invalid index: %d\n", index); + lprintf("invalid index: %u\n", index); } } return 1; -- cgit v1.2.3