diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/combined/xine_ogg_demuxer.c | 13 | ||||
-rw-r--r-- | src/combined/xine_vorbis_decoder.c | 16 | ||||
-rw-r--r-- | src/demuxers/id3.c | 14 | ||||
-rw-r--r-- | src/input/input_cdda.c | 23 | ||||
-rw-r--r-- | src/input/input_vcd.c | 18 | ||||
-rw-r--r-- | src/input/libdvdnav/dvd_reader.c | 2 | ||||
-rw-r--r-- | src/input/media_helper.c | 4 | ||||
-rw-r--r-- | src/libw32dll/wine/ldt_keeper.c | 10 | ||||
-rw-r--r-- | src/libw32dll/wine/win32.c | 4 | ||||
-rw-r--r-- | src/xine-engine/audio_out.c | 6 | ||||
-rw-r--r-- | src/xine-engine/input_cache.c | 2 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 8 | ||||
-rw-r--r-- | src/xine-engine/xine_interface.c | 2 | ||||
-rw-r--r-- | src/xine-utils/utils.c | 10 |
14 files changed, 79 insertions, 53 deletions
diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c index 973f02a47..f8a4437a4 100644 --- a/src/combined/xine_ogg_demuxer.c +++ b/src/combined/xine_ogg_demuxer.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; } @@ -1359,7 +1365,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 */ diff --git a/src/combined/xine_vorbis_decoder.c b/src/combined/xine_vorbis_decoder.c index ef6d94d06..29d095228 100644 --- a/src/combined/xine_vorbis_decoder.c +++ b/src/combined/xine_vorbis_decoder.c @@ -158,7 +158,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; } @@ -219,7 +219,6 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { */ int i,j; - int clipflag=0; int bout=(samples<this->convsize?samples:this->convsize); audio_buffer_t *audio_buffer; @@ -231,15 +230,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;j<bout;j++){ - int val=mono[j]*32767.f; + int val=(mono[j] + 1.0f) * 32768.f; + val -= 32768; /* might as well guard against clipping */ if(val>32767){ val=32767; - clipflag=1; - } - if(val<-32768){ + } else if(val<-32768){ val=-32768; - clipflag=1; } *ptr=val; ptr+=this->vi.channels; @@ -257,8 +254,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) { diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 8eb413f83..5c13a306e 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 (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", @@ -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[] = { @@ -595,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, "%2d", &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; diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 43baa3c4a..621aff14a 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -616,7 +616,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 <sys/cdio.h> @@ -627,7 +627,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; @@ -658,7 +658,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) { @@ -677,7 +677,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; @@ -701,7 +701,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) { @@ -720,7 +720,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; @@ -749,8 +749,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; @@ -759,13 +759,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 c422b2531..d5895c9a8 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -37,7 +37,7 @@ #ifdef HAVE_SYS_CDIO_H # include <sys/cdio.h> /* TODO: not clean yet */ -# if defined (__FreeBSD__) +# if defined (__FreeBSD_kernel__) # include <sys/cdrio.h> # 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; @@ -394,7 +394,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, void *buf_gen, off_t nlen) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; @@ -534,7 +534,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) { @@ -693,7 +693,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) { @@ -767,7 +767,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 ; @@ -862,7 +862,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 <unistd.h> #include <string.h> -#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) +#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) #include <sys/cdio.h> /* CDIOCALLOW etc... */ #elif defined(HAVE_LINUX_CDROM_H) #include <linux/cdrom.h> @@ -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/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 <machine/segments.h> #include <machine/sysarch.h> #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/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 288e27672..76d678aa2 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -291,6 +291,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) { @@ -1598,6 +1599,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); } diff --git a/src/xine-engine/input_cache.c b/src/xine-engine/input_cache.c index 83ec4ae33..0535bc8f7 100644 --- a/src/xine-engine/input_cache.c +++ b/src/xine-engine/input_cache.c @@ -34,6 +34,7 @@ */ #include "xine_internal.h" +#include <assert.h> #define DEFAULT_BUFFER_SIZE 1024 @@ -191,6 +192,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; } diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 83137fb82..77430a053 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -35,7 +35,7 @@ #include <pthread.h> #include <stdarg.h> #include <stdio.h> -#if defined (__linux__) +#if defined (__linux__) || defined (__GLIBC__) #include <endian.h> #elif defined (__FreeBSD__) #include <machine/endian.h> @@ -1233,7 +1233,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; 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 <stdlib.h> #include <pthread.h> #include <stdarg.h> -#if defined (__linux__) +#if defined (__linux__) || defined (__GLIBC__) #include <endian.h> #elif defined (__FreeBSD__) #include <machine/endian.h> diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index 980a2a520..d9eb7fb3f 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -452,6 +452,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; @@ -467,6 +468,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 } |