diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/av_common.c | 107 | ||||
-rw-r--r-- | core/av_log.c | 7 | ||||
-rw-r--r-- | core/bstr.c | 9 | ||||
-rw-r--r-- | core/bstr.h | 7 | ||||
-rw-r--r-- | core/cfg-mplayer.h | 45 | ||||
-rw-r--r-- | core/command.c | 83 | ||||
-rw-r--r-- | core/defaultopts.c | 15 | ||||
-rw-r--r-- | core/encode_lavc.c | 5 | ||||
-rw-r--r-- | core/input/appleir.c | 153 | ||||
-rw-r--r-- | core/input/ar.c | 469 | ||||
-rw-r--r-- | core/input/ar.h | 35 | ||||
-rw-r--r-- | core/input/input.c | 93 | ||||
-rw-r--r-- | core/input/input.h | 1 | ||||
-rw-r--r-- | core/input/keycodes.h | 17 | ||||
-rw-r--r-- | core/m_config.c | 21 | ||||
-rw-r--r-- | core/m_config.h | 2 | ||||
-rw-r--r-- | core/m_option.c | 438 | ||||
-rw-r--r-- | core/m_option.h | 32 | ||||
-rw-r--r-- | core/m_property.c | 2 | ||||
-rw-r--r-- | core/mp_core.h | 33 | ||||
-rw-r--r-- | core/mp_msg.c | 19 | ||||
-rw-r--r-- | core/mp_msg.h | 2 | ||||
-rw-r--r-- | core/mplayer.c | 595 | ||||
-rw-r--r-- | core/mplayer.h | 8 | ||||
-rw-r--r-- | core/options.h | 27 | ||||
-rw-r--r-- | core/timeline/tl_matroska.c | 123 |
26 files changed, 942 insertions, 1406 deletions
diff --git a/core/av_common.c b/core/av_common.c index 68ab461c10..5e6c8a4352 100644 --- a/core/av_common.c +++ b/core/av_common.c @@ -19,7 +19,6 @@ #include <libavutil/common.h> -#include "config.h" #include "core/mp_talloc.h" #include "av_common.h" #include "codecs.h" @@ -59,13 +58,6 @@ void mp_copy_lav_codec_headers(AVCodecContext *avctx, AVCodecContext *st) avctx->bits_per_coded_sample = st->bits_per_coded_sample; } -#if !HAVE_AVCODEC_IS_DECODER_API -static int av_codec_is_decoder(AVCodec *codec) -{ - return !!codec->decode; -} -#endif - void mp_add_lavc_decoders(struct mp_decoder_list *list, enum AVMediaType type) { AVCodec *cur = NULL; @@ -74,93 +66,38 @@ void mp_add_lavc_decoders(struct mp_decoder_list *list, enum AVMediaType type) if (!cur) break; if (av_codec_is_decoder(cur) && cur->type == type) { - struct mp_decoder_entry entry = { - .family = "lavc", - .codec = mp_codec_from_av_codec_id(cur->id), - .decoder = cur->name, - .desc = cur->long_name, - }; - assert(entry.family); - MP_TARRAY_APPEND(list, list->entries, list->num_entries, entry); + mp_add_decoder(list, "lavc", mp_codec_from_av_codec_id(cur->id), + cur->name, cur->long_name); } } } -#if HAVE_AVCODEC_CODEC_DESC_API - -int mp_codec_to_av_codec_id(const char *codec) -{ - - const AVCodecDescriptor *desc = avcodec_descriptor_get_by_name(codec); - return desc ? desc->id : CODEC_ID_NONE; -} - -const char *mp_codec_from_av_codec_id(int codec_id) -{ - const AVCodecDescriptor *desc = avcodec_descriptor_get(codec_id); - return desc ? desc->name : NULL; -} - -#else - -struct mp_av_codec { - const char *name; - int codec_id; -}; - -// Some decoders have a different name from the canonical codec name, for -// example the codec "dts" CODEC_ID_DTS has the decoder named "dca", and -// avcodec_find_decoder_by_name("dts") would return 0. We always want the -// canonical name. -// On newer lavc versions, avcodec_descriptor_get_by_name("dts") will return -// CODEC_ID_DTS, which is what we want, but for older versions we need this -// lookup table. -struct mp_av_codec mp_av_codec_id_list[] = { - {"ra_144", CODEC_ID_RA_144}, - {"ra_288", CODEC_ID_RA_288}, - {"smackaudio", CODEC_ID_SMACKAUDIO}, - {"dts", CODEC_ID_DTS}, - {"musepack7", CODEC_ID_MUSEPACK7}, - {"musepack8", CODEC_ID_MUSEPACK8}, - {"amr_nb", CODEC_ID_AMR_NB}, - {"amr_wb", CODEC_ID_AMR_WB}, - {"adpcm_g722", CODEC_ID_ADPCM_G722}, - {"adpcm_g726", CODEC_ID_ADPCM_G726}, - {"westwood_snd1", CODEC_ID_WESTWOOD_SND1}, - {"mp4als", CODEC_ID_MP4ALS}, - {"vixl", CODEC_ID_VIXL}, - {"flv1", CODEC_ID_FLV1}, - {"msmpeg4v3", CODEC_ID_MSMPEG4V3}, - {"jpeg2000", CODEC_ID_JPEG2000}, - {"ulti", CODEC_ID_ULTI}, - {"smackvideo", CODEC_ID_SMACKVIDEO}, - {"tscc", CODEC_ID_TSCC}, - {"cscd", CODEC_ID_CSCD}, - {"tgv", CODEC_ID_TGV}, - {"roq", CODEC_ID_ROQ}, - {"idcin", CODEC_ID_IDCIN}, - {"ws_vqa", CODEC_ID_WS_VQA}, - {0}, -}; - int mp_codec_to_av_codec_id(const char *codec) { - for (int n = 0; mp_av_codec_id_list[n].name; n++) { - if (strcmp(mp_av_codec_id_list[n].name, codec) == 0) - return mp_av_codec_id_list[n].codec_id; + int id = AV_CODEC_ID_NONE; + if (codec) { + const AVCodecDescriptor *desc = avcodec_descriptor_get_by_name(codec); + if (desc) + id = desc->id; + if (id == AV_CODEC_ID_NONE) { + AVCodec *avcodec = avcodec_find_decoder_by_name(codec); + if (avcodec) + id = avcodec->id; + } } - AVCodec *avcodec = avcodec_find_decoder_by_name(codec); - return avcodec ? avcodec->id : CODEC_ID_NONE; + return id; } const char *mp_codec_from_av_codec_id(int codec_id) { - for (int n = 0; mp_av_codec_id_list[n].name; n++) { - if (mp_av_codec_id_list[n].codec_id == codec_id) - return mp_av_codec_id_list[n].name; + const char *name = NULL; + const AVCodecDescriptor *desc = avcodec_descriptor_get(codec_id); + if (desc) + name = desc->name; + if (!name) { + AVCodec *avcodec = avcodec_find_decoder(codec_id); + if (avcodec) + name = avcodec->name; } - AVCodec *avcodec = avcodec_find_decoder(codec_id); - return avcodec ? avcodec->name : NULL; + return name; } - -#endif diff --git a/core/av_log.c b/core/av_log.c index 9f6f84a39b..37c308be7a 100644 --- a/core/av_log.c +++ b/core/av_log.c @@ -37,6 +37,10 @@ #include <libavdevice/avdevice.h> #endif +#ifdef CONFIG_LIBAVFILTER +#include <libavfilter/avfilter.h> +#endif + static int av_log_level_to_mp_level(int av_level) { if (av_level > AV_LOG_VERBOSE) @@ -118,6 +122,9 @@ void init_libav(void) av_register_all(); avformat_network_init(); +#ifdef CONFIG_LIBAVFILTER + avfilter_register_all(); +#endif #ifdef CONFIG_LIBAVDEVICE avdevice_register_all(); #endif diff --git a/core/bstr.c b/core/bstr.c index a472fbfb02..16da0993ea 100644 --- a/core/bstr.c +++ b/core/bstr.c @@ -82,6 +82,15 @@ int bstrcspn(struct bstr str, const char *reject) return i; } +int bstrspn(struct bstr str, const char *accept) +{ + int i; + for (i = 0; i < str.len; i++) + if (!strchr(accept, str.start[i])) + break; + return i; +} + int bstr_find(struct bstr haystack, struct bstr needle) { for (int i = 0; i < haystack.len; i++) diff --git a/core/bstr.h b/core/bstr.h index bcac6cdba3..ce9e029ea5 100644 --- a/core/bstr.h +++ b/core/bstr.h @@ -40,6 +40,12 @@ static inline char *bstrdup0(void *talloc_ctx, struct bstr str) return talloc_strndup(talloc_ctx, (char *)str.start, str.len); } +// Like bstrdup0(), but always return a valid C-string. +static inline char *bstrto0(void *talloc_ctx, struct bstr str) +{ + return str.start ? bstrdup0(talloc_ctx, str) : talloc_strdup(talloc_ctx, ""); +} + // Return start = NULL iff that is true for the original. static inline struct bstr bstrdup(void *talloc_ctx, struct bstr str) { @@ -58,6 +64,7 @@ int bstrcmp(struct bstr str1, struct bstr str2); int bstrcasecmp(struct bstr str1, struct bstr str2); int bstrchr(struct bstr str, int c); int bstrrchr(struct bstr str, int c); +int bstrspn(struct bstr str, const char *accept); int bstrcspn(struct bstr str, const char *reject); int bstr_find(struct bstr haystack, struct bstr needle); diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h index af01a999d1..65b95de7c0 100644 --- a/core/cfg-mplayer.h +++ b/core/cfg-mplayer.h @@ -297,6 +297,7 @@ const m_option_t common_opts[] = { {"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL}, #endif OPT_FLAG("config", load_config, CONF_GLOBAL | CONF_NOCFG | CONF_PRE_PARSE), + OPT_STRINGLIST("reset-on-next-file", reset_options, CONF_GLOBAL), // ------------------------- stream options -------------------- @@ -320,7 +321,6 @@ const m_option_t common_opts[] = { #ifdef CONFIG_LIBBLURAY {"bluray-device", &bluray_device, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"bluray-angle", &bluray_angle, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL}, - {"bluray-chapter", &bluray_chapter, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL}, #endif /* CONFIG_LIBBLURAY */ #ifdef CONFIG_NETWORKING @@ -342,16 +342,16 @@ const m_option_t common_opts[] = { // ------------------------- demuxer options -------------------- - // number of frames to play/convert - {"frames", &play_n_frames_mf, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, + OPT_CHOICE_OR_INT("frames", play_frames, 0, 0, INT_MAX, + ({"all", -1})), // seek to byte/seconds position - {"sb", &seek_to_byte, CONF_TYPE_INT64, CONF_MIN, 0, 0, NULL}, + OPT_INT64("sb", seek_to_byte, 0), OPT_REL_TIME("start", play_start, 0), OPT_REL_TIME("end", play_end, 0), OPT_REL_TIME("length", play_length, 0), - OPT_FLAG("pause", start_paused, 0), + OPT_FLAG("pause", pause, 0), OPT_FLAG("keep-open", keep_open, 0), // AVI specific: force non-interleaved mode @@ -391,6 +391,7 @@ const m_option_t common_opts[] = { OPT_STRING("audio-demuxer", audio_demuxer_name, 0), OPT_STRING("sub-demuxer", sub_demuxer_name, 0), OPT_FLAG("extbased", extension_parsing, 0), + OPT_FLAG("mkv-subtitle-preroll", mkv_subtitle_preroll, 0), {"mf", (void *) mfopts_conf, CONF_TYPE_SUBCONFIG, 0,0,0, NULL}, #ifdef CONFIG_RADIO @@ -412,20 +413,20 @@ const m_option_t common_opts[] = { {"bps", &pts_from_bps, CONF_TYPE_FLAG, 0, 0, 1, NULL}, // set A-V sync correction speed (0=disables it): - {"mc", &default_max_pts_correction, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL}, + OPT_FLOATRANGE("mc", default_max_pts_correction, 0, 0, 100), // force video/audio rate: - {"fps", &force_fps, CONF_TYPE_DOUBLE, CONF_MIN, 0, 0, NULL}, - {"srate", &force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL}, + OPT_DOUBLE("fps", force_fps, CONF_MIN, 0), + OPT_INTRANGE("srate", force_srate, 0, 1000, 8*48000), OPT_INTRANGE("channels", audio_output_channels, 0, 1, 8), OPT_AUDIOFORMAT("format", audio_output_format, 0), OPT_FLOATRANGE("speed", playback_speed, 0, 0.01, 100.0), // set a-v distance - {"audio-delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -100.0, 100.0, NULL}, + OPT_FLOATRANGE("audio-delay", audio_delay, 0, -100.0, 100.0), // ignore header-specified delay (dwStart) - {"ignore-start", &ignore_start, CONF_TYPE_FLAG, 0, 0, 1, NULL}, + OPT_FLAG("ignore-start", ignore_start, 0), OPT_FLOATRANGE("a52drc", drc_level, 0, 0, 2), @@ -478,7 +479,7 @@ const m_option_t common_opts[] = { {"sub-delay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL}, {"subfps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL}, OPT_FLAG("autosub", sub_auto, 0), - {"sub-forced-only", &forced_subs_only, CONF_TYPE_FLAG, 0, 0, 1, NULL}, + OPT_FLAG("sub-forced-only", forced_subs_only, 0), // enable Closed Captioning display {"overlapsub", &suboverlap_enabled, CONF_TYPE_FLAG, 0, 0, 2, NULL}, {"sub-no-text-pp", &sub_no_text_pp, CONF_TYPE_FLAG, 0, 0, 1, NULL}, @@ -501,6 +502,8 @@ const m_option_t common_opts[] = { OPT_FLAG("osd-bar", osd_bar_visible, 0), OPT_FLOATRANGE("osd-bar-align-x", osd_bar_align_x, 0, -1.0, +1.0), OPT_FLOATRANGE("osd-bar-align-y", osd_bar_align_y, 0, -1.0, +1.0), + OPT_FLOATRANGE("osd-bar-w", osd_bar_w, 0, 1, 100), + OPT_FLOATRANGE("osd-bar-h", osd_bar_h, 0, 0.1, 50), OPT_SUBSTRUCT("osd", osd_style, osd_style_conf, 0), OPT_SUBSTRUCT("sub-text", sub_text_style, osd_style_conf, 0), {NULL, NULL, 0, 0, 0, 0, NULL} @@ -540,7 +543,7 @@ const m_option_t mplayer_opts[]={ {"yes", SOFTVOL_YES}, {"auto", SOFTVOL_AUTO})), OPT_FLOATRANGE("softvol-max", softvol_max, 0, 10, 10000), - {"volstep", &volstep, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL}, + OPT_INTRANGE("volstep", volstep, 0, 0, 100), OPT_FLOATRANGE("volume", mixer_init_volume, 0, -1, 10000), OPT_CHOICE("mute", mixer_init_mute, M_OPT_OPTIONAL_PARAM, ({"auto", -1}, @@ -569,10 +572,9 @@ const m_option_t mplayer_opts[]={ // set fullscreen switch method (workaround for buggy WMs) OPT_INTRANGE("fsmode-dontuse", vo.fsmode, 0, 31, 4096), OPT_INT("colorkey", vo.colorkey, 0), - OPT_INT("no-colorkey", vo.colorkey, 0x1000000), - // wait for v-sync (gl) - OPT_FLAG("vsync", vo.vsync, 1), - OPT_FLOATRANGE("panscan", vo.panscan, 0, 1.0, 99.0), + OPT_FLAG_STORE("no-colorkey", vo.colorkey, 0, 0x1000000), + OPT_FLAG("native-keyrepeat", vo.native_keyrepeat, 0), + OPT_FLOATRANGE("panscan", vo.panscan, 0, 0.0, 1.0), OPT_FLOATRANGE("panscanrange", vo.panscanrange, 0, -19.0, 99.0), OPT_FLAG("force-rgba-osd-rendering", force_rgba_osd, 0), OPT_CHOICE("colormatrix", requested_colorspace, 0, @@ -592,12 +594,13 @@ const m_option_t mplayer_opts[]={ OPT_CHOICE_OR_INT("cursor-autohide", vo.cursor_autohide_delay, 0, 0, 30000, ({"no", -1}, {"always", -2})), - OPT_INT64("wid", vo.WinID, -1), + OPT_INT64("wid", vo.WinID, CONF_GLOBAL), #ifdef CONFIG_X11 OPT_FLAG("stop-xscreensaver", vo.stop_screensaver, 0), OPT_STRINGLIST("fstype", vo.fstype_list, 0), #endif - {"heartbeat-cmd", &heartbeat_cmd, CONF_TYPE_STRING, 0, 0, 0, NULL}, + OPT_STRING("heartbeat-cmd", heartbeat_cmd, 0), + OPT_FLOAT("heartbeat-interval", heartbeat_interval, CONF_MIN, 0), OPT_FLAG("mouseinput", vo.nomouse_input, 0), OPT_CHOICE_OR_INT("screen", vo.screen_id, 0, 0, 32, @@ -615,13 +618,13 @@ const m_option_t mplayer_opts[]={ //---------------------- mplayer-only options ------------------------ - {"use-filedir-conf", &use_filedir_conf, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL}, + OPT_FLAG("use-filedir-conf", use_filedir_conf, CONF_GLOBAL), OPT_CHOICE("osd-level", osd_level, 0, ({"0", 0}, {"1", 1}, {"2", 2}, {"3", 3})), OPT_INTRANGE("osd-duration", osd_duration, 0, 0, 3600000), OPT_FLAG("osd-fractions", osd_fractions, 0), - {"sstep", &step_sec, CONF_TYPE_DOUBLE, CONF_MIN, 0, 0, NULL}, + OPT_DOUBLE("sstep", step_sec, CONF_MIN, 0), OPT_CHOICE("framedrop", frame_dropping, 0, ({"no", 0}, @@ -672,7 +675,7 @@ const m_option_t mplayer_opts[]={ OPT_STRING("status-msg", status_msg, M_OPT_PARSE_ESCAPES), OPT_STRING("osd-status-msg", osd_status_msg, M_OPT_PARSE_ESCAPES), - {"slave-broken", &slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, NULL}, + OPT_FLAG("slave-broken", slave_mode, CONF_GLOBAL), OPT_FLAG("idle", player_idle_mode, CONF_GLOBAL), OPT_INTRANGE("key-fifo-size", input.key_fifo_size, CONF_GLOBAL, 2, 65000), OPT_FLAG("consolecontrols", consolecontrols, CONF_GLOBAL), diff --git a/core/command.c b/core/command.c index 3553a192ad..05608c7df4 100644 --- a/core/command.c +++ b/core/command.c @@ -146,7 +146,8 @@ static int mp_property_playback_speed(m_option_t *prop, int action, opts->playback_speed = *(float *) arg; // Adjust time until next frame flip for nosound mode mpctx->time_frame *= orig_speed / opts->playback_speed; - reinit_audio_chain(mpctx); + if (mpctx->sh_audio) + reinit_audio_chain(mpctx); return M_PROPERTY_OK; } case M_PROPERTY_PRINT: @@ -517,19 +518,15 @@ static int mp_property_pause(m_option_t *prop, int action, void *arg, { MPContext *mpctx = ctx; - switch (action) { - case M_PROPERTY_SET: + if (action == M_PROPERTY_SET) { if (*(int *)arg) { pause_player(mpctx); } else { unpause_player(mpctx); } return M_PROPERTY_OK; - case M_PROPERTY_GET: - *(int *)arg = mpctx->paused; - return M_PROPERTY_OK; } - return M_PROPERTY_NOT_IMPLEMENTED; + return mp_property_generic_option(prop, action, arg, ctx); } static int mp_property_cache(m_option_t *prop, int action, void *arg, @@ -594,14 +591,14 @@ static int mp_property_audio_delay(m_option_t *prop, int action, { if (!(mpctx->sh_audio && mpctx->sh_video)) return M_PROPERTY_UNAVAILABLE; - float delay = audio_delay; + float delay = mpctx->opts.audio_delay; switch (action) { case M_PROPERTY_PRINT: *(char **)arg = format_delay(delay); return M_PROPERTY_OK; case M_PROPERTY_SET: - audio_delay = *(float *)arg; - mpctx->delay -= audio_delay - delay; + mpctx->audio_delay = mpctx->opts.audio_delay = *(float *)arg; + mpctx->delay -= mpctx->audio_delay - delay; return M_PROPERTY_OK; } return mp_property_generic_option(prop, action, arg, mpctx); @@ -834,10 +831,12 @@ 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_switch_track(mpctx, STREAM_AUDIO, - find_track_by_demuxer_id(mpctx, STREAM_AUDIO, prog.aid)); mp_switch_track(mpctx, STREAM_VIDEO, find_track_by_demuxer_id(mpctx, STREAM_VIDEO, prog.vid)); + mp_switch_track(mpctx, STREAM_AUDIO, + find_track_by_demuxer_id(mpctx, STREAM_AUDIO, prog.aid)); + mp_switch_track(mpctx, STREAM_SUB, + find_track_by_demuxer_id(mpctx, STREAM_VIDEO, prog.sid)); return M_PROPERTY_OK; } return M_PROPERTY_NOT_IMPLEMENTED; @@ -850,9 +849,9 @@ static int mp_property_fullscreen(m_option_t *prop, void *arg, MPContext *mpctx) { - struct mp_vo_opts *opts = mpctx->video_out->opts; if (!mpctx->video_out) return M_PROPERTY_UNAVAILABLE; + struct mp_vo_opts *opts = mpctx->video_out->opts; if (action == M_PROPERTY_SET) { if (opts->fs == !!*(int *) arg) @@ -1088,13 +1087,6 @@ static int mp_property_gamma(m_option_t *prop, int action, void *arg, return M_PROPERTY_UNAVAILABLE; } -/// VSync (RW) -static int mp_property_vsync(m_option_t *prop, int action, void *arg, - MPContext *mpctx) -{ - return mp_property_generic_option(prop, action, arg, mpctx); -} - /// Video codec tag (RO) static int mp_property_video_format(m_option_t *prop, int action, void *arg, MPContext *mpctx) @@ -1143,6 +1135,28 @@ static int mp_property_height(m_option_t *prop, int action, void *arg, return m_property_int_ro(prop, action, arg, mpctx->sh_video->disp_h); } +static int property_vo_wh(m_option_t *prop, int action, void *arg, + MPContext *mpctx, bool get_w) +{ + struct vo *vo = mpctx->video_out; + if (!mpctx->sh_video && !vo || !vo->hasframe) + return M_PROPERTY_UNAVAILABLE; + return m_property_int_ro(prop, action, arg, + get_w ? vo->aspdat.prew : vo->aspdat.preh); +} + +static int mp_property_dwidth(m_option_t *prop, int action, void *arg, + MPContext *mpctx) +{ + return property_vo_wh(prop, action, arg, mpctx, true); +} + +static int mp_property_dheight(m_option_t *prop, int action, void *arg, + MPContext *mpctx) +{ + return property_vo_wh(prop, action, arg, mpctx, false); +} + /// Video fps (RO) static int mp_property_fps(m_option_t *prop, int action, void *arg, MPContext *mpctx) @@ -1247,12 +1261,14 @@ static int mp_property_sub_visibility(m_option_t *prop, int action, static int mp_property_sub_forced_only(m_option_t *prop, int action, void *arg, MPContext *mpctx) { + struct MPOpts *opts = &mpctx->opts; + if (!vo_spudec) return M_PROPERTY_UNAVAILABLE; if (action == M_PROPERTY_SET) { - forced_subs_only = *(int *)arg; - spudec_set_forced_subs_only(vo_spudec, forced_subs_only); + opts->forced_subs_only = *(int *)arg; + spudec_set_forced_subs_only(vo_spudec, opts->forced_subs_only); return M_PROPERTY_OK; } return mp_property_generic_option(prop, action, arg, mpctx); @@ -1345,8 +1361,7 @@ static const m_option_t mp_properties[] = { CONF_RANGE, -2, 10, NULL }, { "metadata", mp_property_metadata, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL }, - { "pause", mp_property_pause, CONF_TYPE_FLAG, - M_OPT_RANGE, 0, 1, NULL }, + M_OPTION_PROPERTY_CUSTOM("pause", mp_property_pause), { "cache", mp_property_cache, CONF_TYPE_INT }, M_OPTION_PROPERTY("pts-association-mode"), M_OPTION_PROPERTY("hr-seek"), @@ -1395,7 +1410,6 @@ static const m_option_t mp_properties[] = { M_OPTION_PROPERTY_CUSTOM_("hue", mp_property_gamma, .offset = offsetof(struct MPOpts, gamma_hue)), M_OPTION_PROPERTY_CUSTOM("panscan", mp_property_panscan), - M_OPTION_PROPERTY_CUSTOM_("vsync", mp_property_vsync), { "video-format", mp_property_video_format, CONF_TYPE_STRING, 0, 0, 0, NULL }, { "video-codec", mp_property_video_codec, CONF_TYPE_STRING, @@ -1406,6 +1420,8 @@ static const m_option_t mp_properties[] = { 0, 0, 0, NULL }, { "height", mp_property_height, CONF_TYPE_INT, 0, 0, 0, NULL }, + { "dwidth", mp_property_dwidth, CONF_TYPE_INT }, + { "dheight", mp_property_dheight, CONF_TYPE_INT }, { "fps", mp_property_fps, CONF_TYPE_FLOAT, 0, 0, 0, NULL }, { "aspect", mp_property_aspect, CONF_TYPE_FLOAT, @@ -1508,7 +1524,6 @@ static struct property_osd_display { { "contrast", _("Contrast"), .osd_progbar = OSD_CONTRAST }, { "saturation", _("Saturation"), .osd_progbar = OSD_SATURATION }, { "hue", _("Hue"), .osd_progbar = OSD_HUE }, - { "vsync", _("VSync") }, { "angle", _("Angle") }, // subs { "sub", _("Subtitles") }, @@ -1812,7 +1827,11 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) } case MP_CMD_FRAME_STEP: - add_step_frame(mpctx); + add_step_frame(mpctx, 1); + break; + + case MP_CMD_FRAME_BACK_STEP: + add_step_frame(mpctx, -1); break; case MP_CMD_QUIT: @@ -1918,14 +1937,16 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) char *filename = cmd->args[0].v.s; bool append = cmd->args[1].v.i; struct playlist *pl = playlist_parse_file(filename); - if (!pl) { + if (pl) { if (!append) playlist_clear(mpctx->playlist); playlist_transfer_entries(mpctx->playlist, pl); talloc_free(pl); - if (!append) - mpctx->stop_play = PT_NEXT_ENTRY; + if (!append) { + mpctx->playlist->current = mpctx->playlist->first; + mpctx->stop_play = PT_CURRENT_ENTRY; + } } else { mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "\nUnable to load playlist %s.\n", filename); @@ -2277,7 +2298,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) pause_player(mpctx); break; case 3: // "pausing_toggle" - if (mpctx->paused) + if (opts->pause) unpause_player(mpctx); else pause_player(mpctx); diff --git a/core/defaultopts.c b/core/defaultopts.c index 859e50d855..3231c8142d 100644 --- a/core/defaultopts.c +++ b/core/defaultopts.c @@ -16,6 +16,7 @@ void set_default_mplayer_options(struct MPOpts *opts) .softvol_max = 200, .mixer_init_volume = -1, .mixer_init_mute = -1, + .volstep = 3, .ao_buffersize = -1, .vo = { .video_driver_list = NULL, @@ -25,7 +26,6 @@ void set_default_mplayer_options(struct MPOpts *opts) .fs = false, .screen_id = -1, .fsscreen_id = -1, - .vsync = 1, .stop_screensaver = 1, .nomouse_input = 0, .fsmode = 0, @@ -37,6 +37,7 @@ void set_default_mplayer_options(struct MPOpts *opts) .WinID = -1, }, .wintitle = "mpv - ${media-title}", + .heartbeat_interval = 30.0, .gamma_gamma = 1000, .gamma_brightness = 1000, .gamma_contrast = 1000, @@ -44,6 +45,9 @@ void set_default_mplayer_options(struct MPOpts *opts) .gamma_hue = 1000, .osd_level = 1, .osd_duration = 1000, + .osd_bar_align_y = 0.5, + .osd_bar_w = 75.0, + .osd_bar_h = 3.125, .loop_times = -1, .ordered_chapters = 1, .chapter_merge_threshold = 100, @@ -53,11 +57,13 @@ void set_default_mplayer_options(struct MPOpts *opts) .stream_cache_pause = 10.0, .chapterrange = {-1, -1}, .edition_id = -1, + .default_max_pts_correction = -1, .user_correct_pts = -1, .initial_audio_sync = 1, .term_osd = 2, .consolecontrols = 1, .doubleclick_time = 300, + .play_frames = -1, .keep_open = 0, .audio_id = -1, .video_id = -1, @@ -86,14 +92,11 @@ void set_default_mplayer_options(struct MPOpts *opts) }, .input = { .key_fifo_size = 7, - .ar_delay = 100, - .ar_rate = 8, + .ar_delay = 200, + .ar_rate = 40, .use_joystick = 1, .use_lirc = 1, .use_lircc = 1, -#ifdef CONFIG_APPLE_REMOTE - .use_ar = 1, -#endif .default_bindings = 1, } }; diff --git a/core/encode_lavc.c b/core/encode_lavc.c index 9bb1abcdcd..457f6ab987 100644 --- a/core/encode_lavc.c +++ b/core/encode_lavc.c @@ -117,6 +117,11 @@ struct encode_lavc_context *encode_lavc_init(struct encode_output_conf *options) { struct encode_lavc_context *ctx; + if (options->file && ( + !strcmp(options->file, "pipe:") || + !strcmp(options->file, "pipe:1"))) + mp_msg_stdout_in_use = 1; + ctx = talloc_zero(NULL, struct encode_lavc_context); encode_lavc_discontinuity(ctx); ctx->options = options; diff --git a/core/input/appleir.c b/core/input/appleir.c deleted file mode 100644 index e645ba736a..0000000000 --- a/core/input/appleir.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Linux Apple IR Remote input interface - * - * Copyright (C) 2008 Benjamin Zores <ben at geexbox dot org> - * - * 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. - */ - -#include "config.h" - -#include "ar.h" -#include "input.h" - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <errno.h> - -#include <linux/types.h> -#include <linux/input.h> - -#include "core/mp_msg.h" - -#include "keycodes.h" - -#define EVDEV_MAX_EVENTS 32 - -/* ripped from AppleIR driver */ -#define USB_VENDOR_APPLE 0x05ac -#define USB_DEV_APPLE_IR 0x8240 -#define USB_DEV_APPLE_IR_2 0x8242 - -/* Apple IR Remote evdev mapping */ -#define APPLE_IR_MINUS KEY_VOLUMEDOWN -#define APPLE_IR_PLUS KEY_VOLUMEUP -#define APPLE_IR_MENU KEY_MENU -#define APPLE_IR_FORWARD KEY_NEXTSONG -#define APPLE_IR_PLAY KEY_PLAYPAUSE -#define APPLE_IR_BACKWARD KEY_PREVIOUSSONG - -static const struct { - int linux_keycode; - int value; - int mp_keycode; -} apple_ir_mapping[] = { - { APPLE_IR_PLAY, 1, MP_AR_PLAY }, - { APPLE_IR_PLAY, 2, MP_AR_PLAY_HOLD }, - { APPLE_IR_FORWARD, 1, MP_AR_NEXT }, - { APPLE_IR_FORWARD, 2, MP_AR_NEXT_HOLD }, - { APPLE_IR_BACKWARD, 1, MP_AR_PREV }, - { APPLE_IR_BACKWARD, 2, MP_AR_PREV_HOLD }, - { APPLE_IR_MENU, 1, MP_AR_MENU }, - { APPLE_IR_MENU, 2, MP_AR_MENU_HOLD }, - { APPLE_IR_PLUS, 1, MP_AR_VUP }, - { APPLE_IR_MINUS, 1, MP_AR_VDOWN }, - { -1, -1, -1 } -}; - -int mp_input_appleir_init (char *dev) -{ - int i, fd; - - if (dev) - { - mp_tmsg (MSGT_INPUT, MSGL_V, "Initializing Apple IR on %s\n", dev); - fd = open (dev, O_RDONLY | O_NONBLOCK); - if (fd < 0) - { - mp_tmsg (MSGT_INPUT, MSGL_ERR, - "Can't open Apple IR device: %s\n", strerror (errno)); - return -1; - } - - return fd; - } - else - { - /* look for a valid AppleIR device on system */ - for (i = 0; i < EVDEV_MAX_EVENTS; i++) - { - struct input_id id; - char file[64]; - - sprintf (file, "/dev/input/event%d", i); - fd = open (file, O_RDONLY | O_NONBLOCK); - if (fd < 0) - continue; - - ioctl (fd, EVIOCGID, &id); - if (id.bustype == BUS_USB && - id.vendor == USB_VENDOR_APPLE && - (id.product == USB_DEV_APPLE_IR ||id.product == USB_DEV_APPLE_IR_2)) - { - mp_tmsg (MSGT_INPUT, MSGL_V, "Detected Apple IR on %s\n", file); - return fd; - } - close (fd); - } - - mp_tmsg (MSGT_INPUT, MSGL_ERR, - "Can't open Apple IR device: %s\n", strerror (errno)); - } - - return -1; -} - -int mp_input_ap |