summaryrefslogtreecommitdiffstats
path: root/libmenu
diff options
context:
space:
mode:
Diffstat (limited to 'libmenu')
-rw-r--r--libmenu/menu.c50
-rw-r--r--libmenu/menu.h5
-rw-r--r--libmenu/menu_chapsel.c4
-rw-r--r--libmenu/menu_cmdlist.c18
-rw-r--r--libmenu/menu_console.c18
-rw-r--r--libmenu/menu_dvbin.c4
-rw-r--r--libmenu/menu_filesel.c17
-rw-r--r--libmenu/menu_list.c1
-rw-r--r--libmenu/menu_param.c16
-rw-r--r--libmenu/menu_pt.c8
-rw-r--r--libmenu/menu_txt.c8
-rw-r--r--libmenu/vf_menu.c25
12 files changed, 91 insertions, 83 deletions
diff --git a/libmenu/menu.c b/libmenu/menu.c
index c8cf349c94..3ba54be45c 100644
--- a/libmenu/menu.c
+++ b/libmenu/menu.c
@@ -88,13 +88,15 @@ 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 struct input_ctx *menu_input = NULL;
static menu_def_t* menu_list = NULL;
static int menu_count = 0;
static menu_cmd_bindings_t *cmd_bindings = NULL;
static int cmd_bindings_num = 0;
-menu_cmd_bindings_t *get_cmd_bindings(const char *name) {
+static menu_cmd_bindings_t *get_cmd_bindings(const char *name) {
int i;
for (i = 0; i < cmd_bindings_num; ++i)
if (!strcasecmp(cmd_bindings[i].name, name))
@@ -102,16 +104,17 @@ 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);
if(r < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] syntax error at line: %d\n",parser->line);
asx_parser_free(parser);
return 0;
} else if(r == 0) {
@@ -121,7 +124,7 @@ static int menu_parse_config(char* buffer) {
// Has it a name ?
name = asx_get_attrib("name",attribs);
if(!name) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuDefinitionsNeedANameAttrib,parser->line);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Menu definitions need a name attribute (line %d).\n",parser->line);
free(element);
if(body) free(body);
asx_free_attribs(attribs);
@@ -153,7 +156,7 @@ static int menu_parse_config(char* buffer) {
for(;;) {
r = asx_get_element(parser,&bd,&element,&b,&attribs);
if(r < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_SyntaxErrorAtLine,
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] syntax error at line: %d\n",
parser->line);
free(body);
asx_parser_free(parser);
@@ -206,13 +209,13 @@ static int menu_parse_config(char* buffer) {
for(i = 0 ; attribs[2*i] ; i++) {
if(strcasecmp(attribs[2*i],"name") == 0) continue;
if(!m_struct_set(&minfo->priv_st,menu_list[menu_count].cfg,attribs[2*i], attribs[2*i+1]))
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_BadAttrib,attribs[2*i],attribs[2*i+1],
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] bad attribute %s=%s in menu '%s' at line %d\n",attribs[2*i],attribs[2*i+1],
name,parser->line);
}
menu_count++;
memset(&menu_list[menu_count],0,sizeof(menu_def_t));
} else {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuType,element,parser->line);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] unknown menu type '%s' at line %d\n",element,parser->line);
free(name);
if(body) free(body);
}
@@ -228,7 +231,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,
+ struct input_ctx *input_ctx, char* cfg_file)
+{
char* buffer = NULL;
int bl = BUF_STEP, br = 0;
int f, fd;
@@ -238,7 +243,7 @@ int menu_init(struct MPContext *mpctx, char* cfg_file) {
#endif
fd = open(cfg_file, O_RDONLY);
if(fd < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_CantOpenConfigFile,cfg_file);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Can't open menu config file: %s\n",cfg_file);
return 0;
}
buffer = malloc(bl);
@@ -246,7 +251,7 @@ int menu_init(struct MPContext *mpctx, char* cfg_file) {
int r;
if(bl - br < BUF_MIN) {
if(bl >= BUF_MAX) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ConfigFileIsTooBig,BUF_MAX/1024);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Config file is too big (> %d KB)\n",BUF_MAX/1024);
close(fd);
free(buffer);
return 0;
@@ -259,7 +264,7 @@ int menu_init(struct MPContext *mpctx, char* cfg_file) {
br += r;
}
if(!br) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ConfigFileIsEmpty);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Config file is empty.\n");
return 0;
}
buffer[br-1] = '\0';
@@ -267,7 +272,9 @@ int menu_init(struct MPContext *mpctx, char* cfg_file) {
close(fd);
menu_ctx = mpctx;
- f = menu_parse_config(buffer);
+ menu_mconfig = mconfig;
+ menu_input = input_ctx;
+ f = menu_parse_config(buffer, mconfig);
free(buffer);
return f;
}
@@ -303,7 +310,8 @@ int menu_dflt_read_key(menu_t* menu,int cmd) {
for (i = 0; i < bindings->binding_num; ++i) {
if (bindings->bindings[i].key == cmd) {
if (bindings->bindings[i].cmd)
- mp_input_parse_and_queue_cmds(bindings->bindings[i].cmd);
+ mp_input_parse_and_queue_cmds(menu->input_ctx,
+ bindings->bindings[i].cmd);
return 1;
}
}
@@ -321,20 +329,22 @@ menu_t* menu_open(char *name) {
break;
}
if(menu_list[i].name == NULL) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuNotFound,name);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Menu %s not found.\n",name);
return NULL;
}
m = calloc(1,sizeof(menu_t));
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->input_ctx = menu_input;
m->type = &menu_list[i];
if(menu_list[i].type->open(m,menu_list[i].args))
return m;
if(m->priv)
m_struct_free(m->priv_st,m->priv);
free(m);
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuInitFailed,name);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Menu '%s': Init failed.\n",name);
return NULL;
}
@@ -472,7 +482,7 @@ void menu_draw_text(mp_image_t* mpi,char* txt, int x, int y) {
int font;
if(!draw_alpha) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Unsupported output format!!!!\n");
return;
}
@@ -506,7 +516,7 @@ void menu_draw_text_full(mp_image_t* mpi,char* txt,
draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt);
if(!draw_alpha) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Unsupported output format!!!!\n");
return;
}
@@ -725,7 +735,7 @@ int menu_text_num_lines(char* txt, int max_width) {
return l;
}
-char* menu_text_get_next_line(char* txt, int max_width) {
+static char* menu_text_get_next_line(char* txt, int max_width) {
int i = 0;
render_txt(txt);
while (*txt) {
@@ -748,7 +758,7 @@ void menu_draw_box(mp_image_t* mpi,unsigned char grey,unsigned char alpha, int x
int g;
if(!draw_alpha) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Unsupported output format!!!!\n");
return;
}
diff --git a/libmenu/menu.h b/libmenu/menu.h
index d29091a4ae..cc76b5b7a3 100644
--- a/libmenu/menu.h
+++ b/libmenu/menu.h
@@ -31,6 +31,8 @@ struct m_struct_st;
struct menu_s {
struct MPContext *ctx;
+ struct m_config *mconfig;
+ struct input_ctx *input_ctx;
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);
@@ -70,7 +72,8 @@ 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,
+ struct input_ctx *input_ctx, char* cfg_file);
void menu_uninit(void);
/// Open a menu defined in the config file
diff --git a/libmenu/menu_chapsel.c b/libmenu/menu_chapsel.c
index 01fcd25550..f350655311 100644
--- a/libmenu/menu_chapsel.c
+++ b/libmenu/menu_chapsel.c
@@ -141,9 +141,9 @@ static void read_cmd (menu_t* menu, int cmd)
case MENU_CMD_OK: {
char cmdbuf[26];
sprintf(cmdbuf, "seek_chapter %d 1", menu->priv->p.current->cid);
- mp_input_queue_cmd(mp_input_parse_cmd(cmdbuf));
+ mp_input_queue_cmd(menu->input_ctx, mp_input_parse_cmd(cmdbuf));
if (menu->priv->auto_close)
- mp_input_queue_cmd(mp_input_parse_cmd("menu hide"));
+ mp_input_queue_cmd(menu->input_ctx, mp_input_parse_cmd("menu hide"));
break;
}
default:
diff --git a/libmenu/menu_cmdlist.c b/libmenu/menu_cmdlist.c
index e146a4e9db..60146e31f1 100644
--- a/libmenu/menu_cmdlist.c
+++ b/libmenu/menu_cmdlist.c
@@ -71,21 +71,21 @@ static void read_cmd(menu_t* menu,int cmd) {
switch(cmd) {
case MENU_CMD_RIGHT:
if(mpriv->p.current->right) {
- mp_input_parse_and_queue_cmds(mpriv->p.current->right);
+ mp_input_parse_and_queue_cmds(menu->input_ctx, mpriv->p.current->right);
break;
} // fallback on ok if right is not defined
case MENU_CMD_OK:
if (mpriv->p.current->ok)
- mp_input_parse_and_queue_cmds(mpriv->p.current->ok);
+ mp_input_parse_and_queue_cmds(menu->input_ctx, mpriv->p.current->ok);
break;
case MENU_CMD_LEFT:
if(mpriv->p.current->left) {
- mp_input_parse_and_queue_cmds(mpriv->p.current->left);
+ mp_input_parse_and_queue_cmds(menu->input_ctx, mpriv->p.current->left);
break;
} // fallback on cancel if left is not defined
case MENU_CMD_CANCEL:
if(mpriv->p.current->cancel) {
- mp_input_parse_and_queue_cmds(mpriv->p.current->cancel);
+ mp_input_parse_and_queue_cmds(menu->input_ctx, mpriv->p.current->cancel);
break;
}
default:
@@ -114,24 +114,24 @@ 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);
if(r < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] syntax error at line: %d\n",parser->line);
asx_parser_free(parser);
return -1;
} else if(r == 0) {
asx_parser_free(parser);
if(!m)
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_NoEntryFoundInTheMenuDefinition);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] No entry found in the menu definition.\n");
return m ? 1 : 0;
}
// Has it a name ?
name = asx_get_attrib("name",attribs);
if(!name) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ListMenuEntryDefinitionsNeedAName,parser->line);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] List menu entry definitions need a name (line %d).\n",parser->line);
free(element);
if(body) free(body);
asx_free_attribs(attribs);
@@ -157,7 +157,7 @@ static int open_cmdlist(menu_t* menu, char* args) {
menu->close = close_menu;
if(!args) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ListMenuNeedsAnArgument);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] List menu needs an argument.\n");
return 0;
}
diff --git a/libmenu/menu_console.c b/libmenu/menu_console.c
index db0ab2d7db..8070ff63a3 100644
--- a/libmenu/menu_console.c
+++ b/libmenu/menu_console.c
@@ -265,10 +265,10 @@ static void check_child(menu_t* menu) {
mpriv->prompt = mpriv->mp_prompt;
//add_line(mpriv,"Child process exited");
}
- else mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_WaitPidError,strerror(errno));
+ else mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Waitpid error: %s.\n",strerror(errno));
}
} else if(r < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_SelectError);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Select error.\n");
return;
}
@@ -278,7 +278,7 @@ static void check_child(menu_t* menu) {
if(w) mpriv->add_line = 1;
r = read(mpriv->child_fd[i],buffer,255);
if(r < 0)
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReadErrorOnChildFD, i == 1 ? "stdout":"stderr");
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Read error on child's file descriptor: %s.\n", i == 1 ? "stdout":"stderr");
else if(r>0) {
buffer[r] = '\0';
add_string(mpriv,buffer);
@@ -296,9 +296,9 @@ static int run_shell_cmd(menu_t* menu, char* cmd) {
#ifndef __MINGW32__
int in[2],out[2],err[2];
- mp_msg(MSGT_GLOBAL,MSGL_INFO,MSGTR_LIBMENU_ConsoleRun,cmd);
+ mp_tmsg(MSGT_GLOBAL,MSGL_INFO,"[MENU] Console run: %s ...\n",cmd);
if(mpriv->child) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_AChildIsAlreadyRunning);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] A child is already running.\n");
return 0;
}
@@ -308,7 +308,7 @@ static int run_shell_cmd(menu_t* menu, char* cmd) {
mpriv->child = fork();
if(mpriv->child < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ForkFailed);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Fork failed !!!\n");
close_pipe(in);
close_pipe(out);
close_pipe(err);
@@ -382,14 +382,14 @@ static void read_cmd(menu_t* menu,int cmd) {
while(l > 0) {
int w = write(mpriv->child_fd[0],str,l);
if(w < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_WriteError);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] write error\n");
break;
}
l -= w;
str += w;
}
if(write(mpriv->child_fd[0],"\n",1) < 0)
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_WriteError);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] write error\n");
enter_cmd(menu);
return;
}
@@ -420,7 +420,7 @@ static void read_cmd(menu_t* menu,int cmd) {
run_shell_cmd(menu,c->args[0].v.s);
break;
default: // Send the other commands to mplayer
- mp_input_queue_cmd(c);
+ mp_input_queue_cmd(menu->input_ctx, c);
}
}
return;
diff --git a/libmenu/menu_dvbin.c b/libmenu/menu_dvbin.c
index 0f84386f8c..e2b99a0f07 100644
--- a/libmenu/menu_dvbin.c
+++ b/libmenu/menu_dvbin.c
@@ -232,8 +232,8 @@ static void read_cmd(menu_t* menu, int cmd)
if(c)
{
if(mpriv->auto_close)
- mp_input_queue_cmd (mp_input_parse_cmd ("menu hide"));
- mp_input_queue_cmd(c);
+ mp_input_queue_cmd(menu->input_ctx, mp_input_parse_cmd ("menu hide"));
+ mp_input_queue_cmd(menu->input_ctx, c);
}
}
}
diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c
index 1321702945..08507bec20 100644
--- a/libmenu/menu_filesel.c
+++ b/libmenu/menu_filesel.c
@@ -48,7 +48,6 @@
int menu_keepdir = 0;
char *menu_chroot = NULL;
-extern char *filename;
struct list_entry_s {
struct list_entry p;
@@ -250,7 +249,7 @@ static int open_dir(menu_t* menu,char* args) {
mpriv->p.title = replace_path(mpriv->title,mpriv->dir,0);
if ((dirp = opendir (mpriv->dir)) == NULL){
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_OpendirError, strerror(errno));
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] opendir error: %s\n", strerror(errno));
return 0;
}
@@ -292,7 +291,7 @@ static int open_dir(menu_t* menu,char* args) {
if(n%20 == 0){ // Get some more mem
if((tp = (char **) realloc(namelist, (n+20) * sizeof (char *)))
== NULL) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReallocError, strerror(errno));
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] realloc error: %s\n", strerror(errno));
n--;
goto bailout;
}
@@ -301,7 +300,7 @@ static int open_dir(menu_t* menu,char* args) {
namelist[n] = (char *) malloc(strlen(dp->d_name) + 2);
if(namelist[n] == NULL){
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno));
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] memory allocation error: %s\n", strerror(errno));
n--;
goto bailout;
}
@@ -319,7 +318,7 @@ bailout:
qsort(namelist, n, sizeof(char *), (kill_warn)compare);
if (n < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReaddirError,strerror(errno));
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] readdir error: %s\n",strerror(errno));
return 0;
}
while(n--) {
@@ -330,7 +329,7 @@ bailout:
e->d = 1;
menu_list_add_entry(menu,e);
}else{
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno));
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] memory allocation error: %s\n", strerror(errno));
}
free(namelist[n]);
}
@@ -369,7 +368,7 @@ static void read_cmd(menu_t* menu,int cmd) {
}
menu_list_uninit(menu,free_entry);
if(!open_dir(menu,p)) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_CantOpenDirectory,p);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Can't open directory %s.\n",p);
menu->cl = 1;
}
free(p);
@@ -380,7 +379,7 @@ static void read_cmd(menu_t* menu,int cmd) {
char *action = mpriv->p.current->d ? mpriv->dir_action:mpriv->file_action;
sprintf(filename,"%s%s",mpriv->dir,mpriv->p.current->p.txt);
str = replace_path(action, filename,1);
- mp_input_parse_and_queue_cmds(str);
+ mp_input_parse_and_queue_cmds(menu->input_ctx, str);
if (str != action)
free(str);
}
@@ -391,7 +390,7 @@ static void read_cmd(menu_t* menu,int cmd) {
char *str;
sprintf(filename,"%s%s",mpriv->dir,mpriv->p.current->p.txt);
str = replace_path(action, filename,1);
- mp_input_parse_and_queue_cmds(str);
+ mp_input_parse_and_queue_cmds(menu->input_ctx, str);
if(str != action)
free(str);
} break;
diff --git a/libmenu/menu_list.c b/libmenu/menu_list.c
index 9264490b81..0fd6ffb2cf 100644
--- a/libmenu/menu_list.c
+++ b/libmenu/menu_list.c
@@ -332,4 +332,3 @@ void menu_list_uninit(menu_t* menu,free_entry_t free_func) {
mpriv->menu = mpriv->current = NULL;
}
-
diff --git a/libmenu/menu_param.c b/libmenu/menu_param.c
index 529cd49e2f..5052a26954 100644
--- a/libmenu/menu_param.c
+++ b/libmenu/menu_param.c
@@ -111,19 +111,19 @@ 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) {
r = asx_get_element(parser,&args,&element,&body,&attribs);
if(r < 0) {
- mp_msg(MSGT_OSD_MENU,MSGL_ERR,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line);
+ mp_tmsg(MSGT_OSD_MENU,MSGL_ERR,"[MENU] syntax error at line: %d\n",parser->line);
asx_parser_free(parser);
return -1;
} else if(r == 0) {
asx_parser_free(parser);
if(!m)
- mp_msg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_NoEntryFoundInTheMenuDefinition);
+ mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,"[MENU] No entry found in the menu definition.\n");
m = calloc(1,sizeof(struct list_entry_s));
m->p.txt = strdup("Back");
menu_list_add_entry(menu,m);
@@ -132,7 +132,7 @@ static int parse_args(menu_t* menu,char* args) {
if(!strcmp(element,"menu")) {
name = asx_get_attrib("menu",attribs);
if(!name) {
- mp_msg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_SubmenuDefinitionNeedAMenuAttribut);
+ mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,"[MENU] Submenu definition needs a 'menu' attribute.\n");
goto next_element;
}
m = calloc(1,sizeof(struct list_entry_s));
@@ -147,13 +147,13 @@ static int parse_args(menu_t* menu,char* args) {
name = asx_get_attrib("property",attribs);
opt = NULL;
if(name && mp_property_do(name,M_PROPERTY_GET_TYPE,&opt,menu->ctx) <= 0) {
- mp_msg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_InvalidProperty,
+ mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,"[MENU] Invalid property '%s' in pref menu entry. (line %d).\n",
name,parser->line);
goto next_element;
}
txt = asx_get_attrib("txt",attribs);
if(!(name || txt)) {
- mp_msg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_PrefMenuEntryDefinitionsNeed,parser->line);
+ mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,"[MENU] Pref menu entry definitions need a valid 'property' or 'txt' attribute (line %d).\n",parser->line);
if(txt) free(txt), txt = NULL;
goto next_element;
}
@@ -236,7 +236,7 @@ static void read_cmd(menu_t* menu,int cmd) {
char* txt = malloc(10 + strlen(e->menu) + 1);
sprintf(txt,"set_menu %s",e->menu);
c = mp_input_parse_cmd(txt);
- if(c) mp_input_queue_cmd(c);
+ if(c) mp_input_queue_cmd(menu->input_ctx, c);
return;
}
}
@@ -278,7 +278,7 @@ static int openMenu(menu_t* menu, char* args) {
if(!args) {
- mp_msg(MSGT_OSD_MENU,MSGL_ERR,MSGTR_LIBMENU_PrefMenuNeedsAnArgument);
+ mp_tmsg(MSGT_OSD_MENU,MSGL_ERR,"[MENU] Pref menu needs an argument.\n");
return 0;
}
diff --git a/libmenu/menu_pt.c b/libmenu/menu_pt.c
index f5f9999492..a985b63176 100644
--- a/libmenu/menu_pt.c
+++ b/libmenu/menu_pt.c
@@ -98,7 +98,7 @@ static void read_cmd(menu_t* menu,int cmd) {
d--;
}
if(i == NULL) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_CantfindTheTargetItem);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Can't find the target item ????\n");
break;
}
}
@@ -107,11 +107,11 @@ static void read_cmd(menu_t* menu,int cmd) {
c = mp_input_parse_cmd(str);
if(c) {
if(mpriv->auto_close)
- mp_input_queue_cmd(mp_input_parse_cmd("menu hide"));
- mp_input_queue_cmd(c);
+ mp_input_queue_cmd(menu->input_ctx, mp_input_parse_cmd("menu hide"));
+ mp_input_queue_cmd(menu->input_ctx, c);
}
else
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToBuildCommand,str);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Failed to build command: %s.\n",str);
} break;
default:
menu_list_read_cmd(menu,cmd);
diff --git a/libmenu/menu_txt.c b/libmenu/menu_txt.c
index 30d0fcc98f..d7d2c874c5 100644
--- a/libmenu/menu_txt.c
+++ b/libmenu/menu_txt.c
@@ -141,13 +141,13 @@ static int open_txt(menu_t* menu, char* args) {
menu->read_cmd = read_cmd;
if(!mpriv->file) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuTxtNeedATxtFileName);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Text menu needs a textfile name (parameter file).\n");
return 0;
}
fd = fopen(mpriv->file,"r");
if(!fd) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuTxtCantOpen,mpriv->file);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Can't open %s.\n",mpriv->file);
return 0;
}
@@ -178,7 +178,7 @@ static int open_txt(menu_t* menu, char* args) {
mpriv->num_lines++;
}
if(pos >= BUF_SIZE-1) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_WarningTooLongLineSplitting);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Warning, line too long. Splitting it.\n");
mpriv->lines = realloc(mpriv->lines,(mpriv->num_lines + 1)*sizeof(char*));
mpriv->lines[mpriv->num_lines] = strdup(buf);
mpriv->num_lines++;
@@ -186,7 +186,7 @@ static int open_txt(menu_t* menu, char* args) {
}
}
- mp_msg(MSGT_GLOBAL,MSGL_INFO,MSGTR_LIBMENU_ParsedLines,mpriv->num_lines);
+ mp_tmsg(MSGT_GLOBAL,MSGL_INFO,"[MENU] Parsed %d lines.\n",mpriv->num_lines);
return 1;
}
diff --git a/libmenu/vf_menu.c b/libmenu/vf_menu.c
index 50c9ebfe1a..7f8ae84aca 100644
--- a/libmenu/vf_menu.c
+++ b/libmenu/vf_menu.c
@@ -54,15 +54,15 @@ struct vf_priv_s {
int passthrough;
};
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts);
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts);
-void vf_menu_pause_update(struct vf_instance_s* vf) {
- const vo_functions_t *video_out = mpctx_get_video_out(vf->priv->current->ctx);
+void vf_menu_pause_update(struct vf_instance* vf) {
+ const struct vo *video_out = mpctx_get_video_out(vf->priv->current->ctx);
if(pause_mpi) {
put_image(vf,pause_mpi, MP_NOPTS_VALUE);
// Don't draw the osd atm
//vf->control(vf,VFCTRL_DRAW_OSD,NULL);
- video_out->flip_page();
+ vo_flip_page(video_out, 0, -1);
}
}
@@ -99,7 +99,7 @@ static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) {
else if(strcmp(arg,"hide") == 0 || strcmp(arg,"toggle") == 0)
priv->current->show = 0;
else
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuCommand,arg);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Unknown command: '%s'.\n",arg);
return 1;
}
case MP_CMD_SET_MENU : {
@@ -107,7 +107,7 @@ static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) {
menu_t* l = priv->current;
priv->current = menu_open(menu);
if(!priv->current) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToOpenMenu,menu);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Failed to open menu: '%s'.\n",menu);
priv->current = l;
priv->current->show = 0;
} else {
@@ -120,7 +120,7 @@ static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) {
return 0;
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
mp_image_t *dmpi;
if(mpi->type == MP_IMGTYPE_TEMP && (!(mpi->flags&MP_IMGFLAG_PRESERVE)) ) {
@@ -137,7 +137,7 @@ static int key_cb(int code) {
return menu_read_key(st_priv->current,code);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi = NULL;
if (vf->priv->passthrough) {
@@ -213,7 +213,7 @@ static void uninit(vf_instance_t *vf) {
}
}
-static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height,
+static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt) {
#ifdef CONFIG_FREETYPE
// here is the right place to get screen dimensions
@@ -227,8 +227,8 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
- return vf_next_query_format(vf,fmt);
+static int query_format(struct vf_instance* vf, unsigned int fmt){
+ return vf_next_query_format(vf, fmt);
}
static int open_vf(vf_instance_t *vf, char* args){
@@ -264,6 +264,3 @@ vf_info_t vf_info_menu = {
open_vf,
NULL
};
-
-
-