summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/Makefile.am13
-rw-r--r--src/xine-engine/audio_decoder.c14
-rw-r--r--src/xine-engine/audio_out.c10
-rw-r--r--src/xine-engine/demux.c19
-rw-r--r--src/xine-engine/load_plugins.c13
-rw-r--r--src/xine-engine/osd.c4
-rw-r--r--src/xine-engine/video_decoder.c12
-rw-r--r--src/xine-engine/xine.c6
-rw-r--r--src/xine-engine/xine_internal.h7
9 files changed, 55 insertions, 43 deletions
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index 02eb6136a..735f41eae 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -8,16 +8,16 @@ lib_LTLIBRARIES = libxine.la
XINEUTILS_LIB = $(top_builddir)/src/xine-utils/libxineutils.la
INTERNAL_ZLIB_LIB = $(top_builddir)/win32/contrib/zlib/libzlib.la
-DIRENT_LIB = $(top_builddir)/win32/contrib/libdirent.la
INTERNAL_PTHREAD_LIB = $(top_builddir)/win32/contrib/pthreads/libpthread.la
DEF_FILE = libxine-$(XINE_MAJOR).def
if HAVE_ZLIB
else
zlib_dep = $(INTERNAL_ZLIB_LIB)
endif
-if WIN32
-dirent_lib = $(DIRENT_LIB)
+if HAVE_INTERNAL_WIN32_PTHREAD
pthread_dep = $(INTERNAL_PTHREAD_LIB)
+endif
+if WIN32
def_ldflags="-Wl,--output-def,$(DEF_FILE)"
endif
@@ -35,10 +35,10 @@ if INCLUDED_INTL
INCLUDED_INTLLIBS = @INTLLIBS@
endif
libxine_la_DEPENDENCIES = $(INCLUDED_INTLLIBS) $(XINEUTILS_LIB) $(zlib_dep) \
- $(dirent_lib) $(pthread_dep) $(LIBXINEPOSIX)
+ $(pthread_dep) $(LIBXINEPOSIX)
libxine_la_LIBADD = $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) @INTLLIBS@ $(ZLIB_LIBS) \
-lm $(XINEUTILS_LIB) $(LIBICONV) $(FT2_LIBS) \
- $(dirent_lib) $(LIBXINEPOSIX) $(RT_LIBS)
+ $(LIBXINEPOSIX) $(RT_LIBS)
libxine_la_LDFLAGS = \
-version-info $(XINE_LT_CURRENT):$(XINE_LT_REVISION):$(XINE_LT_AGE) \
@@ -72,6 +72,3 @@ $(INTERNAL_PTHREAD_LIB):
$(INTERNAL_ZLIB_LIB):
$(MAKE) -C $(top_builddir)/win32/contrib/zlib libzlib.la
-
-$(DIRENT_LIB):
- $(MAKE) -C $(top_builddir)/win32/contrib libdirent.la
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index dd4a1fb3f..f3b09b50b 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_decoder.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2005 the xine project
*
* This file is part of xine, a free video player.
*
@@ -17,7 +17,7 @@
* 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_decoder.c,v 1.134 2005/04/19 17:42:29 hadess Exp $
+ * $Id: audio_decoder.c,v 1.135 2005/08/25 15:36:30 valtri Exp $
*
*
* functions that implement audio decoding
@@ -148,7 +148,7 @@ static void *audio_decoder_loop (void *stream_gen) {
pthread_cond_broadcast (&stream->counter_changed);
- if (stream->video_thread) {
+ if (stream->video_thread_created) {
while (stream->finished_count_video < stream->finished_count_audio) {
struct timeval tv;
struct timespec ts;
@@ -490,7 +490,8 @@ void _x_audio_decoder_init (xine_stream_t *stream) {
pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
pthread_attr_setschedparam(&pth_attrs, &pth_params);
pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
-
+
+ stream->audio_thread_created = 1;
if ((err = pthread_create (&stream->audio_thread,
&pth_attrs, audio_decoder_loop, stream)) != 0) {
xprintf (stream->xine, XINE_VERBOSITY_DEBUG,
@@ -507,14 +508,15 @@ void _x_audio_decoder_shutdown (xine_stream_t *stream) {
buf_element_t *buf;
void *p;
- if (stream->audio_thread) {
+ if (stream->audio_thread_created) {
/* stream->audio_fifo->clear(stream->audio_fifo); */
buf = stream->audio_fifo->buffer_pool_alloc (stream->audio_fifo);
buf->type = BUF_CONTROL_QUIT;
stream->audio_fifo->put (stream->audio_fifo, buf);
- pthread_join (stream->audio_thread, &p);
+ pthread_join (stream->audio_thread, &p);
+ stream->audio_thread_created = 0;
}
stream->audio_fifo->dispose (stream->audio_fifo);
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index 7383d3859..41f024641 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2005 the xine project
*
* This file is part of xine, a free video player.
*
@@ -17,7 +17,7 @@
* along with self program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_out.c,v 1.190 2005/01/20 11:29:43 holstsn Exp $
+ * $Id: audio_out.c,v 1.191 2005/08/25 15:36:30 valtri Exp $
*
* 22-8-2001 James imported some useful AC3 sections from the previous alsa driver.
* (c) 2001 Andy Lo A Foe <andy@alsaplayer.org>
@@ -216,6 +216,7 @@ typedef struct {
int audio_loop_running;
int grab_only; /* => do not start thread, frontend will consume samples */
pthread_t audio_thread;
+ int audio_thread_created;
int64_t audio_step; /* pts per 32 768 samples (sample = #bytes/2) */
int32_t frames_per_kpts; /* frames per 1024/90000 sec */
@@ -1543,7 +1544,7 @@ static void ao_exit(xine_audio_port_t *this_gen) {
fifo_append (this->out_fifo, buf);
pthread_join (this->audio_thread, &p);
- this->audio_thread = 0;
+ this->audio_thread_created = 0;
}
if (!this->grab_only) {
@@ -2103,7 +2104,8 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver,
pthread_attr_init(&pth_attrs);
pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
-
+
+ this->audio_thread_created = 1;
if ((err = pthread_create (&this->audio_thread,
&pth_attrs, ao_loop, this)) != 0) {
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c
index 90f2d3a99..f89fec38f 100644
--- a/src/xine-engine/demux.c
+++ b/src/xine-engine/demux.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2005 the xine project
*
* This file is part of xine, a free video player.
*
@@ -20,7 +20,7 @@
* Demuxer helper functions
* hide some xine engine details from demuxers and reduce code duplication
*
- * $Id: demux.c,v 1.58 2005/07/17 23:11:45 dsalt Exp $
+ * $Id: demux.c,v 1.59 2005/08/25 15:36:30 valtri Exp $
*/
@@ -150,13 +150,13 @@ void _x_demux_control_headers_done (xine_stream_t *stream) {
pthread_mutex_lock (&stream->counter_lock);
- if (stream->video_thread) {
+ if (stream->video_thread_created) {
header_count_video = stream->header_count_video + 1;
} else {
header_count_video = 0;
}
- if (stream->audio_thread) {
+ if (stream->audio_thread_created) {
header_count_audio = stream->header_count_audio + 1;
} else {
header_count_audio = 0;
@@ -292,9 +292,9 @@ static void *demux_loop (void *stream_gen) {
lprintf ("loop finished (status: %d)\n", status);
pthread_mutex_lock (&stream->counter_lock);
- if (stream->audio_thread)
+ if (stream->audio_thread_created)
finished_count_audio = stream->finished_count_audio + 1;
- if (stream->video_thread)
+ if (stream->video_thread_created)
finished_count_video = stream->finished_count_video + 1;
pthread_mutex_unlock (&stream->counter_lock);
@@ -332,12 +332,13 @@ int _x_demux_start_thread (xine_stream_t *stream) {
if( !stream->demux_thread_running ) {
- if (stream->demux_thread) {
+ if (stream->demux_thread_created) {
void *p;
pthread_join(stream->demux_thread, &p);
}
stream->demux_thread_running = 1;
+ stream->demux_thread_created = 1;
if ((err = pthread_create (&stream->demux_thread,
NULL, demux_loop, (void *)stream)) != 0) {
printf ("demux: can't create new thread (%s)\n", strerror(err));
@@ -368,9 +369,9 @@ int _x_demux_stop_thread (xine_stream_t *stream) {
lprintf ("joining thread %ld\n", stream->demux_thread );
- if( stream->demux_thread ) {
+ if( stream->demux_thread_created ) {
pthread_join (stream->demux_thread, &p);
- stream->demux_thread = 0;
+ stream->demux_thread_created = 0;
}
/*
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index eceacb799..6910f157b 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2005 the xine project
*
* This file is part of xine, a free video player.
*
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: load_plugins.c,v 1.210 2005/07/18 01:46:02 miguelfreitas Exp $
+ * $Id: load_plugins.c,v 1.211 2005/08/25 15:36:30 valtri Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -32,7 +32,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#ifdef HAVE_DIRENT_H
#include <dirent.h>
+#endif
#include <dlfcn.h>
#include <string.h>
#include <errno.h>
@@ -536,19 +538,20 @@ static void collect_plugins(xine_t *this, char *path){
str[path_len + 1] = '\0';
while ((pEntry = readdir (dir)) != NULL) {
- size_t new_str_size;
+ size_t new_str_size, d_len;
void *lib = NULL;
plugin_info_t *info = NULL;
struct stat statbuffer;
- new_str_size = path_len + pEntry->d_reclen + 2;
+ d_len = strlen(pEntry->d_name);
+ new_str_size = path_len + d_len + 2;
if (str_size < new_str_size) {
str_size = new_str_size + new_str_size / 2;
str = realloc(str, str_size);
}
- xine_fast_memcpy(&str[path_len + 1], pEntry->d_name, pEntry->d_reclen + 1);
+ xine_fast_memcpy(&str[path_len + 1], pEntry->d_name, d_len + 1);
if (stat(str, &statbuffer)) {
xine_log (this, XINE_LOG_PLUGIN, _("load_plugins: unable to stat %s\n"), str);
diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c
index 745069570..e76f22167 100644
--- a/src/xine-engine/osd.c
+++ b/src/xine-engine/osd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2005 the xine project
*
* This file is part of xine, a free video player.
*
@@ -31,7 +31,9 @@
#include <stdio.h>
#include <zlib.h>
#include <sys/types.h>
+#ifdef HAVE_DIRENT_H
#include <dirent.h>
+#endif
#include <errno.h>
#ifdef HAVE_ICONV
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index e4e500051..edec3a00c 100644
--- a/src/xine-engine/video_decoder.c
+++ b/src/xine-engine/video_decoder.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2005 the xine project
*
* This file is part of xine, a free video player.
*
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_decoder.c,v 1.158 2005/04/19 17:42:30 hadess Exp $
+ * $Id: video_decoder.c,v 1.159 2005/08/25 15:36:30 valtri Exp $
*
*/
@@ -220,7 +220,7 @@ static void *video_decoder_loop (void *stream_gen) {
pthread_cond_broadcast (&stream->counter_changed);
- if (stream->audio_thread) {
+ if (stream->audio_thread_created) {
while (stream->finished_count_video > stream->finished_count_audio) {
struct timeval tv;
@@ -500,7 +500,8 @@ void _x_video_decoder_init (xine_stream_t *stream) {
pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
pthread_attr_setschedparam(&pth_attrs, &pth_params);
pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
-
+
+ stream->video_thread_created = 1;
if ((err = pthread_create (&stream->video_thread,
&pth_attrs, video_decoder_loop, stream)) != 0) {
fprintf (stderr, "video_decoder: can't create new thread (%s)\n",
@@ -519,7 +520,7 @@ void _x_video_decoder_shutdown (xine_stream_t *stream) {
lprintf ("shutdown...\n");
- if (stream->video_thread) {
+ if (stream->video_thread_created) {
/* stream->video_fifo->clear(stream->video_fifo); */
@@ -533,6 +534,7 @@ void _x_video_decoder_shutdown (xine_stream_t *stream) {
lprintf ("shutdown...3\n");
pthread_join (stream->video_thread, &p);
+ stream->video_thread_created = 0;
lprintf ("shutdown...4\n");
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 40f8eb465..c3f326bcd 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2005 the xine project
*
* This file is part of xine, a free video player.
*
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine.c,v 1.314 2005/07/21 02:51:14 miguelfreitas Exp $
+ * $Id: xine.c,v 1.315 2005/08/25 15:36:30 valtri Exp $
*/
/*
@@ -288,7 +288,7 @@ static void stop_internal (xine_stream_t *stream) {
/*
* stop demux
*/
- if (stream->demux_plugin && stream->demux_thread) {
+ if (stream->demux_plugin && stream->demux_thread_created) {
lprintf ("stopping demux\n");
_x_demux_stop_thread( stream );
lprintf ("demux stopped\n");
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 81a9f6ac1..d5aba92b4 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2005 the xine project
*
* This file is part of xine, a free video player.
*
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_internal.h,v 1.166 2005/07/17 23:11:45 dsalt Exp $
+ * $Id: xine_internal.h,v 1.167 2005/08/25 15:36:30 valtri Exp $
*
*/
@@ -248,12 +248,14 @@ struct xine_stream_s {
/* vo_driver_t *video_driver;*/
pthread_t video_thread;
+ int video_thread_created;
video_decoder_t *video_decoder_plugin;
int video_decoder_streamtype;
extra_info_t *video_decoder_extra_info;
int video_channel;
pthread_t audio_thread;
+ int audio_thread_created;
audio_decoder_t *audio_decoder_plugin;
int audio_decoder_streamtype;
extra_info_t *audio_decoder_extra_info;
@@ -308,6 +310,7 @@ struct xine_stream_s {
/* demux thread stuff */
pthread_t demux_thread;
+ int demux_thread_created;
int demux_thread_running;
pthread_mutex_t demux_lock;
int demux_action_pending;