@@ -3808,6 +3808,29 @@ <h2>Subtitles</h2>
38083808<p class="last"><tt class="docutils literal">complex</tt> is the default. If libass hasn't been compiled against HarfBuzz,
38093809libass silently reverts to <tt class="docutils literal">simple</tt>.</p>
38103810</dd>
3811+ <dt><tt class="docutils literal"><span class="pre">--sub-ass-prune-delay=<-1|seconds></span></tt></dt>
3812+ <dd><p class="first">Set the delay for automatic pruning of events from memory in libass. When
3813+ enabled, subtitle events are removed from memory once their end timestamp is
3814+ older than the specified delay.</p>
3815+ <table class="docutils field-list" frame="void" rules="none">
3816+ <col class="field-name" />
3817+ <col class="field-body" />
3818+ <tbody valign="top">
3819+ <tr class="field"><th class="field-name">-1:</th><td class="field-body">disables automatic pruning (default).</td>
3820+ </tr>
3821+ <tr class="field"><th class="field-name">seconds:</th><td class="field-body">specify how many seconds after an event is no longer displayed
3822+ should the pruning occur. <tt class="docutils literal">0</tt> prunes events as soon as they're
3823+ off screen.</td>
3824+ </tr>
3825+ </tbody>
3826+ </table>
3827+ <div class="admonition note last">
3828+ <p class="first admonition-title">Note</p>
3829+ <p class="last">This breaks sub-seek and subtitle rendering when changing play-direction
3830+ from forward to backward during runtime for events that were already
3831+ "seen" and need to be rendered again, if those events got pruned.</p>
3832+ </div>
3833+ </dd>
38113834<dt><tt class="docutils literal"><span class="pre">--sub-ass-styles=<filename></span></tt></dt>
38123835<dd><p class="first">Load all SSA/ASS styles found in the specified file and use them for
38133836rendering text subtitles. The syntax of the file is exactly like the <tt class="docutils literal">[V4
@@ -3820,7 +3843,8 @@ <h2>Subtitles</h2>
38203843<dt><tt class="docutils literal"><span class="pre">--sub-ass-override=<no|yes|scale|force|strip></span></tt></dt>
38213844<dd><p class="first">Control whether user style overrides should be applied. Note that all of
38223845these overrides try to be somewhat smart about figuring out whether or not
3823- a subtitle is considered a "sign".</p>
3846+ a subtitle is considered a "sign" and try to be as non-destructive as
3847+ possible.</p>
38243848<table class="docutils field-list" frame="void" rules="none">
38253849<col class="field-name" />
38263850<col class="field-body" />
@@ -3835,7 +3859,8 @@ <h2>Subtitles</h2>
38353859<tr class="field"><th class="field-name">scale:</th><td class="field-body">Like <tt class="docutils literal">yes</tt>, but also apply <tt class="docutils literal"><span class="pre">--sub-scale</span></tt> (default).</td>
38363860</tr>
38373861<tr class="field"><th class="field-name">force:</th><td class="field-body">Like <tt class="docutils literal">yes</tt>, but also force all <tt class="docutils literal"><span class="pre">--sub-*</span></tt> options. Can break
3838- rendering easily.</td>
3862+ rendering easily. Certain options aren't overridden if they can
3863+ potentially be too destructive.</td>
38393864</tr>
38403865<tr class="field"><th class="field-name">strip:</th><td class="field-body">Radically strip all ASS tags and styles from the subtitle. This
38413866is equivalent to the old <tt class="docutils literal"><span class="pre">--no-ass</span></tt> / <tt class="docutils literal"><span class="pre">--no-sub-ass</span></tt> options.</td>
@@ -7310,11 +7335,42 @@ <h2>GPU renderer options</h2>
73107335<dt><tt class="docutils literal"><span class="pre">--glsl-shader=<file></span></tt></dt>
73117336<dd>CLI/config file only alias for <tt class="docutils literal"><span class="pre">--glsl-shaders-append</span></tt>.</dd>
73127337<dt><tt class="docutils literal"><span class="pre">--glsl-shader-opts=param1=value1,param2=value2,...</span></tt></dt>
7313- <dd>Specifies the options to use for tunable shader parameters. You can target
7338+ <dd><p class="first"> Specifies the options to use for tunable shader parameters. You can target
73147339specific named shaders by prefixing the shader name with a <tt class="docutils literal">/</tt>, e.g.
73157340<tt class="docutils literal">shader/param=value</tt>. Without a prefix, parameters affect all shaders.
73167341The shader name is the base part of the shader filename, without the
7317- extension. (<tt class="docutils literal"><span class="pre">--vo=gpu-next</span></tt> only)</dd>
7342+ extension. (<tt class="docutils literal"><span class="pre">--vo=gpu-next</span></tt> only)</p>
7343+ <p>Some parameters are filled automatically if the shader requests them.
7344+ Currently following parameters are available:</p>
7345+ <dl class="last docutils">
7346+ <dt><tt class="docutils literal">PTS</tt></dt>
7347+ <dd>PTS of the current frame in seconds.</dd>
7348+ <dt><tt class="docutils literal">chroma_offset_x</tt></dt>
7349+ <dd>chroma offset to the reference plane in x direction.</dd>
7350+ <dt><tt class="docutils literal">chroma_offset_y</tt></dt>
7351+ <dd>chroma offset to the reference plane in y direction.</dd>
7352+ <dt><tt class="docutils literal">min_luma</tt></dt>
7353+ <dd>Minimum luminance value (in cd/m²).</dd>
7354+ <dt><tt class="docutils literal">max_luma</tt></dt>
7355+ <dd>Maximum luminance value (in cd/m²).</dd>
7356+ <dt><tt class="docutils literal">max_cll</tt></dt>
7357+ <dd>Maximum Content Light Level (in cd/m²).</dd>
7358+ <dt><tt class="docutils literal">max_fall</tt></dt>
7359+ <dd>Maximum Frame Average Light Level (in cd/m²).</dd>
7360+ <dt><tt class="docutils literal">scene_max_r</tt></dt>
7361+ <dd>Maximum scene light level of the red channel (in cd/m²).</dd>
7362+ <dt><tt class="docutils literal">scene_max_g</tt></dt>
7363+ <dd>Maximum scene light level of the green channel (in cd/m²).</dd>
7364+ <dt><tt class="docutils literal">scene_max_b</tt></dt>
7365+ <dd>Maximum scene light level of the blue channel (in cd/m²).</dd>
7366+ <dt><tt class="docutils literal">scene_avg</tt></dt>
7367+ <dd>Average scene light level (in cd/m²).</dd>
7368+ <dt><tt class="docutils literal">max_pq_y</tt></dt>
7369+ <dd>Maximum PQ luminance (in PQ, 0-1).</dd>
7370+ <dt><tt class="docutils literal">avg_pq_y</tt></dt>
7371+ <dd>Average PQ luminance (in PQ, 0-1).</dd>
7372+ </dl>
7373+ </dd>
73187374<dt><tt class="docutils literal"><span class="pre">--deband</span></tt></dt>
73197375<dd>Enable the debanding algorithm. This greatly reduces the amount of visible
73207376banding, blocking and other quantization artifacts, at the expense of
@@ -16106,6 +16162,18 @@ <h2>Advanced mp functions</h2>
1610616162be "scaled" pixels). The third is the display pixel aspect ratio.</p>
1610716163<p class="last">May return invalid/nonsense values if OSD is not initialized yet.</p>
1610816164</dd>
16165+ <dt><tt class="docutils literal">exit()</tt> (global)</dt>
16166+ <dd><p class="first">Make the script exit at the end of the current event loop iteration. This
16167+ does not terminate mpv itself or other scripts.</p>
16168+ <p>This can be polyfilled to support mpv versions older than 0.40 with:</p>
16169+ <pre class="last literal-block">
16170+ if not _G.exit then
16171+ function exit()
16172+ mp.keep_running = false
16173+ end
16174+ end
16175+ </pre>
16176+ </dd>
1610916177</dl>
1611016178</div>
1611116179<div class="section" id="mp-msg-functions">
@@ -16610,6 +16678,7 @@ <h2>Scripting APIs - identical to Lua</h2>
1661016678<p><tt class="docutils literal">mp.input.log(message, style)</tt></p>
1661116679<p><tt class="docutils literal">mp.input.log_error(message)</tt></p>
1661216680<p><tt class="docutils literal">mp.input.set_log(log)</tt></p>
16681+ <p><tt class="docutils literal">exit()</tt> (global)</p>
1661316682</div>
1661416683<div class="section" id="additional-utilities">
1661516684<h2>Additional utilities</h2>
@@ -16649,9 +16718,6 @@ <h2>Additional utilities</h2>
1664916718<dd>Same as <tt class="docutils literal">mp.get_time()</tt> but in ms instead of seconds.</dd>
1665016719<dt><tt class="docutils literal">mp.get_script_file()</tt></dt>
1665116720<dd>Returns the file name of the current script.</dd>
16652- <dt><tt class="docutils literal">exit()</tt> (global)</dt>
16653- <dd>Make the script exit at the end of the current event loop iteration.
16654- Note: please remove added key bindings before calling <tt class="docutils literal">exit()</tt>.</dd>
1665516721<dt><tt class="docutils literal">mp.utils.compile_js(fname, content_str)</tt></dt>
1665616722<dd>Compiles the JS code <tt class="docutils literal">content_str</tt> as file name <tt class="docutils literal">fname</tt> (without loading
1665716723anything from the filesystem), and returns it as a function. Very similar
0 commit comments