changeset 19533:0fc9a4ca9e66

extended slave mode with metadata retrieval commands
author ben
date Sat, 26 Aug 2006 09:44:20 +0000
parents 13599373bb02
children b0a6a97e2ba0
files input/input.c input/input.h mplayer.c
diffstat 3 files changed, 123 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/input/input.c	Fri Aug 25 23:14:32 2006 +0000
+++ b/input/input.c	Sat Aug 26 09:44:20 2006 +0000
@@ -85,6 +85,20 @@
   { MP_CMD_GET_PERCENT_POS, "get_percent_pos", 0, { {-1,{0}} } },
   { MP_CMD_GET_TIME_POS, "get_time_pos", 0, { {-1,{0}} } },
   { MP_CMD_GET_TIME_LENGTH, "get_time_length", 0, { {-1,{0}} } },
+  { MP_CMD_GET_FILENAME, "get_file_name", 0, { {-1,{0}} } },
+  { MP_CMD_GET_VIDEO_CODEC, "get_video_codec", 0, { {-1,{0}} } },
+  { MP_CMD_GET_VIDEO_BITRATE, "get_video_bitrate", 0, { {-1,{0}} } },
+  { MP_CMD_GET_VIDEO_RESOLUTION, "get_video_resolution", 0, { {-1,{0}} } },
+  { MP_CMD_GET_AUDIO_CODEC, "get_audio_codec", 0, { {-1,{0}} } },
+  { MP_CMD_GET_AUDIO_BITRATE, "get_audio_bitrate", 0, { {-1,{0}} } },
+  { MP_CMD_GET_AUDIO_SAMPLES, "get_audio_samples", 0, { {-1,{0}} } },
+  { MP_CMD_GET_META_TITLE, "get_meta_title", 0, { {-1,{0}} } },
+  { MP_CMD_GET_META_ARTIST, "get_meta_artist", 0, { {-1,{0}} } },
+  { MP_CMD_GET_META_ALBUM, "get_meta_album", 0, { {-1,{0}} } },
+  { MP_CMD_GET_META_YEAR, "get_meta_year", 0, { {-1,{0}} } },
+  { MP_CMD_GET_META_COMMENT, "get_meta_comment", 0, { {-1,{0}} } },
+  { MP_CMD_GET_META_TRACK, "get_meta_track", 0, { {-1,{0}} } },
+  { MP_CMD_GET_META_GENRE, "get_meta_genre", 0, { {-1,{0}} } },
   { MP_CMD_SWITCH_AUDIO, "switch_audio", 0, { { MP_CMD_ARG_INT,{-1} }, {-1,{0}} } },
 #ifdef USE_TV
   { MP_CMD_TV_STEP_CHANNEL, "tv_step_channel", 1,  { { MP_CMD_ARG_INT ,{0}}, {-1,{0}} }},
--- a/input/input.h	Fri Aug 25 23:14:32 2006 +0000
+++ b/input/input.h	Sat Aug 26 09:44:20 2006 +0000
@@ -72,6 +72,20 @@
 #define MP_CMD_OSD_SHOW_PROPERTY_TEXT 70
 #define MP_CMD_SEEK_CHAPTER 71
 #define MP_CMD_FILE_FILTER 72
+#define MP_CMD_GET_FILENAME 73
+#define MP_CMD_GET_VIDEO_CODEC 74
+#define MP_CMD_GET_VIDEO_BITRATE 75
+#define MP_CMD_GET_VIDEO_RESOLUTION 76
+#define MP_CMD_GET_AUDIO_CODEC 77
+#define MP_CMD_GET_AUDIO_BITRATE 78
+#define MP_CMD_GET_AUDIO_SAMPLES 79
+#define MP_CMD_GET_META_TITLE 80
+#define MP_CMD_GET_META_ARTIST 81
+#define MP_CMD_GET_META_ALBUM 82
+#define MP_CMD_GET_META_YEAR 83
+#define MP_CMD_GET_META_COMMENT 84
+#define MP_CMD_GET_META_TRACK 85
+#define MP_CMD_GET_META_GENRE 86
 
 #define MP_CMD_GUI_EVENTS       5000
 #define MP_CMD_GUI_LOADFILE     5001
