diff options
author | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2001-11-30 00:53:50 +0000 |
---|---|---|
committer | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2001-11-30 00:53:50 +0000 |
commit | 873578a7965683e3e76420731c1d571908b54848 (patch) | |
tree | cd8153e478f39f9aac7c851672996a8e58ace71e /src/demuxers | |
parent | ad5f52afbed82f29ba0816255edf1ff63533a2ff (diff) | |
download | xine-lib-873578a7965683e3e76420731c1d571908b54848.tar.gz xine-lib-873578a7965683e3e76420731c1d571908b54848.tar.bz2 |
Valid mrls are no more static (except few ones), like file suffix too.
First draft of compat.h (almost empty for now).
CVS patchset: 1139
CVS date: 2001/11/30 00:53:50
Diffstat (limited to 'src/demuxers')
-rw-r--r-- | src/demuxers/demux_asf.c | 37 | ||||
-rw-r--r-- | src/demuxers/demux_avi.c | 58 | ||||
-rw-r--r-- | src/demuxers/demux_elem.c | 40 | ||||
-rw-r--r-- | src/demuxers/demux_mpeg.c | 74 | ||||
-rw-r--r-- | src/demuxers/demux_mpeg_block.c | 68 | ||||
-rw-r--r-- | src/demuxers/demux_mpgaudio.c | 42 | ||||
-rw-r--r-- | src/demuxers/demux_ogg.c | 32 | ||||
-rw-r--r-- | src/demuxers/demux_pes.c | 64 | ||||
-rw-r--r-- | src/demuxers/demux_qt.c | 32 | ||||
-rw-r--r-- | src/demuxers/demux_ts.c | 72 |
10 files changed, 375 insertions, 144 deletions
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; |