summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/.hgignore (renamed from src/xine-engine/.cvsignore)0
-rw-r--r--src/xine-engine/Makefile.am6
-rw-r--r--src/xine-engine/alphablend.c2
-rw-r--r--src/xine-engine/audio_decoder.c4
-rw-r--r--src/xine-engine/audio_out.c58
-rw-r--r--src/xine-engine/broadcaster.c15
-rw-r--r--src/xine-engine/buffer.c4
-rw-r--r--src/xine-engine/buffer.h5
-rw-r--r--src/xine-engine/buffer_types.c9
-rw-r--r--src/xine-engine/configfile.c58
-rw-r--r--src/xine-engine/configfile.h14
-rw-r--r--src/xine-engine/demux.c6
-rw-r--r--src/xine-engine/input_cache.c10
-rw-r--r--src/xine-engine/input_rip.c70
-rw-r--r--src/xine-engine/load_plugins.c32
-rw-r--r--src/xine-engine/metronom.c6
-rw-r--r--src/xine-engine/osd.c23
-rw-r--r--src/xine-engine/post.h6
-rw-r--r--src/xine-engine/scratch.c32
-rw-r--r--src/xine-engine/scratch.h8
-rw-r--r--src/xine-engine/video_decoder.c16
-rw-r--r--src/xine-engine/video_out.c48
-rw-r--r--src/xine-engine/xine.c46
-rw-r--r--src/xine-engine/xine_interface.c52
-rw-r--r--src/xine-engine/xine_internal.h5
-rw-r--r--src/xine-engine/xine_plugin.h4
26 files changed, 369 insertions, 170 deletions
diff --git a/src/xine-engine/.cvsignore b/src/xine-engine/.hgignore
index 7d926a554..7d926a554 100644
--- a/src/xine-engine/.cvsignore
+++ b/src/xine-engine/.hgignore
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index 2b317d2aa..ecd1968f2 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -26,16 +26,16 @@ EXTRA_DIST = lrb.c lrb.h accel_xvmc.h
libxine_la_DEPENDENCIES = $(XINEUTILS_LIB) \
$(pthread_dep) $(LIBXINEPOSIX)
-libxine_la_LIBADD = $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) $(ZLIB_LIBS) \
+libxine_la_LIBADD = $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) $(ZLIB_LIBS) \
-lm $(XINEUTILS_LIB) $(LIBICONV) $(FT2_LIBS) $(FONTCONFIG_LIBS) \
- $(LIBXINEPOSIX) $(RT_LIBS)
+ $(LIBXINEPOSIX) $(RT_LIBS) $(NET_LIBS)
libxine_la_LDFLAGS = \
-version-info $(XINE_LT_CURRENT):$(XINE_LT_REVISION):$(XINE_LT_AGE) \
$(def_ldflags)
-include_HEADERS = buffer.h metronom.h configfile.h vo_scale.h \
+xineinclude_HEADERS = buffer.h metronom.h configfile.h vo_scale.h \
audio_out.h resample.h video_out.h xine_internal.h spu_decoder.h \
video_overlay.h osd.h scratch.h xine_plugin.h xineintl.h \
plugin_catalog.h audio_decoder.h video_decoder.h post.h \
diff --git a/src/xine-engine/alphablend.c b/src/xine-engine/alphablend.c
index a0ff6ccf3..9947da365 100644
--- a/src/xine-engine/alphablend.c
+++ b/src/xine-engine/alphablend.c
@@ -66,7 +66,7 @@ static void mem_blend24(uint8_t *mem, uint8_t r, uint8_t g, uint8_t b,
}
}
-static void mem_blend32(uint8_t *mem, uint8_t *src, uint8_t o, int len) {
+static void mem_blend32(uint8_t *mem, const uint8_t *src, uint8_t o, int len) {
uint8_t *limit = mem + len*4;
while (mem < limit) {
*mem = BLEND_BYTE(*mem, src[0], o);
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index d504d9511..549c19b02 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_decoder.c
@@ -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.138 2006/09/08 21:11:29 miguelfreitas Exp $
+ * $Id: audio_decoder.c,v 1.139 2007/02/20 00:34:57 dgp85 Exp $
*
*
* functions that implement audio decoding
@@ -67,7 +67,7 @@ static void *audio_decoder_loop (void *stream_gen) {
if( !replaying_headers )
buf = stream->audio_fifo->get (stream->audio_fifo);
- lprintf ("audio_loop: got package pts = %lld, type = %08x\n", buf->pts, buf->type);
+ lprintf ("audio_loop: got package pts = %"PRId64", type = %08x\n", buf->pts, buf->type);
_x_extra_info_merge( stream->audio_decoder_extra_info, buf->extra_info );
stream->audio_decoder_extra_info->seek_count = stream->video_seek_count;
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index ce8cbe536..cd87c2947 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -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.207 2006/11/04 23:30:14 dsalt Exp $
+ * $Id: audio_out.c,v 1.210 2007/04/01 00:52:36 dgp85 Exp $
*
* 22-8-2001 James imported some useful AC3 sections from the previous alsa driver.
* (c) 2001 Andy Lo A Foe <andy@alsaplayer.org>
@@ -204,36 +204,45 @@ typedef struct {
/* private stuff */
ao_driver_t *driver;
pthread_mutex_t driver_lock;
- int driver_open;
- pthread_mutex_t driver_action_lock; /* protects num_driver_actions */
+
+ uint32_t driver_open:1;
+ uint32_t audio_loop_running:1;
+ uint32_t audio_thread_created:1;
+ uint32_t grab_only:1; /* => do not start thread, frontend will consume samples */
+ uint32_t do_resample:1;
+ uint32_t do_compress:1;
+ uint32_t do_amp:1;
+ uint32_t amp_mute:1;
+ uint32_t do_equ:1;
+
int num_driver_actions; /* number of threads, that wish to call
* functions needing driver_lock */
+ pthread_mutex_t driver_action_lock; /* protects num_driver_actions */
+
metronom_clock_t *clock;
xine_t *xine;
xine_list_t *streams;
pthread_mutex_t streams_lock;
- 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 */
- ao_format_t input, output; /* format conversion done at audio_out.c */
- double frame_rate_factor;
- double output_frame_excess; /* used to keep track of 'half' frames */
-
int av_sync_method_conf;
resample_sync_t resample_sync_info;
- int resample_sync_method; /* fix sound card clock drift by resampling */
double resample_sync_factor; /* correct buffer length by this factor
* to sync audio hardware to (dxr3) clock */
+ int resample_sync_method; /* fix sound card clock drift by resampling */
+
+ int gap_tolerance;
+
+ ao_format_t input, output; /* format conversion done at audio_out.c */
+ double frame_rate_factor;
+ double output_frame_excess; /* used to keep track of 'half' frames */
+
int resample_conf;
uint32_t force_rate; /* force audio output rate to this value if non-zero */
- int do_resample;
- int gap_tolerance;
audio_fifo_t *free_fifo;
audio_fifo_t *out_fifo;
int64_t last_audio_vpts;
@@ -247,22 +256,18 @@ typedef struct {
int64_t passthrough_offset;
int flush_audio_driver;
+ int discard_buffers;
pthread_mutex_t flush_audio_driver_lock;
pthread_cond_t flush_audio_driver_reached;
- int discard_buffers;
/* some built-in audio filters */
- int do_compress;
double compression_factor; /* current compression */
double compression_factor_max; /* user limit on compression */
- int do_amp;
- int amp_mute;
double amp_factor;
/* 10-band equalizer */
- int do_equ;
int eq_gain[EQ_BANDS];
int eq_preamp;
int eq_i;
@@ -1055,9 +1060,7 @@ static void *ao_loop (void *this_gen) {
delay = this->driver->delay(this->driver);
while (delay < 0 && this->audio_loop_running) {
/* Get the audio card into RUNNING state. */
- pthread_mutex_unlock( &this->driver_lock );
ao_fill_gap (this, 10000); /* FIXME, this PTS of 1000 should == period size */
- pthread_mutex_lock( &this->driver_lock );
delay = this->driver->delay(this->driver);
}
pthread_mutex_unlock( &this->driver_lock );
@@ -1200,7 +1203,7 @@ static void *ao_loop (void *this_gen) {
if (this->driver_open) {
pthread_mutex_lock( &this->driver_lock );
- result = this->driver->write (this->driver, out_buf->mem, out_buf->num_frames );
+ result = this->driver_open ? this->driver->write (this->driver, out_buf->mem, out_buf->num_frames ) : 0;
pthread_mutex_unlock( &this->driver_lock );
} else {
result = 0;
@@ -1762,13 +1765,15 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value
this->amp_factor = (double) value / 100.0;
- this->do_amp = (this->amp_factor != 1.0);
+ this->do_amp = (this->amp_factor != 1.0 || this->amp_mute);
ret = this->amp_factor*100;
break;
case AO_PROP_AMP_MUTE:
ret = this->amp_mute = value;
+
+ this->do_amp = (this->amp_factor != 1.0 || this->amp_mute);
break;
case AO_PROP_EQ_30HZ:
@@ -1984,6 +1989,7 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver,
aos_t *this;
int i, err;
pthread_attr_t pth_attrs;
+ pthread_mutexattr_t attr;
static const char* resample_modes[] = {"auto", "off", "on", NULL};
static const char* av_sync_methods[] = {"metronom feedback", "resample", NULL};
@@ -1994,8 +2000,14 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver,
this->clock = xine->clock;
this->streams = xine_list_new();
+ /* warning: driver_lock is a recursive mutex. it must NOT be
+ * used with neither pthread_cond_wait() or pthread_cond_timedwait()
+ */
+ pthread_mutexattr_init( &attr );
+ pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE );
+
pthread_mutex_init( &this->streams_lock, NULL );
- pthread_mutex_init( &this->driver_lock, NULL );
+ pthread_mutex_init( &this->driver_lock, &attr );
pthread_mutex_init( &this->driver_action_lock, NULL );
this->ao.open = ao_open;
diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c
index edf52e474..3beacb226 100644
--- a/src/xine-engine/broadcaster.c
+++ b/src/xine-engine/broadcaster.c
@@ -19,7 +19,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: broadcaster.c,v 1.12 2006/06/20 00:18:44 dgp85 Exp $
+ * $Id: broadcaster.c,v 1.15 2007/01/19 01:23:06 dgp85 Exp $
*
* broadcaster.c - xine network broadcaster
*
@@ -305,7 +305,10 @@ static void audio_put_cb (fifo_buffer_t *fifo, buf_element_t *buf, void *this_ge
broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port)
{
broadcaster_t *this;
- struct sockaddr_in servAddr;
+ union {
+ struct sockaddr_in in;
+ struct sockaddr sa;
+ } servAddr;
int msock, err;
msock = socket(PF_INET, SOCK_STREAM, 0);
@@ -314,11 +317,11 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port)
xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: error opening master socket.\n");
return NULL;
}
- servAddr.sin_family = AF_INET;
- servAddr.sin_addr.s_addr = htonl(INADDR_ANY);
- servAddr.sin_port = htons(port);
+ servAddr.in.sin_family = AF_INET;
+ servAddr.in.sin_addr.s_addr = htonl(INADDR_ANY);
+ servAddr.in.sin_port = htons(port);
- if(bind(msock, (struct sockaddr *) &servAddr, sizeof(servAddr))<0)
+ if(bind(msock, &servAddr.sa, sizeof(servAddr.in))<0)
{
xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: error binding to port %d\n", port);
return NULL;
diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c
index c36e97877..389146dcb 100644
--- a/src/xine-engine/buffer.c
+++ b/src/xine-engine/buffer.c
@@ -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: buffer.c,v 1.36 2006/06/20 00:35:07 dgp85 Exp $
+ * $Id: buffer.c,v 1.37 2006/12/25 21:59:32 dgp85 Exp $
*
*
* contents:
@@ -64,7 +64,7 @@ static void buffer_pool_free (buf_element_t *element) {
this->buffer_pool_num_free++;
if (this->buffer_pool_num_free > this->buffer_pool_capacity) {
- printf("xine-lib:buffer: Their has been a fatal error: TOO MANY FREE's\n");
+ fprintf(stderr, _("xine-lib: buffer.c: There has been a fatal error: TOO MANY FREE's\n"));
_x_abort();
}
diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h
index fa8d96388..64fe52a20 100644
--- a/src/xine-engine/buffer.h
+++ b/src/xine-engine/buffer.h
@@ -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: buffer.h,v 1.159 2006/11/14 14:11:59 dgp85 Exp $
+ * $Id: buffer.h,v 1.162 2007/01/14 16:53:37 klan Exp $
*
*
* contents:
@@ -190,6 +190,7 @@ extern "C" {
#define BUF_VIDEO_KMVC 0x02600000
#define BUF_VIDEO_FLASHSV 0x02610000
#define BUF_VIDEO_CAVS 0x02620000
+#define BUF_VIDEO_VP6F 0x02630000
/* audio buffer types: (please keep in sync with buffer_types.c) */
@@ -255,6 +256,8 @@ extern "C" {
#define BUF_AUDIO_TRUESPEECH 0x03390000
#define BUF_AUDIO_TTA 0x033A0000
#define BUF_AUDIO_SMACKER 0x033B0000
+#define BUF_AUDIO_FLVADPCM 0x033C0000
+#define BUF_AUDIO_WAVPACK 0x033D0000
/* spu buffer types: */
diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c
index ea8d58842..161ec70a9 100644
--- a/src/xine-engine/buffer_types.c
+++ b/src/xine-engine/buffer_types.c
@@ -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: buffer_types.c,v 1.106 2006/10/02 15:56:06 valtri Exp $
+ * $Id: buffer_types.c,v 1.107 2006/12/26 03:18:56 dgp85 Exp $
*
*
* contents:
@@ -1114,6 +1114,13 @@ static audio_db_t audio_db[] = {
BUF_AUDIO_MPC,
"Musepack"
},
+{
+ {
+ 0
+ },
+ BUF_AUDIO_WAVPACK,
+ "Wavpack"
+},
{ { 0 }, 0, "last entry" }
};
diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c
index 21ebfd5be..28b44fd51 100644
--- a/src/xine-engine/configfile.c
+++ b/src/xine-engine/configfile.c
@@ -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: configfile.c,v 1.81 2006/09/26 21:51:11 dgp85 Exp $
+ * $Id: configfile.c,v 1.85 2007/02/22 15:49:16 dgp85 Exp $
*
* config object (was: file) management - implementation
*
@@ -491,14 +491,15 @@ static cfg_entry_t *config_register_key (config_values_t *this,
return entry;
}
-static char *config_register_string (config_values_t *this,
- const char *key,
- const char *def_value,
- const char *description,
- const char *help,
- int exp_level,
- xine_config_cb_t changed_cb,
- void *cb_data) {
+static cfg_entry_t *config_register_string_internal (config_values_t *this,
+ const char *key,
+ const char *def_value,
+ int num_value,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
cfg_entry_t *entry;
_x_assert(this);
@@ -512,7 +513,7 @@ static char *config_register_string (config_values_t *this,
if (entry->type != XINE_CONFIG_TYPE_UNKNOWN) {
lprintf("config entry already registered: %s\n", key);
pthread_mutex_unlock(&this->config_lock);
- return entry->str_value;
+ return entry;
}
config_reset_value(entry);
@@ -525,13 +526,40 @@ static char *config_register_string (config_values_t *this,
else
entry->str_value = strdup(def_value);
+ entry->num_value = num_value;
+
/* fill out rest of struct */
entry->str_default = strdup(def_value);
entry->description = (description) ? strdup(description) : NULL;
entry->help = (help) ? strdup(help) : NULL;
pthread_mutex_unlock(&this->config_lock);
- return entry->str_value;
+ return entry;
+}
+
+static char *config_register_string (config_values_t *this,
+ const char *key,
+ const char *def_value,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
+ return config_register_string_internal (this, key, def_value, 0, description,
+ help, exp_level, changed_cb, cb_data)->str_value;
+}
+
+static char *config_register_filename (config_values_t *this,
+ const char *key,
+ const char *def_value,
+ int req_type,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
+ return config_register_string_internal (this, key, def_value, req_type, description,
+ help, exp_level, changed_cb, cb_data)->str_value;
}
static int config_register_num (config_values_t *this,
@@ -661,9 +689,9 @@ static int config_register_range (config_values_t *this,
return entry->num_value;
}
-static int config_parse_enum (const char *str, char **values) {
+static int config_parse_enum (const char *str, const char **values) {
- char **value;
+ const char **value;
int i;
@@ -697,7 +725,8 @@ static int config_register_enum (config_values_t *this,
void *cb_data) {
cfg_entry_t *entry;
- char **value_src, **value_dest;
+ const char **value_src;
+ char **value_dest;
int value_count;
@@ -1184,6 +1213,7 @@ config_values_t *_x_config_init (void) {
pthread_mutex_init(&this->config_lock, &attr);
this->register_string = config_register_string;
+ this->register_filename = config_register_filename;
this->register_range = config_register_range;
this->register_enum = config_register_enum;
this->register_num = config_register_num;
diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h
index 2a98be9f1..859214d1c 100644
--- a/src/xine-engine/configfile.h
+++ b/src/xine-engine/configfile.h
@@ -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: configfile.h,v 1.38 2006/09/26 05:19:48 dgp85 Exp $
+ * $Id: configfile.h,v 1.42 2007/02/22 15:49:16 dgp85 Exp $
*
* config file management
*
@@ -108,6 +108,16 @@ struct config_values_s {
xine_config_cb_t changed_cb,
void *cb_data);
+ char* (*register_filename) (config_values_t *self,
+ const char *key,
+ const char *def_value,
+ int req_type,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data);
+
int (*register_range) (config_values_t *self,
const char *key,
int def_value,
@@ -153,7 +163,7 @@ struct config_values_s {
void (*update_string) (config_values_t *self, const char *key, const char *value);
/* small utility function for enum handling */
- int (*parse_enum) (const char *str, char **values);
+ int (*parse_enum) (const char *str, const char **values);
/*
* lookup config entries
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c
index c6a234ae5..d1bd2bc1d 100644
--- a/src/xine-engine/demux.c
+++ b/src/xine-engine/demux.c
@@ -20,7 +20,7 @@
* Demuxer helper functions
* hide some xine engine details from demuxers and reduce code duplication
*
- * $Id: demux.c,v 1.64 2006/08/13 23:51:34 miguelfreitas Exp $
+ * $Id: demux.c,v 1.66 2007/01/18 23:28:46 dgp85 Exp $
*/
@@ -336,7 +336,7 @@ static void *demux_loop (void *stream_gen) {
finished_count_video = stream->finished_count_video + 1;
pthread_mutex_unlock (&stream->counter_lock);
- /* demux_thread_running is zero if demux loop has being stopped by user */
+ /* demux_thread_running is zero if demux loop has been stopped by user */
non_user = stream->demux_thread_running;
stream->demux_thread_running = 0;
@@ -448,7 +448,7 @@ int _x_demux_read_header( input_plugin_t *input, unsigned char *buffer, off_t si
return read_size;
}
-int _x_demux_check_extension (char *mrl, char *extensions){
+int _x_demux_check_extension (const char *mrl, const char *extensions){
char *last_dot, *e, *ext_copy, *ext_work;
ext_copy = strdup(extensions);
diff --git a/src/xine-engine/input_cache.c b/src/xine-engine/input_cache.c
index 33b8b47da..a566e1f84 100644
--- a/src/xine-engine/input_cache.c
+++ b/src/xine-engine/input_cache.c
@@ -22,7 +22,7 @@
* The goal of this input plugin is to reduce
* the number of calls to the real input plugin.
*
- * $Id: input_cache.c,v 1.12 2006/09/08 06:20:37 tmattern Exp $
+ * $Id: input_cache.c,v 1.14 2007/02/20 00:34:57 dgp85 Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -67,7 +67,7 @@ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) {
off_t read_len = 0;
off_t main_read;
- lprintf("cache_plugin_read: len=%lld\n", len);
+ lprintf("cache_plugin_read: len=%"PRId64"\n", len);
this->read_call++;
/* optimized for common cases */
@@ -205,7 +205,7 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi
off_t rel_offset;
off_t new_buf_pos;
- lprintf("offset: %lld, origin: %d\n", offset, origin);
+ lprintf("offset: %"PRId64", origin: %d\n", offset, origin);
this->seek_call++;
if( !this->buf_len ) {
@@ -236,7 +236,7 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi
}
new_buf_pos = (off_t)this->buf_pos + rel_offset;
- lprintf("buf_len: %d, rel_offset=%lld, new_buf_pos=%lld\n",
+ lprintf("buf_len: %d, rel_offset=%"PRId64", new_buf_pos=%"PRId64"\n",
this->buf_len, rel_offset, new_buf_pos);
if ((new_buf_pos < 0) || (new_buf_pos >= this->buf_len)) {
@@ -304,7 +304,7 @@ static uint32_t cache_plugin_get_blocksize(input_plugin_t *this_gen) {
return this->main_input_plugin->get_blocksize(this->main_input_plugin);
}
-static char* cache_plugin_get_mrl (input_plugin_t *this_gen) {
+static const char* cache_plugin_get_mrl (input_plugin_t *this_gen) {
cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen;
return this->main_input_plugin->get_mrl(this->main_input_plugin);
diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c
index bb6548bc2..d8715fb85 100644
--- a/src/xine-engine/input_rip.c
+++ b/src/xine-engine/input_rip.c
@@ -29,7 +29,7 @@
* - it's possible speeder saving streams in the xine without playing:
* xine stream_mrl#save:file.raw\;noaudio\;novideo
*
- * $Id: input_rip.c,v 1.31 2006/06/20 00:35:07 dgp85 Exp $
+ * $Id: input_rip.c,v 1.34 2007/02/20 00:34:57 dgp85 Exp $
*/
/* TODO:
@@ -103,7 +103,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) {
rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen;
off_t retlen, npreview, nread, nwrite, nread_orig, nread_file;
- lprintf("reading %lld bytes (curpos = %lld, savepos = %lld)\n", len, this->curpos, this->savepos);
+ lprintf("reading %"PRId64" bytes (curpos = %"PRId64", savepos = %"PRId64")\n", len, this->curpos, this->savepos);
if (len < 0) return -1;
@@ -117,7 +117,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) {
nread = min_off(this->savepos - this->preview_size, len - npreview);
}
- lprintf(" => get %lld bytes from preview (%lld bytes)\n", npreview, this->preview_size);
+ lprintf(" => get %"PRId64" bytes from preview (%"PRId64" bytes)\n", npreview, this->preview_size);
memcpy(buf, &this->preview[this->curpos], npreview);
} else {
@@ -134,7 +134,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) {
/* re-reading from file */
if (nread_file) {
- lprintf(" => read %lld bytes from file\n", nread_file);
+ lprintf(" => read %"PRId64" bytes from file\n", nread_file);
if (fread(&buf[npreview], nread_file, 1, this->file) != 1) {
xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: reading of saved data failed: %s\n"), strerror(errno));
return -1;
@@ -143,11 +143,11 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) {
/* really to read/catch */
if (nread_orig + nwrite) {
- lprintf(" => read %lld bytes from input plugin\n", nread_orig + nwrite);
+ lprintf(" => read %"PRId64" bytes from input plugin\n", nread_orig + nwrite);
/* read from main input plugin */
retlen = this->main_input_plugin->read(this->main_input_plugin, &buf[npreview + nread_file], nread_orig + nwrite);
- lprintf("%s => returned %lld" CLR_RST "\n", retlen == nread_orig + nwrite ? "" : CLR_FAIL, retlen);
+ lprintf("%s => returned %"PRId64"" CLR_RST "\n", retlen == nread_orig + nwrite ? "" : CLR_FAIL, retlen);
if (retlen < 0) {
xine_log(this->stream->xine, XINE_LOG_MSG,
@@ -163,7 +163,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) {
return -1;
}
this->savepos += nwrite;
- lprintf(" => saved %lld bytes\n", nwrite);
+ lprintf(" => saved %"PRId64" bytes\n", nwrite);
} else
nwrite = 0;
}
@@ -212,7 +212,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe
buf_element_t *buf = NULL;
off_t retlen, npreview, nread, nwrite, nread_orig, nread_file;
- lprintf("reading %lld bytes (curpos = %lld, savepos = %lld) (block)\n", todo, this->curpos, this->savepos);
+ lprintf("reading %"PRId64" bytes (curpos = %"PRId64", savepos = %"PRId64") (block)\n", todo, this->curpos, this->savepos);
if (todo <= 0) return NULL;
@@ -226,7 +226,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe
nread = min_off(this->savepos - this->preview_size, todo - npreview);
}
- lprintf(" => get %lld bytes from preview (%lld bytes) (block)\n", npreview, this->preview_size);
+ lprintf(" => get %"PRId64" bytes from preview (%"PRId64" bytes) (block)\n", npreview, this->preview_size);
} else {
npreview = 0;
nread = min_off(this->savepos - this->curpos, todo);
@@ -247,13 +247,13 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe
/* get data from preview */
if (npreview) {
- lprintf(" => get %lld bytes from the preview (block)\n", npreview);
+ lprintf(" => get %"PRId64" bytes from the preview (block)\n", npreview);
memcpy(buf->content, &this->preview[this->curpos], npreview);
}
/* re-reading from the file */
if (nread_file) {
- lprintf(" => read %lld bytes from the file (block)\n", nread_file);
+ lprintf(" => read %"PRId64" bytes from the file (block)\n", nread_file);
if (fread(&buf->content[npreview], nread_file, 1, this->file) != 1) {
xine_log(this->stream->xine, XINE_LOG_MSG,
_("input_rip: reading of saved data failed: %s\n"),
@@ -267,10 +267,10 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe
if (nread_orig + nwrite) {
/* read from main input plugin */
if (buf) {
- lprintf(" => read %lld bytes from input plugin (block)\n", nread_orig + nwrite);
+ lprintf(" => read %"PRId64" bytes from input plugin (block)\n", nread_orig + nwrite);
retlen = this->main_input_plugin->read(this->main_input_plugin, &buf->content[npreview + nread_file], nread_orig + nwrite);
} else {
- lprintf(" => read block of %lld bytes from input plugin (block)\n", nread_orig + nwrite);
+ lprintf(" => read block of %"PRId64" bytes from input plugin (block)\n", nread_orig + nwrite);
buf = this->main_input_plugin->read_block(this->main_input_plugin, fifo, nread_orig + nwrite);
if (buf) retlen = buf->size;
else {
@@ -279,7 +279,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe
}
}
if (retlen != nread_orig + nwrite) {
- lprintf(CLR_FAIL " => returned %lld" CLR_RST "\n", retlen);
+ lprintf(CLR_FAIL " => returned %"PRId64"" CLR_RST "\n", retlen);
return NULL;
}
@@ -293,7 +293,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe
return NULL;
}
this->savepos += nwrite;
- lprintf(" => saved %lld bytes\n", nwrite);
+ lprintf(" => saved %"PRId64" bytes\n", nwrite);
} else
nwrite = 0;
}
@@ -307,7 +307,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe
static off_t rip_seek_original(rip_input_plugin_t *this, off_t reqpos) {
off_t pos;
- lprintf(" => seeking original input plugin to %lld\n", reqpos);
+ lprintf(" => seeking original input plugin to %"PRId64"\n", reqpos);
pos = this->main_input_plugin->seek(this->main_input_plugin, reqpos, SEEK_SET);
if (pos == -1) {
@@ -316,7 +316,7 @@ static off_t rip_seek_original(rip_input_plugin_t *this, off_t reqpos) {
}
#ifdef LOG
if (pos != reqpos) {
- lprintf(CLR_FAIL " => reqested position %lld differs from result position %lld" CLR_RST "\n", reqpos, pos);
+ lprintf(CLR_FAIL " => reqested position %"PRId64" differs from result position %"PRId64"" CLR_RST "\n", reqpos, pos);
}
#endif
@@ -339,7 +339,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin)
struct timeval time1, time2;
double interval = 0;
- lprintf("seek, offset %lld, origin %d (curpos %lld, savepos %lld)\n", offset, origin, this->curpos, this->savepos);
+ lprintf("seek, offset %"PRId64", origin %d (curpos %"PRId64", savepos %"PRId64")\n", offset, origin, this->curpos, this->savepos);
switch (origin) {
case SEEK_SET: newpos = offset; break;
@@ -355,7 +355,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin)
blocksize = 0;
if (newpos < this->savepos) {
- lprintf(" => virtual seeking from %lld to %lld\n", this->curpos, newpos);
+ lprintf(" => virtual seeking from %"PRId64" to %"PRId64"\n", this->curpos, newpos);
/* don't seek into preview area */
if (this->preview && newpos < this->preview_size) {
@@ -366,7 +366,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin)
if (this->regular) {
if (reqpos != this->savepos) {
- lprintf(" => seeking file to %lld\n", reqpos);
+ lprintf(" => seeking file to %"PRId64"\n", reqpos);
if (fseeko(this->file, reqpos, SEEK_SET) != 0) {
xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: seeking failed: %s\n"), strerror(errno));
return -1;
@@ -382,9 +382,9 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin)
}
if (this->curpos < this->savepos) {
- lprintf(" => seeking to end: %lld\n", this->savepos);
+ lprintf(" => seeking to end: %"PRId64"\n", this->savepos);
if (this->regular) {
- lprintf(" => seeking file to end: %lld\n", this->savepos);
+ lprintf(" => seeking file to end: %"PRId64"\n", this->savepos);
if (fseeko(this->file, this->savepos, SEEK_SET) != 0) {
xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: seeking failed: %s\n"), strerror(errno));
return -1;
@@ -425,11 +425,19 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin)
+ (double)(time2.tv_usec - time1.tv_usec) / 1000000;
}
- lprintf(" => new position %lld\n", this->curpos);
+ lprintf(" => new position %"PRId64"\n", this->curpos);
return this->curpos;
}
+static off_t rip_plugin_seek_time(input_plugin_t *this_gen, int time_offset, int origin) {
+ rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen;
+
+ lprintf("seek_time, time_offset: %d, origin: %d\n", time_offset, origin);
+
+ return this->main_input_plugin->seek_time(this->main_input_plugin, time_offset, origin);
+}
+
/*
* return current position,
* check values for debug build
@@ -441,13 +449,19 @@ static off_t rip_plugin_get_current_pos(input_plugin_t *this_gen) {
pos = this->main_input_plugin->get_current_pos(this->main_input_plugin);
if (pos != this->curpos) {
- lprintf(CLR_FAIL "position: computed = %lld, input plugin = %lld" CLR_RST "\n", this->curpos, pos);
+ lprintf(CLR_FAIL "position: computed = %"PRId64", input plugin = %"PRId64"" CLR_RST "\n", this->curpos, pos);
}
#endif
return this->curpos;
}
+static int rip_plugin_get_current_time(input_plugin_t *this_gen) {
+ rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen;
+
+ return this->main_input_plugin->get_current_time(this->main_input_plugin);
+}
+
static off_t rip_plugin_get_length (input_plugin_t *this_gen) {
rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen;
off_t length;
@@ -465,7 +479,7 @@ static uint32_t rip_plugin_get_blocksize(input_plugin_t *this_gen) {
return this->main_input_plugin->get_blocksize(this->main_input_plugin);
}
-static char* rip_plugin_get_mrl (input_plugin_t *this_gen) {
+static const char* rip_plugin_get_mrl (input_plugin_t *this_gen) {
rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen;
return this->main_input_plugin->get_mrl(this->main_input_plugin);
@@ -646,7 +660,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f
free(this);
return NULL;
}
- lprintf(" => saved %lld bytes (preview)\n", this->preview_size);
+ lprintf(" => saved %"PRId64" bytes (preview)\n", this->preview_size);
this->savepos = this->preview_size;
}
@@ -655,7 +669,11 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f
this->input_plugin.read = rip_plugin_read;
this->input_plugin.read_block = rip_plugin_read_block;
this->input_plugin.seek = rip_plugin_seek;
+ if(this->main_input_plugin->seek_time)
+ this->input_plugin.seek_time = rip_plugin_seek_time;
this->input_plugin.get_current_pos = rip_plugin_get_current_pos;
+ if(this->main_input_plugin->get_current_time)
+ this->input_plugin.get_current_time = rip_plugin_get_current_time;
this->input_plugin.get_length = rip_plugin_get_length;
this->input_plugin.get_blocksize = rip_plugin_get_blocksize;
this->input_plugin.get_mrl = rip_plugin_get_mrl;
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 62f4705fa..d35eba736 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.c
@@ -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.228 2006/11/23 21:05:31 klan Exp $
+ * $Id: load_plugins.c,v 1.230 2007/02/19 23:33:33 dgp85 Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -1989,18 +1989,19 @@ int _x_decoder_available (xine_t *xine, uint32_t buftype)
return 0;
}
-
#ifdef LOG
static void _display_file_plugin_list (xine_list_t *list, plugin_file_t *file) {
- plugin_node_t *node;
+ xine_list_iterator_t ite = xine_list_front(list);
+
+ while (ite) {
+ plugin_node_t *node = xine_list_get_value(list, ite);
- node = xine_list_first_content(list);
- while (node) {
if ((node->file == file) && (node->ref)) {
printf(" plugin: %s, class: %p , %d instance(s)\n",
node->info->id, node->plugin_class, node->ref);
}
- node = xine_list_next_content(list);
+
+ ite = xine_list_next(list, ite);
}
}
#endif
@@ -2375,14 +2376,14 @@ char *xine_get_file_extensions (xine_t *self) {
list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
for (list_id = 0; list_id < list_size; list_id++) {
demux_class_t *cls;
- char *exts;
+ const char *exts;
node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id);
if (node->plugin_class || _load_plugin_class(self, node, NULL)) {
cls = (demux_class_t *)node->plugin_class;
- if((exts = cls->get_extensions(cls)) && strlen(exts))
+ if((exts = cls->get_extensions(cls)) && *exts)
len += strlen(exts) + 1;
}
}
@@ -2394,7 +2395,7 @@ char *xine_get_file_extensions (xine_t *self) {
list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
for (list_id = 0; list_id < list_size; list_id++) {
demux_class_t *cls;
- char *e;
+ const char *e;
int l;
node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id);
@@ -2402,7 +2403,7 @@ char *xine_get_file_extensions (xine_t *self) {
cls = (demux_class_t *)node->plugin_class;
- if((e = cls->get_extensions (cls)) && strlen(e)) {
+ if((e = cls->get_extensions (cls)) && *e) {
l = strlen(e);
memcpy (&str[pos], e, l);
@@ -2444,7 +2445,7 @@ char *xine_get_mime_types (xine_t *self) {
for (list_id = 0; list_id < list_size; list_id++) {
demux_class_t *cls;
- char *s;
+ const char *s;
node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id);
if (node->plugin_class || _load_plugin_class(self, node, NULL)) {
@@ -2466,7 +2467,7 @@ char *xine_get_mime_types (xine_t *self) {
for (list_id = 0; list_id < list_size; list_id++) {
demux_class_t *cls;
- char *s;
+ const char *s;
int l;
node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id);
@@ -2503,6 +2504,7 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) {
char *id = NULL;
char *mime_arg, *mime_demux;
char *s;
+ const char *mt;
int list_id, list_size;
/* create a copy and convert to lower case */
@@ -2522,9 +2524,9 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) {
cls = (demux_class_t *)node->plugin_class;
- s = cls->get_mimetypes (cls);
- if (s) {
- mime_demux = strdup(s);
+ mt = cls->get_mimetypes (cls);
+ if (mt) {
+ mime_demux = strdup(mt);
for(s=mime_demux; *s; s++)
*s = tolower(*s);
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index 809204af9..fa33da9e1 100644
--- a/src/xine-engine/metronom.c
+++ b/src/xine-engine/metronom.c
@@ -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: metronom.c,v 1.143 2006/01/27 22:35:07 dsalt Exp $
+ * $Id: metronom.c,v 1.144 2007/02/20 00:34:57 dgp85 Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -524,7 +524,7 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) {
img->vpts = this->video_vpts + this->av_offset;
if (this->video_mode == VIDEO_PREDICTION_MODE) {
- lprintf("video vpts for %10lld : %10lld (duration:%d drift:%" PRId64 " step:%" PRId64 ")\n",
+ lprintf("video vpts for %10"PRId64" : %10"PRId64" (duration:%d drift:%" PRId64 " step:%" PRId64 ")\n",
pts, this->video_vpts, img->duration, this->video_drift, this->video_drift_step );
if (this->video_drift * this->video_drift_step > 0) {
@@ -681,7 +681,7 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts,
this->audio_samples += nsamples;
this->vpts_offset += nsamples * this->audio_drift_step / AUDIO_SAMPLE_NUM;
- lprintf("audio vpts for %10lld : %10lld\n", pts, vpts);
+ lprintf("audio vpts for %10"PRId64" : %10"PRId64"\n", pts, vpts);
pthread_mutex_unlock (&this->lock);
diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c
index b5f45d0af..b33d81f6e 100644
--- a/src/xine-engine/osd.c
+++ b/src/xine-engine/osd.c
@@ -102,6 +102,12 @@
# define KERNING_DEFAULT ft_kerning_default
#endif
+#ifdef ENABLE_ANTIALIASING
+# define FT_LOAD_FLAGS FT_LOAD_DEFAULT
+#else
+# define FT_LOAD_FLAGS (FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING)
+#endif
+
typedef struct osd_fontchar_s {
uint16_t code;
uint16_t width;
@@ -194,7 +200,7 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) {
int x, y, required;
uint8_t *c;
- lprintf("osd=%p vpts=%lld\n", osd, vpts);
+ lprintf("osd=%p vpts=%"PRId64"\n", osd, vpts);
this->stream->xine->port_ticket->acquire(this->stream->xine->port_ticket, 1);
@@ -341,7 +347,7 @@ static int _osd_hide (osd_object_t *osd, int64_t vpts) {
osd_renderer_t *this = osd->renderer;
video_overlay_manager_t *ovl_manager;
- lprintf("osd=%p vpts=%lld\n",osd, vpts);
+ lprintf("osd=%p vpts=%"PRId64"\n",osd, vpts);
if( osd->handle < 0 )
return 0;
@@ -1171,7 +1177,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1,
}
previous = i;
- if (FT_Load_Glyph(osd->ft2->face, i, FT_LOAD_DEFAULT)) {
+ if (FT_Load_Glyph(osd->ft2->face, i, FT_LOAD_FLAGS)) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: error loading glyph\n"));
continue;
}
@@ -1475,7 +1481,16 @@ static void osd_free_object (osd_object_t *osd_to_close) {
while( osd ) {
if ( osd == osd_to_close ) {
free( osd->area );
- if( osd->ft2 ) free( osd->ft2 );
+
+#ifdef HAVE_FT2
+ if( osd->ft2 ) {
+ if ( osd->ft2->library )
+ FT_Done_FreeType(osd->ft2->library);
+
+ free( osd->ft2 );
+ }
+#endif
+
osd_free_encoding(osd);
if( last )
diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h
index f8aba5cef..bcdc3c54b 100644
--- a/src/xine-engine/post.h
+++ b/src/xine-engine/post.h
@@ -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: post.h,v 1.23 2006/09/26 05:19:49 dgp85 Exp $
+ * $Id: post.h,v 1.26 2007/02/20 01:13:08 dgp85 Exp $
*
* post plugin definitions
*
@@ -259,7 +259,7 @@ void _x_post_frame_copy_up(vo_frame_t *to, vo_frame_t *from) XINE_PROTECTED;
/* when you shortcut a frames usual draw() travel so that it will never reach
* the draw() function of the original issuer, you still have to do some
* housekeeping on the frame, before returning control up the pipe */
-void _x_post_frame_u_turn(vo_frame_t *frame, xine_stream_t *stream);
+void _x_post_frame_u_turn(vo_frame_t *frame, xine_stream_t *stream) XINE_PROTECTED;
/* use this to create a new, trivially decorated overlay manager in which
* port functions can be replaced with own implementations */
@@ -380,7 +380,7 @@ static xine_post_api_parameter_t temp_p[] = {
#define PARAM_ITEM( param_type, var, enumv, min, max, readonly, descr ) \
{ param_type, #var, sizeof(temp_s.var), \
- (char *)&temp_s.var-(char *)&temp_s, enumv, min, max, readonly, descr },
+ (char*)&temp_s.var-(char*)&temp_s, enumv, min, max, readonly, descr },
#define END_PARAM_DESCR( name ) \
{ POST_PARAM_TYPE_LAST, NULL, 0, 0, NULL, 0, 0, 1, NULL } \
diff --git a/src/xine-engine/scratch.c b/src/xine-engine/scratch.c
index eac5eee63..67281b041 100644
--- a/src/xine-engine/scratch.c
+++ b/src/xine-engine/scratch.c
@@ -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: scratch.c,v 1.22 2006/10/18 18:46:17 hadess Exp $
+ * $Id: scratch.c,v 1.24 2007/01/19 00:12:22 dgp85 Exp $
*
* top-level xine functions
*
@@ -47,6 +47,8 @@ static void __attribute__((__format__(__printf__, 2, 0)))
struct tm tm;
size_t l;
+ pthread_mutex_lock (&this->lock);
+
time (&t);
localtime_r (&t, &tm);
@@ -61,37 +63,46 @@ static void __attribute__((__format__(__printf__, 2, 0)))
lprintf ("printing format %s to line %d\n", format, this->cur);
this->cur = (this->cur + 1) % this->num_lines;
+
+ pthread_mutex_unlock (&this->lock);
}
-static const char **scratch_get_content (scratch_buffer_t *this) {
+static char **scratch_get_content (scratch_buffer_t *this) {
int i, j;
+ pthread_mutex_lock (&this->lock);
+
for(i = 0, j = (this->cur - 1); i < this->num_lines; i++, j--) {
if(j < 0)
j = (this->num_lines - 1);
- this->ordered[i] = this->lines[j];
+ free (this->ordered[i]);
+ this->ordered[i] = this->lines[j] ? strdup (this->lines[j]) : NULL;
lprintf ("line %d contains >%s<\n", i , this->lines[j]);
}
+ pthread_mutex_unlock (&this->lock);
return this->ordered;
}
static void scratch_dispose (scratch_buffer_t *this) {
- char *mem;
int i;
- mem = (char *) this->lines[0];
-
+ pthread_mutex_lock (&this->lock);
+
for(i = 0; i < this->num_lines; i++ ) {
+ free(this->ordered[i]);
free(this->lines[i]);
- this->lines[i] = NULL;
}
free (this->lines);
free (this->ordered);
+
+ pthread_mutex_unlock (&this->lock);
+ pthread_mutex_destroy (&this->lock);
+
free (this);
}
@@ -104,16 +115,15 @@ scratch_buffer_t *_x_new_scratch_buffer (int num_lines) {
this->lines = xine_xmalloc (sizeof (char *) * (num_lines + 1));
this->ordered = xine_xmalloc (sizeof (char *) * (num_lines + 1));
- for (i = 0; i < num_lines; i++)
- this->lines[i] = NULL;
+ for (i = 0; i <= num_lines; i++)
+ this->lines[i] = this->ordered[i] = NULL;
- this->ordered[i] = NULL;
- this->lines[i] = NULL;
this->scratch_printf = scratch_printf;
this->get_content = scratch_get_content;
this->dispose = scratch_dispose;
this->num_lines = num_lines;
this->cur = 0;
+ pthread_mutex_init (&this->lock, NULL);
return this;
}
diff --git a/src/xine-engine/scratch.h b/src/xine-engine/scratch.h
index d23d68503..bcfe815c3 100644
--- a/src/xine-engine/scratch.h
+++ b/src/xine-engine/scratch.h
@@ -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: scratch.h,v 1.11 2006/09/26 05:19:49 dgp85 Exp $
+ * $Id: scratch.h,v 1.13 2007/01/19 00:12:22 dgp85 Exp $
*
* scratch buffer for log output
*
@@ -27,6 +27,7 @@
#define HAVE_SCRATCH_H
#include <stdarg.h>
+#include <pthread.h>
typedef struct scratch_buffer_s scratch_buffer_t;
@@ -40,16 +41,17 @@ struct scratch_buffer_s {
#endif
(*scratch_printf) (scratch_buffer_t *this, const char *format, va_list ap);
- const char **(*get_content) (scratch_buffer_t *this);
+ char **(*get_content) (scratch_buffer_t *this);
void (*dispose) (scratch_buffer_t *this);
char **lines;
- const char **ordered;
+ char **ordered;
int num_lines;
int cur;
+ pthread_mutex_t lock;
};
scratch_buffer_t *_x_new_scratch_buffer (int num_lines) XINE_PROTECTED;
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index 16ebb61b2..fee75ec76 100644
--- a/src/xine-engine/video_decoder.c
+++ b/src/xine-engine/video_decoder.c
@@ -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.161 2006/09/08 21:11:29 miguelfreitas Exp $
+ * $Id: video_decoder.c,v 1.163 2007/02/20 00:34:58 dgp85 Exp $
*
*/
@@ -193,8 +193,13 @@ static void *video_decoder_loop (void *stream_gen) {
/*
* wait the output fifos to run dry before sending the notification event
- * to the frontend. this test is only valid if there is only a single
- * stream attached to the current output port.
+ * to the frontend. exceptions:
+ * 1) don't wait if there is more than one stream attached to the current
+ * output port (the other stream might be sending data so we would be
+ * here forever)
+ * 2) early_finish_event: send notification asap to allow gapless switch
+ * 3) slave stream: don't wait. get into an unblocked state asap to allow
+ * new master actions.
*/
while(1) {
int num_bufs, num_streams;
@@ -204,7 +209,8 @@ static void *video_decoder_loop (void *stream_gen) {
num_streams = stream->video_out->get_property(stream->video_out, VO_PROP_NUM_STREAMS);
running_ticket->release(running_ticket, 0);
- if( num_bufs > 0 && num_streams == 1 && !stream->early_finish_event )
+ if( num_bufs > 0 && num_streams == 1 && !stream->early_finish_event &&
+ stream->master == stream )
xine_usec_sleep (10000);
else
break;
@@ -302,7 +308,7 @@ static void *video_decoder_loop (void *stream_gen) {
break;
case BUF_CONTROL_NEWPTS:
- lprintf ("new pts %lld\n", buf->disc_off);
+ lprintf ("new pts %"PRId64"\n", buf->disc_off);
if (stream->video_decoder_plugin) {
running_ticket->acquire(running_ticket, 0);
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 19d635d76..2a3ee1980 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.c
@@ -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_out.c,v 1.225 2006/03/25 01:26:34 dsalt Exp $
+ * $Id: video_out.c,v 1.228 2007/04/01 01:03:06 dgp85 Exp $
*
* frame allocation / queuing / scheduling / output functions
*/
@@ -93,11 +93,20 @@ typedef struct {
vo_frame_t *last_frame;
vo_frame_t *img_backup;
- int redraw_needed;
+
+ uint32_t video_loop_running:1;
+ uint32_t video_opened:1;
+
+ uint32_t overlay_enabled:1;
+
+ uint32_t warn_threshold_event_sent:1;
+
+ /* do we true real-time output or is this a grab only instance ? */
+ uint32_t grab_only:1;
+
+ uint32_t redraw_needed:3;
int discard_frames;
- int video_loop_running;
- int video_opened;
pthread_t video_thread;
int num_frames_delivered;
@@ -108,17 +117,12 @@ typedef struct {
int warn_skipped_threshold;
int warn_discarded_threshold;
int warn_threshold_exceeded;
- int warn_threshold_event_sent;
/* pts value when decoder delivered last video frame */
int64_t last_delivery_pts;
video_overlay_manager_t *overlay_source;
- int overlay_enabled;
-
- /* do we true real-time output or is this a grab only instance ? */
- int grab_only;
extra_info_t *extra_info_base; /* used to free mem chunk */
@@ -600,7 +604,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
*/
send_event = (this->warn_threshold_exceeded == 5 &&
!this->warn_threshold_event_sent);
- this->warn_threshold_event_sent += send_event;
+ this->warn_threshold_event_sent = send_event;
pthread_mutex_lock(&this->streams_lock);
for (ite = xine_list_front(this->streams); ite;
@@ -1195,7 +1199,7 @@ static void *video_out_loop (void *this_gen) {
if (this->clock->speed == XINE_SPEED_PAUSE)
paused_loop (this, vpts);
- if (next_frame_vpts) {
+ if (next_frame_vpts && this->clock->speed > 0) {
usec_to_sleep = (next_frame_vpts - vpts) * 100 * XINE_FINE_SPEED_NORMAL / (9 * this->clock->speed);
} else {
/* we don't know when the next frame is due, only wait a little */
@@ -1783,11 +1787,23 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon
this->frame_drop_limit = 3;
this->frame_drop_cpt = 0;
- num_frame_buffers = driver->get_property (driver, VO_PROP_MAX_NUM_FRAMES);
-
- if (!num_frame_buffers)
- num_frame_buffers = NUM_FRAME_BUFFERS; /* default */
- else if (num_frame_buffers<5)
+ /* default number of video frames from config */
+ num_frame_buffers = xine->config->register_num (xine->config,
+ "engine.buffers.video_num_frames",
+ NUM_FRAME_BUFFERS, /* default */
+ _("default number of video frames"),
+ _("The default number of video frames to request "
+ "from xine video out driver. Some drivers will "
+ "override this setting with their own values."),
+ 20, NULL, NULL);
+
+ /* check driver's limit and use the smaller value */
+ i = driver->get_property (driver, VO_PROP_MAX_NUM_FRAMES);
+ if (i && i < num_frame_buffers)
+ num_frame_buffers = i;
+
+ /* we need at least 5 frames */
+ if (num_frame_buffers<5)
num_frame_buffers = 5;
this->extra_info_base = calloc (num_frame_buffers,
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 78476a768..f49a988c9 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -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.335 2006/10/16 22:18:24 valtri Exp $
+ * $Id: xine.c,v 1.342 2007/02/20 00:37:02 dgp85 Exp $
*/
/*
@@ -78,6 +78,10 @@
#endif /* WIN32 */
+static void mutex_cleanup (void *mutex) {
+ pthread_mutex_unlock ((pthread_mutex_t *) mutex);
+}
+
void _x_handle_stream_end (xine_stream_t *stream, int non_user) {
if (stream->status == XINE_STATUS_QUIT)
@@ -294,6 +298,7 @@ static void stop_internal (xine_stream_t *stream) {
void xine_stop (xine_stream_t *stream) {
pthread_mutex_lock (&stream->frontend_lock);
+ pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock);
/* make sure that other threads cannot change the speed, especially pauseing the stream */
pthread_mutex_lock(&stream->speed_change_lock);
@@ -320,6 +325,7 @@ void xine_stop (xine_stream_t *stream) {
stream->xine->port_ticket->release(stream->xine->port_ticket, 1);
stream->ignore_speed_change = 0;
+ pthread_cleanup_pop (0);
pthread_mutex_unlock (&stream->frontend_lock);
}
@@ -395,6 +401,7 @@ static void close_internal (xine_stream_t *stream) {
void xine_close (xine_stream_t *stream) {
pthread_mutex_lock (&stream->frontend_lock);
+ pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock);
close_internal (stream);
@@ -408,6 +415,7 @@ void xine_close (xine_stream_t *stream) {
if (stream->status != XINE_STATUS_QUIT)
stream->status = XINE_STATUS_IDLE;
+ pthread_cleanup_pop (0);
pthread_mutex_unlock (&stream->frontend_lock);
}
@@ -1131,11 +1139,13 @@ int xine_open (xine_stream_t *stream, const char *mrl) {
int ret;
pthread_mutex_lock (&stream->frontend_lock);
+ pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock);
lprintf ("open MRL:%s\n", mrl);
ret = open_internal (stream, mrl);
+ pthread_cleanup_pop (0);
pthread_mutex_unlock (&stream->frontend_lock);
return ret;
@@ -1263,6 +1273,7 @@ int xine_play (xine_stream_t *stream, int start_pos, int start_time) {
int ret;
pthread_mutex_lock (&stream->frontend_lock);
+ pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock);
stream->delay_finish_event = 0;
@@ -1272,6 +1283,7 @@ int xine_play (xine_stream_t *stream, int start_pos, int start_time) {
stream->gapless_switch = 0;
+ pthread_cleanup_pop (0);
pthread_mutex_unlock (&stream->frontend_lock);
return ret;
@@ -1285,6 +1297,7 @@ int xine_eject (xine_stream_t *stream) {
return 0;
pthread_mutex_lock (&stream->frontend_lock);
+ pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock);
status = 0;
/* only eject, if we are stopped OR a different input plugin is playing */
@@ -1295,7 +1308,9 @@ int xine_eject (xine_stream_t *stream) {
status = stream->eject_class->eject_media (stream->eject_class);
}
+ pthread_cleanup_pop (0);
pthread_mutex_unlock (&stream->frontend_lock);
+
return status;
}
@@ -1520,8 +1535,8 @@ static void config_save_cb (void *this_gen, xine_cfg_entry_t *entry) {
}
void xine_init (xine_t *this) {
- static char *demux_strategies[] = {"default", "reverse", "content",
- "extension", NULL};
+ static const char *demux_strategies[] = {"default", "reverse", "content",
+ "extension", NULL};
/* initialize color conversion tables and functions */
init_yuv_conversion();
@@ -1561,9 +1576,9 @@ void xine_init (xine_t *this) {
/*
* save directory
*/
- this->save_path = this->config->register_string (
+ this->save_path = this->config->register_filename (
this->config,
- "media.capture.save_dir", "",
+ "media.capture.save_dir", "", XINE_CONFIG_STRING_IS_DIRECTORY_NAME,
_("directory for saving streams"),
_("When using the stream save feature, files will be written only into this directory.\n"
"This setting is security critical, because when changed to a different directory, xine "
@@ -1604,9 +1619,10 @@ void xine_init (xine_t *this) {
this->streams = xine_list_new();
/*
- * streams lock
+ * locks
*/
pthread_mutex_init (&this->streams_lock, NULL);
+ pthread_mutex_init (&this->log_lock, NULL);
/*
* start metronom clock
@@ -1951,12 +1967,21 @@ const char *const *xine_get_log_names (xine_t *this) {
return log_sections;
}
+static inline void check_log_alloc (xine_t *this, int buf)
+{
+ pthread_mutex_lock (&this->log_lock);
+
+ if ( ! this->log_buffers[buf] )
+ this->log_buffers[buf] = _x_new_scratch_buffer(150);
+
+ pthread_mutex_unlock (&this->log_lock);
+}
+
void xine_log (xine_t *this, int buf, const char *format, ...) {
va_list argp;
char buffer[SCRATCH_LINE_LEN_MAX];
- if ( ! this->log_buffers[buf] )
- this->log_buffers[buf] = _x_new_scratch_buffer(150);
+ check_log_alloc (this, buf);
va_start (argp, format);
this->log_buffers[buf]->scratch_printf (this->log_buffers[buf], format, argp);
@@ -1973,13 +1998,12 @@ void xine_log (xine_t *this, int buf, const char *format, ...) {
void xine_vlog(xine_t *this, int buf, const char *format,
va_list args)
{
- if ( ! this->log_buffers[buf] )
- this->log_buffers[buf] = _x_new_scratch_buffer(150);
+ check_log_alloc (this, buf);
this->log_buffers[buf]->scratch_printf(this->log_buffers[buf], format, args);
}
-const char *const *xine_get_log (xine_t *this, int buf) {
+char *const *xine_get_log (xine_t *this, int buf) {
if(buf >= XINE_LOG_NUM)
return NULL;
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index d0dc0e4a5..e58d9ed61 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.c
@@ -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_interface.c,v 1.99 2006/10/16 06:29:38 dgp85 Exp $
+ * $Id: xine_interface.c,v 1.104 2007/03/26 11:48:01 dgp85 Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -100,7 +100,23 @@ const char* xine_config_register_string (xine_t *self,
cb_data);
}
+
+const char* xine_config_register_filename (xine_t *self,
+ const char *key,
+ const char *def_value,
+ int req_type,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data) {
+ return self->config->register_filename (self->config,
+ key, def_value, req_type,
+ description, help, exp_level,
+ changed_cb, cb_data);
+}
+
int xine_config_register_range (xine_t *self,
const char *key,
int def_value,
@@ -325,6 +341,24 @@ int xine_port_send_gui_data (xine_video_port_t *vo,
type, data);
}
+static void send_audio_amp_event_internal(xine_stream_t *stream)
+{
+ xine_event_t event;
+ xine_audio_level_data_t data;
+
+ data.left
+ = data.right
+ = stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP);
+ data.mute
+ = stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP_MUTE);
+
+ event.type = XINE_EVENT_AUDIO_AMP_LEVEL;
+ event.data = &data;
+ event.data_length = sizeof (data);
+
+ xine_event_send(stream, &event);
+}
+
void xine_set_param (xine_stream_t *stream, int param, int value) {
/* Avoid crashing */
if ( ! stream ) {
@@ -396,15 +430,21 @@ void xine_set_param (xine_stream_t *stream, int param, int value) {
case XINE_PARAM_AUDIO_AMP_LEVEL:
stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0);
- if (stream->audio_out)
- stream->audio_out->set_property (stream->audio_out, AO_PROP_AMP, value);
+ if (stream->audio_out) {
+ int old_value = stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP);
+ if (old_value != stream->audio_out->set_property (stream->audio_out, AO_PROP_AMP, value))
+ send_audio_amp_event_internal(stream);
+ }
stream->xine->port_ticket->release(stream->xine->port_ticket, 0);
break;
case XINE_PARAM_AUDIO_AMP_MUTE:
stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0);
- if (stream->audio_out)
- stream->audio_out->set_property (stream->audio_out, AO_PROP_AMP_MUTE, value);
+ if (stream->audio_out) {
+ int old_value = stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP_MUTE);
+ if (old_value != stream->audio_out->set_property (stream->audio_out, AO_PROP_AMP_MUTE, value))
+ send_audio_amp_event_internal(stream);
+ }
stream->xine->port_ticket->release(stream->xine->port_ticket, 0);
break;
@@ -913,7 +953,7 @@ int _x_message(xine_stream_t *stream, int type, ...) {
va_list ap;
char *s, *params;
char *args[1025];
- static char *std_explanation[] = {
+ static const char *std_explanation[] = {
"",
N_("Warning:"),
N_("Unknown host:"),
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 8ee5d8219..30899a4b3 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.h
@@ -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.179 2006/10/02 15:56:06 valtri Exp $
+ * $Id: xine_internal.h,v 1.181 2007/01/18 23:28:46 dgp85 Exp $
*
*/
@@ -118,6 +118,7 @@ struct xine_s {
#ifdef XINE_ENGINE_INTERNAL
xine_ticket_t *port_ticket;
+ pthread_mutex_t log_lock;
#endif
};
@@ -415,7 +416,7 @@ void _x_demux_control_end (xine_stream_t *stream, uint32_t flags) XINE_
int _x_demux_start_thread (xine_stream_t *stream) XINE_PROTECTED;
int _x_demux_stop_thread (xine_stream_t *stream) XINE_PROTECTED;
int _x_demux_read_header (input_plugin_t *input, unsigned char *buffer, off_t size) XINE_PROTECTED;
-int _x_demux_check_extension (char *mrl, char *extensions) XINE_PROTECTED;
+int _x_demux_check_extension (const char *mrl, const char *extensions) XINE_PROTECTED;
off_t _x_read_abort (xine_stream_t *stream, int fd, char *buf, off_t todo) XINE_PROTECTED;
diff --git a/src/xine-engine/xine_plugin.h b/src/xine-engine/xine_plugin.h
index f55c5be63..4ddb65eda 100644
--- a/src/xine-engine/xine_plugin.h
+++ b/src/xine-engine/xine_plugin.h
@@ -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_plugin.h,v 1.21 2006/09/26 05:19:49 dgp85 Exp $
+ * $Id: xine_plugin.h,v 1.23 2007/01/19 02:49:31 dgp85 Exp $
*
* generic plugin definitions
*
@@ -73,7 +73,7 @@ typedef struct {
/* special_info for a decoder plugin */
typedef struct {
- uint32_t *supported_types; /* streamtypes this decoder can handle */
+ uint32_t *supported_types; /* streamtypes this decoder can handle */
int priority;
} decoder_info_t;