diff options
83 files changed, 9469 insertions, 2678 deletions
diff --git a/.gitignore b/.gitignore index e90239351c..8c4cd6181a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ /TAGS /locale /po + +libvo/vo_gl3_shaders.h diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 3575fb22a6..0e1ff45516 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -3894,6 +3894,9 @@ Select the scaling function to use for chrominance scaling. For details see lscale. .IPs filter-strength=<value> Set the effect strength for the lscale/cscale filters that support it. +.IPs noise-strength=<value> +Set how much noise to add. 0 to disable (default), 1.0 for level suitable +for dithering to 6 bit. .IPs stereo=<value> Select a method for stereo display. You may have to use \-aspect to fix the aspect value. @@ -367,6 +367,7 @@ SRCS_COMMON = asxparser.c \ libmpdemux/demux_avi.c \ libmpdemux/demux_demuxers.c \ libmpdemux/demux_edl.c \ + libmpdemux/demux_cue.c \ libmpdemux/demux_film.c \ libmpdemux/demux_fli.c \ libmpdemux/demux_lavf.c \ @@ -401,6 +402,7 @@ SRCS_COMMON = asxparser.c \ libmpdemux/yuv4mpeg.c \ libmpdemux/yuv4mpeg_ratio.c \ libvo/osd.c \ + libvo/eosd_packer.c \ osdep/numcores.c \ osdep/io.c \ osdep/$(GETCH) \ @@ -425,6 +427,7 @@ SRCS_COMMON = asxparser.c \ sub/vobsub.c \ timeline/tl_edl.c \ timeline/tl_matroska.c \ + timeline/tl_cue.c \ $(SRCS_COMMON-yes) @@ -448,7 +451,7 @@ SRCS_MPLAYER-$(ESD) += libao2/ao_esd.c SRCS_MPLAYER-$(FBDEV) += libvo/vo_fbdev.c libvo/vo_fbdev2.c SRCS_MPLAYER-$(GGI) += libvo/vo_ggi.c SRCS_MPLAYER-$(GIF) += libvo/vo_gif89a.c -SRCS_MPLAYER-$(GL) += libvo/gl_common.c libvo/vo_gl.c \ +SRCS_MPLAYER-$(GL) += libvo/gl_common.c libvo/vo_gl.c libvo/vo_gl3.c \ pnm_loader.c SRCS_MPLAYER-$(GL_COCOA) += libvo/cocoa_common.m SRCS_MPLAYER-$(GL_SDL) += libvo/sdl_common.c @@ -506,6 +509,7 @@ SRCS_MPLAYER = command.c \ libao2/audio_out.c \ libvo/aspect.c \ libvo/csputils.c \ + libvo/filter_kernels.c \ libvo/geometry.c \ libvo/old_vo_wrapper.c \ libvo/spuenc.c \ @@ -601,6 +605,11 @@ codec-cfg$(EXESUF): codec-cfg.c codec-cfg.h codecs.conf.h: codec-cfg$(EXESUF) etc/codecs.conf ./$^ > $@ +libvo/vo_gl3_shaders.h: libvo/vo_gl3_shaders.glsl + python ./bin_to_header.py $^ $@ + +libvo/vo_gl3.c: libvo/vo_gl3_shaders.h + # ./configure must be rerun if it changed config.mak: configure @echo "############################################################" diff --git a/bin_to_header.py b/bin_to_header.py new file mode 100644 index 0000000000..137a5b3728 --- /dev/null +++ b/bin_to_header.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +# Script to embed arbitrary binary files in C header files. + +CHARS_PER_LINE = 19 + +import sys +import os + +if len(sys.argv) != 3: + print("Embed binary files in C headers.") + print("Usage: ") + print(" bin_to_header.py infile outfile.h") + print("outfile.h will be overwritten with the new contents.") + sys.exit(1) + +infile_name = sys.argv[1] +outfile_name = sys.argv[2] + +varname = os.path.splitext(os.path.basename(outfile_name))[0] + +infile = open(infile_name, "rb") +outfile = open(outfile_name, "w") + +outfile.write("// Generated with " + " ".join(sys.argv) + "\n") +outfile.write("\nstatic const unsigned char " + varname + "[] = {\n") + +while True: + data = infile.read(CHARS_PER_LINE) + if len(data) == 0: + break + outfile.write(" ") + for c in data: + # make it work both in Python 2.x (c is str) and 3.x (c is int) + if type(c) != int: + c = ord(c) + outfile.write("{0:3},".format(c)) + outfile.write("\n") + +outfile.write("};\n") + +infile.close() +outfile.close() @@ -185,6 +185,27 @@ struct bstr *bstr_splitlines(void *talloc_ctx, struct bstr str) return r; } +struct bstr bstr_getline(struct bstr str, struct bstr *rest) +{ + int pos = bstrchr(str, '\n'); + if (pos < 0) + pos = str.len; + if (rest) + *rest = bstr_cut(str, pos + 1); + str.len = pos; + if (str.len > 0 && str.start[str.len - 1] == '\r') + str.len -= 1; + return str; +} + +bool bstr_eatstart(struct bstr *s, struct bstr prefix) +{ + if (!bstr_startswith(*s, prefix)) + return false; + *s = bstr_cut(*s, prefix.len); + return true; +} + void bstr_lower(struct bstr str) { for (int i = 0; i < str.len; i++) @@ -233,3 +254,31 @@ int bstr_decode_utf8(struct bstr s, struct bstr *out_next) *out_next = s; return codepoint; } + +bool bstr_case_startswith(struct bstr s, struct bstr prefix) +{ + struct bstr start = bstr_splice(s, 0, prefix.len); + return start.len == prefix.len && bstrcasecmp(start, prefix) == 0; +} + +bool bstr_case_endswith(struct bstr s, struct bstr suffix) +{ + struct bstr end = bstr_cut(s, -suffix.len); + return end.len == suffix.len && bstrcasecmp(end, suffix) == 0; +} + +struct bstr bstr_strip_ext(struct bstr str) +{ + int dotpos = bstrrchr(str, '.'); + if (dotpos < 0) + return str; + return (struct bstr){str.start, dotpos}; +} + +struct bstr bstr_get_ext(struct bstr s) +{ + int dotpos = bstrrchr(s, '.'); + if (dotpos < 0) + return (struct bstr){NULL, 0}; + return bstr_splice(s, dotpos + 1, s.len); +} @@ -82,8 +82,28 @@ int bstr_decode_utf8(struct bstr str, struct bstr *out_next); // On error, -1 is returned. On success, it returns a value in the range [1, 4]. int bstr_parse_utf8_code_length(unsigned char b); +// Return the text before the next line break, and return it. Change *rest to +// point to the text following this line break. (rest can be NULL.) +// Unlike bstr_splitlines, possible \r characters coming from files with CR+LF +// line breaks are stripped. +struct bstr bstr_getline(struct bstr str, struct bstr *rest); + +// If s starts with prefix, return true and return the rest of the string in s. +bool bstr_eatstart(struct bstr *s, struct bstr prefix); + +bool bstr_case_startswith(struct bstr s, struct bstr prefix); +bool bstr_case_endswith(struct bstr s, struct bstr suffix); +struct bstr bstr_strip_ext(struct bstr str); +struct bstr bstr_get_ext(struct bstr s); + + static inline struct bstr bstr_cut(struct bstr str, int n) { + if (n < 0) { + n += str.len; + if (n < 0) + n = 0; + } if (n > str.len) n = str.len; return (struct bstr){str.start + n, str.len - n}; diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 6d105569ae..1d18949ce0 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -485,6 +485,9 @@ const m_option_t common_opts[] = { {"sb", &seek_to_byte, CONF_TYPE_POSITION, CONF_MIN, 0, 0, NULL}, OPT_TIME("ss", seek_to_sec, 0), + // start paused + OPT_FLAG_ON("pause", start_paused, 0), + // stop at given position {"endpos", &end_at, CONF_TYPE_TIME_SIZE, 0, 0, 0, NULL}, @@ -910,7 +913,15 @@ const m_option_t mplayer_opts[]={ OPT_STRING("rtc-device", rtc_device, 0), #endif - OPT_MAKE_FLAGS("term-osd", term_osd, 0), + OPT_CHOICE("term-osd", term_osd, M_OPT_IMPLICIT_DEFAULT, + ({"force", 1}, + {"auto", 2}, + {"off", 0})), + + // set term_osd to 0 + // this is for compatibility + {"noterm-osd", NULL, &m_option_type_flag, 0, 1, 0, NULL, 1, offsetof(struct MPOpts, term_osd)}, + OPT_STRING("term-osd-esc", term_osd_esc, 0), OPT_STRING("playing-msg", playing_msg, 0), @@ -927,6 +938,11 @@ const m_option_t mplayer_opts[]={ {"tvscan", "MPlayer was compiled without TV interface support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, #endif /* CONFIG_TV */ + OPT_INTRANGE("screenshot-jpeg-quality", screenshot_jpeg_quality, 0, 0, 100), + OPT_INTRANGE("screenshot-png-compression", screenshot_png_compression, 0, 0, 9), + OPT_STRING("screenshot-filetype", screenshot_filetype, 0), + OPT_STRING("screenshot-template", screenshot_template, 0), + OPT_FLAG_ON("list-properties", list_properties, CONF_GLOBAL), {"identify", &mp_msg_levels[MSGT_IDENTIFY], CONF_TYPE_FLAG, CONF_GLOBAL, 0, MSGL_V, NULL}, {"help", (void *) help_text, CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL}, diff --git a/codec-cfg.c b/codec-cfg.c index 98b3088516..b8db55c7ec 100644 --- a/codec-cfg.c +++ b/codec-cfg.c @@ -215,6 +215,7 @@ static const struct { {"BGR32", IMGFMT_BGR32}, {"RGB1", IMGFMT_RGB1}, {"BGR1", IMGFMT_BGR1}, + {"GBRP", IMGFMT_GBRP}, {"MPES", IMGFMT_MPEGPES}, @@ -21,6 +21,7 @@ #include <unistd.h> #include <string.h> #include <stdbool.h> +#include <assert.h> #include "config.h" #include "talloc.h" @@ -719,8 +720,6 @@ static int mp_property_volume(m_option_t *prop, int action, void *arg, return M_PROPERTY_NOT_IMPLEMENTED; } - mpctx->user_muted = 0; - switch (action) { case M_PROPERTY_SET: if (!arg) @@ -756,17 +755,15 @@ static int mp_property_mute(m_option_t *prop, int action, void *arg, case M_PROPERTY_SET: if (!arg) return M_PROPERTY_ERROR; - if ((!!*(int *) arg) != mpctx->mixer.muted) - mixer_mute(&mpctx->mixer); - mpctx->user_muted = mpctx->mixer.muted; + mixer_setmuted(&mpctx->mixer, *(int *) arg); return M_PROPERTY_OK; case M_PROPERTY_STEP_UP: case M_PROPERTY_STEP_DOWN: mixer_mute(&mpctx->mixer); - mpctx->user_muted = mpctx->mixer.muted; return M_PROPERTY_OK; default: - return m_property_flag(prop, action, arg, &mpctx->mixer.muted); + return m_property_flag_ro(prop, action, arg, + mixer_getmuted(&mpctx->mixer)); } } @@ -2791,6 +2788,28 @@ static void remove_subtitle_range(MPContext *mpctx, int start, int count) } } +static void do_clear_pt(struct play_tree *node, struct play_tree *exclude) +{ + while (node) { + do_clear_pt(node->child, exclude); + struct play_tree *next = node->next; + // do not delete root node, or nodes that could lead to "exclude" node + if (node->parent && !node->child && node != exclude) + play_tree_remove(node, 1, 1); + node = next; + } +} + +static void clear_play_tree(MPContext *mpctx) +{ + struct play_tree *exclude = NULL; + if (mpctx->playtree_iter) { + assert(mpctx->playtree == mpctx->playtree_iter->root); + exclude = mpctx->playtree_iter->tree; + } + do_clear_pt(mpctx->playtree, exclude); +} + void run_command(MPContext *mpctx, mp_cmd_t *cmd) { struct MPOpts *opts = &mpctx->opts; @@ -3120,6 +3139,10 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) break; } + case MP_CMD_PLAY_TREE_CLEAR: + clear_play_tree(mpctx); + break; + case MP_CMD_STOP: // Go back to the starting point. while (play_tree_iter_up_step(mpctx->playtree_iter, 0, 1) != @@ -338,6 +338,7 @@ Optional features: --en |