From fb33e286b5c23dbe8d0aeaf63cd3490bed3906e3 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sat, 26 Apr 2008 10:44:59 +0300 Subject: Move global mconfig to mpctx The global was used in the function cfg_include which handles the -include option. Make the address available in that function by creating a new dynamically allocated option in m_config_new that has the address in the option's private data. asxparser.c also used the global. Making it available through all ways the code could get called required a number of relatively straightforward changes to playtree and menu code. --- asxparser.c | 14 ++++++------- asxparser.h | 6 ++++-- cfg-common-opts.h | 1 - command.c | 2 +- libmenu/menu.c | 14 +++++++++---- libmenu/menu.h | 3 ++- libmenu/menu_cmdlist.c | 2 +- libmenu/menu_param.c | 2 +- m_config.c | 11 ++++++++-- m_config.h | 3 ++- mencoder.c | 2 +- mp_core.h | 1 + mplayer.c | 57 +++++++++++++++++++++++++------------------------- parser-mpcmd.c | 8 ++++--- playtree.h | 5 +++-- playtreeparser.c | 23 ++++++++++---------- playtreeparser.h | 3 ++- 17 files changed, 89 insertions(+), 68 deletions(-) diff --git a/asxparser.c b/asxparser.c index cf72875886..554a006929 100644 --- a/asxparser.c +++ b/asxparser.c @@ -14,8 +14,6 @@ #include "mp_msg.h" #include "m_config.h" -extern m_config_t* mconfig; - ////// List utils void @@ -109,8 +107,10 @@ asx_attrib_to_enum(const char* val,char** valid_vals) { #define asx_warning_body_parse_error(p,e) mp_msg(MSGT_PLAYTREE,MSGL_WARN,"At line %d : error while parsing %s body",p->line,e) ASX_Parser_t* -asx_parser_new(void) { +asx_parser_new(struct m_config *mconfig) +{ ASX_Parser_t* parser = calloc(1,sizeof(ASX_Parser_t)); + parser->mconfig = mconfig; return parser; } @@ -426,7 +426,7 @@ asx_parse_param(ASX_Parser_t* parser, char** attribs, play_tree_t* pt) { return; } val = asx_get_attrib("VALUE",attribs); - if(m_config_get_option(mconfig,name) == NULL) { + if(m_config_get_option(parser->mconfig,name) == NULL) { mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Found unknown param in asx: %s",name); if(val) mp_msg(MSGT_PLAYTREE,MSGL_WARN,"=%s\n",val); @@ -494,7 +494,7 @@ asx_parse_entryref(ASX_Parser_t* parser,char* buffer,char** _attribs) { mp_msg(MSGT_PLAYTREE,MSGL_V,"Adding playlist %s to element entryref\n",href); - ptp = play_tree_parser_new(stream,parser->deep+1); + ptp = play_tree_parser_new(stream, parser->mconfig, parser->deep+1); pt = play_tree_parser_get_play_tree(ptp, 1); @@ -611,11 +611,11 @@ asx_parse_repeat(ASX_Parser_t* parser,char* buffer,char** _attribs) { play_tree_t* -asx_parser_build_tree(char* buffer,int deep) { +asx_parser_build_tree(struct m_config *mconfig, char* buffer,int deep) { char *element,*asx_body,**asx_attribs,*body = NULL, **attribs; int r; play_tree_t *asx,*entry,*list = NULL; - ASX_Parser_t* parser = asx_parser_new(); + ASX_Parser_t* parser = asx_parser_new(mconfig); parser->line = 1; parser->deep = deep; diff --git a/asxparser.h b/asxparser.h index 2d9b860707..7b148a7775 100644 --- a/asxparser.h +++ b/asxparser.h @@ -14,10 +14,12 @@ struct ASX_Parser_t { int ret_stack_size; char* last_body; int deep; + struct m_config *mconfig; }; - + +struct m_config; ASX_Parser_t* -asx_parser_new(void); +asx_parser_new(struct m_config *mconfig); void asx_parser_free(ASX_Parser_t* parser); diff --git a/cfg-common-opts.h b/cfg-common-opts.h index 36e43f65c8..b2e47faf18 100644 --- a/cfg-common-opts.h +++ b/cfg-common-opts.h @@ -9,7 +9,6 @@ #ifdef USE_ICONV {"msgcharset", &mp_msg_charset, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, #endif - {"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL}, #ifdef WIN32 {"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL}, #endif diff --git a/command.c b/command.c index cb277ac5c5..6eff9f1760 100644 --- a/command.c +++ b/command.c @@ -2605,7 +2605,7 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) break; case MP_CMD_LOADLIST:{ - play_tree_t *e = parse_playlist_file(cmd->args[0].v.s); + play_tree_t *e = parse_playlist_file(mpctx->mconfig, cmd->args[0].v.s); if (!e) mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_PlaylistLoadUnable, cmd->args[0].v.s); diff --git a/libmenu/menu.c b/libmenu/menu.c index 3c47623ed6..6d3c6fb83e 100644 --- a/libmenu/menu.c +++ b/libmenu/menu.c @@ -71,6 +71,7 @@ double menu_mouse_y = -1.0; int menu_mouse_pos_updated = 0; static struct MPContext *menu_ctx = NULL; +static struct m_config *menu_mconfig = NULL; static menu_def_t* menu_list = NULL; static int menu_count = 0; static menu_cmd_bindings_t *cmd_bindings = NULL; @@ -85,11 +86,12 @@ menu_cmd_bindings_t *get_cmd_bindings(const char *name) { return NULL; } -static int menu_parse_config(char* buffer) { +static int menu_parse_config(char* buffer, struct m_config *mconfig) +{ char *element,*body, **attribs, *name; menu_info_t* minfo = NULL; int r,i; - ASX_Parser_t* parser = asx_parser_new(); + ASX_Parser_t* parser = asx_parser_new(mconfig); while(1) { r = asx_get_element(parser,&buffer,&element,&body,&attribs); @@ -211,7 +213,9 @@ static int menu_parse_config(char* buffer) { #define BUF_STEP 1024 #define BUF_MIN 128 #define BUF_MAX BUF_STEP*1024 -int menu_init(struct MPContext *mpctx, char* cfg_file) { +int menu_init(struct MPContext *mpctx, struct m_config *mconfig, + char* cfg_file) +{ char* buffer = NULL; int bl = BUF_STEP, br = 0; int f, fd; @@ -250,7 +254,8 @@ int menu_init(struct MPContext *mpctx, char* cfg_file) { close(fd); menu_ctx = mpctx; - f = menu_parse_config(buffer); + menu_mconfig = mconfig; + f = menu_parse_config(buffer, mconfig); free(buffer); return f; } @@ -311,6 +316,7 @@ menu_t* menu_open(char *name) { m->priv_st = &(menu_list[i].type->priv_st); m->priv = m_struct_copy(m->priv_st,menu_list[i].cfg); m->ctx = menu_ctx; + m->mconfig = menu_mconfig; m->type = &menu_list[i]; if(menu_list[i].type->open(m,menu_list[i].args)) return m; diff --git a/libmenu/menu.h b/libmenu/menu.h index 2d62a5be89..7b63fad547 100644 --- a/libmenu/menu.h +++ b/libmenu/menu.h @@ -13,6 +13,7 @@ struct m_struct_st; struct menu_s { struct MPContext *ctx; + struct m_config *mconfig; void (*draw)(menu_t* menu,mp_image_t* mpi); void (*read_cmd)(menu_t* menu,int cmd); int (*read_key)(menu_t* menu,int cmd); @@ -52,7 +53,7 @@ typedef struct menu_info_s { #define MENU_CMD_CLICK 11 /// Global init/uninit -int menu_init(struct MPContext *mpctx, char* cfg_file); +int menu_init(struct MPContext *mpctx, struct m_config *mconfig, char* cfg_file); void menu_uninit(void); /// Open a menu defined in the config file diff --git a/libmenu/menu_cmdlist.c b/libmenu/menu_cmdlist.c index ab7cbeb3a9..13025c222c 100644 --- a/libmenu/menu_cmdlist.c +++ b/libmenu/menu_cmdlist.c @@ -98,7 +98,7 @@ static int parse_args(menu_t* menu,char* args) { char *element,*body, **attribs, *name; list_entry_t* m = NULL; int r; - ASX_Parser_t* parser = asx_parser_new(); + ASX_Parser_t* parser = asx_parser_new(menu->mconfig); while(1) { r = asx_get_element(parser,&args,&element,&body,&attribs); diff --git a/libmenu/menu_param.c b/libmenu/menu_param.c index a1aeef44bd..6eadf8825d 100644 --- a/libmenu/menu_param.c +++ b/libmenu/menu_param.c @@ -94,7 +94,7 @@ static int parse_args(menu_t* menu,char* args) { list_entry_t* m = NULL; int r; m_option_t* opt; - ASX_Parser_t* parser = asx_parser_new(); + ASX_Parser_t* parser = asx_parser_new(menu->mconfig); while(1) { diff --git a/m_config.c b/m_config.c index 02a2898dee..fc61494f0d 100644 --- a/m_config.c +++ b/m_config.c @@ -55,8 +55,9 @@ static void m_option_set(const m_config_t *config, const m_option_t *opt, -m_config_t* -m_config_new(void *optstruct) { +m_config_t *m_config_new(void *optstruct, + int includefunc(m_option_t *conf, char *filename)) +{ m_config_t* config; static int initialized = 0; static m_option_type_t profile_opt_type; @@ -80,6 +81,12 @@ m_config_new(void *optstruct) { for (i = 0; self_opts[i].name; i++) self_opts[i].priv = config; m_config_register_options(config, self_opts); + if (includefunc) { + struct m_option *p = talloc_ptrtype(config, p); + *p = (struct m_option){"include", includefunc, CONF_TYPE_FUNC_PARAM, + CONF_NOSAVE, 0, 0, config}; + m_config_add_option(config, p, NULL); + } config->optstruct = optstruct; return config; diff --git a/m_config.h b/m_config.h index 156f7b8fbb..60064e8771 100644 --- a/m_config.h +++ b/m_config.h @@ -96,7 +96,8 @@ typedef struct m_config { /** \ingroup Config */ m_config_t* -m_config_new(void *optstruct); +m_config_new(void *optstruct, + int includefunc(struct m_option *conf, char *filename)); /// Free a config object. void diff --git a/mencoder.c b/mencoder.c index 54dc1c0776..6767000501 100644 --- a/mencoder.c +++ b/mencoder.c @@ -419,7 +419,7 @@ audio_encoder_t *aencoder = NULL; // Create the config context and register the options set_default_mencoder_options(&opts); - mconfig = m_config_new(&opts); + mconfig = m_config_new(&opts, cfg_include); m_config_register_options(mconfig,mencoder_opts); // Preparse the command line diff --git a/mp_core.h b/mp_core.h index 7c8d3b4d5a..96846ae5d2 100644 --- a/mp_core.h +++ b/mp_core.h @@ -37,6 +37,7 @@ typedef struct MPContext { struct MPOpts opts; + struct m_config *mconfig; struct vo_x11_state *x11_state; int osd_show_percentage; int osd_function; diff --git a/mplayer.c b/mplayer.c index 3a18f68a6a..7df1140047 100644 --- a/mplayer.c +++ b/mplayer.c @@ -134,18 +134,12 @@ extern int import_initial_playtree_into_gui(play_tree_t* my_playtree, m_config_t #include "parser-cfg.h" #include "parser-mpcmd.h" -m_config_t* mconfig; - //**************************************************************************// // Config file //**************************************************************************// static int cfg_inc_verbose(m_option_t *conf){ ++verbose; return 0;} -static int cfg_include(m_option_t *conf, char *filename){ - return m_config_parse_config_file(mconfig, filename); -} - #include "get_path.h" //**************************************************************************// @@ -685,8 +679,8 @@ void exit_player_with_rc(struct MPContext *mpctx, const char* how, int rc){ current_module="exit_player"; // free mplayer config - if(mconfig) - m_config_free(mconfig); + if(mpctx->mconfig) + m_config_free(mpctx->mconfig); if(mpctx->playtree) play_tree_free(mpctx->playtree, 1); @@ -791,6 +785,11 @@ extern void mp_input_register_options(m_config_t* cfg); #include "cfg-mplayer.h" +static int cfg_include(m_option_t *conf, char *filename) +{ + return m_config_parse_config_file(conf->priv, filename); +} + static void parse_cfgfiles(struct MPContext *mpctx, m_config_t* conf) { char *conffile; @@ -955,7 +954,7 @@ static int playtree_add_playlist(struct MPContext *mpctx, play_tree_t* entry) #ifdef HAVE_NEW_GUI if (use_gui) { if (entry) { - import_playtree_playlist_into_gui(entry, mconfig); + import_playtree_playlist_into_gui(entry, mpctx->mconfig); play_tree_free_list(entry,1); } } else @@ -2575,12 +2574,12 @@ int gui_no_filename=0; struct MPOpts *opts = &mpctx->opts; set_default_mplayer_options(opts); // Create the config context and register the options - mconfig = m_config_new(opts); - m_config_register_options(mconfig,mplayer_opts); - mp_input_register_options(mconfig); + mpctx->mconfig = m_config_new(opts, cfg_include); + m_config_register_options(mpctx->mconfig,mplayer_opts); + mp_input_register_options(mpctx->mconfig); // Preparse the command line - m_config_preparse_command_line(mconfig,argc,argv); + m_config_preparse_command_line(mpctx->mconfig,argc,argv); print_version(); #if defined(WIN32) && defined(USE_WIN32DLL) @@ -2606,19 +2605,19 @@ int gui_no_filename=0; use_gui=1; } - parse_cfgfiles(mpctx, mconfig); + parse_cfgfiles(mpctx, mpctx->mconfig); #ifdef HAVE_NEW_GUI if ( use_gui ) cfg_read(); #endif - mpctx->playtree = m_config_parse_mp_command_line(mconfig, argc, argv); + mpctx->playtree = m_config_parse_mp_command_line(mpctx->mconfig, argc, argv); if(mpctx->playtree == NULL) opt_exit = 1; else { mpctx->playtree = play_tree_cleanup(mpctx->playtree); if(mpctx->playtree) { - mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree,mconfig); + mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree,mpctx->mconfig); if(mpctx->playtree_iter) { if(play_tree_iter_step(mpctx->playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) { play_tree_iter_free(mpctx->playtree_iter); @@ -2681,7 +2680,7 @@ int gui_no_filename=0; play_tree_add_bpf(mpctx->playtree, cwd); } // Import initital playtree into GUI. - import_initial_playtree_into_gui(mpctx->playtree, mconfig, enqueue); + import_initial_playtree_into_gui(mpctx->playtree, mpctx->mconfig, enqueue); } #endif /* HAVE_NEW_GUI */ @@ -2880,14 +2879,14 @@ stream_set_interrupt_callback(mp_input_check_interrupt); #ifdef HAVE_MENU if(use_menu) { - if(menu_cfg && menu_init(mpctx, menu_cfg)) + if(menu_cfg && menu_init(mpctx, mpctx->mconfig, menu_cfg)) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_MenuInitialized, menu_cfg); else { menu_cfg = get_path("menu.conf"); - if(menu_init(mpctx, menu_cfg)) + if(menu_init(mpctx, mpctx->mconfig, menu_cfg)) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_MenuInitialized, menu_cfg); else { - if(menu_init(mpctx, MPLAYER_CONFDIR "/menu.conf")) + if(menu_init(mpctx, mpctx->mconfig, MPLAYER_CONFDIR "/menu.conf")) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_MenuInitialized, MPLAYER_CONFDIR"/menu.conf"); else { mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_MenuInitFailed); @@ -2949,15 +2948,15 @@ play_next_file: { int i; for (i = 0; i < SUB_SOURCES; i++) mpctx->global_sub_indices[i] = -1; } if (filename) { - load_per_protocol_config (mconfig, filename); - load_per_extension_config (mconfig, filename); - load_per_file_config (mconfig, filename); + load_per_protocol_config (mpctx->mconfig, filename); + load_per_extension_config (mpctx->mconfig, filename); + load_per_file_config (mpctx->mconfig, filename); } if (opts->video_driver_list) - load_per_output_config (mconfig, PROFILE_CFG_VO, opts->video_driver_list[0]); + load_per_output_config (mpctx->mconfig, PROFILE_CFG_VO, opts->video_driver_list[0]); if (opts->audio_driver_list) - load_per_output_config (mconfig, PROFILE_CFG_AO, opts->audio_driver_list[0]); + load_per_output_config (mpctx->mconfig, PROFILE_CFG_AO, opts->audio_driver_list[0]); // We must enable getch2 here to be able to interrupt network connection // or cache filling @@ -2996,7 +2995,7 @@ if(!noconsolecontrols && !slave_mode){ play_tree_set_child( mpctx->playtree,entry ); if(mpctx->playtree) { - mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree,mconfig); + mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree,mpctx->mconfig); if(mpctx->playtree_iter) { if(play_tree_iter_step(mpctx->playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) @@ -3027,7 +3026,7 @@ while (player_idle_mode && !filename) { // The entry is added to the main playtree after the switch(). break; case MP_CMD_LOADLIST: - entry = parse_playlist_file(cmd->args[0].v.s); + entry = parse_playlist_file(mpctx->mconfig, cmd->args[0].v.s); break; case MP_CMD_QUIT: exit_player_with_rc(mpctx, MSGTR_Exit_quit, (cmd->nargs > 0)? cmd->args[0].v.i : 0); @@ -3051,7 +3050,7 @@ while (player_idle_mode && !filename) { play_tree_set_child(mpctx->playtree, entry); /* Make iterator start at the top the of tree. */ - mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree, mconfig); + mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree, mpctx->mconfig); if (!mpctx->playtree_iter) continue; // find the first real item in the tree @@ -3164,7 +3163,7 @@ if (edl_output_filename) { current_module="handle_playlist"; mp_msg(MSGT_CPLAYER,MSGL_V,"Parsing playlist %s...\n", filename_recode(filename)); - entry = parse_playtree(mpctx->stream,0); + entry = parse_playtree(mpctx->stream, mpctx->mconfig, 0); mpctx->eof=playtree_add_playlist(mpctx, entry); goto goto_next_file; } diff --git a/parser-mpcmd.c b/parser-mpcmd.c index 8e5da2cb98..cba28e538a 100644 --- a/parser-mpcmd.c +++ b/parser-mpcmd.c @@ -33,7 +33,9 @@ static int mode = 0; // #define UNSET_GLOBAL (mode = GLOBAL) -static int is_entry_option(char *opt, char *param, play_tree_t** ret) { +static int is_entry_option(struct m_config *mconfig, char *opt, char *param, + play_tree_t** ret) +{ play_tree_t* entry = NULL; *ret = NULL; @@ -42,7 +44,7 @@ static int is_entry_option(char *opt, char *param, play_tree_t** ret) { if(!param) return M_OPT_MISSING_PARAM; - entry = parse_playlist_file(param); + entry = parse_playlist_file(mconfig, param); if(!entry) return -1; else { @@ -174,7 +176,7 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv) const m_option_t* mp_opt = NULL; play_tree_t* entry = NULL; - tmp = is_entry_option(opt,(i+1 0) { // It's an entry if(entry) { add_entry(&last_parent,&last_entry,entry); diff --git a/playtree.h b/playtree.h index 78543db995..dfd30d6707 100644 --- a/playtree.h +++ b/playtree.h @@ -227,8 +227,9 @@ play_tree_iter_get_file(play_tree_iter_t* iter, int d); /// Create a playtree from a playlist file. /** \ingroup PlaytreeParser */ +struct m_config; play_tree_t* -parse_playtree(struct stream *stream, int forced); +parse_playtree(struct stream *stream, struct m_config *mconfig, int forced); /// Clean a tree by destroying all empty elements. play_tree_t* @@ -238,7 +239,7 @@ play_tree_cleanup(play_tree_t* pt); /** \ingroup PlaytreeParser */ play_tree_t* -parse_playlist_file(char* file); +parse_playlist_file(struct m_config *mconfig, char* file); /// \defgroup PtAPI Playtree highlevel API /// \ingroup Playtree diff --git a/playtreeparser.c b/playtreeparser.c index 0d4c0fe43d..33e472a87c 100644 --- a/playtreeparser.c +++ b/playtreeparser.c @@ -22,9 +22,9 @@ #include "libmpdemux/demuxer.h" #include "mp_msg.h" - +struct m_config; extern play_tree_t* -asx_parser_build_tree(char* buffer, int ref); +asx_parser_build_tree(struct m_config *mconfig, char* buffer, int ref); #define BUF_STEP 1024 @@ -195,7 +195,7 @@ parse_asx(play_tree_parser_t* p) { /* NOTHING */; mp_msg(MSGT_PLAYTREE,MSGL_DBG3,"Parsing asx file: [%s]\n",p->buffer); - return asx_parser_build_tree(p->buffer,p->deep); + return asx_parser_build_tree(p->mconfig, p->buffer,p->deep); } static char* @@ -573,7 +573,7 @@ parse_smil(play_tree_parser_t* p) { } static play_tree_t* -embedded_playlist_parse(char *line) { +embedded_playlist_parse(struct m_config *mconfig, char *line) { int f=DEMUXER_TYPE_PLAYLIST; stream_t* stream; play_tree_parser_t* ptp; @@ -589,7 +589,7 @@ embedded_playlist_parse(char *line) { //add new playtree mp_msg(MSGT_PLAYTREE,MSGL_V,"Adding playlist %s to element entryref\n",line); - ptp = play_tree_parser_new(stream,1); + ptp = play_tree_parser_new(stream, mconfig, 1); entry = play_tree_parser_get_play_tree(ptp, 1); play_tree_parser_free(ptp); free_stream(stream); @@ -624,7 +624,7 @@ parse_textplain(play_tree_parser_t* p) { ( ((tolower(c[1]) == 's') && (tolower(c[2])== 'm') && (tolower(c[3]) == 'i')) || ((tolower(c[1]) == 'r') && (tolower(c[2])== 'a') && (tolower(c[3]) == 'm')) ) && (!c[4] || c[4] == '?' || c[4] == '&')) ){ - entry=embedded_playlist_parse(line); + entry=embedded_playlist_parse(p->mconfig, line); embedded = 1; break; } @@ -650,7 +650,7 @@ parse_textplain(play_tree_parser_t* p) { } play_tree_t* -parse_playtree(stream_t *stream, int forced) { +parse_playtree(stream_t *stream, struct m_config *mconfig, int forced) { play_tree_parser_t* p; play_tree_t* ret; @@ -658,7 +658,7 @@ parse_playtree(stream_t *stream, int forced) { assert(stream != NULL); #endif - p = play_tree_parser_new(stream,0); + p = play_tree_parser_new(stream, mconfig, 0); if(!p) return NULL; @@ -725,7 +725,7 @@ void play_tree_add_bpf(play_tree_t* pt, char* filename) } play_tree_t* -parse_playlist_file(char* file) { +parse_playlist_file(struct m_config *mconfig, char* file) { stream_t *stream; play_tree_t* ret; int f=DEMUXER_TYPE_PLAYLIST; @@ -739,7 +739,7 @@ parse_playlist_file(char* file) { mp_msg(MSGT_PLAYTREE,MSGL_V,"Parsing playlist file %s...\n",file); - ret = parse_playtree(stream,1); + ret = parse_playtree(stream, mconfig, 1); free_stream(stream); play_tree_add_bpf(ret, file); @@ -750,13 +750,14 @@ parse_playlist_file(char* file) { play_tree_parser_t* -play_tree_parser_new(stream_t* stream,int deep) { +play_tree_parser_new(stream_t* stream, struct m_config *mconfig, int deep) { play_tree_parser_t* p; p = calloc(1,sizeof(play_tree_parser_t)); if(!p) return NULL; p->stream = stream; + p->mconfig = mconfig; p->deep = deep; p->keep = 1; diff --git a/playtreeparser.h b/playtreeparser.h index 9715f8328c..437d09ad0c 100644 --- a/playtreeparser.h +++ b/playtreeparser.h @@ -16,6 +16,7 @@ struct stream; typedef struct play_tree_parser { struct stream* stream; + struct m_config *mconfig; char *buffer,*iter,*line; int buffer_size , buffer_end; int deep,keep; @@ -28,7 +29,7 @@ typedef struct play_tree_parser { * \return The new parser. */ play_tree_parser_t* -play_tree_parser_new(struct stream* stream,int deep); +play_tree_parser_new(struct stream* stream, struct m_config *mconfig, int deep); /// Destroy a parser. void -- cgit v1.2.3