From f518cf7ea99e9282508f551ecb43892f6aabcbc4 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 23 Apr 2008 06:35:36 +0300 Subject: Add option pointer to stream struct (at least temporarily) The stream code does not access many option variables directly, but it does access some such as audio_id and network_bandwidth (and does that without including proper headers for them). Add option pointer to the stream struct to allow access to those variables. Remove the unused (always NULL) and clumsy-looking char** options parameter in the open_stream call and replace it with the option pointer. The parameter is currently only set in the main open_stream() call in MPlayer.c and not in any other locations that can open a stream. In the long term it might be better to pass a more limited set of values somehow, but this should do for now. --- stream/stream.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'stream/stream.c') diff --git a/stream/stream.c b/stream/stream.c index f9ce23cfb8..ded692eca0 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -121,9 +121,11 @@ static const stream_info_t* const auto_open_streams[] = { NULL }; -static stream_t* open_stream_plugin(const stream_info_t* sinfo,char* filename,int mode, - char** options, int* file_format, int* ret, - char** redirected_url) { +static stream_t *open_stream_plugin(const stream_info_t *sinfo, char *filename, + int mode, struct MPOpts *options, + int *file_format, int *ret, + char **redirected_url) +{ void* arg = NULL; stream_t* s; m_struct_t* desc = (m_struct_t*)sinfo->opts; @@ -140,18 +142,9 @@ static stream_t* open_stream_plugin(const stream_info_t* sinfo,char* filename,in return NULL; } } - if(options) { - int i; - for(i = 0 ; options[i] != NULL ; i += 2) { - mp_msg(MSGT_OPEN,MSGL_DBG2, "Set stream arg %s=%s\n", - options[i],options[i+1]); - if(!m_struct_set(desc,arg,options[i],options[i+1])) - mp_msg(MSGT_OPEN,MSGL_WARN, "Failed to set stream option %s=%s\n", - options[i],options[i+1]); - } - } } s = new_stream(-2,-2); + s->opts = options; s->url=strdup(filename); s->flags |= mode; *ret = sinfo->open(s,mode,arg,file_format); @@ -188,7 +181,9 @@ static stream_t* open_stream_plugin(const stream_info_t* sinfo,char* filename,in } -stream_t* open_stream_full(char* filename,int mode, char** options, int* file_format) { +stream_t *open_stream_full(char *filename,int mode, struct MPOpts *options, + int* file_format) +{ int i,j,l,r; const stream_info_t* sinfo; stream_t* s; @@ -230,7 +225,8 @@ stream_t* open_stream_full(char* filename,int mode, char** options, int* file_fo return NULL; } -stream_t* open_output_stream(char* filename,char** options) { +stream_t *open_output_stream(char *filename, struct MPOpts *options) +{ int file_format; //unused if(!filename) { mp_msg(MSGT_OPEN,MSGL_ERR,"open_output_stream(), NULL filename, report this bug\n"); -- cgit v1.2.3