summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-03-22 16:35:17 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-03-22 16:35:17 +0000
commit0fd651ff1ab39caca19551e0f66326db49c01699 (patch)
treed88628b14e084c3a405b5b9e1e053f7eb5f139d4
parent528ec79cc28c02ad25fceb9f4bf69aa6ee2205a7 (diff)
downloadmpv-0fd651ff1ab39caca19551e0f66326db49c01699.tar.bz2
mpv-0fd651ff1ab39caca19551e0f66326db49c01699.tar.xz
Add an option to list the properties: -list-properties
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17915 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--cfg-mplayer.h1
-rw-r--r--help/help_mp-en.h4
-rw-r--r--m_property.c29
-rw-r--r--m_property.h2
-rw-r--r--mplayer.c6
5 files changed, 42 insertions, 0 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index 1671463581..c5a103684b 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -397,6 +397,7 @@ m_option_t mplayer_opts[]={
#include "cfg-common.h"
#undef MAIN_CONF
+ {"list-properties", &list_properties, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
{"identify", &identify, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
{"-help", help_text, CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL},
{"help", help_text, CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL},
diff --git a/help/help_mp-en.h b/help/help_mp-en.h
index 07d24b8aaf..60822f3938 100644
--- a/help/help_mp-en.h
+++ b/help/help_mp-en.h
@@ -503,6 +503,10 @@ static char help_text[]=
#define MSGTR_UnknownProfile "Unknown profile '%s'.\n"
#define MSGTR_Profile "Profile %s: %s\n"
+// m_property.c
+#define MSGTR_PropertyListHeader "\n Name Type Min Max\n\n"
+#define MSGTR_TotalProperties "\nTotal: %d properties\n"
+
// open.c, stream.c:
#define MSGTR_CdDevNotfound "CD-ROM Device '%s' not found.\n"
#define MSGTR_ErrTrackSelect "Error selecting VCD track."
diff --git a/m_property.c b/m_property.c
index 14f5c7943f..619a919223 100644
--- a/m_property.c
+++ b/m_property.c
@@ -9,6 +9,7 @@
#include "m_option.h"
#include "m_property.h"
+#include "mp_msg.h"
#include "help_mp.h"
#define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5))
@@ -142,6 +143,34 @@ char* m_properties_expand_string(m_option_t* prop_list,char* str) {
return ret;
}
+void m_properties_print_help_list(m_option_t* list) {
+ char min[50],max[50];
+ int i,count = 0;
+
+ mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_PropertyListHeader);
+ for(i = 0 ; list[i].name ; i++) {
+ m_option_t* opt = &list[i];
+ if(opt->flags & M_OPT_MIN)
+ sprintf(min,"%-8.0f",opt->min);
+ else
+ strcpy(min,"No");
+ if(opt->flags & M_OPT_MAX)
+ sprintf(max,"%-8.0f",opt->max);
+ else
+ strcpy(max,"No");
+ mp_msg(MSGT_CFGPARSER, MSGL_INFO, " %-20.20s %-15.15s %-10.10s %-10.10s\n",
+ opt->name,
+ opt->type->name,
+ min,
+ max,
+ opt->flags & CONF_GLOBAL ? "Yes" : "No",
+ opt->flags & CONF_NOCMD ? "No" : "Yes",
+ opt->flags & CONF_NOCFG ? "No" : "Yes");
+ count++;
+ }
+ mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_TotalProperties, count);
+}
+
// Some generic property implementations
int m_property_int_ro(m_option_t* prop,int action,
diff --git a/m_property.h b/m_property.h
index 775f9d566b..dc3e436cf6 100644
--- a/m_property.h
+++ b/m_property.h
@@ -33,6 +33,8 @@ char* m_property_print(m_option_t* prop);
int m_property_parse(m_option_t* prop, char* txt);
+void m_properties_print_help_list(m_option_t* list);
+
char* m_properties_expand_string(m_option_t* prop_list,char* str);
#define M_PROPERTY_CLAMP(prop,val) do { \
diff --git a/mplayer.c b/mplayer.c
index fd996dcf72..d670b32f69 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -227,6 +227,8 @@ int use_gui=0;
int enqueue=0;
#endif
+static int list_properties = 0;
+
#define MAX_OSD_LEVEL 3
#define MAX_TERM_OSD_LEVEL 1
@@ -1815,6 +1817,10 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
mp_msg(MSGT_CPLAYER, MSGL_INFO, "\n");
opt_exit = 1;
}
+ if(list_properties) {
+ m_properties_print_help_list(mp_properties);
+ opt_exit = 1;
+ }
if(opt_exit)
exit_player(NULL);