summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in2
-rw-r--r--src/audio_out/audio_alsa_out.c26
-rw-r--r--src/audio_out/audio_irixal_out.c38
-rw-r--r--src/audio_out/audio_oss_out.c9
-rw-r--r--src/demuxers/demux_asf.c37
-rw-r--r--src/demuxers/demux_avi.c58
-rw-r--r--src/demuxers/demux_elem.c40
-rw-r--r--src/demuxers/demux_mpeg.c74
-rw-r--r--src/demuxers/demux_mpeg_block.c68
-rw-r--r--src/demuxers/demux_mpgaudio.c42
-rw-r--r--src/demuxers/demux_ogg.c32
-rw-r--r--src/demuxers/demux_pes.c64
-rw-r--r--src/demuxers/demux_qt.c32
-rw-r--r--src/demuxers/demux_ts.c72
-rw-r--r--src/input/dvd_udf.c25
-rw-r--r--src/input/input_file.c13
-rw-r--r--src/libspudec/spu.c21
-rw-r--r--src/libspudec/xine_decoder.c54
-rw-r--r--src/libw32dll/wine/debugtools.h8
-rw-r--r--src/xine-engine/load_plugins.c17
-rw-r--r--src/xine-engine/osd.c26
-rw-r--r--src/xine-engine/xine.c12
-rw-r--r--src/xine-utils/Makefile.am2
-rw-r--r--src/xine-utils/compat.h42
-rw-r--r--src/xine-utils/utils.c9
-rw-r--r--src/xine-utils/xineutils.h95
26 files changed, 595 insertions, 323 deletions
diff --git a/configure.in b/configure.in
index cae6e0a2c..734801867 100644
--- a/configure.in
+++ b/configure.in
@@ -401,7 +401,7 @@ dnl
dnl Some extra checks.
dnl
AC_CHECK_LIB(posix4, sched_get_priority_min)
-AC_HAVE_FUNCS(sigaction sigset getpwuid_r nanosleep)
+AC_HAVE_FUNCS(sigaction sigset getpwuid_r nanosleep strsep strpbrk)
AC_CHECK_HEADERS(byteswap.h malloc.h sys/mman.h)
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c
index 54001e355..b3f2687c2 100644
--- a/src/audio_out/audio_alsa_out.c
+++ b/src/audio_out/audio_alsa_out.c
@@ -26,7 +26,7 @@
* (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk>
*
*
- * $Id: audio_alsa_out.c,v 1.39 2001/11/28 23:15:09 jcdutton Exp $
+ * $Id: audio_alsa_out.c,v 1.40 2001/11/30 00:53:50 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -45,23 +45,9 @@
#include <sys/ioctl.h>
#include <inttypes.h>
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
-#define error(...) do {\
- fprintf(stderr, "XINE lib %s:%d:(%s) ", __FILE__, __LINE__, __FUNCTION__); \
- fprintf(stderr, __VA_ARGS__); \
- putc('\n', stderr); \
-} while (0)
-#else
-#define error(args...) do {\
- fprintf(stderr, "XINE lib %s:%d:(%s) ", __FILE__, __LINE__, __FUNCTION__); \
- fprintf(stderr, ##args); \
- putc('\n', stderr); \
-} while (0)
-#endif
-
-
#include "xine_internal.h"
#include "xineutils.h"
+#include "compat.h"
#include "audio_out.h"
#ifndef AFMT_S16_NE
@@ -236,7 +222,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
printf("audio_alsa_out: Number of channels = %d\n",this->num_channels);
if (this->audio_fd != NULL) {
- error ("Already open...WHY!");
+ xlerror ("Already open...WHY!");
snd_pcm_close (this->audio_fd);
}
@@ -351,7 +337,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
tmp = snd_pcm_hw_params_set_period_size_near(this->audio_fd, params,
period_size, 0);
printf("audio_alsa_out:open:period_size=%ld tmp=%ld\n",period_size,tmp);
-
+
if (period_size < 0) {
printf ("audio_alsa_out: period size not available");
goto __close;
@@ -843,8 +829,8 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) {
err=snd_pcm_open(&this->audio_fd, pcm_device, SND_PCM_STREAM_PLAYBACK, 0);
if(err <0 ) {
- error("snd_pcm_open() failed: %d", err);
- error(">>> Check if another program don't already use PCM <<<");
+ xlerror("snd_pcm_open() failed: %d", err);
+ xlerror(">>> Check if another program don't already use PCM <<<");
return NULL;
}
diff --git a/src/audio_out/audio_irixal_out.c b/src/audio_out/audio_irixal_out.c
index 56e857283..b7fc38971 100644
--- a/src/audio_out/audio_irixal_out.c
+++ b/src/audio_out/audio_irixal_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: audio_irixal_out.c,v 1.3 2001/11/17 14:26:37 f1rmb Exp $
+ * $Id: audio_irixal_out.c,v 1.4 2001/11/30 00:53:50 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -36,23 +36,9 @@
#include <dmedia/audio.h>
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
-#define error(...) do {\
- fprintf(stderr, "XINE lib %s:%d:(%s) ", __FILE__, __LINE__, __FUNCTION__); \
- fprintf(stderr, __VA_ARGS__); \
- putc('\n', stderr); \
-} while (0)
-#else
-#define error(args...) do {\
- fprintf(stderr, "XINE lib %s:%d:(%s) ", __FILE__, __LINE__, __FUNCTION__); \
- fprintf(stderr, ##args); \
- putc('\n', stderr); \
-} while (0)
-#endif
-
-
#include "xine_internal.h"
#include "xineutils.h"
+#include "compat.h"
#include "audio_out.h"
//#ifndef AFMT_S16_NE
@@ -124,18 +110,18 @@ static int ao_irixal_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, i
break;
#endif
default:
- error ("irixal Driver does not support the requested mode: 0x%x",mode);
+ xlerror ("irixal Driver does not support the requested mode: 0x%x",mode);
return 0;
}
if (! (config = alNewConfig ()))
{
- error ("cannot get new config: %s", strerror (oserror()));
+ xlerror ("cannot get new config: %s", strerror (oserror()));
return 0;
}
if ( (alSetChannels (config, this->num_channels)) == -1)
{
- error ("cannot set to %d channels: %s", this->num_channels, strerror (oserror()));
+ xlerror ("cannot set to %d channels: %s", this->num_channels, strerror (oserror()));
alFreeConfig (config);
return 0;
}
@@ -144,7 +130,7 @@ static int ao_irixal_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, i
case 8:
if ( (alSetWidth (config, AL_SAMPLE_8)) == -1)
{
- error ("cannot set 8bit mode: %s", strerror (oserror()));
+ xlerror ("cannot set 8bit mode: %s", strerror (oserror()));
alFreeConfig (config);
return 0;
}
@@ -153,7 +139,7 @@ static int ao_irixal_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, i
/* Default format is 16bit PCM */
break;
default:
- error ("irixal Driver does not support %dbit audio", bits);
+ xlerror ("irixal Driver does not support %dbit audio", bits);
alFreeConfig (config);
return 0;
}
@@ -164,7 +150,7 @@ static int ao_irixal_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, i
* Try to open audio port
*/
if (! (this->port = alOpenPort ("xine", "w", config))) {
- error ("irixal Driver does not support the audio configuration");
+ xlerror ("irixal Driver does not support the audio configuration");
alFreeConfig (config);
return 0;
}
@@ -193,7 +179,7 @@ static int ao_irixal_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, i
printf ("audio_irixal: FYI: cannot set sample rate, using software resampling\n");
if (alGetParams (resource, &parvalue, 1) == -1)
{
- error ("cannot ask for current sample rate, assuming everything worked...");
+ xlerror ("cannot ask for current sample rate, assuming everything worked...");
this->output_sample_rate = this->input_sample_rate;
}
else
@@ -231,7 +217,7 @@ static int ao_irixal_delay (ao_driver_t *this_gen)
int frames_left;
if (alGetFrameTime (this->port, &stamp, &time) == -1)
- error ("alGetFrameNumber failed");
+ xlerror ("alGetFrameNumber failed");
frames_left = this->frames_in_buffer - stamp;
if (frames_left <= 0) /* buffer ran dry */
frames_left = 0;
@@ -249,7 +235,7 @@ static int ao_irixal_write(ao_driver_t *this_gen,int16_t *data, uint32_t num_fra
/* get absolute number of samples played so far
* note: this counts up when run dry as well... */
if (alGetFrameNumber (this->port, &stamp) == -1)
- error ("alGetFrameNumber failed");
+ xlerror ("alGetFrameNumber failed");
if (this->frames_in_buffer < stamp) /* dry run */
{
if (this->frames_in_buffer > 0)
@@ -327,7 +313,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config)
}
if (useresource == -1)
{
- error ("cannot find output resource");
+ xlerror ("cannot find output resource");
return NULL;
}
diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c
index d4b22806b..2da37be12 100644
--- a/src/audio_out/audio_oss_out.c
+++ b/src/audio_out/audio_oss_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: audio_oss_out.c,v 1.51 2001/11/18 15:08:30 guenter Exp $
+ * $Id: audio_oss_out.c,v 1.52 2001/11/30 00:53:50 f1rmb Exp $
*
* 20-8-2001 First implementation of Audio sync and Audio driver separation.
* Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk
@@ -61,6 +61,7 @@
#include "xine_internal.h"
#include "xineutils.h"
+#include "compat.h"
#include "audio_out.h"
#include <sys/time.h>
@@ -432,7 +433,7 @@ static int ao_oss_get_property (ao_driver_t *this_gen, int property) {
}
else
printf("%s(): open() %s failed: %s\n",
- __FUNCTION__, this->mixer.name, strerror(errno));
+ __XINE_FUNCTION__, this->mixer.name, strerror(errno));
return this->mixer.volume;
break;
@@ -482,7 +483,7 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value)
}
else
printf("%s(): open() %s failed: %s\n",
- __FUNCTION__, this->mixer.name, strerror(errno));
+ __XINE_FUNCTION__, this->mixer.name, strerror(errno));
}
else
this->mixer.volume = value;
@@ -518,7 +519,7 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value)
}
else
printf("%s(): open() %s failed: %s\n",
- __FUNCTION__, this->mixer.name, strerror(errno));
+ __XINE_FUNCTION__, this->mixer.name, strerror(errno));
}
else
(void) ao_oss_set_property(&this->ao_driver, this->mixer.prop, this->mixer.volume);
diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c
index 8fe1c021d..29d3ec0f5 100644
--- a/src/demuxers/demux_asf.c
+++ b/src/demuxers/demux_asf.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: demux_asf.c,v 1.15 2001/11/26 13:29:54 miguelfreitas Exp $
+ * $Id: demux_asf.c,v 1.16 2001/11/30 00:53:51 f1rmb Exp $
*
* demultiplexer for asf streams
*
@@ -56,6 +56,8 @@
#define DEFRAG_BUFSIZE 65536
+#define VALID_ENDS "asf,wmv"
+
typedef struct {
int num;
int seq;
@@ -75,6 +77,8 @@ typedef struct {
typedef struct demux_asf_s {
demux_plugin_t demux_plugin;
+ config_values_t *config;
+
fifo_buffer_t *audio_fifo;
fifo_buffer_t *video_fifo;
@@ -1160,6 +1164,7 @@ static int demux_asf_open(demux_plugin_t *this_gen,
case STAGE_BY_EXTENSION: {
char *ending;
char *MRL;
+ char *m, *valid_ends;
MRL = input->get_mrl (input);
@@ -1172,12 +1177,18 @@ static int demux_asf_open(demux_plugin_t *this_gen,
if(!ending)
return DEMUX_CANNOT_HANDLE;
- if(!strcasecmp(ending, ".asf")) {
- this->input = input;
- return DEMUX_CAN_HANDLE;
- } else if(!strcasecmp(ending, ".wmv")) {
- this->input = input;
- return DEMUX_CAN_HANDLE;
+ xine_strdupa(valid_ends, (this->config->register_string(this->config,
+ "mrl.ends_asf", VALID_ENDS,
+ "valid mrls ending for asf demuxer",
+ NULL, NULL, NULL)));
+ while((m = xine_strsep(&valid_ends, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strcasecmp((ending + 1), m)) {
+ this->input = input;
+ return DEMUX_CAN_HANDLE;
+ }
}
}
break;
@@ -1205,7 +1216,6 @@ static int demux_asf_get_stream_length (demux_plugin_t *this_gen) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_asf_t *this;
- config_values_t *config;
if (iface != 6) {
printf( "demux_asf: plugin doesn't support plugin API version %d.\n"
@@ -1214,10 +1224,15 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
iface);
return NULL;
}
+
+ this = xine_xmalloc (sizeof (demux_asf_t));
+ this->config = xine->config;
- this = xine_xmalloc (sizeof (demux_asf_t));
- config = xine->config;
-
+ (void*) this->config->register_string(this->config,
+ "mrl.ends_asf", VALID_ENDS,
+ "valid mrls ending for asf demuxer",
+ NULL, NULL, NULL);
+
this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION;
this->demux_plugin.open = demux_asf_open;
this->demux_plugin.start = demux_asf_start;
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c
index 20d498857..0013fef61 100644
--- a/src/demuxers/demux_avi.c
+++ b/src/demuxers/demux_avi.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: demux_avi.c,v 1.53 2001/11/18 03:53:23 guenter Exp $
+ * $Id: demux_avi.c,v 1.54 2001/11/30 00:53:51 f1rmb Exp $
*
* demultiplexer for avi streams
*
@@ -46,6 +46,8 @@
#include "libw32dll/wine/windef.h"
#include "libw32dll/wine/vfw.h"
+#define VALID_ENDS "avi"
+
/* The following variable indicates the kind of error */
typedef struct
@@ -107,6 +109,8 @@ typedef struct
typedef struct demux_avi_s {
demux_plugin_t demux_plugin;
+ config_values_t *config;
+
fifo_buffer_t *audio_fifo;
fifo_buffer_t *video_fifo;
@@ -1036,31 +1040,41 @@ static int demux_avi_open(demux_plugin_t *this_gen,
case STAGE_BY_EXTENSION: {
char *ending, *mrl;
+ char *m, *valid_ends;
mrl = input->get_mrl (input);
ending = strrchr(mrl, '.');
if(ending) {
- if(!strcasecmp(ending, ".avi")) {
- this->input = input;
-
- if (strncmp(this->last_mrl, input->get_mrl (input), 1024)) {
- if (this->avi)
- AVI_close (this->avi);
- this->avi = AVI_init (this);
- }
-
- if (this->avi) {
- strncpy(this->last_mrl, input->get_mrl (input), 1024);
- return DEMUX_CAN_HANDLE;
- } else {
- printf ("demux_avi: AVI_init failed (AVI_errno: %d)\n",this->AVI_errno);
- return DEMUX_CANNOT_HANDLE;
+ xine_strdupa(valid_ends, (this->config->register_string(this->config,
+ "mrl.ends_avi", VALID_ENDS,
+ "valid mrls ending for avi demuxer",
+ NULL, NULL, NULL)));
+ while((m = xine_strsep(&valid_ends, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strcasecmp((ending + 1), m)) {
+
+ this->input = input;
+
+ if (strncmp(this->last_mrl, input->get_mrl (input), 1024)) {
+ if (this->avi)
+ AVI_close (this->avi);
+ this->avi = AVI_init (this);
+ }
+
+ if (this->avi) {
+ strncpy(this->last_mrl, input->get_mrl (input), 1024);
+ return DEMUX_CAN_HANDLE;
+ } else {
+ printf ("demux_avi: AVI_init failed (AVI_errno: %d)\n",this->AVI_errno);
+ return DEMUX_CANNOT_HANDLE;
+ }
}
}
}
-
return DEMUX_CANNOT_HANDLE;
}
break;
@@ -1096,7 +1110,6 @@ static int demux_avi_get_stream_length (demux_plugin_t *this_gen) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_avi_t *this;
- config_values_t *config;
if (iface != 6) {
printf( "demux_avi: this plugin doesn't support plugin API version %d.\n"
@@ -1106,8 +1119,13 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
return NULL;
}
- this = xine_xmalloc (sizeof (demux_avi_t));
- config = xine->config;
+ this = xine_xmalloc (sizeof (demux_avi_t));
+ this->config = xine->config;
+
+ (void*) this->config->register_string(this->config,
+ "mrl.ends_avi", VALID_ENDS,
+ "valid mrls ending for avi demuxer",
+ NULL, NULL, NULL);
this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION;
this->demux_plugin.open = demux_avi_open;
diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c
index c3e11d9e9..eb3bccec7 100644
--- a/src/demuxers/demux_elem.c
+++ b/src/demuxers/demux_elem.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: demux_elem.c,v 1.29 2001/11/18 03:53:23 guenter Exp $
+ * $Id: demux_elem.c,v 1.30 2001/11/30 00:53:51 f1rmb Exp $
*
* demultiplexer for elementary mpeg streams
*
@@ -36,20 +36,21 @@
#include "xine_internal.h"
#include "xineutils.h"
+#include "compat.h"
#include "demux.h"
-#ifndef __GNUC__
-#define __FUNCTION__ __func__
-#endif
-
#define NUM_PREVIEW_BUFFERS 50
#define DEMUX_MPEG_ELEM_IFACE_VERSION 1
+#define VALID_ENDS ".mpv"
+
typedef struct {
demux_plugin_t demux_plugin;
+ config_values_t *config;
+
fifo_buffer_t *video_fifo;
fifo_buffer_t *audio_fifo;
@@ -276,18 +277,28 @@ static int demux_mpeg_elem_open(demux_plugin_t *this_gen,
case STAGE_BY_EXTENSION: {
char *suffix;
char *MRL;
+ char *m, *valid_ends;
MRL = input->get_mrl (input);
suffix = strrchr(MRL, '.');
if(suffix) {
- if(!strcasecmp(suffix, ".mpv")) {
- this->input = input;
- return DEMUX_CAN_HANDLE;
+ xine_strdupa(valid_ends, (this->config->register_string(this->config,
+ "mrl.ends_elem", VALID_ENDS,
+ "valid mrls ending for elementary demuxer",
+ NULL, NULL, NULL)));
+ while((m = xine_strsep(&valid_ends, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strcasecmp((suffix + 1), m)) {
+ this->input = input;
+ return DEMUX_CAN_HANDLE;
+ }
}
}
-
+
return DEMUX_CANNOT_HANDLE;
}
break;
@@ -324,7 +335,6 @@ static int demux_mpeg_elem_get_stream_length(demux_plugin_t *this_gen) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpeg_elem_t *this;
- config_values_t *config;
if (iface != 6) {
printf( "demux_elem: plugin doesn't support plugin API version %d.\n"
@@ -334,8 +344,13 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
return NULL;
}
- this = malloc (sizeof (demux_mpeg_elem_t));
- config = xine->config;
+ this = malloc (sizeof (demux_mpeg_elem_t));
+ this->config = xine->config;
+
+ (void*) this->config->register_string(this->config,
+ "mrl.ends_elem", VALID_ENDS,
+ "valid mrls ending for elementary demuxer",
+ NULL, NULL, NULL);
this->demux_plugin.interface_version = DEMUX_MPEG_ELEM_IFACE_VERSION;
this->demux_plugin.open = demux_mpeg_elem_open;
@@ -349,4 +364,3 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
return &this->demux_plugin;
}
-
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index 49d0e62ab..61e2176dc 100644
--- a/src/demuxers/demux_mpeg.c
+++ b/src/demuxers/demux_mpeg.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: demux_mpeg.c,v 1.45 2001/11/18 03:53:23 guenter Exp $
+ * $Id: demux_mpeg.c,v 1.46 2001/11/30 00:53:51 f1rmb Exp $
*
* demultiplexer for mpeg 1/2 program streams
* reads streams of variable blocksizes
@@ -42,12 +42,17 @@
#include "demux.h"
#include "xineutils.h"
+#define VALID_MRLS "stdin,fifo"
+#define VALID_ENDS "mpg,mpeg,mpe"
+
#define NUM_PREVIEW_BUFFERS 150
typedef struct demux_mpeg_s {
demux_plugin_t demux_plugin;
+ config_values_t *config;
+
fifo_buffer_t *audio_fifo;
fifo_buffer_t *video_fifo;
@@ -821,21 +826,32 @@ static int demux_mpeg_open(demux_plugin_t *this_gen,
char *media;
char *ending;
char *MRL = input->get_mrl(input);
+ char *m, *valid_mrls, *valid_ends;
+
+ xine_strdupa(valid_mrls, (this->config->register_string(this->config,
+ "mrl.mrls_mpeg", VALID_MRLS,
+ "valid mrls for mpeg demuxer",
+ NULL, NULL, NULL)));
media = strstr(MRL, "://");
if (media) {
- if ((!(strncasecmp(MRL, "stdin", 5)))
- || (!(strncasecmp(MRL, "fifo", 4)))) {
-
- if(!(strncasecmp(media+3, "mpeg1", 5))) {
- this->input = input;
- return DEMUX_CAN_HANDLE;
- }
- else if(!(strncasecmp((media+3), "mpeg2", 5))) {
+ while((m = xine_strsep(&valid_mrls, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strncmp(MRL, m, strlen(m))) {
+
+ if(!strncmp((media + 3), "mpeg1", 5)) {
+ this->input = input;
+ return DEMUX_CAN_HANDLE;
+ }
+ else if(!strncasecmp((media + 3), "mpeg2", 5)) {
+ return DEMUX_CANNOT_HANDLE;
+ }
+
+ fprintf(stderr, "You should specify mpeg(mpeg1/mpeg2) stream type.\n");
return DEMUX_CANNOT_HANDLE;
}
- fprintf(stderr, "You should specify mpeg(mpeg1/mpeg2) stream type.\n");
- return DEMUX_CANNOT_HANDLE;
}
}
@@ -844,15 +860,22 @@ static int demux_mpeg_open(demux_plugin_t *this_gen,
if(!ending)
return DEMUX_CANNOT_HANDLE;
- if(!strcasecmp(ending, ".mpg")
- || (!strcasecmp(ending, ".mpeg"))
- || (!strcasecmp(ending, ".mpe"))) {
- this->input = input;
- return DEMUX_CAN_HANDLE;
+ xine_strdupa(valid_ends, (this->config->register_string(this->config,
+ "mrl.ends_mpeg", VALID_ENDS,
+ "valid mrls ending for mpeg demuxer",
+ NULL, NULL, NULL)));
+ while((m = xine_strsep(&valid_ends, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strcasecmp((ending + 1), m)) {
+ this->input = input;
+ return DEMUX_CAN_HANDLE;
+ }
}
}
break;
-
+
default:
return DEMUX_CANNOT_HANDLE;
break;
@@ -888,7 +911,6 @@ static int demux_mpeg_get_stream_length (demux_plugin_t *this_gen) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpeg_t *this;
- config_values_t *config;
if (iface != 6) {
printf( "demux_mpeg: plugin doesn't support plugin API version %d.\n"
@@ -898,9 +920,18 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
return NULL;
}
- this = xine_xmalloc (sizeof (demux_mpeg_t));
- config = xine->config;
-
+ this = xine_xmalloc (sizeof (demux_mpeg_t));
+ this->config = xine->config;
+
+ /* Calling register_string() configure valid mrls in configfile */
+ (void*) this->config->register_string(this->config, "mrl.mrls_mpeg", VALID_MRLS,
+ "valid mrls for mpeg demuxer",
+ NULL, NULL, NULL);
+ (void*) this->config->register_string(this->config,
+ "mrl.ends_mpeg", VALID_ENDS,
+ "valid mrls ending for mpeg demuxer",
+ NULL, NULL, NULL);
+
this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION;
this->demux_plugin.open = demux_mpeg_open;
this->demux_plugin.start = demux_mpeg_start;
@@ -913,3 +944,4 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
return (demux_plugin_t *) this;
}
+
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index cd272d55b..8f4639b59 100644
--- a/src/demuxers/demux_mpeg_block.c
+++ b/src/demuxers/demux_mpeg_block.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: demux_mpeg_block.c,v 1.64 2001/11/28 16:13:07 guenter Exp $
+ * $Id: demux_mpeg_block.c,v 1.65 2001/11/30 00:53:51 f1rmb Exp $
*
* demultiplexer for mpeg 1/2 program streams
*
@@ -38,13 +38,17 @@
#include "xineutils.h"
#include "demux.h"
+#define VALID_MRLS "dvd,stdin,fifo,d4d,dmd"
+#define VALID_ENDS "vob"
+
#define NUM_PREVIEW_BUFFERS 250
typedef struct demux_mpeg_block_s {
demux_plugin_t demux_plugin;
xine_t *xine;
-
+ config_values_t *config;
+
fifo_buffer_t *audio_fifo;
fifo_buffer_t *video_fifo;
@@ -905,19 +909,32 @@ static int demux_mpeg_block_open(demux_plugin_t *this_gen,
char *media;
char *ending;
char *MRL;
+ char *m, *valid_mrls, *valid_ends;
+
+ xine_strdupa(valid_mrls, (this->config->register_string(this->config,
+ "mrl.mrls_mpeg_block", VALID_MRLS,
+ "valid mrls for mpeg block demuxer",
+ NULL, NULL, NULL)));
MRL = input->get_mrl (input);
media = strstr(MRL, "://");
if(media) {
- if(!strncmp(MRL, "dvd", 3) || !strncmp(MRL, "d4d", 3) || !strncmp(MRL, "dmd", 3)
- || (((!strncmp(MRL, "stdin", 5) || !strncmp(MRL, "fifo", 4))
- && (!strncmp((media+3), "mpeg2", 5) )))
- ) {
- this->blocksize = 2048;
- demux_mpeg_block_accept_input (this, input);
- return DEMUX_CAN_HANDLE;
+
+ while((m = xine_strsep(&valid_mrls, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if((!strncmp(MRL, m, strlen(m)))
+ || ((!strncmp(MRL, m, strlen(m))) && (!strncmp((media + 3), "mpeg2", 5)))) {
+
+ this->blocksize = 2048;
+ demux_mpeg_block_accept_input(this, input);
+ return DEMUX_CAN_HANDLE;
+ }
+
}
+
if(!strncmp(MRL, "vcd", 3)) {
this->blocksize = 2324;
demux_mpeg_block_accept_input (this, input);
@@ -934,10 +951,19 @@ static int demux_mpeg_block_open(demux_plugin_t *this_gen,
if(!ending)
return DEMUX_CANNOT_HANDLE;
- if(!strcasecmp(ending, ".vob")) {
- this->blocksize = 2048;
- demux_mpeg_block_accept_input (this, input);
- return DEMUX_CAN_HANDLE;
+ xine_strdupa(valid_ends, (this->config->register_string(this->config,
+ "mrl.ends_mpeg_block", VALID_ENDS,
+ "valid mrls ending for mpeg block demuxer",
+ NULL, NULL, NULL)));
+ while((m = xine_strsep(&valid_ends, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strcasecmp((ending + 1), m)) {
+ this->blocksize = 2048;
+ demux_mpeg_block_accept_input (this, input);
+ return DEMUX_CAN_HANDLE;
+ }
}
}
break;
@@ -972,7 +998,6 @@ static int demux_mpeg_block_get_stream_length (demux_plugin_t *this_gen) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpeg_block_t *this;
- config_values_t *config;
if (iface != 6) {
printf( "demux_mpeg_block: plugin doesn't support plugin API version %d.\n"
@@ -982,9 +1007,18 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
return NULL;
}
- this = xine_xmalloc (sizeof (demux_mpeg_block_t));
- this->xine = xine;
- config = xine->config;
+ this = xine_xmalloc (sizeof (demux_mpeg_block_t));
+ this->xine = xine;
+ this->config = xine->config;
+
+ /* Calling register_string() configure valid mrls in configfile */
+ (void*) this->config->register_string(this->config, "mrl.mrls_mpeg_block", VALID_MRLS,
+ "valid mrls for mpeg block demuxer",
+ NULL, NULL, NULL);
+ (void*) this->config->register_string(this->config,
+ "mrl.ends_mpeg_block", VALID_ENDS,
+ "valid mrls ending for mpeg block demuxer",
+ NULL, NULL, NULL);
this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION;
this->demux_plugin.open = demux_mpeg_block_open;
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c
index cc7acebad..7e0546358 100644
--- a/src/demuxers/demux_mpgaudio.c
+++ b/src/demuxers/demux_mpgaudio.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: demux_mpgaudio.c,v 1.29 2001/11/18 03:53:23 guenter Exp $
+ * $Id: demux_mpgaudio.c,v 1.30 2001/11/30 00:53:51 f1rmb Exp $
*
* demultiplexer for mpeg audio (i.e. mp3) streams
*
@@ -36,18 +36,19 @@
#include "xine_internal.h"
#include "xineutils.h"
+#include "compat.h"
#include "demux.h"
-#ifndef __GNUC__
-#define __FUNCTION__ __func__
-#endif
-
#define DEMUX_MPGAUDIO_IFACE_VERSION 3
+#define VALID_ENDS "mp3,mp2,mpa,mpega"
+
typedef struct {
demux_plugin_t demux_plugin;
+ config_values_t *config;
+
fifo_buffer_t *audio_fifo;
fifo_buffer_t *video_fifo;
@@ -372,7 +373,8 @@ static int demux_mpgaudio_open(demux_plugin_t *this_gen,
case STAGE_BY_EXTENSION: {
char *suffix;
char *MRL;
-
+ char *m, *valid_ends;
+
MRL = input->get_mrl (input);
suffix = strrchr(MRL, '.');
@@ -380,12 +382,18 @@ static int demux_mpgaudio_open(demux_plugin_t *this_gen,
if(!suffix)
return DEMUX_CANNOT_HANDLE;
- if(!strcasecmp(suffix, ".mp3")
- || (!strcasecmp(suffix, ".mp2"))
- || (!strcasecmp(suffix, ".mpa"))
- || (!strcasecmp(suffix, ".mpega"))) {
- this->input = input;
- return DEMUX_CAN_HANDLE;
+ xine_strdupa(valid_ends, (this->config->register_string(this->config,
+ "mrl.ends_mgaudio", VALID_ENDS,
+ "valid mrls ending for mpeg audio demuxer",
+ NULL, NULL, NULL)));
+ while((m = xine_strsep(&valid_ends, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strcasecmp((suffix + 1), m)) {
+ this->input = input;
+ return DEMUX_CAN_HANDLE;
+ }
}
}
break;
@@ -430,7 +438,6 @@ static int demux_mpgaudio_get_stream_length (demux_plugin_t *this_gen) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpgaudio_t *this;
- config_values_t *config;
if (iface != 6) {
printf( "demux_mpeg: plugin doesn't support plugin API version %d.\n"
@@ -440,8 +447,13 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
return NULL;
}
- this = malloc (sizeof (demux_mpgaudio_t));
- config = xine->config;
+ this = malloc (sizeof (demux_mpgaudio_t));
+ this->config = xine->config;
+
+ (void*) this->config->register_string(this->config,
+ "mrl.ends_mgaudio", VALID_ENDS,
+ "valid mrls ending for mpeg audio demuxer",
+ NULL, NULL, NULL);
this->demux_plugin.interface_version = DEMUX_MPGAUDIO_IFACE_VERSION;
this->demux_plugin.open = demux_mpgaudio_open;
diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c
index f9d44e3ad..250cace76 100644
--- a/src/demuxers/demux_ogg.c
+++ b/src/demuxers/demux_ogg.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: demux_ogg.c,v 1.10 2001/11/18 03:53:23 guenter Exp $
+ * $Id: demux_ogg.c,v 1.11 2001/11/30 00:53:51 f1rmb Exp $
*
* demultiplexer for ogg streams
*
@@ -44,9 +44,13 @@
#define MAX_STREAMS 16
+#define VALID_ENDS "ogg"
+
typedef struct demux_ogg_s {
demux_plugin_t demux_plugin;
+ config_values_t *config;
+
fifo_buffer_t *audio_fifo;
fifo_buffer_t *video_fifo;
@@ -352,6 +356,7 @@ static int demux_ogg_open(demux_plugin_t *this_gen,
case STAGE_BY_EXTENSION: {
char *ending;
char *MRL;
+ char *m, *valid_ends;
MRL = input->get_mrl (input);
@@ -364,9 +369,18 @@ static int demux_ogg_open(demux_plugin_t *this_gen,
if(!ending)
return DEMUX_CANNOT_HANDLE;
- if(!strcasecmp(ending, ".ogg")) {
- this->input = input;
- return DEMUX_CAN_HANDLE;
+ xine_strdupa(valid_ends, (this->config->register_string(this->config,
+ "mrl.ends_ogg", VALID_ENDS,
+ "valid mrls ending for ogg demuxer",
+ NULL, NULL, NULL)));
+ while((m = xine_strsep(&valid_ends, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strcasecmp((ending + 1), m)) {
+ this->input = input;
+ return DEMUX_CAN_HANDLE;
+ }
}
}
break;
@@ -393,7 +407,6 @@ static int demux_ogg_get_stream_length (demux_plugin_t *this_gen) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_ogg_t *this;
- config_values_t *config;
if (iface != 6) {
printf( "demux_ogg: plugin doesn't support plugin API version %d.\n"
@@ -403,8 +416,13 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
return NULL;
}
- this = xine_xmalloc (sizeof (demux_ogg_t));
- config = xine->config;
+ this = xine_xmalloc (sizeof (demux_ogg_t));
+ this->config = xine->config;
+
+ (void*) this->config->register_string(this->config,
+ "mrl.ends_ogg", VALID_ENDS,
+ "valid mrls ending for ogg demuxer",
+ NULL, NULL, NULL);
this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION;
this->demux_plugin.open = demux_ogg_open;
diff --git a/src/demuxers/demux_pes.c b/src/demuxers/demux_pes.c
index 2fb0b9bcf..88065aa0a 100644
--- a/src/demuxers/demux_pes.c
+++ b/src/demuxers/demux_pes.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: demux_pes.c,v 1.14 2001/11/18 03:53:23 guenter Exp $
+ * $Id: demux_pes.c,v 1.15 2001/11/30 00:53:51 f1rmb Exp $
*
* demultiplexer for mpeg 2 PES (Packetized Elementary Streams)
* reads streams of variable blocksizes
@@ -43,10 +43,15 @@
#define NUM_PREVIEW_BUFFERS 400
+#define VALID_MRLS "fifo,stdin"
+#define VALID_ENDS "vdr"
+
typedef struct demux_pes_s {
demux_plugin_t demux_plugin;
+ config_values_t *config;
+
fifo_buffer_t *audio_fifo;
fifo_buffer_t *video_fifo;
@@ -479,20 +484,31 @@ static int demux_pes_open(demux_plugin_t *this_gen,
case STAGE_BY_EXTENSION: {
char *media;
char *ending;
+ char *m, *valid_mrls, *valid_ends;
char *MRL = input->get_mrl(input);
+ xine_strdupa(valid_mrls, (this->config->register_string(this->config,
+ "mrl.mrls_pes", VALID_MRLS,
+ "valid mrls for pes demuxer",
+ NULL, NULL, NULL)));
+
media = strstr(MRL, "://");
if(media) {
- if((!(strncasecmp(MRL, "stdin", 5)))
- || (!(strncasecmp(MRL, "fifo", 4)))) {
- if(!(strncasecmp(media+3, "pes", 3))) {
- this->input = input;
- return DEMUX_CAN_HANDLE;
+ while((m = xine_strsep(&valid_mrls, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strncmp(MRL, m, strlen(m))) {
+
+ if(!strncmp((media + 3), "pes", 3)) {
+ this->input = input;
+ return DEMUX_CAN_HANDLE;
+ }
+ return DEMUX_CANNOT_HANDLE;
+ }
+ else if(strncasecmp(MRL, "file", 4)) {
+ return DEMUX_CANNOT_HANDLE;
}
- return DEMUX_CANNOT_HANDLE;
- }
- else if(strncasecmp(MRL, "file", 4)) {
- return DEMUX_CANNOT_HANDLE;
}
}
@@ -501,9 +517,18 @@ static int demux_pes_open(demux_plugin_t *this_gen,
if(!ending)
return DEMUX_CANNOT_HANDLE;
- if(!strcasecmp(ending, ".vdr")) {
- this->input = input;
- return DEMUX_CAN_HANDLE;
+ xine_strdupa(valid_ends, (this->config->register_string(this->config,
+ "mrl.ends_pes", VALID_ENDS,
+ "valid mrls ending for pes demuxer",
+ NULL, NULL, NULL)));
+ while((m = xine_strsep(&valid_ends, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strcasecmp((ending + 1), m)) {
+ this->input = input;
+ return DEMUX_CAN_HANDLE;
+ }
}
}
break;
@@ -538,7 +563,6 @@ static int demux_pes_get_stream_length (demux_plugin_t *this_gen) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_pes_t *this;
- config_values_t *config;
if (iface != 6) {
printf( "demux_pes: plugin doesn't support plugin API version %d.\n"
@@ -548,9 +572,17 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
return NULL;
}
- this = xine_xmalloc (sizeof (demux_pes_t));
- config = xine->config;
+ this = xine_xmalloc (sizeof (demux_pes_t));
+ this->config = xine->config;
+ (void*) this->config->register_string(this->config, "mrl.mrls_pes", VALID_MRLS,
+ "valid mrls for pes demuxer",
+ NULL, NULL, NULL);
+ (void*) this->config->register_string(this->config,
+ "mrl.ends_pes", VALID_ENDS,
+ "valid mrls ending for pes demuxer",
+ NULL, NULL, NULL);
+
this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION;
this->demux_plugin.open = demux_pes_open;
this->demux_plugin.start = demux_pes_start;
diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c
index 2730ccce3..769dfad3d 100644
--- a/src/demuxers/demux_qt.c
+++ b/src/demuxers/demux_qt.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: demux_qt.c,v 1.15 2001/11/24 16:30:31 jkeil Exp $
+ * $Id: demux_qt.c,v 1.16 2001/11/30 00:53:51 f1rmb Exp $
*
* demultiplexer for quicktime streams, based on:
*
@@ -54,6 +54,8 @@
#include "libw32dll/wine/vfw.h"
#include "libw32dll/wine/mmreg.h"
+#define VALID_ENDS "mov"
+
/* OpenQuicktime Codec Parameter Types */
#define QUICKTIME_UNKNOWN_PARAMETER -1
#define QUICKTIME_STRING_PARAMETER 0
@@ -514,6 +516,8 @@ typedef struct quicktime_struc {
typedef struct demux_qt_s {
demux_plugin_t demux_plugin;
+ config_values_t *config;
+
fifo_buffer_t *audio_fifo;
fifo_buffer_t *video_fifo;
@@ -4334,6 +4338,7 @@ static int demux_qt_open(demux_plugin_t *this_gen,
case STAGE_BY_EXTENSION: {
char *suffix;
char *MRL;
+ char *m, *valid_ends;
MRL = input->get_mrl (input);
@@ -4342,9 +4347,18 @@ static int demux_qt_open(demux_plugin_t *this_gen,
if(!suffix)
return DEMUX_CANNOT_HANDLE;
- if (!strcasecmp(suffix, ".mov")) {
- this->input = input;
- return DEMUX_CAN_HANDLE;
+ xine_strdupa(valid_ends, (this->config->register_string(this->config,
+ "mrl.ends_qt", VALID_ENDS,
+ "valid mrls ending for qt demuxer",
+ NULL, NULL, NULL)));
+ while((m = xine_strsep(&valid_ends, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strcasecmp((suffix + 1), m)) {
+ this->input = input;
+ return DEMUX_CAN_HANDLE;
+ }
}
return DEMUX_CANNOT_HANDLE;
@@ -4378,7 +4392,6 @@ static int demux_qt_get_stream_length (demux_plugin_t *this_gen) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_qt_t *this;
- config_values_t *config;
if (iface != 6) {
printf( "demux_qt: plugin doesn't support plugin API version %d.\n"
@@ -4388,8 +4401,13 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
return NULL;
}
- this = xine_xmalloc (sizeof (demux_qt_t));
- config = xine->config;
+ this = xine_xmalloc (sizeof (demux_qt_t));
+ this->config = xine->config;
+
+ (void*) this->config->register_string(this->config,
+ "mrl.ends_qt", VALID_ENDS,
+ "valid mrls ending for qt demuxer",
+ NULL, NULL, NULL);
this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION;
this->demux_plugin.open = demux_qt_open;
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index add6bafd6..744f85a8a 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.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: demux_ts.c,v 1.29 2001/11/18 03:53:23 guenter Exp $
+ * $Id: demux_ts.c,v 1.30 2001/11/30 00:53:51 f1rmb Exp $
*
* Demultiplexer for MPEG2 Transport Streams.
*
@@ -68,6 +68,9 @@
#include "xineutils.h"
#include "demux.h"
+#define VALID_MRLS "fifo,stdin"
+#define VALID_ENDS "m2t,ts,trp"
+
/*
#define TS_LOG
*/
@@ -120,6 +123,8 @@ typedef struct {
*/
demux_plugin_t plugin;
+ config_values_t *config;
+
fifo_buffer_t *fifoAudio;
fifo_buffer_t *fifoVideo;
@@ -1075,35 +1080,61 @@ static int demux_ts_open(demux_plugin_t *this_gen, input_plugin_t *input,
char *mrl;
char *media;
char *ending;
-
+ char *m, *valid_mrls, *valid_ends;
+
switch (stage) {
case STAGE_BY_EXTENSION:
+
+ xine_strdupa(valid_mrls, (this->config->register_string(this->config,
+ "mrl.mrls_ts", VALID_MRLS,
+ "valid mrls for ts demuxer",
+ NULL, NULL, NULL)));
+
mrl = input->get_mrl(input);
media = strstr(mrl, "://");
+
if (media) {
fprintf (stderr, "demux %u ts_open! \n", __LINE__);
- if ((!(strncasecmp(mrl, "stdin", 5))) || (!(strncasecmp(mrl, "fifo", 4)))) {
- if(!(strncasecmp(media+3, "ts", 3))) {
- break;
+ while((m = xine_strsep(&valid_mrls, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strncmp(mrl, m, strlen(m))) {
+
+ if(!strncmp((media + 3), "ts", 2)) {
+ break;
+ }
+ return DEMUX_CANNOT_HANDLE;
+
+ }
+ else if(strncasecmp(mrl, "file", 4)) {
+ return DEMUX_CANNOT_HANDLE;
}
- return DEMUX_CANNOT_HANDLE;
- }
- else if (strncasecmp(mrl, "file", 4)) {
- return DEMUX_CANNOT_HANDLE;
}
}
+
ending = strrchr(mrl, '.');
if (ending) {
#ifdef TS_LOG
- xprintf(VERBOSE|DEMUX, "demux_ts_open: ending %s of %s\n", ending, mrl);
+ printf("demux_ts_open: ending %s of %s\n", ending, mrl);
#endif
- if ((!strcasecmp(ending, ".m2t")) ||
- (!strcasecmp(ending, ".ts")) ||
- (!strcasecmp(ending, ".trp")) ) {
- break;
+
+ xine_strdupa(valid_ends, (this->config->register_string(this->config,
+ "mrl.ends_ts", VALID_ENDS,
+ "valid mrls ending for ts demuxer",
+ NULL, NULL, NULL)));
+ while((m = xine_strsep(&valid_ends, ",")) != NULL) {
+
+ while(*m == ' ' || *m == '\t') m++;
+
+ if(!strcasecmp((ending + 1), m)) {
+ break;
+ }
}
}
return DEMUX_CANNOT_HANDLE;
+ break;
+
default:
return DEMUX_CANNOT_HANDLE;
}
@@ -1208,7 +1239,6 @@ static int demux_ts_get_stream_length (demux_plugin_t *this_gen) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_ts *this;
- config_values_t *config;
int i;
if (iface != 6) {
@@ -1222,8 +1252,16 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
/*
* Initialise the generic plugin.
*/
- this = xine_xmalloc(sizeof(*this));
- config = xine->config;
+ this = xine_xmalloc(sizeof(*this));
+ this->config = xine->config;
+
+ (void*) this->config->register_string(this->config, "mrl.mrls_ts", VALID_MRLS,
+ "valid mrls for ts demuxer",
+ NULL, NULL, NULL);
+ (void*) this->config->register_string(this->config,
+ "mrl.ends_ts", VALID_ENDS,
+ "valid mrls ending for ts demuxer",
+ NULL, NULL, NULL);
this->plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION;
this->plugin.open = demux_ts_open;
diff --git a/src/input/dvd_udf.c b/src/input/dvd_udf.c
index 6a3d839c5..e86012ff7 100644
--- a/src/input/dvd_udf.c
+++ b/src/input/dvd_udf.c
@@ -31,10 +31,7 @@
#include <fcntl.h>
#include "dvd_udf.h"
-
-#ifndef __GNUC__
-#define __FUNCTION__ __func__
-#endif
+#include "compat.h"
static int _Unicodedecode (uint8_t *data, int len, char *target);
@@ -288,7 +285,7 @@ int UDFMapICB (int fd, const struct AD *ICB, uint8_t *FileType, struct AD *File)
uint16_t TagID;
if ((LogBlock = (uint8_t*)malloc(DVD_VIDEO_LB_LEN)) == NULL) {
- fprintf(stderr, "%s: malloc failed\n", __FUNCTION__);
+ fprintf(stderr, "%s: malloc failed\n", __XINE_FUNCTION__);
return 0;
}
@@ -327,13 +324,13 @@ int UDFScanDir (int fd, const struct AD *Dir, char *FileName, struct AD *FileICB
LogBlock = (uint8_t*)malloc(DVD_VIDEO_LB_LEN * 30);
if ( !LogBlock ) {
- fprintf(stderr, MALLOC_FAILED, __FUNCTION__, DVD_VIDEO_LB_LEN * 30);
+ fprintf(stderr, MALLOC_FAILED, __XINE_FUNCTION__, DVD_VIDEO_LB_LEN * 30);
goto error_0;
}
filename = (char*)malloc(MAX_FILE_LEN);
if ( !filename ) {
- fprintf(stderr, MALLOC_FAILED, __FUNCTION__, MAX_FILE_LEN);
+ fprintf(stderr, MALLOC_FAILED, __XINE_FUNCTION__, MAX_FILE_LEN);
goto error_1;
}
@@ -399,13 +396,13 @@ int UDFFindPartition (int fd, int partnum, struct Partition *part)
Anchor = (uint8_t*)malloc(DVD_VIDEO_LB_LEN);
if ( !Anchor ) {
- fprintf(stderr, MALLOC_FAILED, __FUNCTION__, DVD_VIDEO_LB_LEN);
+ fprintf(stderr, MALLOC_FAILED, __XINE_FUNCTION__, DVD_VIDEO_LB_LEN);
goto error_0;
}
LogBlock = (uint8_t*)malloc(DVD_VIDEO_LB_LEN);
if ( !LogBlock ) {
- fprintf(stderr, MALLOC_FAILED, __FUNCTION__, DVD_VIDEO_LB_LEN);
+ fprintf(stderr, MALLOC_FAILED, __XINE_FUNCTION__, DVD_VIDEO_LB_LEN);
goto error_1;
}
@@ -496,13 +493,13 @@ off_t UDFFindFile (int fd, char *filename, off_t *size)
tokenline = (char*)malloc(MAX_FILE_LEN);
if ( !tokenline ) {
- fprintf(stderr, MALLOC_FAILED, __FUNCTION__, MAX_FILE_LEN);
+ fprintf(stderr, MALLOC_FAILED, __XINE_FUNCTION__, MAX_FILE_LEN);
goto error_0;
}
LogBlock = (uint8_t*)malloc(DVD_VIDEO_LB_LEN);
if ( !LogBlock ) {
- fprintf(stderr, MALLOC_FAILED, __FUNCTION__, DVD_VIDEO_LB_LEN);
+ fprintf(stderr, MALLOC_FAILED, __XINE_FUNCTION__, DVD_VIDEO_LB_LEN);
goto error_1;
}
@@ -584,21 +581,21 @@ void UDFListDir(int fd, char *dirname, int nMaxFiles, char **file_list, int *nFi
filename = (char*)malloc(MAX_FILE_LEN);
if ( !filename )
{
- fprintf(stderr, MALLOC_FAILED, __FUNCTION__, MAX_FILE_LEN);
+ fprintf(stderr, MALLOC_FAILED, __XINE_FUNCTION__, MAX_FILE_LEN);
goto error_0;
}
tokenline = (char*)malloc(MAX_FILE_LEN);
if ( !tokenline )
{
- fprintf(stderr, MALLOC_FAILED, __FUNCTION__, MAX_FILE_LEN);
+ fprintf(stderr, MALLOC_FAILED, __XINE_FUNCTION__, MAX_FILE_LEN);
goto error_1;
}
LogBlock = (uint8_t*)malloc(DVD_VIDEO_LB_LEN * 30);
if ( !LogBlock )
{
- fprintf(stderr, MALLOC_FAILED, __FUNCTION__, DVD_VIDEO_LB_LEN*30);
+ fprintf(stderr, MALLOC_FAILED, __XINE_FUNCTION__, DVD_VIDEO_LB_LEN*30);
goto error_2;
}
diff --git a/src/input/input_file.c b/src/input/input_file.c
index ae7267a2b..771108769 100644
--- a/src/input/input_file.c
+++ b/src/input/input_file.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: input_file.c,v 1.29 2001/11/18 03:53:23 guenter Exp $
+ * $Id: input_file.c,v 1.30 2001/11/30 00:53:51 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -37,14 +37,11 @@
#include "xine_internal.h"
#include "xineutils.h"
+#include "compat.h"
#include "input_plugin.h"
extern int errno;
-#ifndef __GNUC__
-#define __FUNCTION__ __func__
-#endif
-
#define MAXFILES 65535
#ifndef NAME_MAX
@@ -456,7 +453,7 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
if(linksize < 0) {
fprintf(stderr, "%s(%d): readlink() failed: %s\n",
- __FUNCTION__, __LINE__, strerror(errno));
+ __XINE_FUNCTION__, __LINE__, strerror(errno));
}
else {
dir_files[num_dir_files].link = (char *) xine_xmalloc(linksize + 1);
@@ -490,7 +487,7 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
if(linksize < 0) {
fprintf(stderr, "%s(%d): readlink() failed: %s\n",
- __FUNCTION__, __LINE__, strerror(errno));
+ __XINE_FUNCTION__, __LINE__, strerror(errno));
}
else {
hide_files[num_hide_files].link = (char *)
@@ -524,7 +521,7 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
if(linksize < 0) {
fprintf(stderr, "%s(%d): readlink() failed: %s\n",
- __FUNCTION__, __LINE__, strerror(errno));
+ __XINE_FUNCTION__, __LINE__, strerror(errno));
}
else {
norm_files[num_norm_files].link = (char *)
diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c
index b096417e5..d089bea05 100644
--- a/src/libspudec/spu.c
+++ b/src/libspudec/spu.c
@@ -35,7 +35,7 @@
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: spu.c,v 1.26 2001/11/28 22:19:12 miguelfreitas Exp $
+ * $Id: spu.c,v 1.27 2001/11/30 00:53:51 f1rmb Exp $
*
*/
@@ -58,25 +58,6 @@
#define LOG_DEBUG 1
*/
-#ifdef DEBUG
-
-# ifdef __GNUC__
-# define LOG(lvl, fmt...) fprintf (stderr, fmt);
-# else
-# define LOG(lvl, ...) fprintf (stderr, __VA_ARGS__);
-# endif
-
-#else /* !DEBUG */
-
-# ifdef __GNUC__
-# define LOG(lvl, fmt...)
-# else
-# define LOG(lvl, ...)
-# endif
-
-#endif /* !DEBUG */
-
-
/* Return value: reassembly complete = 1 */
int spu_reassembly (spu_seq_t *seq, int start, uint8_t *pkt_data, u_int pkt_len)
{
diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c
index 0c5811310..70a93b444 100644
--- a/src/libspudec/xine_decoder.c
+++ b/src/libspudec/xine_decoder.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: xine_decoder.c,v 1.36 2001/11/28 22:19:12 miguelfreitas Exp $
+ * $Id: xine_decoder.c,v 1.37 2001/11/30 00:53:51 f1rmb Exp $
*
* stuff needed to turn libspu into a xine decoder plugin
*/
@@ -43,24 +43,6 @@
#define LOG_DEBUG 1
*/
-#ifdef DEBUG
-
-# ifdef __GNUC__
-# define LOG(lvl, fmt...) fprintf (stderr, fmt);
-# else
-# define LOG(lvl, ...) fprintf (stderr, __VA_ARGS__);
-# endif
-
-#else /* !DEBUG */
-
-# ifdef __GNUC__
-# define LOG(lvl, fmt...)
-# else
-# define LOG(lvl, ...)
-# endif
-
-#endif /* !DEBUG */
-
static clut_t __default_clut[] = {
CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80),
CLUT_Y_CR_CB_INIT(0xbf, 0x80, 0x80),
@@ -371,35 +353,35 @@ static void spudec_event_listener(void *this_gen, xine_event_t *event_gen) {
vo_overlay_t *overlay = NULL;
spu_button_t *but = event->data;
#ifdef LOG_DEBUG
- xprintf (VERBOSE|SPU, "MALLOC1: overlay_event %p, len=%d\n",
- overlay_event,
- sizeof(spu_overlay_event_t));
+ printf ("MALLOC1: overlay_event %p, len=%d\n",
+ overlay_event,
+ sizeof(spu_overlay_event_t));
#endif
overlay_event = xine_xmalloc (sizeof(video_overlay_event_t));
#ifdef LOG_DEBUG
- xprintf (VERBOSE|SPU, "MALLOC2: overlay_event %p, len=%d\n",
- overlay_event,
- sizeof(spu_overlay_event_t));
- xprintf (VERBOSE|SPU, "MALLOC1: overlay %p, len=%d\n",
- overlay,
- sizeof(vo_overlay_t));
+ printf("MALLOC2: overlay_event %p, len=%d\n",
+ overlay_event,
+ sizeof(spu_overlay_event_t));
+ printf ("MALLOC1: overlay %p, len=%d\n",
+ overlay,
+ sizeof(vo_overlay_t));
#endif
overlay = xine_xmalloc (sizeof(vo_overlay_t));
#ifdef LOG_DEBUG
- xprintf (VERBOSE|SPU, "MALLOC2: overlay %p, len=%d\n",
- overlay,
- sizeof(vo_overlay_t));
+ printf ("MALLOC2: overlay %p, len=%d\n",
+ overlay,
+ sizeof(vo_overlay_t));
#endif
overlay_event->object.overlay=overlay;
#ifdef LOG_DEBUG
- xprintf (VERBOSE|SPU, "BUTTON\n");
- xprintf (VERBOSE|SPU, "\tshow=%d\n",but->show);
- xprintf (VERBOSE|SPU, "\tclut [%x %x %x %x]\n",
+ printf ("BUTTON\n");
+ printf ("\tshow=%d\n",but->show);
+ printf ("\tclut [%x %x %x %x]\n",
but->color[0], but->color[1], but->color[2], but->color[3]);
- xprintf (VERBOSE|SPU, "\ttrans [%d %d %d %d]\n",
+ printf ("\ttrans [%d %d %d %d]\n",
but->trans[0], but->trans[1], but->trans[2], but->trans[3]);
- xprintf (VERBOSE|SPU, "\tleft = %d right = %d top = %d bottom = %d\n",
+ printf ("\tleft = %d right = %d top = %d bottom = %d\n",
but->left, but->right, but->top, but->bottom );
#endif
if (!this->state.menu) return;
diff --git a/src/libw32dll/wine/debugtools.h b/src/libw32dll/wine/debugtools.h
index 58f4bb876..ff120a261 100644
--- a/src/libw32dll/wine/debugtools.h
+++ b/src/libw32dll/wine/debugtools.h
@@ -8,6 +8,8 @@
#include "config.h"
#include "windef.h"
+#include "compat.h"
+
struct _GUID;
#define TRACE __vprintf
@@ -38,12 +40,8 @@ enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL
#define __SET_DEBUGGING(dbcl,dbch,on) \
((on) ? ((dbch)[0] |= 1 << (dbcl)) : ((dbch)[0] &= ~(1 << (dbcl))))
-#ifndef __GNUC__
-#define __FUNCTION__ ""
-#endif
-
#define __DPRINTF(dbcl,dbch) \
- (!__GET_DEBUGGING(dbcl,(dbch)) || (dbg_header_##dbcl((dbch),__FUNCTION__),0)) ? \
+ (!__GET_DEBUGGING(dbcl,(dbch)) || (dbg_header_##dbcl((dbch),__XINE_FUNCTION__),0)) ? \
(void)0 : (void)dbg_printf
/* Exported definitions and macros */
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 0a3c5f566..61d00b732 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.58 2001/11/25 13:31:24 miguelfreitas Exp $
+ * $Id: load_plugins.c,v 1.59 2001/11/30 00:53:51 f1rmb Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -45,10 +45,7 @@
#include "metronom.h"
#include "configfile.h"
#include "xineutils.h"
-
-#ifndef __GNUC__
-#define __FUNCTION__ __func__
-#endif
+#include "compat.h"
/*
#define LOAD_LOG
@@ -93,7 +90,7 @@ void load_demux_plugins (xine_t *this,
if(this == NULL || config == NULL) {
printf("%s(%s@%d): parameter should be non null, exiting\n",
- __FILE__, __FUNCTION__, __LINE__);
+ __FILE__, __XINE_FUNCTION__, __LINE__);
exit(1);
}
@@ -343,7 +340,7 @@ static char **_xine_get_featured_input_plugin_ids(xine_t *this, int feature) {
plugin_ids[n] = (char *) malloc (strlen(ip->get_identifier(ip)) + 1 );
strcpy (plugin_ids[n], ip->get_identifier(ip));
/* printf("%s(%d): %s is featured\n", */
- /* __FUNCTION__, feature, ip->get_identifier(ip)); */
+ /* __XINE_FUNCTION__, feature, ip->get_identifier(ip)); */
n++;
}
@@ -416,7 +413,7 @@ void load_decoder_plugins (xine_t *this,
if(this == NULL || config == NULL) {
printf("%s(%s@%d): parameter should be non null, exiting\n",
- __FILE__, __FUNCTION__, __LINE__);
+ __FILE__, __XINE_FUNCTION__, __LINE__);
exit(1);
}
@@ -667,7 +664,7 @@ char **xine_list_video_output_plugins (int visual_type) {
}
} else {
fprintf(stderr, "load_plugins: %s - cannot access plugin dir: %s",
- __FUNCTION__, strerror(errno));
+ __XINE_FUNCTION__, strerror(errno));
}
remove_segv_handler();
@@ -856,7 +853,7 @@ char **xine_list_audio_output_plugins(void) {
}
} else {
fprintf (stderr, "load_plugins: %s - cannot access plugin dir: %s",
- __FUNCTION__, strerror(errno));
+ __XINE_FUNCTION__, strerror(errno));
}
remove_segv_handler();
diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c
index aaad50a63..96b550275 100644
--- a/src/xine-engine/osd.c
+++ b/src/xine-engine/osd.c
@@ -40,26 +40,14 @@
#define LOG_DEBUG 1
*/
-#ifdef DEBUG
-
-# ifdef __GNUC__
-# define LOG(lvl, fmt...) fprintf (stderr, fmt);
-# else
-# define LOG(lvl, ...) fprintf (stderr, __VA_ARGS__);
-# endif
-
-#else /* !DEBUG */
-
-# ifdef __GNUC__
-# define LOG(lvl, fmt...)
-# else
-# define LOG(lvl, ...)
-# endif
-
-#endif /* !DEBUG */
-
-
+#ifdef MAX
+#undef MAX
+#endif
#define MAX(a,b) ( (a) > (b) ) ? (a) : (b)
+
+#ifdef MIN
+#undef MIN
+#endif
#define MIN(a,b) ( (a) < (b) ) ? (a) : (b)
/*
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index f15eed2eb..2efb52cc2 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.81 2001/11/28 22:19:12 miguelfreitas Exp $
+ * $Id: xine.c,v 1.82 2001/11/30 00:53:51 f1rmb Exp $
*
* top-level xine functions
*
@@ -53,10 +53,7 @@
#include "osd.h"
#include "xineutils.h"
-
-#ifndef __GNUC__
-#define __FUNCTION__ __func__
-#endif
+#include "compat.h"
void * xine_notify_stream_finished_thread (void * this_gen) {
xine_t *this = this_gen;
@@ -161,7 +158,7 @@ static int try_demux_with_stages(xine_t *this, const char *MRL,
if(stages[0] == -1) {
fprintf(stderr, "%s(%d) wrong first stage = %d !!\n",
- __FUNCTION__, __LINE__, stage1);
+ __XINE_FUNCTION__, __LINE__, stage1);
return 0;
}
@@ -435,6 +432,8 @@ xine_t *xine_init (vo_driver_t *vo,
this->video_out = vo_new_instance (vo, this->metronom);
video_decoder_init (this);
+
+#ifdef USE_OSD
this->osd_renderer = osd_renderer_init( this->video_out->overlay_source );
osd_renderer_load_font( this->osd_renderer, "vga" );
@@ -447,6 +446,7 @@ xine_t *xine_init (vo_driver_t *vo,
osd_set_position(osd,10,10);
osd_show(osd,0);
}
+#endif
if(ao)
this->audio_out = ao_new_instance (ao, this->metronom, config);
diff --git a/src/xine-utils/Makefile.am b/src/xine-utils/Makefile.am
index 2f6da8855..22d6a99d3 100644
--- a/src/xine-utils/Makefile.am
+++ b/src/xine-utils/Makefile.am
@@ -12,7 +12,7 @@ libxineutils_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-release $(LT_RELEASE)
-include_HEADERS = xineutils.h attributes.h
+include_HEADERS = xineutils.h attributes.h compat.h
debug:
diff --git a/src/xine-utils/compat.h b/src/xine-utils/compat.h
new file mode 100644
index 000000000..1eac305b7
--- /dev/null
+++ b/src/xine-utils/compat.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: compat.h,v 1.1 2001/11/30 00:53:51 f1rmb Exp $
+ *
+ */
+
+#ifndef XINE_COMPAT_H
+#define XINE_COMPAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __GNUC__
+#define __XINE_FUNCTION__ __func__
+#else
+#define __XINE_FUNCTION__ __FUNCTION__
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c
index 3fe910b15..11e45e5cd 100644
--- a/src/xine-utils/utils.c
+++ b/src/xine-utils/utils.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: utils.c,v 1.3 2001/11/17 22:40:01 miguelfreitas Exp $
+ * $Id: utils.c,v 1.4 2001/11/30 00:53:51 f1rmb Exp $
*
*/
#define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */
@@ -36,10 +36,7 @@
#include <sys/types.h>
#include <pthread.h>
-#ifndef __GNUC__
-#define __FUNCTION__ __func__
-#endif
-
+#include "compat.h"
/*
*
@@ -49,7 +46,7 @@ void *xine_xmalloc(size_t size) {
if((ptr = malloc(size)) == NULL) {
fprintf(stderr, "%s: malloc() failed: %s.\n",
- __FUNCTION__, strerror(errno));
+ __XINE_FUNCTION__, strerror(errno));
return NULL;
}
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h
index 1655b3dd8..a4a689f4a 100644
--- a/src/xine-utils/xineutils.h
+++ b/src/xine-utils/xineutils.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: xineutils.h,v 1.3 2001/11/18 03:53:25 guenter Exp $
+ * $Id: xineutils.h,v 1.4 2001/11/30 00:53:51 f1rmb Exp $
*
*/
#ifndef XINEUTILS_H
@@ -30,6 +30,7 @@ extern "C" {
#include <unistd.h>
#include <inttypes.h>
#include "attributes.h"
+#include "compat.h"
/* CPU Acceleration */
@@ -540,12 +541,27 @@ void xine_probe_fast_memcpy(config_values_t *config);
/* Debugging/Monitoring */
-#ifdef __GNUC__
+#ifdef __GNUC__
#define perr(FMT,ARGS...) {fprintf(stderr, FMT, ##ARGS);fflush(stderr);}
-#else /* C99 version: */
+#else /* C99 version: */
#define perr(...) {fprintf(stderr, __VA_ARGS__);fflush(stderr);}
#endif
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+#define xlerror(...) do { \
+ printf("XINE lib %s:%d:(%s) ", __FILE__, __LINE__, __XINE_FUNCTION__); \
+ printf(__VA_ARGS__); \
+ printf("\n"); \
+} while (0)
+#else
+#define xlerror(args...) do { \
+ printf("XINE lib %s:%d:(%s) ", __FILE__, __LINE__, __XINE_FUNCTION__); \
+ printf(##args); \
+ printf("\n"); \
+} while (0)
+#endif
+
+
#ifdef DEBUG
/*
* Debug stuff
@@ -608,6 +624,79 @@ char *xine_chomp (char *str);
void xine_usec_sleep(unsigned usec);
+ /*
+ * Some string functions
+ */
+
+
+void xine_strdupa(char *dest, char *src);
+#define xine_strdupa(d, s) { \
+ (d) = NULL; \
+ if((s) != NULL) { \
+ (d) = (char *) alloca(strlen((s)) + 1); \
+ strcpy((d), (s)); \
+ } \
+}
+
+/* Shamefully copied from glibc 2.2.3 */
+#ifdef HAVE_STRPBRK
+#define xine_strpbrk strpbrk
+#else
+static inline char *_x_strpbrk(const char *s, const char *accept) {
+
+ while(*s != '\0') {
+ const char *a = accept;
+ while(*a != '\0')
+ if(*a++ == *s)
+ return(char *) s;
+ ++s;
+ }
+
+ return NULL;
+}
+#define xine_strpbrk _x_strpbrk
+#endif
+
+#ifdef HAVE_STRSEP
+#define xine_strsep strsep
+#else
+static inline char *_x_strsep(char **stringp, const char *delim) {
+ char *begin, *end;
+
+ begin = *stringp;
+ if(begin == NULL)
+ return NULL;
+
+ if(delim[0] == '\0' || delim[1] == '\0') {
+ char ch = delim[0];
+
+ if(ch == '\0')
+ end = NULL;
+ else {
+ if(*begin == ch)
+ end = begin;
+ else if(*begin == '\0')
+ end = NULL;
+ else
+ end = strchr(begin + 1, ch);
+ }
+ }
+ else
+ end = xine_strpbrk(begin, delim);
+
+ if(end) {
+ *end++ = '\0';
+ *stringp = end;
+ }
+ else
+ *stringp = NULL;
+
+ return begin;
+}
+#define xine_strsep _x_strsep
+#endif
+
+
#ifdef __cplusplus
}
#endif