--- a/mplayer.c	Fri Aug 25 23:14:32 2006 +0000
+++ b/mplayer.c	Sat Aug 26 09:44:20 2006 +0000
@@ -4942,6 +4942,101 @@
 	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_LENGTH=%.2lf\n", demuxer_get_time_length(demuxer));
     } break;
 
+    case MP_CMD_GET_FILENAME : {
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_FILENAME='%s'\n", get_metadata (META_NAME));
+    } break;
+
+    case MP_CMD_GET_VIDEO_CODEC : {
+        char *inf = get_metadata (META_VIDEO_CODEC);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_VIDEO_CODEC='%s'\n", inf);
+        free (inf);
+    } break;
+
+    case MP_CMD_GET_VIDEO_BITRATE : {
+        char *inf = get_metadata (META_VIDEO_BITRATE);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_VIDEO_BITRATE='%s'\n", inf);
+        free (inf);
+    } break;
+
+    case MP_CMD_GET_VIDEO_RESOLUTION : {
+        char *inf = get_metadata (META_VIDEO_RESOLUTION);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_VIDEO_RESOLUTION='%s'\n", inf);
+        free (inf);
+    } break;
+
+    case MP_CMD_GET_AUDIO_CODEC : {
+        char *inf = get_metadata (META_AUDIO_CODEC);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_AUDIO_CODEC='%s'\n", inf);
+        free (inf);
+    } break;
+
+    case MP_CMD_GET_AUDIO_BITRATE : {
+        char *inf = get_metadata (META_AUDIO_BITRATE);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_AUDIO_BITRATE='%s'\n", inf);
+        free (inf);
+    } break;
+
+    case MP_CMD_GET_AUDIO_SAMPLES : {
+        char *inf = get_metadata (META_AUDIO_SAMPLES);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_AUDIO_SAMPLES='%s'\n", inf);
+        free (inf);
+    } break;
+
+    case MP_CMD_GET_META_TITLE : {
+        char *inf = get_metadata (META_INFO_TITLE);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_META_TITLE='%s'\n", inf);
+        free (inf);
+    } break;
+
+    case MP_CMD_GET_META_ARTIST : {
+        char *inf = get_metadata (META_INFO_ARTIST);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_META_ARTIST='%s'\n", inf);
+        free (inf);
+    } break;
+
+    case MP_CMD_GET_META_ALBUM : {
+        char *inf = get_metadata (META_INFO_ALBUM);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_META_ALBUM='%s'\n", inf);
+        free (inf);
+    } break;
+
+    case MP_CMD_GET_META_YEAR : {
+        char *inf = get_metadata (META_INFO_YEAR);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_META_YEAR='%s'\n", inf);
+        free (inf);
+    } break;
+
+    case MP_CMD_GET_META_COMMENT : {
+        char *inf = get_metadata (META_INFO_COMMENT);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_META_COMMENT='%s'\n", inf);
+        free (inf);
+    } break;
+
+    case MP_CMD_GET_META_TRACK : {
+        char *inf = get_metadata (META_INFO_TRACK);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_META_TRACK='%s'\n", inf);
+        free (inf);
+    } break;
+
+    case MP_CMD_GET_META_GENRE : {
+        char *inf = get_metadata (META_INFO_GENRE);
+        if (!inf) inf = strdup ("");
+	mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_META_GENRE='%s'\n", inf);
+        free (inf);
+    } break;
+
 	case MP_CMD_GET_VO_FULLSCREEN : {
 	if(video_out && vo_config_count)
 		mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_VO_FULLSCREEN=%d\n", vo_fs);