From 356d5df6bc31057df6b676a294aadc40de82b1da Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 7 Mar 2008 15:48:56 +0000 Subject: Get rid of some "may be used uninitialised" warnings. --- src/demuxers/asfheader.c | 14 +++++++------- src/demuxers/demux_ogg.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/demuxers/asfheader.c b/src/demuxers/asfheader.c index eb74c0886..f95c68e41 100644 --- a/src/demuxers/asfheader.c +++ b/src/demuxers/asfheader.c @@ -399,7 +399,7 @@ static int asf_header_parse_stream_extended_properties(asf_header_t *header, uin if (asf_stream_extension->stream_name_count) { asf_stream_extension->stream_names = malloc (asf_stream_extension->stream_name_count * sizeof(void*)); for (i = 0; i < asf_stream_extension->stream_name_count; i++) { - uint16_t lang_index, length; + uint16_t lang_index, length = 0; asf_reader_get_16(&reader, &lang_index); asf_reader_get_16(&reader, &length); asf_stream_extension->stream_names[i] = (char*)asf_reader_get_bytes(&reader, length); /* store them */ @@ -411,7 +411,7 @@ static int asf_header_parse_stream_extended_properties(asf_header_t *header, uin for (i = 0; i < asf_stream_extension->payload_extension_system_count; i++) { GUID guid; uint16_t data_size; - uint32_t length; + uint32_t length = 0; asf_reader_get_guid(&reader, &guid); asf_reader_get_16(&reader, &data_size); asf_reader_get_32(&reader, &length); @@ -427,7 +427,7 @@ static int asf_header_parse_stream_extended_properties(asf_header_t *header, uin /* embeded stream properties */ if (asf_reader_get_size(&reader) >= 24) { GUID guid; - uint64_t object_length; + uint64_t object_length = 0; asf_reader_get_guid(&reader, &guid); asf_reader_get_64(&reader, &object_length); @@ -490,8 +490,8 @@ static int asf_header_parse_stream_bitrate_properties(asf_header_t *header_pub, lprintf (" bitrate count: %d\n", bitrate_count); for(i = 0; i < bitrate_count; i++) { - uint16_t flags; - uint32_t bitrate; + uint16_t flags = 0; + uint32_t bitrate = 0; int stream_number; uint8_t *bitrate_pointer; @@ -533,7 +533,7 @@ static int asf_header_parse_header_extension(asf_header_t *header, uint8_t *buff GUID guid; int object_id; - uint64_t object_length, object_data_length; + uint64_t object_length = 0, object_data_length; if (asf_reader_get_size(&reader) < 24) { printf("invalid buffer size\n"); @@ -644,7 +644,7 @@ asf_header_t *asf_header_new (uint8_t *buffer, int buffer_len) { GUID guid; int object_id; - uint64_t object_length, object_data_length; + uint64_t object_length = 0, object_data_length; if (asf_reader_get_size(&reader) < 24) { printf("invalid buffer size\n"); diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index dc867e5f1..175d61cd8 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -1194,7 +1194,7 @@ static void decode_theora_header (demux_ogg_t *this, const int stream_num, ogg_p static void decode_flac_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) { xine_flac_metadata_header header; - xine_flac_streaminfo_block streaminfo; + xine_flac_streaminfo_block streaminfo = {}; buf_element_t *buf; xine_waveformatex wave; -- cgit v1.2.3 From e51bfef079438ebbe9b5f521f3aa7877a65cb07a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sun, 9 Mar 2008 14:36:53 +0100 Subject: Update the documentation so that it tells users to report bugs on the xine bug tracker rather than xine-user mailing list. --- doc/faq/faq.sgml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/faq/faq.sgml b/doc/faq/faq.sgml index 1176024e0..1a624aba0 100644 --- a/doc/faq/faq.sgml +++ b/doc/faq/faq.sgml @@ -2213,7 +2213,7 @@ OK, yes, that shouldn't happen and you're upset. We can understand that. But, to help you and of course to fix this, we need some information. So, let's go through the checklist and maybe prepare a nice bug report - for the xine-user mailing list: + for the xine bug tracker: @@ -2259,8 +2259,7 @@ still under heavy development (nice excuse, isn't it? *grin*). - If you write to the xine user mailing list - xine-user@lists.sourceforge.net + If you write to the xine bug tracker make sure you include a the above information (when applicable) and also some information about your machine (operating system, cpu type and speed, gfx card, sound card, ...) and please use a meaningfull subject -- cgit v1.2.3 From 925407b099b381f2cd5137b82e92b864e63eca5c Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 10 Mar 2008 00:06:48 -0300 Subject: Support # stream parameter separator in raw filenames as well as in full MRLs. Changeset 8ffe18290ba5 fixed bug 1784272 (opening raw filenames with # character, like "show #1.mpg") but at the cost of killing # separator in raw filenames completely. Although this might be a valid requirement in a new devel branch, imho, such change in stable branch should be considered a regression. The original idea of passing partial MRL for the input plugins to try doesn't work because plugin will generate error messages for every failed attempt to open the file (like "show " above), even thought the complete MRL is valid and will be played. So, since raw filenames are an exception for the MRL scheme anyway, we try stat'ing the partial filenames to determine what user means with the #. --- src/xine-engine/xine.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index e9251267b..841f966d1 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -36,6 +36,7 @@ #include #include #include +#include #if defined (__linux__) || defined (__GLIBC__) #include #elif defined (__FreeBSD__) @@ -796,6 +797,7 @@ static inline int _x_path_looks_like_mrl (const char *path) /*static*/ int open_internal (xine_stream_t *stream, const char *mrl) { const char *stream_setup = NULL; + const char *mrl_proto = NULL; int no_cache = 0; if (!mrl) { @@ -819,16 +821,31 @@ static inline int _x_path_looks_like_mrl (const char *path) /* * look for a stream_setup in MRL and try finding an input plugin */ + stream_setup = strchr (mrl, '#'); if (isalpha (*mrl)) { - stream_setup = mrl + 1; - while (isalnum (*stream_setup) || *stream_setup == '+' || *stream_setup == '-' || *stream_setup == '.') - ++stream_setup; - if (stream_setup[0] == ':' && stream_setup[1] == '/') - stream_setup = strchr (mrl, '#'); - else - stream_setup = NULL; + mrl_proto = mrl + 1; + while (isalnum (*mrl_proto) || *mrl_proto == '+' || *mrl_proto == '-' || *mrl_proto == '.') + ++mrl_proto; + if (!mrl_proto[0] || mrl_proto[0] != ':' || mrl_proto[1] != '/') + mrl_proto = NULL; + } + + /* for raw filenames we must try every '#' checking if it is part of the filename */ + if( !mrl_proto && stream_setup) { + struct stat stat_buf; + int res; + + while( stream_setup ) { + char *raw_filename = strndup (mrl, stream_setup - mrl); + + res = stat(raw_filename, &stat_buf); + free(raw_filename); + if( !res ) + break; + stream_setup = strchr(stream_setup + 1, '#'); + } } { @@ -837,8 +854,10 @@ static inline int _x_path_looks_like_mrl (const char *path) /* * find an input plugin */ - - if ((stream->input_plugin = _x_find_input_plugin (stream, input_source))) { + stream->input_plugin = _x_find_input_plugin (stream, input_source); + free(input_source); + + if ( stream->input_plugin ) { int res; xine_log (stream->xine, XINE_LOG_MSG, _("xine: found input plugin : %s\n"), @@ -853,7 +872,6 @@ static inline int _x_path_looks_like_mrl (const char *path) case 1: /* Open successfull */ break; case -1: /* Open unsuccessfull, but correct plugin */ - free(input_source); stream->err = XINE_ERROR_INPUT_FAILED; _x_flush_events_queues (stream); return 0; @@ -864,8 +882,6 @@ static inline int _x_path_looks_like_mrl (const char *path) stream->err = XINE_ERROR_INPUT_FAILED; } } - - free(input_source); } if (!stream->input_plugin) { -- cgit v1.2.3 From 7c037569b273a754f232f42309f7bda34c9d5268 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 10 Mar 2008 03:32:45 +0000 Subject: Add the missing changelog entry for 1afef0ba01d6. --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index c124af2f8..f3a170403 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,11 @@ xine-lib (1.1.11) unreleased causing failure to play some files. * Support 16-bit big-endian DTS audio. * Improved frame snapshot API. (ABI extension.) + * Re-add support for # (stream parameter separator) in raw filenames, + without the bugs found in the original implementation. + (This is a convenience feature for users only. Front ends which rely on + it for functions like subtitle file detection must instead use file:// + MRLs; if they don't, we consider them to be buggy.) xine-lib (1.1.10.1) 2008-02-07 * Security fixes: -- cgit v1.2.3 From d3572a729ae098dba38d27a2b1914b6ca17c4de1 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 10 Mar 2008 23:11:49 -0300 Subject: Fixed long delay when closing stream on dual core systems [Bug #33] --- ChangeLog | 1 + src/xine-engine/demux.c | 15 ++++++++++----- src/xine-engine/xine.c | 3 +++ src/xine-engine/xine_internal.h | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f3a170403..84dc7815f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,7 @@ xine-lib (1.1.11) unreleased (This is a convenience feature for users only. Front ends which rely on it for functions like subtitle file detection must instead use file:// MRLs; if they don't, we consider them to be buggy.) + * Fixed long delay when closing stream on dual core systems [Bug #33] xine-lib (1.1.10.1) 2008-02-07 * Security fixes: diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index f33397256..24ee1b86d 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -198,6 +198,7 @@ void _x_demux_control_headers_done (xine_stream_t *stream) { } stream->demux_action_pending = 0; + pthread_cond_signal(&stream->demux_resume); lprintf ("headers processed.\n"); @@ -284,12 +285,14 @@ static void *demux_loop (void *stream_gen) { /* someone may want to interrupt us */ if( stream->demux_action_pending ) { - pthread_mutex_unlock( &stream->demux_lock ); + struct timeval tv; + struct timespec ts; - lprintf ("sched_yield\n"); - - sched_yield(); - pthread_mutex_lock( &stream->demux_lock ); + gettimeofday(&tv, NULL); + ts.tv_sec = tv.tv_sec; + ts.tv_nsec = (tv.tv_usec + 100000) * 1000; + + pthread_cond_timedwait (&stream->demux_resume, &stream->demux_lock, &ts); } } @@ -365,6 +368,7 @@ int _x_demux_start_thread (xine_stream_t *stream) { stream->demux_action_pending = 1; pthread_mutex_lock( &stream->demux_lock ); stream->demux_action_pending = 0; + pthread_cond_signal(&stream->demux_resume); if( !stream->demux_thread_running ) { @@ -396,6 +400,7 @@ int _x_demux_stop_thread (xine_stream_t *stream) { pthread_mutex_lock( &stream->demux_lock ); stream->demux_thread_running = 0; stream->demux_action_pending = 0; + pthread_cond_signal(&stream->demux_resume); /* At that point, the demuxer has sent the last audio/video buffer, * so it's a safe place to flush the engine. diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 841f966d1..c207680e6 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -629,6 +629,7 @@ xine_stream_t *xine_stream_new (xine_t *this, pthread_mutex_init (&stream->meta_mutex, NULL); pthread_mutex_init (&stream->demux_lock, NULL); pthread_mutex_init (&stream->demux_mutex, NULL); + pthread_cond_init (&stream->demux_resume, NULL); pthread_mutex_init (&stream->event_queues_lock, NULL); pthread_mutex_init (&stream->counter_lock, NULL); pthread_cond_init (&stream->counter_changed, NULL); @@ -1322,6 +1323,7 @@ static int play_internal (xine_stream_t *stream, int start_pos, int start_time) pthread_mutex_lock( &stream->demux_lock ); /* demux_lock taken. now demuxer is suspended */ stream->demux_action_pending = 0; + pthread_cond_signal(&stream->demux_resume); /* set normal speed again (now that demuxer/input pair is suspended) * some input plugin may have changed speed by itself, we must ensure @@ -1448,6 +1450,7 @@ void xine_dispose_internal (xine_stream_t *stream) { pthread_mutex_destroy (&stream->current_extra_info_lock); pthread_cond_destroy (&stream->counter_changed); pthread_mutex_destroy (&stream->demux_mutex); + pthread_cond_destroy (&stream->demux_resume); pthread_mutex_destroy (&stream->demux_lock); pthread_mutex_destroy (&stream->first_frame_lock); pthread_cond_destroy (&stream->first_frame_reached); diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 9b69f16f1..8fb4723a5 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -333,6 +333,7 @@ struct xine_stream_s { int demux_thread_running; pthread_mutex_t demux_lock; int demux_action_pending; + pthread_cond_t demux_resume; pthread_mutex_t demux_mutex; /* used in _x_demux_... functions to synchronize order of pairwise A/V buffer operations */ extra_info_t *current_extra_info; -- cgit v1.2.3 From c3bd6847b68e11761f5af54d7a7fdb33efe19d65 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 10 Mar 2008 23:15:55 -0300 Subject: fix mrl example --- doc/man/en/xine.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/man/en/xine.5 b/doc/man/en/xine.5 index d5b0b5afe..13e5d0597 100644 --- a/doc/man/en/xine.5 +++ b/doc/man/en/xine.5 @@ -265,7 +265,7 @@ Text subtitle files may be appended to the MRL:. This is the normal way to define the subtitle file to use. The frontend will not take any notice of the subtitle file. For example: .br -.I file://home/user/wibble.mpg#subtitles:/home/user/wibble.sub +.I file://home/user/wibble.mpg#subtitle:/home/user/wibble.sub .br (Note that some front ends can detect subtitles files where the name differs as shown in the example.) -- cgit v1.2.3 From 5feca7a3847d4035b9d4116ceb5ffd24d5ae07b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 11 Mar 2008 15:30:36 +0100 Subject: Use calloc() to avoid possible integer overflow if stream_count is big enough. --HG-- extra : transplant_source : %90%CC%97%8Fk%C1%FD%9C%A4%FB%0C%9E%07%F5A%B8%29o%EEo --- src/input/libreal/sdpplin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index c62b6bbc1..5b22e9044 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -199,7 +199,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { if(filter(*data,"a=OpaqueData:buffer;",&buf)) { decoded = b64_decode(buf, decoded, &(desc->mlti_data_size)); if ( decoded != NULL ) { - desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size); + desc->mlti_data = calloc(desc->mlti_data_size, sizeof(char)); memcpy(desc->mlti_data, decoded, desc->mlti_data_size); handled=1; *data=nl(*data); @@ -294,7 +294,7 @@ sdpplin_t *sdpplin_parse(char *data) { if(filter(data,"a=StreamCount:integer;",&buf)) { desc->stream_count=atoi(buf); - desc->stream = malloc(sizeof(sdpplin_stream_t*)*desc->stream_count); + desc->stream = calloc(desc->stream_count, sizeof(sdpplin_stream_t*)); handled=1; data=nl(data); } -- cgit v1.2.3 From fc0b8f3dcb51da6a0b1293c561cd46792c3047ad Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 12 Mar 2008 00:07:59 +0000 Subject: Tidy up ffmpeg includes a bit. -Ilibavcodec is wrong when build dir != source dir or with external ffmpeg. --- src/libffmpeg/Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libffmpeg/Makefile.am b/src/libffmpeg/Makefile.am index d2be74c39..efc1c18aa 100644 --- a/src/libffmpeg/Makefile.am +++ b/src/libffmpeg/Makefile.am @@ -1,12 +1,13 @@ include $(top_srcdir)/misc/Makefile.common -DEFAULT_INCLUDES = -I. -Ilibavcodec +DEFAULT_INCLUDES = -I. if HAVE_FFMPEG AM_CFLAGS = $(FFMPEG_CFLAGS) $(FFMPEG_POSTPROC_CFLAGS) +ff_cppflags = link_ffmpeg = $(FFMPEG_LIBS) $(FFMPEG_POSTPROC_LIBS) else -ff_cppflags = -I$(top_srcdir)/src/libffmpeg/libavutil +ff_cppflags = -I$(top_srcdir)/src/libffmpeg/libavcodec -I$(top_srcdir)/src/libffmpeg/libavutil link_ffmpeg = \ $(top_builddir)/src/libffmpeg/libavcodec/libavcodec.la \ $(top_builddir)/src/libffmpeg/libavutil/libavutil.la \ -- cgit v1.2.3 From 08765c20628cd7a38b53871390b91b16f30e8f9c Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 12 Mar 2008 00:17:11 +0000 Subject: Cope with NetBSD, which apparently doesn't have SNDCTL_DSP_GETODELAY. (Fall back on SNDCTL_DSP_GETOPTR.) --- src/audio_out/audio_oss_out.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index a6e0fe494..40d5bcfdc 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -405,6 +405,18 @@ static int ao_oss_delay(ao_driver_t *this_gen) { if (bytes_left<=0) /* buffer ran dry */ bytes_left = 0; break; + case OSS_SYNC_GETODELAY: +#ifdef SNDCTL_DSP_GETODELAY + if (ioctl (this->audio_fd, SNDCTL_DSP_GETODELAY, &bytes_left)) { + perror ("audio_oss_out: DSP_GETODELAY ioctl():"); + } + if (bytes_left<0) + bytes_left = 0; + + lprintf ("%d bytes left\n", bytes_left); + + break; +#endif case OSS_SYNC_GETOPTR: if (ioctl (this->audio_fd, SNDCTL_DSP_GETOPTR, &info)) { perror ("audio_oss_out: SNDCTL_DSP_GETOPTR failed:"); @@ -423,16 +435,6 @@ static int ao_oss_delay(ao_driver_t *this_gen) { this->bytes_in_buffer = info.bytes; } this->last_getoptr = info.bytes; - break; - case OSS_SYNC_GETODELAY: - if (ioctl (this->audio_fd, SNDCTL_DSP_GETODELAY, &bytes_left)) { - perror ("audio_oss_out: DSP_GETODELAY ioctl():"); - } - if (bytes_left<0) - bytes_left = 0; - - lprintf ("%d bytes left\n", bytes_left); - break; } @@ -840,10 +842,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da * check if SNDCTL_DSP_GETODELAY works. if so, using it is preferred. */ +#ifdef SNDCTL_DSP_GETODELAY if (ioctl(audio_fd, SNDCTL_DSP_GETODELAY, &info) != -1) { xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: using SNDCTL_DSP_GETODELAY\n"); this->sync_method = OSS_SYNC_GETODELAY; - } else if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) != -1) { + } else +#endif + if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) != -1) { xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: using SNDCTL_DSP_GETOPTR\n"); this->sync_method = OSS_SYNC_GETOPTR; } else { -- cgit v1.2.3