From e83128d4e0e1882a53943c2df3f7e64885223a3a Mon Sep 17 00:00:00 2001 From: Daniel Caujolle-Bert Date: Fri, 30 Nov 2001 21:55:05 +0000 Subject: Add an automatic way for input plugin to add extra valid mrls: add at bottom of init_input_plugin() a line like this: REGISTER_VALID_MRLS(this->config, "mrl.mrls_mpeg_block", "xxx"); CVS patchset: 1147 CVS date: 2001/11/30 21:55:05 --- src/input/input_plugin.h | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'src/input') diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index eb9a597c3..f14edf5ab 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_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: input_plugin.h,v 1.16 2001/10/22 22:50:01 richwareham Exp $ + * $Id: input_plugin.h,v 1.17 2001/11/30 21:55:05 f1rmb Exp $ */ #ifndef HAVE_INPUT_PLUGIN_H @@ -140,6 +140,40 @@ extern void *xmalloc(size_t); } \ } +#define REGISTER_VALID_MRLS(config, mrltype, mrls) { \ + cfg_entry_t *entry; \ + char *sticky; \ + char *v_mrls; \ + char *a_def = NULL; \ + \ + (config)->register_empty((config), (mrltype)); \ + entry = (config)->lookup_entry((config), (mrltype)); \ + \ + sticky = entry->str_sticky; \ + v_mrls = (entry->str_value) ? entry->str_value : entry->unknown_value; \ + \ + if(v_mrls) { \ + a_def = strstr(v_mrls, (mrls)); \ + if(a_def) \ + goto __done; \ + } \ + \ + if(!sticky) { \ + sticky = (char *) xine_xmalloc(strlen((mrls)) + 2); \ + sprintf(sticky, ",%s", (mrls)); \ + entry->str_sticky = sticky; \ + } \ + else { \ + a_def = strstr(sticky, (mrls)); \ + if(!a_def) { \ + sticky = (char *) realloc(sticky, strlen((mrls)) + 2); \ + sprintf(sticky, "%s,%s", sticky, (mrls)); \ + } \ + } \ +__done: \ +} + + typedef struct { char *origin; /* Origin of grabbed mrls (eg: path for file plugin */ char *mrl; /* :// */ -- cgit v1.2.3