From 0a54f5e741e395ffb14a1305529c70e817679596 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 6 Sep 2012 05:29:38 +0200 Subject: commands: remove legacy slave mode get commands These have been replaced by properties. Also remove some other slave- mode specific get commands that can be replaced by property uses. The get_metadata() function didn't actually contain anything useful, and just replicated code from other parts of mplayer. --- command.c | 127 ---------------------------------------------------------- input/input.c | 19 --------- input/input.h | 19 --------- metadata.h | 55 ------------------------- mplayer.c | 125 --------------------------------------------------------- screenshot.c | 4 +- 6 files changed, 1 insertion(+), 348 deletions(-) delete mode 100644 metadata.h diff --git a/command.c b/command.c index 1cffedfd13..e4bc5e73ff 100644 --- a/command.c +++ b/command.c @@ -39,7 +39,6 @@ #include "m_option.h" #include "m_property.h" #include "m_config.h" -#include "metadata.h" #include "libmpcodecs/vf.h" #include "libmpcodecs/vd.h" #include "mp_osd.h" @@ -2676,136 +2675,10 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) } break; - case MP_CMD_GET_SUB_VISIBILITY: - if (sh_video) { - mp_msg(MSGT_GLOBAL, MSGL_INFO, - "ANS_SUB_VISIBILITY=%d\n", opts->sub_visibility); - } - break; - case MP_CMD_SCREENSHOT: screenshot_request(mpctx, cmd->args[0].v.i, cmd->args[1].v.i); break; - case MP_CMD_GET_TIME_LENGTH: - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_LENGTH=%.2f\n", - get_time_length(mpctx)); - break; - - case MP_CMD_GET_FILENAME: { - char *inf = get_metadata(mpctx, META_NAME); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_FILENAME='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_VIDEO_CODEC: { - char *inf = get_metadata(mpctx, META_VIDEO_CODEC); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VIDEO_CODEC='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_VIDEO_BITRATE: { - char *inf = get_metadata(mpctx, META_VIDEO_BITRATE); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VIDEO_BITRATE='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_VIDEO_RESOLUTION: { - char *inf = get_metadata(mpctx, META_VIDEO_RESOLUTION); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VIDEO_RESOLUTION='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_AUDIO_CODEC: { - char *inf = get_metadata(mpctx, META_AUDIO_CODEC); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_AUDIO_CODEC='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_AUDIO_BITRATE: { - char *inf = get_metadata(mpctx, META_AUDIO_BITRATE); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_AUDIO_BITRATE='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_AUDIO_SAMPLES: { - char *inf = get_metadata(mpctx, META_AUDIO_SAMPLES); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_AUDIO_SAMPLES='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_META_TITLE: { - char *inf = get_metadata(mpctx, META_INFO_TITLE); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_TITLE='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_META_ARTIST: { - char *inf = get_metadata(mpctx, META_INFO_ARTIST); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_ARTIST='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_META_ALBUM: { - char *inf = get_metadata(mpctx, META_INFO_ALBUM); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_ALBUM='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_META_YEAR: { - char *inf = get_metadata(mpctx, META_INFO_YEAR); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_YEAR='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_META_COMMENT: { - char *inf = get_metadata(mpctx, META_INFO_COMMENT); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_COMMENT='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_META_TRACK: { - char *inf = get_metadata(mpctx, META_INFO_TRACK); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_TRACK='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_META_GENRE: { - char *inf = get_metadata(mpctx, META_INFO_GENRE); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_GENRE='%s'\n", inf); - talloc_free(inf); - break; - } - - case MP_CMD_GET_VO_FULLSCREEN: - if (mpctx->video_out && mpctx->video_out->config_ok) - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VO_FULLSCREEN=%d\n", vo_fs); - break; - - case MP_CMD_GET_PERCENT_POS: - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_PERCENT_POSITION=%d\n", - get_percent_pos(mpctx)); - break; - - case MP_CMD_GET_TIME_POS: { - float pos = get_current_time(mpctx); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_TIME_POSITION=%.1f\n", pos); - break; - } - case MP_CMD_RUN: #ifndef __MINGW32__ if (!fork()) { diff --git a/input/input.c b/input/input.c index 7f9021e35b..38e89d4577 100644 --- a/input/input.c +++ b/input/input.c @@ -138,23 +138,6 @@ static const mp_cmd_t mp_cmds[] = { #ifdef CONFIG_ASS { MP_CMD_ASS_USE_MARGINS, "ass_use_margins", { OARG_INT(-1) } }, #endif - { MP_CMD_GET_PERCENT_POS, "get_percent_pos", }, - { MP_CMD_GET_TIME_POS, "get_time_pos", }, - { MP_CMD_GET_TIME_LENGTH, "get_time_length", }, - { MP_CMD_GET_FILENAME, "get_file_name", }, - { MP_CMD_GET_VIDEO_CODEC, "get_video_codec", }, - { MP_CMD_GET_VIDEO_BITRATE, "get_video_bitrate", }, - { MP_CMD_GET_VIDEO_RESOLUTION, "get_video_resolution", }, - { MP_CMD_GET_AUDIO_CODEC, "get_audio_codec", }, - { MP_CMD_GET_AUDIO_BITRATE, "get_audio_bitrate", }, - { MP_CMD_GET_AUDIO_SAMPLES, "get_audio_samples", }, - { MP_CMD_GET_META_TITLE, "get_meta_title", }, - { MP_CMD_GET_META_ARTIST, "get_meta_artist", }, - { MP_CMD_GET_META_ALBUM, "get_meta_album", }, - { MP_CMD_GET_META_YEAR, "get_meta_year", }, - { MP_CMD_GET_META_COMMENT, "get_meta_comment", }, - { MP_CMD_GET_META_TRACK, "get_meta_track", }, - { MP_CMD_GET_META_GENRE, "get_meta_genre", }, { MP_CMD_SWITCH_AUDIO, "switch_audio", { OARG_INT(-1) } }, { MP_CMD_SWITCH_ANGLE, "switch_angle", { OARG_INT(-1) } }, { MP_CMD_SWITCH_TITLE, "switch_title", { OARG_INT(-1) } }, @@ -190,8 +173,6 @@ static const mp_cmd_t mp_cmds[] = { { MP_CMD_PLAYLIST_CLEAR, "playlist_clear", }, { MP_CMD_RUN, "run", { ARG_STRING } }, - { MP_CMD_GET_VO_FULLSCREEN, "get_vo_fullscreen", }, - { MP_CMD_GET_SUB_VISIBILITY, "get_sub_visibility", }, { MP_CMD_KEYDOWN_EVENTS, "key_down_event", { ARG_INT } }, { MP_CMD_SET_PROPERTY, "set_property", { ARG_STRING, ARG_STRING } }, { MP_CMD_SET_PROPERTY_OSD, "set_property_osd", { ARG_STRING, ARG_STRING } }, diff --git a/input/input.h b/input/input.h index ddd9016203..8672728598 100644 --- a/input/input.h +++ b/input/input.h @@ -53,8 +53,6 @@ enum mp_command_type { MP_CMD_GAMMA, MP_CMD_SUB_VISIBILITY, MP_CMD_VOBSUB_LANG, // deprecated: combined with SUB_SELECT - MP_CMD_GET_TIME_LENGTH, - MP_CMD_GET_PERCENT_POS, MP_CMD_SUB_STEP, MP_CMD_TV_SET_CHANNEL, MP_CMD_EDL_MARK, @@ -67,8 +65,6 @@ enum mp_command_type { MP_CMD_TV_SET_CONTRAST, MP_CMD_TV_SET_HUE, MP_CMD_TV_SET_SATURATION, - MP_CMD_GET_VO_FULLSCREEN, - MP_CMD_GET_SUB_VISIBILITY, MP_CMD_SUB_FORCED_ONLY, MP_CMD_VO_ONTOP, MP_CMD_SUB_SELECT, @@ -81,7 +77,6 @@ enum mp_command_type { MP_CMD_SPEED_SET, MP_CMD_RUN, MP_CMD_SWITCH_AUDIO, - MP_CMD_GET_TIME_POS, MP_CMD_SUB_LOAD, MP_CMD_KEYDOWN_EVENTS, MP_CMD_VO_BORDER, @@ -91,20 +86,6 @@ enum mp_command_type { MP_CMD_OSD_SHOW_PROPERTY_TEXT, MP_CMD_OSD_SHOW_PROGRESSION, MP_CMD_SEEK_CHAPTER, - MP_CMD_GET_FILENAME, - MP_CMD_GET_VIDEO_CODEC, - MP_CMD_GET_VIDEO_BITRATE, - MP_CMD_GET_VIDEO_RESOLUTION, - MP_CMD_GET_AUDIO_CODEC, - MP_CMD_GET_AUDIO_BITRATE, - MP_CMD_GET_AUDIO_SAMPLES, - MP_CMD_GET_META_TITLE, - MP_CMD_GET_META_ARTIST, - MP_CMD_GET_META_ALBUM, - MP_CMD_GET_META_YEAR, - MP_CMD_GET_META_COMMENT, - MP_CMD_GET_META_TRACK, - MP_CMD_GET_META_GENRE, MP_CMD_RADIO_STEP_CHANNEL, MP_CMD_RADIO_SET_CHANNEL, MP_CMD_RADIO_SET_FREQ, diff --git a/metadata.h b/metadata.h deleted file mode 100644 index 06c3822d81..0000000000 --- a/metadata.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * set of helper routines for stream metadata and properties retrieval - * - * Copyright (C) 2006 Benjamin Zores - * - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_METADATA_H -#define MPLAYER_METADATA_H - -typedef enum metadata_s metadata_t; -enum metadata_s { - /* common info */ - META_NAME = 0, - - /* video stream properties */ - META_VIDEO_CODEC, - META_VIDEO_BITRATE, - META_VIDEO_RESOLUTION, - - /* audio stream properties */ - META_AUDIO_CODEC, - META_AUDIO_BITRATE, - META_AUDIO_SAMPLES, - - /* ID3 tags and other stream infos */ - META_INFO_TITLE, - META_INFO_ARTIST, - META_INFO_ALBUM, - META_INFO_YEAR, - META_INFO_COMMENT, - META_INFO_TRACK, - META_INFO_GENRE -}; - -struct MPContext; - -char *get_metadata(struct MPContext *mpctx, metadata_t type); - -#endif /* MPLAYER_METADATA_H */ diff --git a/mplayer.c b/mplayer.c index 7fa37641fc..d0abca3112 100644 --- a/mplayer.c +++ b/mplayer.c @@ -247,8 +247,6 @@ int use_filedir_conf; #include "mpcommon.h" #include "command.h" -#include "metadata.h" - static void reset_subtitles(struct MPContext *mpctx); static void reinit_subs(struct MPContext *mpctx); @@ -260,129 +258,6 @@ static float get_relative_time(struct MPContext *mpctx) return delta * 0.000001; } -static int is_valid_metadata_type(struct MPContext *mpctx, metadata_t type) -{ - switch (type) { - /* check for valid video stream */ - case META_VIDEO_CODEC: - case META_VIDEO_BITRATE: - case META_VIDEO_RESOLUTION: - if (!mpctx->sh_video) - return 0; - break; - - /* check for valid audio stream */ - case META_AUDIO_CODEC: - case META_AUDIO_BITRATE: - case META_AUDIO_SAMPLES: - if (!mpctx->sh_audio) - return 0; - break; - - /* check for valid demuxer */ - case META_INFO_TITLE: - case META_INFO_ARTIST: - case META_INFO_ALBUM: - case META_INFO_YEAR: - case META_INFO_COMMENT: - case META_INFO_TRACK: - case META_INFO_GENRE: - if (!mpctx->master_demuxer) - return 0; - break; - - default: - break; - } - - return 1; -} - -static char *get_demuxer_info(struct MPContext *mpctx, char *tag) -{ - char **info = mpctx->master_demuxer->info; - int n; - - if (!info || !tag) - return talloc_strdup(NULL, ""); - - for (n = 0; info[2 * n] != NULL; n++) - if (!strcasecmp(info[2 * n], tag)) - break; - - return talloc_strdup(NULL, info[2 * n + 1] ? info[2 * n + 1] : ""); -} - -char *get_metadata(struct MPContext *mpctx, metadata_t type) -{ - sh_audio_t * const sh_audio = mpctx->sh_audio; - sh_video_t * const sh_video = mpctx->sh_video; - - if (!is_valid_metadata_type(mpctx, type)) - return NULL; - - switch (type) { - case META_NAME: - return talloc_strdup(NULL, mp_basename(mpctx->filename)); - case META_VIDEO_CODEC: - if (sh_video->format == 0x10000001) - return talloc_strdup(NULL, "mpeg1"); - else if (sh_video->format == 0x10000002) - return talloc_strdup(NULL, "mpeg2"); - else if (sh_video->format == 0x10000004) - return talloc_strdup(NULL, "mpeg4"); - else if (sh_video->format == 0x10000005) - return talloc_strdup(NULL, "h264"); - else if (sh_video->format >= 0x20202020) - return talloc_asprintf(NULL, "%.4s", (char *) &sh_video->format); - else - return talloc_asprintf(NULL, "0x%08X", sh_video->format); - case META_VIDEO_BITRATE: - return talloc_asprintf(NULL, "%d kbps", - (int) (sh_video->i_bps * 8 / 1024)); - case META_VIDEO_RESOLUTION: - return talloc_asprintf(NULL, "%d x %d", sh_video->disp_w, - sh_video->disp_h); - case META_AUDIO_CODEC: - if (sh_audio->codec && sh_audio->codec->name) - return talloc_strdup(NULL, sh_audio->codec->name); - return talloc_strdup(NULL, ""); - case META_AUDIO_BITRATE: - return talloc_asprintf(NULL, "%d kbps", - (int) (sh_audio->i_bps * 8 / 1000)); - case META_AUDIO_SAMPLES: - return talloc_asprintf(NULL, "%d Hz, %d ch.", sh_audio->samplerate, - sh_audio->channels); - - /* check for valid demuxer */ - case META_INFO_TITLE: - return get_demuxer_info(mpctx, "Title"); - - case META_INFO_ARTIST: - return get_demuxer_info(mpctx, "Artist"); - - case META_INFO_ALBUM: - return get_demuxer_info(mpctx, "Album"); - - case META_INFO_YEAR: - return get_demuxer_info(mpctx, "Year"); - - case META_INFO_COMMENT: - return get_demuxer_info(mpctx, "Comment"); - - case META_INFO_TRACK: - return get_demuxer_info(mpctx, "Track"); - - case META_INFO_GENRE: - return get_demuxer_info(mpctx, "Genre"); - - default: - break; - } - - return talloc_strdup(NULL, ""); -} - static void print_stream(struct MPContext *mpctx, struct track *t, int id) { struct sh_stream *s = t->stream; diff --git a/screenshot.c b/screenshot.c index 79356ed9a2..a6313d01da 100644 --- a/screenshot.c +++ b/screenshot.c @@ -30,7 +30,6 @@ #include "m_property.h" #include "bstr.h" #include "mp_msg.h" -#include "metadata.h" #include "path.h" #include "libmpcodecs/mp_image.h" #include "libmpcodecs/dec_video.h" @@ -154,14 +153,13 @@ static char *create_fname(struct MPContext *mpctx, char *template, } case 'f': case 'F': { - char *video_file = get_metadata(mpctx, META_NAME); + char *video_file = mp_basename(mpctx->filename); if (video_file) { char *name = video_file; if (fmt == 'F') name = stripext(res, video_file); append_filename(&res, name); } - talloc_free(video_file); break; } case 'p': -- cgit v1.2.3 From e41378ea7186a4be1d5ed3f0d55a1d4cb93f2f10 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 6 Sep 2012 07:19:41 +0200 Subject: commands: simplify legacy command-to-property bridge There are many input commands which are redundant to properties. They were parsed like normal commands, but set_property_command() in command.c handled them automatically using the property mechanism. This still required having the command specifications around, and the code in command.c was quite messy. Replace this with a text based replacement mechanism. Some corner cases are not handled: commands of form "seek_chapter 3 1" are supposed to set the "chapter" property to 3. This use is probably rare, and doesn't show up in the default input.conf. The reason compatibility is kept is because breaking input.conf is quite annoying, so a minimal effort is made to avoid this. Currently we print an annoying warning every time a legacy command is used, though. Also add a compatibility entry for "pt_step", which was removed some time ago. Variations in whitespace are not handled, but it's good enough to deal with old input.conf entries. --- command.c | 112 ---------------------------------------------------------- input/input.c | 103 ++++++++++++++++++++++++++++++++--------------------- input/input.h | 36 ------------------- 3 files changed, 63 insertions(+), 188 deletions(-) diff --git a/command.c b/command.c index e4bc5e73ff..97dbc8ea6f 100644 --- a/command.c +++ b/command.c @@ -1965,115 +1965,6 @@ static int show_property_osd(MPContext *mpctx, const char *pname) return 0; } - -/** - * Command to property bridge - * - * It is used to handle most commands that just set a property - * and optionally display something on the OSD. - * Two kinds of commands are handled: adjust or toggle. - * - * Adjust commands take 1 or 2 parameters: - * If is non-zero the property is set to the given value - * otherwise it is adjusted. - * - * Toggle commands take 0 or 1 parameters. With no parameter - * or a value less than the property minimum it just steps the - * property to its next or previous value respectively. - * Otherwise it sets it to the given value. - */ - -/// List of the commands that can be handled by setting a property. -static struct { - /// property name - const char *name; - /// cmd id - int cmd; - /// set/adjust or toggle command - int toggle; -} set_prop_cmd[] = { - // general - { "loop", MP_CMD_LOOP, 0}, - { "chapter", MP_CMD_SEEK_CHAPTER, 0}, - { "angle", MP_CMD_SWITCH_ANGLE, 0}, - { "pause", MP_CMD_PAUSE, 0}, - // audio - { "volume", MP_CMD_VOLUME, 0}, - { "mute", MP_CMD_MUTE, 1}, - { "audio_delay", MP_CMD_AUDIO_DELAY, 0}, - { "switch_audio", MP_CMD_SWITCH_AUDIO, 1}, - { "balance", MP_CMD_BALANCE, 0}, - // video - { "fullscreen", MP_CMD_VO_FULLSCREEN, 1}, - { "panscan", MP_CMD_PANSCAN, 0}, - { "ontop", MP_CMD_VO_ONTOP, 1}, - { "rootwin", MP_CMD_VO_ROOTWIN, 1}, - { "border", MP_CMD_VO_BORDER, 1}, - { "framedropping", MP_CMD_FRAMEDROPPING, 1}, - { "gamma", MP_CMD_GAMMA, 0}, - { "brightness", MP_CMD_BRIGHTNESS, 0}, - { "contrast", MP_CMD_CONTRAST, 0}, - { "saturation", MP_CMD_SATURATION, 0}, - { "hue", MP_CMD_HUE, 0}, - { "vsync", MP_CMD_SWITCH_VSYNC, 1}, - // subs - { "sub", MP_CMD_SUB_SELECT, 1}, - { "sub_pos", MP_CMD_SUB_POS, 0}, - { "sub_delay", MP_CMD_SUB_DELAY, 0}, - { "sub_visibility", MP_CMD_SUB_VISIBILITY, 1}, - { "sub_forced_only", MP_CMD_SUB_FORCED_ONLY, 1}, - { "sub_scale", MP_CMD_SUB_SCALE, 0}, -#ifdef CONFIG_ASS - { "ass_use_margins", MP_CMD_ASS_USE_MARGINS, 1}, -#endif -#ifdef CONFIG_TV - { "tv_brightness", MP_CMD_TV_SET_BRIGHTNESS, 0}, - { "tv_hue", MP_CMD_TV_SET_HUE, 0}, - { "tv_saturation", MP_CMD_TV_SET_SATURATION, 0}, - { "tv_contrast", MP_CMD_TV_SET_CONTRAST, 0}, -#endif - {} -}; - -/// Handle commands that set a property. -static bool set_property_command(MPContext *mpctx, mp_cmd_t *cmd) -{ - int i, r; - m_option_t *prop; - const char *pname; - - // look for the command - for (i = 0; set_prop_cmd[i].name; i++) - if (set_prop_cmd[i].cmd == cmd->id) - break; - if (!(pname = set_prop_cmd[i].name)) - return 0; - - if (mp_property_do(pname, M_PROPERTY_GET_TYPE, &prop, mpctx) <= 0 || !prop) - return 0; - - // toggle command - if (set_prop_cmd[i].toggle) { - // set to value - if (cmd->nargs > 0 && cmd->args[0].v.i >= prop->min) - r = mp_property_do(pname, M_PROPERTY_SET, &cmd->args[0].v.i, mpctx); - else if (cmd->nargs > 0) - r = mp_property_do(pname, M_PROPERTY_STEP_DOWN, NULL, mpctx); - else - r = mp_property_do(pname, M_PROPERTY_STEP_UP, NULL, mpctx); - } else if (cmd->args[1].v.i) //set - r = mp_property_do(pname, M_PROPERTY_SET, &cmd->args[0].v, mpctx); - else // adjust - r = mp_property_do(pname, M_PROPERTY_STEP_UP, &cmd->args[0].v, mpctx); - - if (r <= 0) - return 1; - - show_property_osd(mpctx, pname); - - return 1; -} - static const char *property_error_string(int error_value) { switch (error_value) { @@ -2176,8 +2067,6 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) sh_video_t *const sh_video = mpctx->sh_video; int osd_duration = opts->osd_duration; int case_fallthrough_hack = 0; - if (set_property_command(mpctx, cmd)) - goto old_pause_hack; // was handled already switch (cmd->id) { case MP_CMD_SEEK: { mpctx->add_osd_seek_info = true; @@ -2774,7 +2663,6 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) "Received unknown cmd %s\n", cmd->name); } -old_pause_hack: switch (cmd->pausing) { case 1: // "pausing" pause_player(mpctx); diff --git a/input/input.c b/input/input.c index 38e89d4577..a2bc7d838a 100644 --- a/input/input.c +++ b/input/input.c @@ -101,46 +101,21 @@ static const mp_cmd_t mp_cmds[] = { #endif { MP_CMD_SEEK, "seek", { ARG_FLOAT, OARG_INT(0), OARG_INT(0) } }, { MP_CMD_EDL_MARK, "edl_mark", }, - { MP_CMD_AUDIO_DELAY, "audio_delay", { ARG_FLOAT, OARG_INT(0) } }, { MP_CMD_SPEED_INCR, "speed_incr", { ARG_FLOAT } }, { MP_CMD_SPEED_MULT, "speed_mult", { ARG_FLOAT } }, { MP_CMD_SPEED_SET, "speed_set", { ARG_FLOAT } }, { MP_CMD_QUIT, "quit", { OARG_INT(0) } }, { MP_CMD_STOP, "stop", }, - { MP_CMD_PAUSE, "pause", }, { MP_CMD_FRAME_STEP, "frame_step", }, { MP_CMD_PLAYLIST_NEXT, "playlist_next", { OARG_INT(0) } }, { MP_CMD_PLAYLIST_PREV, "playlist_prev", { OARG_INT(0) } }, - { MP_CMD_LOOP, "loop", { ARG_INT, OARG_INT(0) } }, - { MP_CMD_SUB_DELAY, "sub_delay", { ARG_FLOAT, OARG_INT(0) } }, { MP_CMD_SUB_STEP, "sub_step", { ARG_INT, OARG_INT(0) } }, { MP_CMD_OSD, "osd", { OARG_INT(-1) } }, { MP_CMD_OSD_SHOW_TEXT, "osd_show_text", { ARG_STRING, OARG_INT(-1), OARG_INT(0) } }, { MP_CMD_OSD_SHOW_PROPERTY_TEXT, "osd_show_property_text", { ARG_STRING, OARG_INT(-1), OARG_INT(0) } }, { MP_CMD_OSD_SHOW_PROGRESSION, "osd_show_progression", }, - { MP_CMD_VOLUME, "volume", { ARG_FLOAT, OARG_INT(0) } }, - { MP_CMD_BALANCE, "balance", { ARG_FLOAT, OARG_INT(0) } }, { MP_CMD_MIXER_USEMASTER, "use_master", }, - { MP_CMD_MUTE, "mute", { OARG_INT(-1) } }, - { MP_CMD_CONTRAST, "contrast", { ARG_INT, OARG_INT(0) } }, - { MP_CMD_GAMMA, "gamma", { ARG_INT, OARG_INT(0) } }, - { MP_CMD_BRIGHTNESS, "brightness", { ARG_INT, OARG_INT(0) } }, - { MP_CMD_HUE, "hue", { ARG_INT, OARG_INT(0) } }, - { MP_CMD_SATURATION, "saturation", { ARG_INT, OARG_INT(0) } }, - { MP_CMD_FRAMEDROPPING, "frame_drop", { OARG_INT(-1) } }, - { MP_CMD_SUB_POS, "sub_pos", { ARG_INT, OARG_INT(0) } }, - { MP_CMD_SUB_ALIGNMENT, "sub_alignment", { OARG_INT(-1) } }, - { MP_CMD_SUB_VISIBILITY, "sub_visibility", { OARG_INT(-1) } }, { MP_CMD_SUB_LOAD, "sub_load", { ARG_STRING } }, - { MP_CMD_SUB_SELECT, "vobsub_lang", { OARG_INT(-2) } }, // for compatibility - { MP_CMD_SUB_SELECT, "sub_select", { OARG_INT(-2) } }, - { MP_CMD_SUB_SCALE, "sub_scale", { ARG_FLOAT, OARG_INT(0) } }, -#ifdef CONFIG_ASS - { MP_CMD_ASS_USE_MARGINS, "ass_use_margins", { OARG_INT(-1) } }, -#endif - { MP_CMD_SWITCH_AUDIO, "switch_audio", { OARG_INT(-1) } }, - { MP_CMD_SWITCH_ANGLE, "switch_angle", { OARG_INT(-1) } }, - { MP_CMD_SWITCH_TITLE, "switch_title", { OARG_INT(-1) } }, #ifdef CONFIG_TV { MP_CMD_TV_START_SCAN, "tv_start_scan", }, { MP_CMD_TV_STEP_CHANNEL, "tv_step_channel", { ARG_INT } }, @@ -151,23 +126,12 @@ static const mp_cmd_t mp_cmds[] = { { MP_CMD_TV_SET_FREQ, "tv_set_freq", { ARG_FLOAT } }, { MP_CMD_TV_STEP_FREQ, "tv_step_freq", { ARG_FLOAT } }, { MP_CMD_TV_SET_NORM, "tv_set_norm", { ARG_STRING } }, - { MP_CMD_TV_SET_BRIGHTNESS, "tv_set_brightness", { ARG_INT, OARG_INT(1) } }, - { MP_CMD_TV_SET_CONTRAST, "tv_set_contrast", { ARG_INT, OARG_INT(1) } }, - { MP_CMD_TV_SET_HUE, "tv_set_hue", { ARG_INT, OARG_INT(1) } }, - { MP_CMD_TV_SET_SATURATION, "tv_set_saturation", { ARG_INT, OARG_INT(1) } }, #endif - { MP_CMD_SUB_FORCED_ONLY, "forced_subs_only", { OARG_INT(-1) } }, #ifdef CONFIG_DVBIN { MP_CMD_DVB_SET_CHANNEL, "dvb_set_channel", { ARG_INT, ARG_INT } }, #endif { MP_CMD_SWITCH_RATIO, "switch_ratio", { OARG_FLOAT(0) } }, - { MP_CMD_VO_FULLSCREEN, "vo_fullscreen", { OARG_INT(-1) } }, - { MP_CMD_VO_ONTOP, "vo_ontop", { OARG_INT(-1) } }, - { MP_CMD_VO_ROOTWIN, "vo_rootwin", { OARG_INT(-1) } }, - { MP_CMD_VO_BORDER, "vo_border", { OARG_INT(-1) } }, { MP_CMD_SCREENSHOT, "screenshot", { OARG_INT(0), OARG_INT(0) } }, - { MP_CMD_PANSCAN, "panscan", { ARG_FLOAT, OARG_INT(0) } }, - { MP_CMD_SWITCH_VSYNC, "switch_vsync", { OARG_INT(0) } }, { MP_CMD_LOADFILE, "loadfile", { ARG_STRING, OARG_INT(0) } }, { MP_CMD_LOADLIST, "loadlist", { ARG_STRING, OARG_INT(0) } }, { MP_CMD_PLAYLIST_CLEAR, "playlist_clear", }, @@ -180,7 +144,6 @@ static const mp_cmd_t mp_cmds[] = { { MP_CMD_STEP_PROPERTY, "step_property", { ARG_STRING, OARG_FLOAT(0), OARG_INT(0) } }, { MP_CMD_STEP_PROPERTY_OSD, "step_property_osd", { ARG_STRING, OARG_FLOAT(0), OARG_INT(0) } }, - { MP_CMD_SEEK_CHAPTER, "seek_chapter", { ARG_INT, OARG_INT(0) } }, { MP_CMD_SET_MOUSE_POS, "set_mouse_pos", { ARG_INT, ARG_INT } }, { MP_CMD_AF_SWITCH, "af_switch", { ARG_STRING } }, @@ -197,6 +160,50 @@ static const mp_cmd_t mp_cmds[] = { {0} }; +// Map legacy commands to proper commands +struct legacy_cmd { + const char *old, *new; +}; +#define LEGACY_STEP(old) {old, "step_property_osd " old} +static const struct legacy_cmd legacy_cmds[] = { + LEGACY_STEP("loop"), + {"seek_chapter", "step_property_osd chapter"}, + {"switch_angle", "step_property_osd angle"}, + LEGACY_STEP("pause"), + LEGACY_STEP("volume"), + LEGACY_STEP("mute"), + LEGACY_STEP("audio_delay"), + LEGACY_STEP("switch_audio"), + LEGACY_STEP("balance"), + {"vo_fullscreen", "step_property fullscreen"}, + LEGACY_STEP("panscan"), + {"vo_ontop", "step_property_osd ontop"}, + {"vo_rootwin", "step_property_osd rootwin"}, + {"vo_border", "step_property_osd border"}, + {"frame_drop", "step_property_osd framedropping"}, + LEGACY_STEP("gamma"), + LEGACY_STEP("brightness"), + LEGACY_STEP("contrast"), + LEGACY_STEP("saturation"), + LEGACY_STEP("hue"), + {"switch_vsync", "step_property_osd vsync"}, + {"sub_select", "step_property_osd sub"}, + LEGACY_STEP("sub_pos"), + LEGACY_STEP("sub_delay"), + LEGACY_STEP("sub_visibility"), + {"forced_subs_only", "step_property_osd sub_forced_only"}, + LEGACY_STEP("sub_scale"), + LEGACY_STEP("ass_use_margins"), + {"tv_set_brightness", "tv_brightness"}, + {"tv_set_hue", "tv_hue"}, + {"tv_set_saturation", "tv_saturation"}, + {"tv_set_contrast", "tv_contrast"}, + {"pt_step 1", "playlist_next"}, + {"pt_step -1", "playlist_prev"}, + {0} +}; + + /// The names of the keys as used in input.conf /// If you add some new keys, you also need to add them here @@ -685,6 +692,8 @@ mp_cmd_t *mp_input_parse_cmd(char *str) int pausing = 0; char *ptr; const mp_cmd_t *cmd_def; + mp_cmd_t *cmd = NULL; + void *tmp = NULL; // Ignore heading spaces. while (str[0] == ' ' || str[0] == '\t') @@ -704,6 +713,18 @@ mp_cmd_t *mp_input_parse_cmd(char *str) str = &str[19]; } + for (const struct legacy_cmd *entry = legacy_cmds; entry->old; entry++) { + size_t old_len = strlen(entry->old); + if (strncasecmp(entry->old, str, old_len) == 0) { + mp_tmsg(MSGT_INPUT, MSGL_WARN, "Warning: command '%s' is " + "deprecated, replaced with '%s'. Fix your input.conf!\n", + entry->old, entry->new); + str = talloc_asprintf(NULL, "%s%s", entry->new, str + old_len); + tmp = str; + break; + } + } + ptr = str + strcspn(str, "\t "); if (*ptr != 0) l = ptr - str; @@ -711,7 +732,7 @@ mp_cmd_t *mp_input_parse_cmd(char *str) l = strlen(str); if (l == 0) - return NULL; + goto error; for (i = 0; mp_cmds[i].name != NULL; i++) { if (strncasecmp(mp_cmds[i].name, str, l) == 0) @@ -719,11 +740,11 @@ mp_cmd_t *mp_input_parse_cmd(char *str) } if (mp_cmds[i].name == NULL) - return NULL; + goto error; cmd_def = &mp_cmds[i]; - mp_cmd_t *cmd = talloc_ptrtype(NULL, cmd); + cmd = talloc_ptrtype(NULL, cmd); *cmd = (mp_cmd_t){ .id = cmd_def->id, .name = talloc_strdup(cmd, cmd_def->name), @@ -815,10 +836,12 @@ mp_cmd_t *mp_input_parse_cmd(char *str) if (i < MP_CMD_MAX_ARGS) cmd->args[i].type = 0; + talloc_free(tmp); return cmd; error: mp_cmd_free(cmd); + talloc_free(tmp); return NULL; } diff --git a/input/input.h b/input/input.h index 8672728598..719fdf840a 100644 --- a/input/input.h +++ b/input/input.h @@ -24,68 +24,38 @@ // All command IDs enum mp_command_type { MP_CMD_SEEK, - MP_CMD_AUDIO_DELAY, MP_CMD_QUIT, - MP_CMD_PAUSE, - MP_CMD_GRAB_FRAMES, // deprecated: was a no-op command for years MP_CMD_PLAYLIST_NEXT, MP_CMD_PLAYLIST_PREV, - MP_CMD_SUB_DELAY, MP_CMD_OSD, - MP_CMD_VOLUME, MP_CMD_MIXER_USEMASTER, - MP_CMD_CONTRAST, - MP_CMD_BRIGHTNESS, - MP_CMD_HUE, - MP_CMD_SATURATION, - MP_CMD_FRAMEDROPPING, MP_CMD_TV_STEP_CHANNEL, MP_CMD_TV_STEP_NORM, MP_CMD_TV_STEP_CHANNEL_LIST, - MP_CMD_VO_FULLSCREEN, - MP_CMD_SUB_POS, MP_CMD_SCREENSHOT, - MP_CMD_PANSCAN, - MP_CMD_MUTE, MP_CMD_LOADFILE, MP_CMD_LOADLIST, MP_CMD_PLAYLIST_CLEAR, - MP_CMD_GAMMA, - MP_CMD_SUB_VISIBILITY, - MP_CMD_VOBSUB_LANG, // deprecated: combined with SUB_SELECT MP_CMD_SUB_STEP, MP_CMD_TV_SET_CHANNEL, MP_CMD_EDL_MARK, - MP_CMD_SUB_ALIGNMENT, MP_CMD_TV_LAST_CHANNEL, MP_CMD_OSD_SHOW_TEXT, MP_CMD_TV_SET_FREQ, MP_CMD_TV_SET_NORM, - MP_CMD_TV_SET_BRIGHTNESS, - MP_CMD_TV_SET_CONTRAST, - MP_CMD_TV_SET_HUE, - MP_CMD_TV_SET_SATURATION, - MP_CMD_SUB_FORCED_ONLY, - MP_CMD_VO_ONTOP, - MP_CMD_SUB_SELECT, - MP_CMD_VO_ROOTWIN, - MP_CMD_SWITCH_VSYNC, MP_CMD_SWITCH_RATIO, MP_CMD_FRAME_STEP, MP_CMD_SPEED_INCR, MP_CMD_SPEED_MULT, MP_CMD_SPEED_SET, MP_CMD_RUN, - MP_CMD_SWITCH_AUDIO, MP_CMD_SUB_LOAD, MP_CMD_KEYDOWN_EVENTS, - MP_CMD_VO_BORDER, MP_CMD_SET_PROPERTY, MP_CMD_SET_PROPERTY_OSD, MP_CMD_GET_PROPERTY, MP_CMD_OSD_SHOW_PROPERTY_TEXT, MP_CMD_OSD_SHOW_PROGRESSION, - MP_CMD_SEEK_CHAPTER, MP_CMD_RADIO_STEP_CHANNEL, MP_CMD_RADIO_SET_CHANNEL, MP_CMD_RADIO_SET_FREQ, @@ -94,13 +64,7 @@ enum mp_command_type { MP_CMD_STEP_PROPERTY_OSD, MP_CMD_RADIO_STEP_FREQ, MP_CMD_TV_STEP_FREQ, - MP_CMD_LOOP, - MP_CMD_BALANCE, - MP_CMD_SUB_SCALE, MP_CMD_TV_START_SCAN, - MP_CMD_SWITCH_ANGLE, - MP_CMD_ASS_USE_MARGINS, - MP_CMD_SWITCH_TITLE, MP_CMD_STOP, /// DVB commands -- cgit v1.2.3 From 6096966dee420179b65f4d2d3b93207419e58471 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 6 Sep 2012 07:58:28 +0200 Subject: commands: minor cleanup for property_osd_display array Make the definition more compact and less confusing by omitting rarely used fields. Avoid having to initialize osd_id with -1 in every entry by making 0 an unused OSD ID instead. --- command.c | 79 +++++++++++++++++++++++++++++++-------------------------------- mp_osd.h | 2 +- 2 files changed, 40 insertions(+), 41 deletions(-) diff --git a/command.c b/command.c index 97dbc8ea6f..56885ef179 100644 --- a/command.c +++ b/command.c @@ -1862,55 +1862,54 @@ void property_print_help(void) static struct property_osd_display { /// property name const char *name; + /// osd msg template + const char *osd_msg; /// progressbar type int osd_progbar; // -1 is special value for seek indicators /// osd msg id if it must be shared int osd_id; - /// osd msg template - const char *osd_msg; } property_osd_display[] = { // general - { "loop", 0, -1, _("Loop: %s") }, - { "chapter", -1, -1, NULL }, - { "pts_association_mode", 0, -1, "PTS association mode: %s" }, - { "hr_seek", 0, -1, "hr-seek: %s" }, - { "speed", 0, -1, _("Speed: x %6s") }, + { "loop", _("Loop: %s") }, + { "chapter", NULL, .osd_progbar = -1 }, + { "pts_association_mode", "PTS association mode: %s" }, + { "hr_seek", "hr-seek: %s" }, + { "speed", _("Speed: x %6s") }, // audio - { "volume", OSD_VOLUME, -1, _("Volume") }, - { "mute", 0, -1, _("Mute: %s") }, - { "audio_delay", 0, -1, _("A-V delay: %s") }, - { "switch_audio", 0, -1, _("Audio: %s") }, - { "balance", OSD_BALANCE, -1, _("Balance") }, + { "volume", _("Volume"), .osd_progbar = OSD_VOLUME }, + { "mute", _("Mute: %s") }, + { "audio_delay", _("A-V delay: %s") }, + { "switch_audio", _("Audio: %s") }, + { "balance", _("Balance"), .osd_progbar = OSD_BALANCE }, // video - { "panscan", OSD_PANSCAN, -1, _("Panscan") }, - { "ontop", 0, -1, _("Stay on top: %s") }, - { "rootwin", 0, -1, _("Rootwin: %s") }, - { "border", 0, -1, _("Border: %s") }, - { "framedropping", 0, -1, _("Framedropping: %s") }, - { "deinterlace", 0, -1, _("Deinterlace: %s") }, - { "colormatrix", 0, -1, _("YUV colormatrix: %s") }, - { "colormatrix_input_range", 0, -1, _("YUV input range: %s") }, - { "colormatrix_output_range", 0, -1, _("RGB output range: %s") }, - { "gamma", OSD_BRIGHTNESS, -1, _("Gamma") }, - { "brightness", OSD_BRIGHTNESS, -1, _("Brightness") }, - { "contrast", OSD_CONTRAST, -1, _("Contrast") }, - { "saturation", OSD_SATURATION, -1, _("Saturation") }, - { "hue", OSD_HUE, -1, _("Hue") }, - { "vsync", 0, -1, _("VSync: %s") }, + { "panscan", _("Panscan"), .osd_progbar = OSD_PANSCAN }, + { "ontop", _("Stay on top: %s") }, + { "rootwin", _("Rootwin: %s") }, + { "border", _("Border: %s") }, + { "framedropping", _("Framedropping: %s") }, + { "deinterlace", _("Deinterlace: %s") }, + { "colormatrix", _("YUV colormatrix: %s") }, + { "colormatrix_input_range", _("YUV input range: %s") }, + { "colormatrix_output_range", _("RGB output range: %s") }, + { "gamma", _("Gamma"), .osd_progbar = OSD_BRIGHTNESS }, + { "brightness", _("Brightness"), .osd_progbar = OSD_BRIGHTNESS }, + { "contrast", _("Contrast"), .osd_progbar = OSD_CONTRAST }, + { "saturation", _("Saturation"), .osd_progbar = OSD_SATURATION }, + { "hue", _("Hue"), .osd_progbar = OSD_HUE }, + { "vsync", _("VSync: %s") }, // subs - { "sub", 0, -1, _("Subtitles: %s") }, - { "sub_pos", 0, -1, _("Sub position: %s/100") }, - { "sub_delay", 0, OSD_MSG_SUB_DELAY, _("Sub delay: %s") }, - { "sub_visibility", 0, -1, _("Subtitles: %s") }, - { "sub_forced_only", 0, -1, _("Forced sub only: %s") }, - { "sub_scale", 0, -1, _("Sub Scale: %s")}, - { "ass_vsfilter_aspect_compat", 0, -1, - _("Subtitle VSFilter aspect compat: %s")}, + { "sub", _("Subtitles: %s") }, + { "sub_pos", _("Sub position: %s/100") }, + { "sub_delay", _("Sub delay: %s"), .osd_id = OSD_MSG_SUB_DELAY }, + { "sub_visibility", _("Subtitles: %s") }, + { "sub_forced_only", _("Forced sub only: %s") }, + { "sub_scale", _("Sub Scale: %s")}, + { "ass_vsfilter_aspect_compat", _("Subtitle VSFilter aspect compat: %s")}, #ifdef CONFIG_TV - { "tv_brightness", OSD_BRIGHTNESS, -1, _("Brightness") }, - { "tv_hue", OSD_HUE, -1, _("Hue") }, - { "tv_saturation", OSD_SATURATION, -1, _("Saturation") }, - { "tv_contrast", OSD_CONTRAST, -1, _("Contrast") }, + { "tv_brightness", _("Brightness"), .osd_progbar = OSD_BRIGHTNESS }, + { "tv_hue", _("Hue"), .osd_progbar = OSD_HUE}, + { "tv_saturation", _("Saturation"), .osd_progbar = OSD_SATURATION }, + { "tv_contrast", _("Contrast"), .osd_progbar = OSD_CONTRAST }, #endif {} }; @@ -1957,7 +1956,7 @@ static int show_property_osd(MPContext *mpctx, const char *pname) char *val = mp_property_print(pname, mpctx); if (val) { int index = p - property_osd_display; - set_osd_tmsg(mpctx, p->osd_id >= 0 ? p->osd_id : OSD_MSG_PROPERTY + index, + set_osd_tmsg(mpctx, p->osd_id > 0 ? p->osd_id : OSD_MSG_PROPERTY + index, 1, opts->osd_duration, p->osd_msg, val); talloc_free(val); } diff --git a/mp_osd.h b/mp_osd.h index 0e9476a4f8..a6797ed318 100644 --- a/mp_osd.h +++ b/mp_osd.h @@ -19,7 +19,6 @@ #ifndef MPLAYER_MP_OSD_H #define MPLAYER_MP_OSD_H -#define OSD_MSG_TV_CHANNEL 0 #define OSD_MSG_TEXT 1 #define OSD_MSG_SUB_DELAY 2 #define OSD_MSG_SPEED 3 @@ -27,6 +26,7 @@ #define OSD_MSG_BAR 5 #define OSD_MSG_PAUSE 6 #define OSD_MSG_RADIO_CHANNEL 7 +#define OSD_MSG_TV_CHANNEL 8 /// Base id for messages generated from the commmand to property bridge. #define OSD_MSG_PROPERTY 0x100 #define OSD_MSG_SUB_BASE 0x1000 -- cgit v1.2.3 From a668ae0ff90c43ebcdea4f581aef0c98aeebd382 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 9 Sep 2012 02:08:08 +0200 Subject: commands: change input commands to make OSD usage explicit Most input commands had their own policy whether to display an OSD message for user feedback or not. Some commands had two variants, one that showed an OSD message and one that didn't (e.g. step_property_osd and step_property). Change it such that all commands show a message on the OSD. Add a "no-osd" modifier that disables OSD for that command. Rename the "step_property" and "step_property_osd" command to "switch", and rename "set_property" and "set_property_osd" to "set". Note that commands which haven't used OSD before still don't use OSD. That will possibly be fixed later. (E.g. "screenshot" could display an OSD message instead of just printing a message on the terminal.) The chapter and edition properties still produce OSD messages even with "no-osd", because they don't map so well to the property_osd_display[] mechanism. --- command.c | 68 ++++++++++++++++++++++++++++------------------------------- input/input.c | 66 +++++++++++++++++++++++++++++++++++++++------------------ input/input.h | 12 +++++++---- mp_osd.h | 1 + mplayer.c | 2 ++ 5 files changed, 89 insertions(+), 60 deletions(-) diff --git a/command.c b/command.c index 56885ef179..9a94ceea08 100644 --- a/command.c +++ b/command.c @@ -558,7 +558,6 @@ static int mp_property_editions(m_option_t *prop, int action, void *arg, static int mp_property_angle(m_option_t *prop, int action, void *arg, MPContext *mpctx) { - struct MPOpts *opts = &mpctx->opts; struct demuxer *demuxer = mpctx->master_demuxer; int angle = -1; int angles; @@ -618,8 +617,6 @@ static int mp_property_angle(m_option_t *prop, int action, void *arg, resync_audio_stream(sh_audio); } - set_osd_tmsg(mpctx, OSD_MSG_TEXT, 1, opts->osd_duration, - "Angle: %d/%d", angle, angles); return M_PROPERTY_OK; } @@ -1897,6 +1894,7 @@ static struct property_osd_display { { "saturation", _("Saturation"), .osd_progbar = OSD_SATURATION }, { "hue", _("Hue"), .osd_progbar = OSD_HUE }, { "vsync", _("VSync: %s") }, + { "angle", _("Angle: %s") }, // subs { "sub", _("Subtitles: %s") }, { "sub_pos", _("Sub position: %s/100") }, @@ -2065,31 +2063,32 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) sh_audio_t *const sh_audio = mpctx->sh_audio; sh_video_t *const sh_video = mpctx->sh_video; int osd_duration = opts->osd_duration; + int osdl = cmd->on_osd ? 1 : OSD_LEVEL_INVISIBLE; int case_fallthrough_hack = 0; switch (cmd->id) { case MP_CMD_SEEK: { - mpctx->add_osd_seek_info = true; float v = cmd->args[0].v.f; int abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0; int exact = (cmd->nargs > 2) ? cmd->args[2].v.i : 0; + int function; if (abs == 2) { // Absolute seek to a timestamp in seconds queue_seek(mpctx, MPSEEK_ABSOLUTE, v, exact); - mpctx->osd_function = v > get_current_time(mpctx) ? - OSD_FFW : OSD_REW; + function = v > get_current_time(mpctx) ? OSD_FFW : OSD_REW; } else if (abs) { /* Absolute seek by percentage */ queue_seek(mpctx, MPSEEK_FACTOR, v / 100.0, exact); - mpctx->osd_function = OSD_FFW; // Direction isn't set correctly + function = OSD_FFW; // Direction isn't set correctly } else { queue_seek(mpctx, MPSEEK_RELATIVE, v, exact); - mpctx->osd_function = (v > 0) ? OSD_FFW : OSD_REW; + function = (v > 0) ? OSD_FFW : OSD_REW; + } + if (cmd->on_osd) { + mpctx->add_osd_seek_info = true; + mpctx->osd_function = function; } break; } - case MP_CMD_SET_PROPERTY_OSD: - case_fallthrough_hack = 1; - - case MP_CMD_SET_PROPERTY: { + case MP_CMD_SET: { int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_PARSE, cmd->args[1].v.s, mpctx); if (r == M_PROPERTY_UNKNOWN) @@ -2099,7 +2098,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) mp_msg(MSGT_CPLAYER, MSGL_WARN, "Failed to set property '%s' to '%s'.\n", cmd->args[0].v.s, cmd->args[1].v.s); - else if (case_fallthrough_hack) + else if (cmd->on_osd) show_property_osd(mpctx, cmd->args[0].v.s); if (r <= 0) mp_msg(MSGT_GLOBAL, MSGL_INFO, @@ -2107,10 +2106,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) break; } - case MP_CMD_STEP_PROPERTY_OSD: - case_fallthrough_hack = 1; - - case MP_CMD_STEP_PROPERTY: { + case MP_CMD_SWITCH: { void *arg = NULL; int r, i; double d; @@ -2149,7 +2145,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) mp_msg(MSGT_CPLAYER, MSGL_WARN, "Failed to increment property '%s' by %f.\n", cmd->args[0].v.s, cmd->args[1].v.f); - else if (case_fallthrough_hack) + else if (cmd->on_osd) show_property_osd(mpctx, cmd->args[0].v.s); if (r <= 0) mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_ERROR=%s\n", @@ -2209,7 +2205,8 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) case MP_CMD_SPEED_INCR: { float v = cmd->args[0].v.f; mp_property_do("speed", M_PROPERTY_STEP_UP, &v, mpctx); - show_property_osd(mpctx, "speed"); + if (cmd->on_osd) + show_property_osd(mpctx, "speed"); break; } @@ -2221,7 +2218,8 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) if (case_fallthrough_hack) v *= mpctx->opts.playback_speed; mp_property_do("speed", M_PROPERTY_SET, &v, mpctx); - show_property_osd(mpctx, "speed"); + if (cmd->on_osd) + show_property_osd(mpctx, "speed"); break; } @@ -2267,7 +2265,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) } #endif if (available) - set_osd_tmsg(mpctx, OSD_MSG_SUB_DELAY, 1, osd_duration, + set_osd_tmsg(mpctx, OSD_MSG_SUB_DELAY, osdl, osd_duration, "Sub delay: %d ms", ROUND(sub_delay * 1000)); } break; @@ -2282,9 +2280,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) opts->osd_level = (opts->osd_level + 1) % (max + 1); else opts->osd_level = v > max ? max : v; - /* Show OSD state when disabled, but not when an explicit - argument is given to the OSD command, i.e. in slave mode. */ - if (v == -1 && opts->osd_level <= 1) + if (cmd->on_osd && opts->osd_level <= 1) set_osd_tmsg(mpctx, OSD_MSG_OSD_STATUS, 0, osd_duration, "OSD: %s", opts->osd_level ? mp_gtext("enabled") : @@ -2386,7 +2382,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) else radio_step_channel(mpctx->stream, RADIO_CHANNEL_LOWER); if (radio_get_channel_name(mpctx->stream)) { - set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration, + set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, osdl, osd_duration, "Channel: %s", radio_get_channel_name(mpctx->stream)); } @@ -2397,7 +2393,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) if (mpctx->stream && mpctx->stream->type == STREAMTYPE_RADIO) { radio_set_channel(mpctx->stream, cmd->args[0].v.s); if (radio_get_channel_name(mpctx->stream)) { - set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration, + set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, osdl, osd_duration, "Channel: %s", radio_get_channel_name(mpctx->stream)); } @@ -2426,7 +2422,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) #ifdef CONFIG_PVR else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) { pvr_set_freq(mpctx->stream, ROUND(cmd->args[0].v.f)); - set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s", + set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s", pvr_get_current_channelname(mpctx->stream), pvr_get_current_stationname(mpctx->stream)); } @@ -2439,7 +2435,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) #ifdef CONFIG_PVR else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) { pvr_force_freq_step(mpctx->stream, ROUND(cmd->args[0].v.f)); - set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: f %d", + set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: f %d", pvr_get_current_channelname(mpctx->stream), pvr_get_current_frequency(mpctx->stream)); } @@ -2460,7 +2456,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) tv_step_channel(get_tvh(mpctx), TV_CHANNEL_LOWER); } if (tv_channel_list) { - set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, + set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "Channel: %s", tv_channel_current->name); //vo_osd_changed(OSDTYPE_SUBTITLE); } @@ -2469,7 +2465,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) { pvr_set_channel_step(mpctx->stream, cmd->args[0].v.i); - set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s", + set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s", pvr_get_current_channelname(mpctx->stream), pvr_get_current_stationname(mpctx->stream)); } @@ -2498,7 +2494,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) if (get_tvh(mpctx)) { tv_set_channel(get_tvh(mpctx), cmd->args[0].v.s); if (tv_channel_list) { - set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, + set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "Channel: %s", tv_channel_current->name); //vo_osd_changed(OSDTYPE_SUBTITLE); } @@ -2506,7 +2502,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) #ifdef CONFIG_PVR else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) { pvr_set_channel(mpctx->stream, cmd->args[0].v.s); - set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s", + set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s", pvr_get_current_channelname(mpctx->stream), pvr_get_current_stationname(mpctx->stream)); } @@ -2531,7 +2527,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) if (get_tvh(mpctx)) { tv_last_channel(get_tvh(mpctx)); if (tv_channel_list) { - set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, + set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "Channel: %s", tv_channel_current->name); //vo_osd_changed(OSDTYPE_SUBTITLE); } @@ -2539,7 +2535,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) #ifdef CONFIG_PVR else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) { pvr_set_lastchannel(mpctx->stream); - set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s", + set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s", pvr_get_current_channelname(mpctx->stream), pvr_get_current_stationname(mpctx->stream)); } @@ -2599,9 +2595,9 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) mp_msg(MSGT_CPLAYER, MSGL_INFO, "Setting vo cmd line to '%s'.\n", s); if (vo_control(mpctx->video_out, VOCTRL_SET_COMMAND_LINE, s) > 0) { - set_osd_msg(mpctx, OSD_MSG_TEXT, 1, osd_duration, "vo='%s'", s); + set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration, "vo='%s'", s); } else { - set_osd_msg(mpctx, OSD_MSG_TEXT, 1, osd_duration, "Failed!"); + set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration, "Failed!"); } } break; diff --git a/input/input.c b/input/input.c index a2bc7d838a..5d3ab686df 100644 --- a/input/input.c +++ b/input/input.c @@ -138,11 +138,9 @@ static const mp_cmd_t mp_cmds[] = { { MP_CMD_RUN, "run", { ARG_STRING } }, { MP_CMD_KEYDOWN_EVENTS, "key_down_event", { ARG_INT } }, - { MP_CMD_SET_PROPERTY, "set_property", { ARG_STRING, ARG_STRING } }, - { MP_CMD_SET_PROPERTY_OSD, "set_property_osd", { ARG_STRING, ARG_STRING } }, + { MP_CMD_SET, "set", { ARG_STRING, ARG_STRING } }, { MP_CMD_GET_PROPERTY, "get_property", { ARG_STRING } }, - { MP_CMD_STEP_PROPERTY, "step_property", { ARG_STRING, OARG_FLOAT(0), OARG_INT(0) } }, - { MP_CMD_STEP_PROPERTY_OSD, "step_property_osd", { ARG_STRING, OARG_FLOAT(0), OARG_INT(0) } }, + { MP_CMD_SWITCH, "switch", { ARG_STRING, OARG_FLOAT(0), OARG_INT(0) } }, { MP_CMD_SET_MOUSE_POS, "set_mouse_pos", { ARG_INT, ARG_INT } }, @@ -164,40 +162,44 @@ static const mp_cmd_t mp_cmds[] = { struct legacy_cmd { const char *old, *new; }; -#define LEGACY_STEP(old) {old, "step_property_osd " old} +#define LEGACY_STEP(old) {old, "switch " old} static const struct legacy_cmd legacy_cmds[] = { LEGACY_STEP("loop"), - {"seek_chapter", "step_property_osd chapter"}, - {"switch_angle", "step_property_osd angle"}, + {"seek_chapter", "switch chapter"}, + {"switch_angle", "switch angle"}, LEGACY_STEP("pause"), LEGACY_STEP("volume"), LEGACY_STEP("mute"), LEGACY_STEP("audio_delay"), LEGACY_STEP("switch_audio"), LEGACY_STEP("balance"), - {"vo_fullscreen", "step_property fullscreen"}, + {"vo_fullscreen", "no-osd switch fullscreen"}, LEGACY_STEP("panscan"), - {"vo_ontop", "step_property_osd ontop"}, - {"vo_rootwin", "step_property_osd rootwin"}, - {"vo_border", "step_property_osd border"}, - {"frame_drop", "step_property_osd framedropping"}, + {"vo_ontop", "switch ontop"}, + {"vo_rootwin", "switch rootwin"}, + {"vo_border", "switch border"}, + {"frame_drop", "switch framedropping"}, LEGACY_STEP("gamma"), LEGACY_STEP("brightness"), LEGACY_STEP("contrast"), LEGACY_STEP("saturation"), LEGACY_STEP("hue"), - {"switch_vsync", "step_property_osd vsync"}, - {"sub_select", "step_property_osd sub"}, + {"switch_vsync", "switch vsync"}, + {"sub_select", "switch sub"}, LEGACY_STEP("sub_pos"), LEGACY_STEP("sub_delay"), LEGACY_STEP("sub_visibility"), - {"forced_subs_only", "step_property_osd sub_forced_only"}, + {"forced_subs_only", "switch sub_forced_only"}, LEGACY_STEP("sub_scale"), LEGACY_STEP("ass_use_margins"), {"tv_set_brightness", "tv_brightness"}, {"tv_set_hue", "tv_hue"}, {"tv_set_saturation", "tv_saturation"}, {"tv_set_contrast", "tv_contrast"}, + {"step_property_osd", "switch"}, + {"step_property", "no-osd switch"}, + {"set_property", "no-osd set"}, + {"set_property_osd", "set"}, {"pt_step 1", "playlist_next"}, {"pt_step -1", "playlist_prev"}, {0} @@ -686,18 +688,31 @@ int mp_input_add_key_fd(struct input_ctx *ictx, int fd, int select, return 1; } +static char *skip_ws(char *str) +{ + while (str[0] == ' ' || str[0] == '\t') + ++str; + return str; +} + +static char *skip_no_ws(char *str) +{ + while (str[0] && !(str[0] == ' ' || str[0] == '\t')) + ++str; + return str; +} + mp_cmd_t *mp_input_parse_cmd(char *str) { int i, l; int pausing = 0; + int on_osd = MP_ON_OSD_AUTO; char *ptr; const mp_cmd_t *cmd_def; mp_cmd_t *cmd = NULL; void *tmp = NULL; - // Ignore heading spaces. - while (str[0] == ' ' || str[0] == '\t') - ++str; + str = skip_ws(str); if (strncmp(str, "pausing ", 8) == 0) { pausing = 1; @@ -713,6 +728,8 @@ mp_cmd_t *mp_input_parse_cmd(char *str) str = &str[19]; } + str = skip_ws(str); + for (const struct legacy_cmd *entry = legacy_cmds; entry->old; entry++) { size_t old_len = strlen(entry->old); if (strncasecmp(entry->old, str, old_len) == 0) { @@ -725,7 +742,14 @@ mp_cmd_t *mp_input_parse_cmd(char *str) } } - ptr = str + strcspn(str, "\t "); + str = skip_ws(str); + + if (strncmp(str, "no-osd ", 7) == 0) { + on_osd = MP_ON_OSD_NO; + str = &str[7]; + } + + ptr = skip_no_ws(str); if (*ptr != 0) l = ptr - str; else @@ -735,7 +759,8 @@ mp_cmd_t *mp_input_parse_cmd(char *str) goto error; for (i = 0; mp_cmds[i].name != NULL; i++) { - if (strncasecmp(mp_cmds[i].name, str, l) == 0) + const char *cmd = mp_cmds[i].name; + if (strncasecmp(cmd, str, l) == 0 && strlen(cmd) == l) break; } @@ -749,6 +774,7 @@ mp_cmd_t *mp_input_parse_cmd(char *str) .id = cmd_def->id, .name = talloc_strdup(cmd, cmd_def->name), .pausing = pausing, + .on_osd = on_osd, }; ptr = str; diff --git a/input/input.h b/input/input.h index 719fdf840a..af9d1a8db0 100644 --- a/input/input.h +++ b/input/input.h @@ -51,8 +51,7 @@ enum mp_command_type { MP_CMD_RUN, MP_CMD_SUB_LOAD, MP_CMD_KEYDOWN_EVENTS, - MP_CMD_SET_PROPERTY, - MP_CMD_SET_PROPERTY_OSD, + MP_CMD_SET, MP_CMD_GET_PROPERTY, MP_CMD_OSD_SHOW_PROPERTY_TEXT, MP_CMD_OSD_SHOW_PROGRESSION, @@ -60,8 +59,7 @@ enum mp_command_type { MP_CMD_RADIO_SET_CHANNEL, MP_CMD_RADIO_SET_FREQ, MP_CMD_SET_MOUSE_POS, - MP_CMD_STEP_PROPERTY, - MP_CMD_STEP_PROPERTY_OSD, + MP_CMD_SWITCH, MP_CMD_RADIO_STEP_FREQ, MP_CMD_TV_STEP_FREQ, MP_CMD_TV_START_SCAN, @@ -104,6 +102,11 @@ enum mp_command_type { // Key FIFO was full - release events may be lost, zero button-down status #define MP_INPUT_RELEASE_ALL -5 +enum mp_on_osd { + MP_ON_OSD_NO = 0, + MP_ON_OSD_AUTO, +}; + enum mp_input_section_flags { // If a key binding is not defined in the current section, search the // default section for it ("default" refers to bindings with no section @@ -129,6 +132,7 @@ typedef struct mp_cmd { struct mp_cmd_arg args[MP_CMD_MAX_ARGS]; int nargs; int pausing; + enum mp_on_osd on_osd; struct mp_cmd *queue_next; } mp_cmd_t; diff --git a/mp_osd.h b/mp_osd.h index a6797ed318..86eed3a142 100644 --- a/mp_osd.h +++ b/mp_osd.h @@ -33,6 +33,7 @@ #define MAX_OSD_LEVEL 3 #define MAX_TERM_OSD_LEVEL 1 +#define OSD_LEVEL_INVISIBLE 4 struct MPContext; diff --git a/mplayer.c b/mplayer.c index d0abca3112..2d1843203f 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1240,6 +1240,8 @@ static mp_osd_msg_t *add_osd_msg(struct MPContext *mpctx, int id, int level, static void set_osd_msg_va(struct MPContext *mpctx, int id, int level, int time, const char *fmt, va_list ap) { + if (level == OSD_LEVEL_INVISIBLE) + return; mp_osd_msg_t *msg = add_osd_msg(mpctx, id, level, time); msg->msg = talloc_vasprintf(msg, fmt, ap); } -- cgit v1.2.3 From cd25a671b58a94fbfa1942103137ad6617170a32 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 14 Sep 2012 22:07:33 +0200 Subject: commands: remove unimplemented "use_master" command The implementation for this command was removed in 2002. --- input/input.c | 1 - input/input.h | 1 - 2 files changed, 2 deletions(-) diff --git a/input/input.c b/input/input.c index 5d3ab686df..97d6a6b25a 100644 --- a/input/input.c +++ b/input/input.c @@ -114,7 +114,6 @@ static const mp_cmd_t mp_cmds[] = { { MP_CMD_OSD_SHOW_TEXT, "osd_show_text", { ARG_STRING, OARG_INT(-1), OARG_INT(0) } }, { MP_CMD_OSD_SHOW_PROPERTY_TEXT, "osd_show_property_text", { ARG_STRING, OARG_INT(-1), OARG_INT(0) } }, { MP_CMD_OSD_SHOW_PROGRESSION, "osd_show_progression", }, - { MP_CMD_MIXER_USEMASTER, "use_master", }, { MP_CMD_SUB_LOAD, "sub_load", { ARG_STRING } }, #ifdef CONFIG_TV { MP_CMD_TV_START_SCAN, "tv_start_scan", }, diff --git a/input/input.h b/input/input.h index af9d1a8db0..52fdfb956b 100644 --- a/input/input.h +++ b/input/input.h @@ -28,7 +28,6 @@ enum mp_command_type { MP_CMD_PLAYLIST_NEXT, MP_CMD_PLAYLIST_PREV, MP_CMD_OSD, - MP_CMD_MIXER_USEMASTER, MP_CMD_TV_STEP_CHANNEL, MP_CMD_TV_STEP_NORM, MP_CMD_TV_STEP_CHANNEL_LIST, -- cgit v1.2.3 From 4e2fab5846d2fe7f51a799abb4118515efac854b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 15 Sep 2012 01:10:59 +0200 Subject: commands: rename properties, update input.conf Use "-" instead of "_" in property names. The intent is that property names and options names should be the same (if they refer to the same thing), and options use "-" as word separator. Rename some other properties too, e.g. "switch_audio" -> "audio". Add a way to translate the old property names to the new ones, similar to the input command legacy bridge. Update input.conf. Use the new property names, and don't use legacy commands. --- TOOLS/mplayer2_identify.sh | 24 ++++---- command.c | 138 ++++++++++++++++++++++++++++----------------- etc/input.conf | 129 +++++++++++++++++++++--------------------- input/input.c | 77 +++++++++++++------------ mplayer.c | 4 +- 5 files changed, 203 insertions(+), 169 deletions(-) diff --git a/TOOLS/mplayer2_identify.sh b/TOOLS/mplayer2_identify.sh index 04902124ab..32f9fc279f 100755 --- a/TOOLS/mplayer2_identify.sh +++ b/TOOLS/mplayer2_identify.sh @@ -59,30 +59,30 @@ fi __midentify__allprops=" filename path - stream_start - stream_end - stream_length + stream-start + stream-end + stream-length demuxer - switch_program + program length chapters editions titles - switch_audio - audio_bitrate - audio_codec - audio_format + audio + audio-bitrate + audio-codec + audio-format channels samplerate - switch_video + video angle - video_bitrate - video_codec - video_format + video-bitrate + video-codec + video-format aspect fps width diff --git a/command.c b/command.c index 9a94ceea08..dcf7634ead 100644 --- a/command.c +++ b/command.c @@ -1019,8 +1019,8 @@ static int mp_property_program(m_option_t *prop, int action, void *arg, "Selected program contains no audio or video streams!\n"); return M_PROPERTY_ERROR; } - mp_property_do("switch_audio", M_PROPERTY_SET, &prog.aid, mpctx); - mp_property_do("switch_video", M_PROPERTY_SET, &prog.vid, mpctx); + mp_property_do("audio", M_PROPERTY_SET, &prog.aid, mpctx); + mp_property_do("video", M_PROPERTY_SET, &prog.vid, mpctx); return M_PROPERTY_OK; default: @@ -1352,7 +1352,7 @@ static int mp_property_gamma(m_option_t *prop, int action, void *arg, if (mpctx->sh_video->gsh->demuxer->type == DEMUXER_TYPE_TV) { int l = strlen(prop->name); char tv_prop[3 + l + 1]; - sprintf(tv_prop, "tv_%s", prop->name); + sprintf(tv_prop, "tv-%s", prop->name); return mp_property_do(tv_prop, action, arg, mpctx); } #endif @@ -1677,21 +1677,21 @@ static const m_option_t mp_properties[] = { 0, 0, 0, NULL }, { "demuxer", mp_property_demuxer, CONF_TYPE_STRING, 0, 0, 0, NULL }, - { "stream_pos", mp_property_stream_pos, CONF_TYPE_POSITION, + { "stream-pos", mp_property_stream_pos, CONF_TYPE_POSITION, M_OPT_MIN, 0, 0, NULL }, - { "stream_start", mp_property_stream_start, CONF_TYPE_POSITION, + { "stream-start", mp_property_stream_start, CONF_TYPE_POSITION, M_OPT_MIN, 0, 0, NULL }, - { "stream_end", mp_property_stream_end, CONF_TYPE_POSITION, + { "stream-end", mp_property_stream_end, CONF_TYPE_POSITION, M_OPT_MIN, 0, 0, NULL }, - { "stream_length", mp_property_stream_length, CONF_TYPE_POSITION, + { "stream-length", mp_property_stream_length, CONF_TYPE_POSITION, M_OPT_MIN, 0, 0, NULL }, - { "stream_time_pos", mp_property_stream_time_pos, CONF_TYPE_TIME, + { "stream-time-pos", mp_property_stream_time_pos, CONF_TYPE_TIME, M_OPT_MIN, 0, 0, NULL }, { "length", mp_property_length, CONF_TYPE_TIME, M_OPT_MIN, 0, 0, NULL }, - { "percent_pos", mp_property_percent_pos, CONF_TYPE_INT, + { "percent-pos", mp_property_percent_pos, CONF_TYPE_INT, M_OPT_RANGE, 0, 100, NULL }, - { "time_pos", mp_property_time_pos, CONF_TYPE_TIME, + { "time-pos", mp_property_time_pos, CONF_TYPE_TIME, M_OPT_MIN, 0, 0, NULL }, { "chapter", mp_property_chapter, CONF_TYPE_INT, M_OPT_MIN, 0, 0, NULL }, @@ -1708,9 +1708,9 @@ static const m_option_t mp_properties[] = { 0, 0, 0, NULL }, { "pause", mp_property_pause, CONF_TYPE_FLAG, M_OPT_RANGE, 0, 1, NULL }, - { "pts_association_mode", mp_property_generic_option, &m_option_type_choice, + { "pts-association-mode", mp_property_generic_option, &m_option_type_choice, 0, 0, 0, "pts-association-mode" }, - { "hr_seek", mp_property_generic_option, &m_option_type_choice, + { "hr-seek", mp_property_generic_option, &m_option_type_choice, 0, 0, 0, "hr-seek" }, // Audio @@ -1718,19 +1718,19 @@ static const m_option_t mp_properties[] = { M_OPT_RANGE, 0, 100, NULL }, { "mute", mp_property_mute, CONF_TYPE_FLAG, M_OPT_RANGE, 0, 1, NULL }, - { "audio_delay", mp_property_audio_delay, CONF_TYPE_FLOAT, + { "audio-delay", mp_property_audio_delay, CONF_TYPE_FLOAT, M_OPT_RANGE, -100, 100, NULL }, - { "audio_format", mp_property_audio_format, CONF_TYPE_INT, + { "audio-format", mp_property_audio_format, CONF_TYPE_INT, 0, 0, 0, NULL }, - { "audio_codec", mp_property_audio_codec, CONF_TYPE_STRING, + { "audio-codec", mp_property_audio_codec, CONF_TYPE_STRING, 0, 0, 0, NULL }, - { "audio_bitrate", mp_property_audio_bitrate, CONF_TYPE_INT, + { "audio-bitrate", mp_property_audio_bitrate, CONF_TYPE_INT, 0, 0, 0, NULL }, { "samplerate", mp_property_samplerate, CONF_TYPE_INT, 0, 0, 0, NULL }, { "channels", mp_property_channels, CONF_TYPE_INT, 0, 0, 0, NULL }, - { "switch_audio", mp_property_audio, CONF_TYPE_INT, + { "audio", mp_property_audi