mpv/options/options.c

1110 lines
42 KiB
C
Raw Normal View History

/*
* This file is part of mpv.
*
player: change license of most core files to LGPL These files have all in common that they were fully or mostly taken from mplayer.c. (mplayer.c was a huge file that contains almost all of the playback core, until it was split into multiple parts.) This was probably the hardest part to relicense, because so much code was moved around all the time. player/audio.c still does not compile. We'll have to redo audio filtering. Once that is done, we can probably actually provide an actual LGPL configure switch. Here is a relatively detailed list of potential issues: 8d190244: author did not reply, parts were made GPL-only in a previous commit. 7882ea9b: author could not be reached, but the code is gone. wscript still has --datadir switch, but I don't think this is relevant to copyright. f197efd5: unclear origin, but I consider the code gone anyway (replaced with generic OSD mechanisms). 8337d9c2: author did not reply, but only the option still exists (under a different name), other code was removed. d8fd7131: did not reply. Disabled in a previous commit. 05258251: same author as above. Both fields actually seem to have vanished (even when tracking renames), so no action taken. d459e644, 268b2c1a: author did not reply, but we reuse only the options (with different names and slightly or fully different semantics, and completely different implementations), so I don't think this is relevant for copyright. 09e742fe, 17c39c4e: same as above. e8a173de, bff4b3ee: author could not be reached. The commands were reworked to properties, and the code outside of the TV code were moved back to the TV code. So I don't think copyright applies to the current command.c parts (mp_property_tv_color, mp_property_tv_freq, mp_property_tv_scan). The TV parts remain GPL. 0810e427: could not be reached. Disabled in a previous commit. 43744a2d: unknown author, but this was replaced by dynamic alloc (if the change is even copyrightable). 116ca0c7: unknown author; reasoning see input.c relicensing commit. e7e4d1d8: these semantics still exist, but as generic code, and this code was fully removed. f1175cd9: the author of the cited patch is unknown, and upon inspection it turns out that I was only using the idea to pause the player on EOF, so I claim it's not copyright relevant. 25affdcc: author could not be reached (yet) - but it's only a function rename, not copyrightable. 5728504c was committed by Arpi (who agreed), but hints that it might be by a different author. In fact it seems to be mostly this patch: http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2001-November/002041.html The author did not respond, but it all seems to have been removed later. It's a terrible mess though. Arpi reverted the A-V sync code at first, but left the RTC code for a while. The following commits remove these changes 100%: 14b35442, 7181a091, 31482783, 614f8475, df58e822. cehoyos did explicitly not agree to LGPL, but was involved in the following changes: c99d8fc8: applied a patch and didn't modify it, the original author agreed. 40ac0d31: author could not be reached, but all code is gone anyway. The "af" command has a similar function, but works completely different and actually reuses a mechanism older than this patch. 54350436: applied a patch, but didn't modify it, except for adding a German translation, which was removed later. a2dda036: same situation as above 240b743e: this was made GPL-only in a previous commit 7b25afd7: same as above (for now) kirijua could not be reached, but was a regular patch contributor: c2c997fd: video equalizer code move; probably not copyrightable. Is GPL due to Nick anyway. be54f481: technically, this became the audio track property later. But all what is left is the fact that you pass a track ID to it, so consider the original coypright non-relevant. 2f376d1b: this was rewritten in b7052b43, but for now we can afford to be careful, so this was marked as GPL only in a previous commit. 43844d09: remaining parts in main.c were reverted in a previous commit. anders has mostly disagreed with the LGPL relicensing. Does not want libaf to become LGPL, but made some concessions. In particular, he granted us permission to relicense 4943e9c52c and 242aa6ebd4. We also consider some of his changes remaining in mpv not relevant for copyright (such as 735de602 - we won't remove the this option completely). We will completely remove his other contributions, including the entire audio filter chain. For now, this stuff is marked as GPL only. The remaining question is how much code in player/audio.c (based on the former mplayer.c and dec_audio.c) is under his copyright. I made claims about this in a previous commit. Nick(ols) Kurshev, svn username "nick" and "nickols_k", could not be reached. He had a lot of changes in early MPlayer. It seems all of that was removed, at least in mpv. His main work, like VIDIX or libswscale work, does not exist in mpv anymore, but the changes to mplayer.c and other core parts still deserve attention: a4119f6b, fb927549, ad3529b8, e11b23dc, 5f2178be, 93c371d5: removed in b43d67e0, d1628d12, 24ed01fe, df58e822. 0a83c6ec, 104c125e, 4e067f62, aec5dcc8, b587a3d6, f3de6e6b: DR, VAA, and "tune" stuff was fully removed later on or replaced with other mechanisms. 340183b0: screenshots were redone later (the VOCTRL was even removed, with an independent implementation using the same VOCTRL a few years later), so not relevant anymore. Basically only the 's' shortcut remains (but not its implementation). 92c5c274, bffd4007, 555c6766: for now marked as GPL only in a previous commit. Might contain some trace amounts of "michael"'s copyright, who agreed to LGPL only once the core is relicensed. This will still be respected, but I don't think it matters at this in this case. (Some code touched by him was merged into mplayer.c, and then disappeared after heavy refactoring.) I tried to be as careful and as complete as possible. It can't be excluded that amends to this will be made later. This does not make the player LGPL yet.
2017-06-23 15:53:41 +02:00
* mpv is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* mpv 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
player: change license of most core files to LGPL These files have all in common that they were fully or mostly taken from mplayer.c. (mplayer.c was a huge file that contains almost all of the playback core, until it was split into multiple parts.) This was probably the hardest part to relicense, because so much code was moved around all the time. player/audio.c still does not compile. We'll have to redo audio filtering. Once that is done, we can probably actually provide an actual LGPL configure switch. Here is a relatively detailed list of potential issues: 8d190244: author did not reply, parts were made GPL-only in a previous commit. 7882ea9b: author could not be reached, but the code is gone. wscript still has --datadir switch, but I don't think this is relevant to copyright. f197efd5: unclear origin, but I consider the code gone anyway (replaced with generic OSD mechanisms). 8337d9c2: author did not reply, but only the option still exists (under a different name), other code was removed. d8fd7131: did not reply. Disabled in a previous commit. 05258251: same author as above. Both fields actually seem to have vanished (even when tracking renames), so no action taken. d459e644, 268b2c1a: author did not reply, but we reuse only the options (with different names and slightly or fully different semantics, and completely different implementations), so I don't think this is relevant for copyright. 09e742fe, 17c39c4e: same as above. e8a173de, bff4b3ee: author could not be reached. The commands were reworked to properties, and the code outside of the TV code were moved back to the TV code. So I don't think copyright applies to the current command.c parts (mp_property_tv_color, mp_property_tv_freq, mp_property_tv_scan). The TV parts remain GPL. 0810e427: could not be reached. Disabled in a previous commit. 43744a2d: unknown author, but this was replaced by dynamic alloc (if the change is even copyrightable). 116ca0c7: unknown author; reasoning see input.c relicensing commit. e7e4d1d8: these semantics still exist, but as generic code, and this code was fully removed. f1175cd9: the author of the cited patch is unknown, and upon inspection it turns out that I was only using the idea to pause the player on EOF, so I claim it's not copyright relevant. 25affdcc: author could not be reached (yet) - but it's only a function rename, not copyrightable. 5728504c was committed by Arpi (who agreed), but hints that it might be by a different author. In fact it seems to be mostly this patch: http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2001-November/002041.html The author did not respond, but it all seems to have been removed later. It's a terrible mess though. Arpi reverted the A-V sync code at first, but left the RTC code for a while. The following commits remove these changes 100%: 14b35442, 7181a091, 31482783, 614f8475, df58e822. cehoyos did explicitly not agree to LGPL, but was involved in the following changes: c99d8fc8: applied a patch and didn't modify it, the original author agreed. 40ac0d31: author could not be reached, but all code is gone anyway. The "af" command has a similar function, but works completely different and actually reuses a mechanism older than this patch. 54350436: applied a patch, but didn't modify it, except for adding a German translation, which was removed later. a2dda036: same situation as above 240b743e: this was made GPL-only in a previous commit 7b25afd7: same as above (for now) kirijua could not be reached, but was a regular patch contributor: c2c997fd: video equalizer code move; probably not copyrightable. Is GPL due to Nick anyway. be54f481: technically, this became the audio track property later. But all what is left is the fact that you pass a track ID to it, so consider the original coypright non-relevant. 2f376d1b: this was rewritten in b7052b43, but for now we can afford to be careful, so this was marked as GPL only in a previous commit. 43844d09: remaining parts in main.c were reverted in a previous commit. anders has mostly disagreed with the LGPL relicensing. Does not want libaf to become LGPL, but made some concessions. In particular, he granted us permission to relicense 4943e9c52c and 242aa6ebd4. We also consider some of his changes remaining in mpv not relevant for copyright (such as 735de602 - we won't remove the this option completely). We will completely remove his other contributions, including the entire audio filter chain. For now, this stuff is marked as GPL only. The remaining question is how much code in player/audio.c (based on the former mplayer.c and dec_audio.c) is under his copyright. I made claims about this in a previous commit. Nick(ols) Kurshev, svn username "nick" and "nickols_k", could not be reached. He had a lot of changes in early MPlayer. It seems all of that was removed, at least in mpv. His main work, like VIDIX or libswscale work, does not exist in mpv anymore, but the changes to mplayer.c and other core parts still deserve attention: a4119f6b, fb927549, ad3529b8, e11b23dc, 5f2178be, 93c371d5: removed in b43d67e0, d1628d12, 24ed01fe, df58e822. 0a83c6ec, 104c125e, 4e067f62, aec5dcc8, b587a3d6, f3de6e6b: DR, VAA, and "tune" stuff was fully removed later on or replaced with other mechanisms. 340183b0: screenshots were redone later (the VOCTRL was even removed, with an independent implementation using the same VOCTRL a few years later), so not relevant anymore. Basically only the 's' shortcut remains (but not its implementation). 92c5c274, bffd4007, 555c6766: for now marked as GPL only in a previous commit. Might contain some trace amounts of "michael"'s copyright, who agreed to LGPL only once the core is relicensed. This will still be respected, but I don't think it matters at this in this case. (Some code touched by him was merged into mplayer.c, and then disappeared after heavy refactoring.) I tried to be as careful and as complete as possible. It can't be excluded that amends to this will be made later. This does not make the player LGPL yet.
2017-06-23 15:53:41 +02:00
* GNU Lesser General Public License for more details.
*
player: change license of most core files to LGPL These files have all in common that they were fully or mostly taken from mplayer.c. (mplayer.c was a huge file that contains almost all of the playback core, until it was split into multiple parts.) This was probably the hardest part to relicense, because so much code was moved around all the time. player/audio.c still does not compile. We'll have to redo audio filtering. Once that is done, we can probably actually provide an actual LGPL configure switch. Here is a relatively detailed list of potential issues: 8d190244: author did not reply, parts were made GPL-only in a previous commit. 7882ea9b: author could not be reached, but the code is gone. wscript still has --datadir switch, but I don't think this is relevant to copyright. f197efd5: unclear origin, but I consider the code gone anyway (replaced with generic OSD mechanisms). 8337d9c2: author did not reply, but only the option still exists (under a different name), other code was removed. d8fd7131: did not reply. Disabled in a previous commit. 05258251: same author as above. Both fields actually seem to have vanished (even when tracking renames), so no action taken. d459e644, 268b2c1a: author did not reply, but we reuse only the options (with different names and slightly or fully different semantics, and completely different implementations), so I don't think this is relevant for copyright. 09e742fe, 17c39c4e: same as above. e8a173de, bff4b3ee: author could not be reached. The commands were reworked to properties, and the code outside of the TV code were moved back to the TV code. So I don't think copyright applies to the current command.c parts (mp_property_tv_color, mp_property_tv_freq, mp_property_tv_scan). The TV parts remain GPL. 0810e427: could not be reached. Disabled in a previous commit. 43744a2d: unknown author, but this was replaced by dynamic alloc (if the change is even copyrightable). 116ca0c7: unknown author; reasoning see input.c relicensing commit. e7e4d1d8: these semantics still exist, but as generic code, and this code was fully removed. f1175cd9: the author of the cited patch is unknown, and upon inspection it turns out that I was only using the idea to pause the player on EOF, so I claim it's not copyright relevant. 25affdcc: author could not be reached (yet) - but it's only a function rename, not copyrightable. 5728504c was committed by Arpi (who agreed), but hints that it might be by a different author. In fact it seems to be mostly this patch: http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2001-November/002041.html The author did not respond, but it all seems to have been removed later. It's a terrible mess though. Arpi reverted the A-V sync code at first, but left the RTC code for a while. The following commits remove these changes 100%: 14b35442, 7181a091, 31482783, 614f8475, df58e822. cehoyos did explicitly not agree to LGPL, but was involved in the following changes: c99d8fc8: applied a patch and didn't modify it, the original author agreed. 40ac0d31: author could not be reached, but all code is gone anyway. The "af" command has a similar function, but works completely different and actually reuses a mechanism older than this patch. 54350436: applied a patch, but didn't modify it, except for adding a German translation, which was removed later. a2dda036: same situation as above 240b743e: this was made GPL-only in a previous commit 7b25afd7: same as above (for now) kirijua could not be reached, but was a regular patch contributor: c2c997fd: video equalizer code move; probably not copyrightable. Is GPL due to Nick anyway. be54f481: technically, this became the audio track property later. But all what is left is the fact that you pass a track ID to it, so consider the original coypright non-relevant. 2f376d1b: this was rewritten in b7052b43, but for now we can afford to be careful, so this was marked as GPL only in a previous commit. 43844d09: remaining parts in main.c were reverted in a previous commit. anders has mostly disagreed with the LGPL relicensing. Does not want libaf to become LGPL, but made some concessions. In particular, he granted us permission to relicense 4943e9c52c and 242aa6ebd4. We also consider some of his changes remaining in mpv not relevant for copyright (such as 735de602 - we won't remove the this option completely). We will completely remove his other contributions, including the entire audio filter chain. For now, this stuff is marked as GPL only. The remaining question is how much code in player/audio.c (based on the former mplayer.c and dec_audio.c) is under his copyright. I made claims about this in a previous commit. Nick(ols) Kurshev, svn username "nick" and "nickols_k", could not be reached. He had a lot of changes in early MPlayer. It seems all of that was removed, at least in mpv. His main work, like VIDIX or libswscale work, does not exist in mpv anymore, but the changes to mplayer.c and other core parts still deserve attention: a4119f6b, fb927549, ad3529b8, e11b23dc, 5f2178be, 93c371d5: removed in b43d67e0, d1628d12, 24ed01fe, df58e822. 0a83c6ec, 104c125e, 4e067f62, aec5dcc8, b587a3d6, f3de6e6b: DR, VAA, and "tune" stuff was fully removed later on or replaced with other mechanisms. 340183b0: screenshots were redone later (the VOCTRL was even removed, with an independent implementation using the same VOCTRL a few years later), so not relevant anymore. Basically only the 's' shortcut remains (but not its implementation). 92c5c274, bffd4007, 555c6766: for now marked as GPL only in a previous commit. Might contain some trace amounts of "michael"'s copyright, who agreed to LGPL only once the core is relicensed. This will still be respected, but I don't think it matters at this in this case. (Some code touched by him was merged into mplayer.c, and then disappeared after heavy refactoring.) I tried to be as careful and as complete as possible. It can't be excluded that amends to this will be made later. This does not make the player LGPL yet.
2017-06-23 15:53:41 +02:00
* You should have received a copy of the GNU Lesser General Public
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPLAYER_CFG_MPLAYER_H
#define MPLAYER_CFG_MPLAYER_H
/*
* config for cfgparser
*/
#include <float.h>
#include <stddef.h>
#include <sys/types.h>
#include <limits.h>
#include <math.h>
#include "config.h"
#ifdef _WIN32
#include <windows.h>
#endif
#include "options.h"
#include "m_config.h"
#include "m_option.h"
#include "common/common.h"
#include "stream/stream.h"
#include "video/csputils.h"
#include "video/hwdec.h"
#include "video/image_writer.h"
#include "sub/osd.h"
#include "player/core.h"
#include "player/command.h"
2014-06-30 12:49:01 +02:00
#include "stream/stream.h"
#include "demux/demux.h"
static void print_version(struct mp_log *log)
{
mp_print_version(log, true);
}
extern const struct m_sub_options tv_params_conf;
extern const struct m_sub_options stream_cdda_conf;
extern const struct m_sub_options stream_dvb_conf;
extern const struct m_sub_options stream_lavf_conf;
extern const struct m_sub_options sws_conf;
extern const struct m_sub_options zimg_conf;
extern const struct m_sub_options drm_conf;
extern const struct m_sub_options demux_rawaudio_conf;
extern const struct m_sub_options demux_rawvideo_conf;
extern const struct m_sub_options demux_lavf_conf;
extern const struct m_sub_options demux_mkv_conf;
extern const struct m_sub_options demux_cue_conf;
extern const struct m_sub_options vd_lavc_conf;
extern const struct m_sub_options ad_lavc_conf;
extern const struct m_sub_options input_config;
extern const struct m_sub_options encode_config;
extern const struct m_sub_options ra_ctx_conf;
extern const struct m_sub_options gl_video_conf;
extern const struct m_sub_options ao_alsa_conf;
extern const struct m_sub_options demux_conf;
demux: add a on-disk cache Somewhat similar to the old --cache-file, except for the demuxer cache. Instead of keeping packet data in memory, it's written to disk and read back when needed. The idea is to reduce main memory usage, while allowing fast seeking in large cached network streams (especially live streams). Keeping the packet metadata on disk would be rather hard (would use mmap or so, or rewrite the entire demux.c packet queue handling), and since it's relatively small, just keep it in memory. Also for simplicity, the disk cache is append-only. If you're watching really long livestreams, and need pruning, you're probably out of luck. This still could be improved by trying to free unused blocks with fallocate(), but since we're writing multiple streams in an interleaved manner, this is slightly hard. Some rather gross ugliness in packet.h: we want to store the file position of the cached data somewhere, but on 32 bit architectures, we don't have any usable 64 bit members for this, just the buf/len fields, which add up to 64 bit - so the shitty union aliases this memory. Error paths untested. Side data (the complicated part of trying to serialize ffmpeg packets) untested. Stream recording had to be adjusted. Some minor details change due to this, but probably nothing important. The change in attempt_range_joining() is because packets in cache have no valid len field. It was a useful check (heuristically finding broken cases), but not a necessary one. Various other approaches were tried. It would be interesting to list them and to mention the pros and cons, but I don't feel like it.
2019-06-13 19:10:32 +02:00
extern const struct m_sub_options demux_cache_conf;
extern const struct m_obj_list vf_obj_list;
extern const struct m_obj_list af_obj_list;
extern const struct m_obj_list vo_obj_list;
extern const struct m_sub_options ao_conf;
vo_opengl: refactor into vo_gpu This is done in several steps: 1. refactor MPGLContext -> struct ra_ctx 2. move GL-specific stuff in vo_opengl into opengl/context.c 3. generalize context creation to support other APIs, and add --gpu-api 4. rename all of the --opengl- options that are no longer opengl-specific 5. move all of the stuff from opengl/* that isn't GL-specific into gpu/ (note: opengl/gl_utils.h became opengl/utils.h) 6. rename vo_opengl to vo_gpu 7. to handle window screenshots, the short-term approach was to just add it to ra_swchain_fns. Long term (and for vulkan) this has to be moved to ra itself (and vo_gpu altered to compensate), but this was a stop-gap measure to prevent this commit from getting too big 8. move ra->fns->flush to ra_gl_ctx instead 9. some other minor changes that I've probably already forgotten Note: This is one half of a major refactor, the other half of which is provided by rossy's following commit. This commit enables support for all linux platforms, while his version enables support for all non-linux platforms. Note 2: vo_opengl_cb.c also re-uses ra_gl_ctx so it benefits from the --opengl- options like --opengl-early-flush, --opengl-finish etc. Should be a strict superset of the old functionality. Disclaimer: Since I have no way of compiling mpv on all platforms, some of these ports were done blindly. Specifically, the blind ports included context_mali_fbdev.c and context_rpi.c. Since they're both based on egl_helpers, the port should have gone smoothly without any major changes required. But if somebody complains about a compile error on those platforms (assuming anybody actually uses them), you know where to complain.
2017-09-14 08:04:55 +02:00
extern const struct m_sub_options opengl_conf;
vo_gpu: vulkan: initial implementation This time based on ra/vo_gpu. 2017 is the year of the vulkan desktop! Current problems / limitations / improvement opportunities: 1. The swapchain/flipping code violates the vulkan spec, by assuming that the presentation queue will be bounded (in cases where rendering is significantly faster than vsync). But apparently, there's simply no better way to do this right now, to the point where even the stupid cube.c examples from LunarG etc. do it wrong. (cf. https://github.com/KhronosGroup/Vulkan-Docs/issues/370) 2. The memory allocator could be improved. (This is a universal constant) 3. Could explore using push descriptors instead of descriptor sets, especially since we expect to switch descriptors semi-often for some passes (like interpolation). Probably won't make a difference, but the synchronization overhead might be a factor. Who knows. 4. Parallelism across frames / async transfer is not well-defined, we either need to use a better semaphore / command buffer strategy or a resource pooling layer to safely handle cross-frame parallelism. (That said, I gave resource pooling a try and was not happy with the result at all - so I'm still exploring the semaphore strategy) 5. We aggressively use pipeline barriers where events would offer a much more fine-grained synchronization mechanism. As a result of this, we might be suffering from GPU bubbles due to too-short dependencies on objects. (That said, I'm also exploring the use of semaphores as a an ordering tactic which would allow cross-frame time slicing in theory) Some minor changes to the vo_gpu and infrastructure, but nothing consequential. NOTE: For safety, all use of asynchronous commands / multiple command pools is currently disabled completely. There are some left-over relics of this in the code (e.g. the distinction between dev_poll and pool_poll), but that is kept in place mostly because this will be re-extended in the future (vulkan rev 2). The queue count is also currently capped to 1, because of the lack of cross-frame semaphores means we need the implicit synchronization from the same-queue semantics to guarantee a correct result.
2016-09-14 20:54:18 +02:00
extern const struct m_sub_options vulkan_conf;
extern const struct m_sub_options vulkan_display_conf;
extern const struct m_sub_options spirv_conf;
vo_gpu: d3d11: initial implementation This is a new RA/vo_gpu backend that uses Direct3D 11. The GLSL generated by vo_gpu is cross-compiled to HLSL with SPIRV-Cross. What works: - All of mpv's internal shaders should work, including compute shaders. - Some external shaders have been tested and work, including RAVU and adaptive-sharpen. - Non-dumb mode works, even on very old hardware. Most features work at feature level 9_3 and all features work at feature level 10_0. Some features also work at feature level 9_1 and 9_2, but without high-bit- depth FBOs, it's not very useful. (Hardware this old is probably not fast enough for advanced features anyway.) Note: This is more compatible than ANGLE, which requires 9_3 to work at all (GLES 2.0,) and 10_1 for non-dumb-mode (GLES 3.0.) - Hardware decoding with D3D11VA, including decoding of 10-bit formats without truncation to 8-bit. What doesn't work / can be improved: - PBO upload and direct rendering does not work yet. Direct rendering requires persistent-mapped PBOs because the decoder needs to be able to read data from images that have already been decoded and uploaded. Unfortunately, it seems like persistent-mapped PBOs are fundamentally incompatible with D3D11, which requires all resources to use driver- managed memory and requires memory to be unmapped (and hence pointers to be invalidated) when a resource is used in a draw or copy operation. However it might be possible to use D3D11's limited multithreading capabilities to emulate some features of PBOs, like asynchronous texture uploading. - The blit() and clear() operations don't have equivalents in the D3D11 API that handle all cases, so in most cases, they have to be emulated with a shader. This is currently done inside ra_d3d11, but ideally it would be done in generic code, so it can take advantage of mpv's shader generation utilities. - SPIRV-Cross is used through a NIH C-compatible wrapper library, since it does not expose a C interface itself. The library is available here: https://github.com/rossy/crossc - The D3D11 context could be made to support more modern DXGI features in future. For example, it should be possible to add support for high-bit-depth and HDR output with DXGI 1.5/1.6.
2017-09-07 12:18:06 +02:00
extern const struct m_sub_options d3d11_conf;
extern const struct m_sub_options d3d11va_conf;
extern const struct m_sub_options angle_conf;
extern const struct m_sub_options cocoa_conf;
extern const struct m_sub_options macos_conf;
extern const struct m_sub_options wayland_conf;
extern const struct m_sub_options vaapi_conf;
static const struct m_sub_options screenshot_conf = {
.opts = image_writer_opts,
.size = sizeof(struct image_writer_opts),
.defaults = &image_writer_opts_defaults,
};
#undef OPT_BASE_STRUCT
#define OPT_BASE_STRUCT struct mp_vo_opts
static const m_option_t mp_vo_opt_list[] = {
{"vo", OPT_SETTINGSLIST(video_driver_list, &vo_obj_list)},
{"taskbar-progress", OPT_BOOL(taskbar_progress)},
{"snap-window", OPT_BOOL(snap_window)},
{"ontop", OPT_BOOL(ontop)},
{"ontop-level", OPT_CHOICE(ontop_level, {"window", -1}, {"system", -2},
{"desktop", -3}), M_RANGE(0, INT_MAX)},
{"border", OPT_BOOL(border)},
{"fit-border", OPT_BOOL(fit_border),
options: win32: ignore and deprecate --fit-border The accurate description of this option was: - fit-border is enabled by default. When disabled, it adds a bug where if the window has borders and mpv shrinks it to fit the desktop, then the calculation ignores the borders and adds incorrect video crop. The option was added at commits 70f64f3c and 949247d6, in order to solve an issue (#2935) where if mpv wanted to display a video with size WxH, then w32_common.c incorrectly set the window to WxH, while down-scaling the video slightly to fit (even with small sizes). It was addressed with a new option which is enabled by default, but does the right thing (sets the client area to WxH) only when disabled, so that everyone who prefers their video slightly downscaled could keep their default behavior. (#2935 also addressed an off-by-one issue, fixed before fit-border) While disabling the option did avoid unnecessary downscaling, it also added a bug when disabled: the borders are no longer taken into account when the size is too big for the desktop. Most users don't notice and are unaffected as it's enabled by default. Shortly later (981048e0) the core issue is fixed, and now the client area is correctly set to WxH instead of the window (and together with the three following commits which center the video, adds a new bug where the window title can be outside the display - addressed next). However, fit-border remained, now without any effect, except that it still has the same bug when disabled and the window is too big. Later code changes and refactoring preserved this issue with great attention to details, and it remained in identical form until now. Simply rip out fit-border.
2021-04-17 12:18:43 +02:00
.deprecation_message = "the option is ignored and no longer needed"},
{"on-all-workspaces", OPT_BOOL(all_workspaces)},
{"geometry", OPT_GEOMETRY(geometry)},
{"autofit", OPT_SIZE_BOX(autofit)},
{"autofit-larger", OPT_SIZE_BOX(autofit_larger)},
{"autofit-smaller", OPT_SIZE_BOX(autofit_smaller)},
{"window-scale", OPT_DOUBLE(window_scale), M_RANGE(0.001, 100)},
{"window-minimized", OPT_BOOL(window_minimized)},
{"window-maximized", OPT_BOOL(window_maximized)},
{"focus-on-open", OPT_BOOL(focus_on_open)},
{"force-render", OPT_BOOL(force_render)},
{"force-window-position", OPT_BOOL(force_window_position)},
{"x11-name", OPT_STRING(winname)},
{"wayland-app-id", OPT_STRING(appid)},
{"monitoraspect", OPT_FLOAT(force_monitor_aspect), M_RANGE(0.0, 9.0)},
{"monitorpixelaspect", OPT_FLOAT(monitor_pixel_aspect),
M_RANGE(1.0/32.0, 32.0)},
{"fullscreen", OPT_BOOL(fullscreen)},
{"fs", OPT_ALIAS("fullscreen")},
{"native-keyrepeat", OPT_BOOL(native_keyrepeat)},
{"panscan", OPT_FLOAT(panscan), M_RANGE(0.0, 1.0)},
{"video-zoom", OPT_FLOAT(zoom), M_RANGE(-20.0, 20.0)},
{"video-pan-x", OPT_FLOAT(pan_x), M_RANGE(-3.0, 3.0)},
{"video-pan-y", OPT_FLOAT(pan_y), M_RANGE(-3.0, 3.0)},
{"video-align-x", OPT_FLOAT(align_x), M_RANGE(-1.0, 1.0)},
{"video-align-y", OPT_FLOAT(align_y), M_RANGE(-1.0, 1.0)},
{"video-scale-x", OPT_FLOAT(scale_x), M_RANGE(0, 10000.0)},
{"video-scale-y", OPT_FLOAT(scale_y), M_RANGE(0, 10000.0)},
{"video-margin-ratio-left", OPT_FLOAT(margin_x[0]), M_RANGE(0.0, 1.0)},
{"video-margin-ratio-right", OPT_FLOAT(margin_x[1]), M_RANGE(0.0, 1.0)},
{"video-margin-ratio-top", OPT_FLOAT(margin_y[0]), M_RANGE(0.0, 1.0)},
{"video-margin-ratio-bottom", OPT_FLOAT(margin_y[1]), M_RANGE(0.0, 1.0)},
{"video-unscaled", OPT_CHOICE(unscaled,
{"no", 0}, {"yes", 1}, {"downscale-big", 2})},
{"wid", OPT_INT64(WinID)},
{"screen", OPT_CHOICE(screen_id, {"default", -1}), M_RANGE(0, 32)},
{"screen-name", OPT_STRING(screen_name)},
{"fs-screen", OPT_CHOICE(fsscreen_id, {"all", -2}, {"current", -1}),
M_RANGE(0, 32)},
{"fs-screen-name", OPT_STRING(fsscreen_name)},
{"keepaspect", OPT_BOOL(keepaspect)},
{"keepaspect-window", OPT_BOOL(keepaspect_window)},
{"hidpi-window-scale", OPT_BOOL(hidpi_window_scale)},
{"native-fs", OPT_BOOL(native_fs)},
{"override-display-fps", OPT_DOUBLE(override_display_fps),
M_RANGE(0, DBL_MAX)},
{"video-timing-offset", OPT_DOUBLE(timing_offset), M_RANGE(0.0, 1.0)},
{"video-sync", OPT_CHOICE(video_sync,
{"audio", VS_DEFAULT},
{"display-resample", VS_DISP_RESAMPLE},
{"display-resample-vdrop", VS_DISP_RESAMPLE_VDROP},
{"display-resample-desync", VS_DISP_RESAMPLE_NONE},
{"display-tempo", VS_DISP_TEMPO},
{"display-adrop", VS_DISP_ADROP},
{"display-vdrop", VS_DISP_VDROP},
{"display-desync", VS_DISP_NONE},
{"desync", VS_NONE})},
#if HAVE_X11
{"x11-netwm", OPT_CHOICE(x11_netwm, {"auto", 0}, {"no", -1}, {"yes", 1})},
{"x11-bypass-compositor", OPT_CHOICE(x11_bypass_compositor,
{"no", 0}, {"yes", 1}, {"fs-only", 2}, {"never", 3})},
{"x11-present", OPT_CHOICE(x11_present,
{"no", 0}, {"auto", 1}, {"yes", 2})},
#endif
#if HAVE_WAYLAND
{"wayland-content-type", OPT_CHOICE(content_type, {"auto", -1}, {"none", 0},
{"photo", 1}, {"video", 2}, {"game", 3})},
#endif
#if HAVE_WIN32_DESKTOP
{"vo-mmcss-profile", OPT_STRING(mmcss_profile)},
#endif
#if HAVE_EGL_ANDROID
{"android-surface-size", OPT_SIZE_BOX(android_surface_size)},
#endif
{"swapchain-depth", OPT_INT(swapchain_depth), M_RANGE(1, 8)},
{0}
};
const struct m_sub_options vo_sub_opts = {
.opts = mp_vo_opt_list,
.size = sizeof(struct mp_vo_opts),
.defaults = &(const struct mp_vo_opts){
.video_driver_list = NULL,
.monitor_pixel_aspect = 1.0,
.screen_id = -1,
.fsscreen_id = -1,
.panscan = 0.0f,
.scale_x = 1.0f,
.scale_y = 1.0f,
.keepaspect = true,
.keepaspect_window = true,
.hidpi_window_scale = true,
.native_fs = true,
.taskbar_progress = true,
.border = true,
.fit_border = true,
.appid = "mpv",
.content_type = -1,
.WinID = -1,
.window_scale = 1.0,
.x11_bypass_compositor = 2,
.x11_present = 1,
.mmcss_profile = "Playback",
.ontop_level = -1,
.timing_offset = 0.050,
.swapchain_depth = 3,
.focus_on_open = true,
},
};
sub: make filter_sdh a "proper" filter, allow runtime changes Until now, filter_sdh was simply a function that was called by sd_ass directly (if enabled). I want to add another filter, so it's time to turn this into a somewhat more general subtitle filtering infrastructure. I pondered whether to reuse the audio/video filtering stuff - but better not. Also, since subtitles are horrible and tend to refuse proper abstraction, it's still messed into sd_ass, instead of working on the dec_sub.c level. Actually mpv used to have subtitle "filters" and even made subtitle converters part of it, but it was fairly horrible, so don't do that again. In addition, make runtime changes possible. Since this was supposed to be a quick hack, I just decided to put all subtitle filter options into a separate option group (=> simpler change notification), to manually push the change through the playloop (like it was sort of before for OSD options), and to recreate the sub filter chain completely in every change. Should be good enough. One strangeness is that due to prefetching and such, most subtitle packets (or those some time ahead) are actually done filtering when we change, so the user still needs to manually seek to actually refresh everything. And since subtitle data is usually cached in ASS_Track (for other terrible but user-friendly reasons), we also must clear the subtitle data, but of course only on seek, since otherwise all subtitles would just disappear. What a fucking mess, but such is life. We could trigger a "refresh seek" to make this more automatic, but I don't feel like it currently. This is slightly inefficient (lots of allocations and copying), but I decided that it doesn't matter. Could matter slightly for crazy ASS subtitles that render with thousands of events. Not very well tested. Still seems to work, but I didn't have many test cases.
2020-02-16 01:02:17 +01:00
#undef OPT_BASE_STRUCT
#define OPT_BASE_STRUCT struct mp_sub_filter_opts
const struct m_sub_options mp_sub_filter_opts = {
.opts = (const struct m_option[]){
{"sub-filter-sdh", OPT_BOOL(sub_filter_SDH)},
{"sub-filter-sdh-harder", OPT_BOOL(sub_filter_SDH_harder)},
{"sub-filter-regex-enable", OPT_BOOL(rf_enable)},
{"sub-filter-regex-plain", OPT_BOOL(rf_plain)},
{"sub-filter-regex", OPT_STRINGLIST(rf_items)},
{"sub-filter-jsre", OPT_STRINGLIST(jsre_items)},
{"sub-filter-regex-warn", OPT_BOOL(rf_warn)},
sub: make filter_sdh a "proper" filter, allow runtime changes Until now, filter_sdh was simply a function that was called by sd_ass directly (if enabled). I want to add another filter, so it's time to turn this into a somewhat more general subtitle filtering infrastructure. I pondered whether to reuse the audio/video filtering stuff - but better not. Also, since subtitles are horrible and tend to refuse proper abstraction, it's still messed into sd_ass, instead of working on the dec_sub.c level. Actually mpv used to have subtitle "filters" and even made subtitle converters part of it, but it was fairly horrible, so don't do that again. In addition, make runtime changes possible. Since this was supposed to be a quick hack, I just decided to put all subtitle filter options into a separate option group (=> simpler change notification), to manually push the change through the playloop (like it was sort of before for OSD options), and to recreate the sub filter chain completely in every change. Should be good enough. One strangeness is that due to prefetching and such, most subtitle packets (or those some time ahead) are actually done filtering when we change, so the user still needs to manually seek to actually refresh everything. And since subtitle data is usually cached in ASS_Track (for other terrible but user-friendly reasons), we also must clear the subtitle data, but of course only on seek, since otherwise all subtitles would just disappear. What a fucking mess, but such is life. We could trigger a "refresh seek" to make this more automatic, but I don't feel like it currently. This is slightly inefficient (lots of allocations and copying), but I decided that it doesn't matter. Could matter slightly for crazy ASS subtitles that render with thousands of events. Not very well tested. Still seems to work, but I didn't have many test cases.
2020-02-16 01:02:17 +01:00
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
.defaults = &(OPT_BASE_STRUCT){
.rf_enable = true,
},
sub: make filter_sdh a "proper" filter, allow runtime changes Until now, filter_sdh was simply a function that was called by sd_ass directly (if enabled). I want to add another filter, so it's time to turn this into a somewhat more general subtitle filtering infrastructure. I pondered whether to reuse the audio/video filtering stuff - but better not. Also, since subtitles are horrible and tend to refuse proper abstraction, it's still messed into sd_ass, instead of working on the dec_sub.c level. Actually mpv used to have subtitle "filters" and even made subtitle converters part of it, but it was fairly horrible, so don't do that again. In addition, make runtime changes possible. Since this was supposed to be a quick hack, I just decided to put all subtitle filter options into a separate option group (=> simpler change notification), to manually push the change through the playloop (like it was sort of before for OSD options), and to recreate the sub filter chain completely in every change. Should be good enough. One strangeness is that due to prefetching and such, most subtitle packets (or those some time ahead) are actually done filtering when we change, so the user still needs to manually seek to actually refresh everything. And since subtitle data is usually cached in ASS_Track (for other terrible but user-friendly reasons), we also must clear the subtitle data, but of course only on seek, since otherwise all subtitles would just disappear. What a fucking mess, but such is life. We could trigger a "refresh seek" to make this more automatic, but I don't feel like it currently. This is slightly inefficient (lots of allocations and copying), but I decided that it doesn't matter. Could matter slightly for crazy ASS subtitles that render with thousands of events. Not very well tested. Still seems to work, but I didn't have many test cases.
2020-02-16 01:02:17 +01:00
.change_flags = UPDATE_SUB_FILT,
};
#undef OPT_BASE_STRUCT
#define OPT_BASE_STRUCT struct mp_subtitle_opts
const struct m_sub_options mp_subtitle_sub_opts = {
.opts = (const struct m_option[]){
{"sub-delay", OPT_FLOAT(sub_delay)},
{"sub-fps", OPT_FLOAT(sub_fps)},
{"sub-speed", OPT_FLOAT(sub_speed)},
{"sub-visibility", OPT_BOOL(sub_visibility)},
{"secondary-sub-visibility", OPT_BOOL(sec_sub_visibility)},
{"sub-forced-only", OPT_CHOICE(forced_subs_only,
{"auto", -1}, {"no", 0}, {"yes", 1})},
{"stretch-dvd-subs", OPT_BOOL(stretch_dvd_subs)},
{"stretch-image-subs-to-screen", OPT_BOOL(stretch_image_subs)},
{"image-subs-video-resolution", OPT_BOOL(image_subs_video_res)},
{"sub-fix-timing", OPT_BOOL(sub_fix_timing)},
{"sub-pos", OPT_INT(sub_pos), M_RANGE(0, 150)},
{"sub-gauss", OPT_FLOAT(sub_gauss), M_RANGE(0.0, 3.0)},
{"sub-gray", OPT_BOOL(sub_gray)},
{"sub-ass", OPT_BOOL(ass_enabled), .flags = UPDATE_SUB_HARD},
{"sub-scale", OPT_FLOAT(sub_scale), M_RANGE(0, 100)},
{"sub-ass-line-spacing", OPT_FLOAT(ass_line_spacing),
M_RANGE(-1000, 1000)},
{"sub-use-margins", OPT_BOOL(sub_use_margins)},
{"sub-ass-force-margins", OPT_BOOL(ass_use_margins)},
{"sub-ass-vsfilter-aspect-compat", OPT_BOOL(ass_vsfilter_aspect_compat)},
{"sub-ass-vsfilter-color-compat", OPT_CHOICE(ass_vsfilter_color_compat,
{"no", 0}, {"basic", 1}, {"full", 2}, {"force-601", 3})},
{"sub-ass-vsfilter-blur-compat", OPT_BOOL(ass_vsfilter_blur_compat)},
{"embeddedfonts", OPT_BOOL(use_embedded_fonts), .flags = UPDATE_SUB_HARD},
{"sub-ass-force-style", OPT_STRINGLIST(ass_force_style_list),
.flags = UPDATE_SUB_HARD},
2020-09-04 00:31:59 +02:00
{"sub-ass-styles", OPT_STRING(ass_styles_file),
.flags = M_OPT_FILE | UPDATE_SUB_HARD},
{"sub-ass-hinting", OPT_CHOICE(ass_hinting,
{"none", 0}, {"light", 1}, {"normal", 2}, {"native", 3})},
{"sub-ass-shaper", OPT_CHOICE(ass_shaper,
{"simple", 0}, {"complex", 1})},
{"sub-ass-justify", OPT_BOOL(ass_justify)},
{"sub-ass-override", OPT_CHOICE(ass_style_override,
{"no", 0}, {"yes", 1}, {"force", 3}, {"scale", 4}, {"strip", 5})},
{"sub-scale-by-window", OPT_BOOL(sub_scale_by_window)},
{"sub-scale-with-window", OPT_BOOL(sub_scale_with_window)},
{"sub-ass-scale-with-window", OPT_BOOL(ass_scale_with_window)},
{"sub", OPT_SUBSTRUCT(sub_style, sub_style_conf)},
{"sub-clear-on-seek", OPT_BOOL(sub_clear_on_seek)},
{"teletext-page", OPT_INT(teletext_page), M_RANGE(1, 999)},
{"sub-past-video-end", OPT_BOOL(sub_past_video_end)},
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
.defaults = &(OPT_BASE_STRUCT){
.sub_visibility = true,
.sec_sub_visibility = true,
.forced_subs_only = -1,
.sub_pos = 100,
.sub_speed = 1.0,
.ass_enabled = true,
.sub_scale_by_window = true,
.sub_use_margins = true,
.sub_scale_with_window = true,
.teletext_page = 100,
.sub_scale = 1,
.ass_vsfilter_aspect_compat = true,
.ass_vsfilter_color_compat = 1,
.ass_vsfilter_blur_compat = true,
.ass_style_override = 1,
.ass_shaper = 1,
.use_embedded_fonts = true,
},
.change_flags = UPDATE_OSD,
};
#undef OPT_BASE_STRUCT
#define OPT_BASE_STRUCT struct mp_osd_render_opts
const struct m_sub_options mp_osd_render_sub_opts = {
.opts = (const struct m_option[]){
{"osd-bar-align-x", OPT_FLOAT(osd_bar_align_x), M_RANGE(-1.0, +1.0)},
{"osd-bar-align-y", OPT_FLOAT(osd_bar_align_y), M_RANGE(-1.0, +1.0)},
{"osd-bar-w", OPT_FLOAT(osd_bar_w), M_RANGE(1, 100)},
{"osd-bar-h", OPT_FLOAT(osd_bar_h), M_RANGE(0.1, 50)},
{"osd", OPT_SUBSTRUCT(osd_style, osd_style_conf)},
{"osd-scale", OPT_FLOAT(osd_scale), M_RANGE(0, 100)},
{"osd-scale-by-window", OPT_BOOL(osd_scale_by_window)},
{"force-rgba-osd-rendering", OPT_BOOL(force_rgba_osd)},
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
.defaults = &(OPT_BASE_STRUCT){
.osd_bar_align_y = 0.5,
.osd_bar_w = 75.0,
.osd_bar_h = 3.125,
.osd_scale = 1,
.osd_scale_by_window = true,
},
.change_flags = UPDATE_OSD,
};
#undef OPT_BASE_STRUCT
#define OPT_BASE_STRUCT struct dvd_opts
const struct m_sub_options dvd_conf = {
.opts = (const struct m_option[]){
{"dvd-device", OPT_STRING(device), .flags = M_OPT_FILE},
{"dvd-speed", OPT_INT(speed)},
{"dvd-angle", OPT_INT(angle), M_RANGE(1, 99)},
{0}
},
.size = sizeof(struct dvd_opts),
.defaults = &(const struct dvd_opts){
.angle = 1,
},
};
video: rewrite filtering glue code Get rid of the old vf.c code. Replace it with a generic filtering framework, which can potentially handle more than just --vf. At least reimplementing --af with this code is planned. This changes some --vf semantics (including runtime behavior and the "vf" command). The most important ones are listed in interface-changes. vf_convert.c is renamed to f_swscale.c. It is now an internal filter that can not be inserted by the user manually. f_lavfi.c is a refactor of player/lavfi.c. The latter will be removed once --lavfi-complex is reimplemented on top of f_lavfi.c. (which is conceptually easy, but a big mess due to the data flow changes). The existing filters are all changed heavily. The data flow of the new filter framework is different. Especially EOF handling changes - EOF is now a "frame" rather than a state, and must be passed through exactly once. Another major thing is that all filters must support dynamic format changes. The filter reconfig() function goes away. (This sounds complex, but since all filters need to handle EOF draining anyway, they can use the same code, and it removes the mess with reconfig() having to predict the output format, which completely breaks with libavfilter anyway.) In addition, there is no automatic format negotiation or conversion. libavfilter's primitive and insufficient API simply doesn't allow us to do this in a reasonable way. Instead, filters can use f_autoconvert as sub-filter, and tell it which formats they support. This filter will in turn add actual conversion filters, such as f_swscale, to perform necessary format changes. vf_vapoursynth.c uses the same basic principle of operation as before, but with worryingly different details in data flow. Still appears to work. The hardware deint filters (vf_vavpp.c, vf_d3d11vpp.c, vf_vdpaupp.c) are heavily changed. Fortunately, they all used refqueue.c, which is for sharing the data flow logic (especially for managing future/past surfaces and such). It turns out it can be used to factor out most of the data flow. Some of these filters accepted software input. Instead of having ad-hoc upload code in each filter, surface upload is now delegated to f_autoconvert, which can use f_hwupload to perform this. Exporting VO capabilities is still a big mess (mp_stream_info stuff). The D3D11 code drops the redundant image formats, and all code uses the hw_subfmt (sw_format in FFmpeg) instead. Although that too seems to be a big mess for now. f_async_queue is unused.
2018-01-16 11:53:44 +01:00
#undef OPT_BASE_STRUCT
#define OPT_BASE_STRUCT struct filter_opts
const struct m_sub_options filter_conf = {
.opts = (const struct m_option[]){
{"deinterlace", OPT_BOOL(deinterlace)},
video: rewrite filtering glue code Get rid of the old vf.c code. Replace it with a generic filtering framework, which can potentially handle more than just --vf. At least reimplementing --af with this code is planned. This changes some --vf semantics (including runtime behavior and the "vf" command). The most important ones are listed in interface-changes. vf_convert.c is renamed to f_swscale.c. It is now an internal filter that can not be inserted by the user manually. f_lavfi.c is a refactor of player/lavfi.c. The latter will be removed once --lavfi-complex is reimplemented on top of f_lavfi.c. (which is conceptually easy, but a big mess due to the data flow changes). The existing filters are all changed heavily. The data flow of the new filter framework is different. Especially EOF handling changes - EOF is now a "frame" rather than a state, and must be passed through exactly once. Another major thing is that all filters must support dynamic format changes. The filter reconfig() function goes away. (This sounds complex, but since all filters need to handle EOF draining anyway, they can use the same code, and it removes the mess with reconfig() having to predict the output format, which completely breaks with libavfilter anyway.) In addition, there is no automatic format negotiation or conversion. libavfilter's primitive and insufficient API simply doesn't allow us to do this in a reasonable way. Instead, filters can use f_autoconvert as sub-filter, and tell it which formats they support. This filter will in turn add actual conversion filters, such as f_swscale, to perform necessary format changes. vf_vapoursynth.c uses the same basic principle of operation as before, but with worryingly different details in data flow. Still appears to work. The hardware deint filters (vf_vavpp.c, vf_d3d11vpp.c, vf_vdpaupp.c) are heavily changed. Fortunately, they all used refqueue.c, which is for sharing the data flow logic (especially for managing future/past surfaces and such). It turns out it can be used to factor out most of the data flow. Some of these filters accepted software input. Instead of having ad-hoc upload code in each filter, surface upload is now delegated to f_autoconvert, which can use f_hwupload to perform this. Exporting VO capabilities is still a big mess (mp_stream_info stuff). The D3D11 code drops the redundant image formats, and all code uses the hw_subfmt (sw_format in FFmpeg) instead. Although that too seems to be a big mess for now. f_async_queue is unused.
2018-01-16 11:53:44 +01:00
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
.change_flags = UPDATE_IMGPAR,
};
#undef OPT_BASE_STRUCT
#define OPT_BASE_STRUCT struct MPOpts
static const m_option_t mp_opts[] = {
2013-12-21 23:11:12 +01:00
// handled in command line pre-parser (parse_commandline.c)
{"v", &m_option_type_dummy_flag, CONF_NOCFG | M_OPT_NOPROP,
.offset = -1},
{"playlist", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FILE, .offset = -1},
{"{", &m_option_type_dummy_flag, CONF_NOCFG | M_OPT_NOPROP,
.offset = -1},
{"}", &m_option_type_dummy_flag, CONF_NOCFG | M_OPT_NOPROP,
.offset = -1},
// handled in m_config.c
{ "include", CONF_TYPE_STRING, M_OPT_FILE, .offset = -1},
{ "profile", CONF_TYPE_STRING_LIST, 0, .offset = -1},
{ "show-profile", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_NOPROP |
M_OPT_OPTIONAL_PARAM, .offset = -1},
{ "list-options", &m_option_type_dummy_flag, CONF_NOCFG | M_OPT_NOPROP,
.offset = -1},
{"list-properties", OPT_BOOL(property_print_help),
.flags = CONF_NOCFG | M_OPT_NOPROP},
{ "help", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_NOPROP | M_OPT_OPTIONAL_PARAM,
.offset = -1},
{ "h", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_NOPROP | M_OPT_OPTIONAL_PARAM,
.offset = -1},
options: make mess to allow setting profile option with libmpv Certain options, such as --profile, --help, and many others require special-handling, because they don't fit conceptually into the option and property model. They don't store data, but perform actions. This caused the situation that profiles could not be set when using libmpv in encoding mode (although you should probably not used libmpv in encoding mode). Using libmpv always ends up in calling m_config_set_option_raw_direct(), while --profile was handled in m_config_parse_option(). Solve this by moving the handling of this from m_config_parse_option() to m_config_set_option_raw_direct(). Actually we just stuff most of this into m_config_handle_special_options(), which is only called by the aforementioned function. Strangely this also means that the --h/--help option declarations need to be changed, because they used OPT_PRINT, and now the option "parser" is always invoked before the special code. Thus, make them a string. Them being OPT_PRINT was apparently always redundant. (The other option declarations are moved for cosmetic purposes only.) The most weird change is how co->data==NULL is handled. We now allow passing down involved options to m_config_set_option_raw_direct(). The thing is that we don't want them to error if the command line parser is using them (with special handling done there), while all other code paths should raise an error. We try using M_SETOPT_FROM_CMDLINE to distinguish these cases. Note that normal libmpv users are supposed to use the "apply-profile" command instead. This probably contains a bunch of bugs, which you should report.
2017-06-15 15:15:05 +02:00
{"list-protocols", OPT_PRINT(stream_print_proto_list)},
{"version", OPT_PRINT(print_version)},
{"V", OPT_PRINT(print_version)},
test: make tests part of the mpv binary Until now, each .c file in test/ was built as separate, self-contained binary. Each binary could be run to execute the tests it contained. Change this and make them part of the normal mpv binary. Now the tests have to be invoked via the --unittest option. Do this for two reasons: - Tests now run within a "properly" initialized mpv instance, so all services are available. - Possibly simplifying the situation for future build systems. The first point is the main motivation. The mpv code is entangled with mp_log and the option system. It feels like a bad idea to duplicate some of the initialization of this just so you can call code using them. I'm also getting rid of cmocka. There wouldn't be any problem to keep it (it's a perfectly sane set of helpers), but NIH calls. I would have had to aggregate all tests into a CMUnitTest list, and I don't see how I'd get different types of entry points easily. Probably easily solvable, but since we made only pretty basic use of this library, NIH-ing this is actually easier (I needed a list of tests with custom metadata anyway, so all what was left was reimplement the assert_* helpers). Unit tests now don't output anything, and if they fail, they'll simply crash and leave a message that typically requires inspecting the test code to figure out what went wrong (and probably editing the test code to get more information). I even merged the various test functions into single ones. Sucks, but here you go. chmap_sel.c is merged into chmap.c, because I didn't see the point of this being separate. json.c drops the print_message() to go along with the new silent-by-default idea, also there's a memory leak fix unrelated to the rest of this commit. The new code is enabled with --enable-tests (--enable-test goes away). Due to waf's option parser, --enable-test still works, because it's a unique prefix to --enable-tests.
2019-11-07 22:42:14 +01:00
#if HAVE_TESTS
{"unittest", OPT_STRING(test_mode), .flags = CONF_NOCFG | M_OPT_NOPROP},
test: make tests part of the mpv binary Until now, each .c file in test/ was built as separate, self-contained binary. Each binary could be run to execute the tests it contained. Change this and make them part of the normal mpv binary. Now the tests have to be invoked via the --unittest option. Do this for two reasons: - Tests now run within a "properly" initialized mpv instance, so all services are available. - Possibly simplifying the situation for future build systems. The first point is the main motivation. The mpv code is entangled with mp_log and the option system. It feels like a bad idea to duplicate some of the initialization of this just so you can call code using them. I'm also getting rid of cmocka. There wouldn't be any problem to keep it (it's a perfectly sane set of helpers), but NIH calls. I would have had to aggregate all tests into a CMUnitTest list, and I don't see how I'd get different types of entry points easily. Probably easily solvable, but since we made only pretty basic use of this library, NIH-ing this is actually easier (I needed a list of tests with custom metadata anyway, so all what was left was reimplement the assert_* helpers). Unit tests now don't output anything, and if they fail, they'll simply crash and leave a message that typically requires inspecting the test code to figure out what went wrong (and probably editing the test code to get more information). I even merged the various test functions into single ones. Sucks, but here you go. chmap_sel.c is merged into chmap.c, because I didn't see the point of this being separate. json.c drops the print_message() to go along with the new silent-by-default idea, also there's a memory leak fix unrelated to the rest of this commit. The new code is enabled with --enable-tests (--enable-test goes away). Due to waf's option parser, --enable-test still works, because it's a unique prefix to --enable-tests.
2019-11-07 22:42:14 +01:00
#endif
{"player-operation-mode", OPT_CHOICE(operation_mode,
{"cplayer", 0}, {"pseudo-gui", 1}),
.flags = M_OPT_PRE_PARSE | M_OPT_NOPROP},
{"shuffle", OPT_BOOL(shuffle)},
// ------------------------- common options --------------------
{"quiet", OPT_BOOL(quiet)},
{"really-quiet", OPT_BOOL(msg_really_quiet),
.flags = CONF_PRE_PARSE | UPDATE_TERM},
{"terminal", OPT_BOOL(use_terminal), .flags = CONF_PRE_PARSE | UPDATE_TERM},
{"msg-level", OPT_MSGLEVELS(msg_levels),
.flags = CONF_PRE_PARSE | UPDATE_TERM},
{"dump-stats", OPT_STRING(dump_stats),
.flags = UPDATE_TERM | CONF_PRE_PARSE | M_OPT_FILE},
{"msg-color", OPT_BOOL(msg_color), .flags = CONF_PRE_PARSE | UPDATE_TERM},
{"log-file", OPT_STRING(log_file),
.flags = CONF_PRE_PARSE | M_OPT_FILE | UPDATE_TERM},
{"msg-module", OPT_BOOL(msg_module), .flags = UPDATE_TERM},
{"msg-time", OPT_BOOL(msg_time), .flags = UPDATE_TERM},
#if HAVE_WIN32_DESKTOP
{"priority", OPT_CHOICE(w32_priority,
{"no", 0},
{"realtime", REALTIME_PRIORITY_CLASS},
{"high", HIGH_PRIORITY_CLASS},
{"abovenormal", ABOVE_NORMAL_PRIORITY_CLASS},
{"normal", NORMAL_PRIORITY_CLASS},
{"belownormal", BELOW_NORMAL_PRIORITY_CLASS},
{"idle", IDLE_PRIORITY_CLASS}),
.flags = UPDATE_PRIORITY},
#endif
{"config", OPT_BOOL(load_config), .flags = CONF_PRE_PARSE},
{"config-dir", OPT_STRING(force_configdir),
.flags = CONF_NOCFG | CONF_PRE_PARSE | M_OPT_FILE},
{"reset-on-next-file", OPT_STRINGLIST(reset_options)},
#if HAVE_LUA || HAVE_JAVASCRIPT
{"scripts", OPT_PATHLIST(script_files), .flags = M_OPT_FILE},
{"script", OPT_CLI_ALIAS("scripts-append")},
{"script-opts", OPT_KEYVALUELIST(script_opts)},
{"load-scripts", OPT_BOOL(auto_load_scripts)},
#endif
#if HAVE_LUA
{"osc", OPT_BOOL(lua_load_osc), .flags = UPDATE_BUILTIN_SCRIPTS},
{"ytdl", OPT_BOOL(lua_load_ytdl), .flags = UPDATE_BUILTIN_SCRIPTS},
{"ytdl-format", OPT_STRING(lua_ytdl_format)},
{"ytdl-raw-options", OPT_KEYVALUELIST(lua_ytdl_raw_options)},
{"load-stats-overlay", OPT_BOOL(lua_load_stats),
.flags = UPDATE_BUILTIN_SCRIPTS},
{"load-osd-console", OPT_BOOL(lua_load_console),
.flags = UPDATE_BUILTIN_SCRIPTS},
{"load-auto-profiles",
OPT_CHOICE(lua_load_auto_profiles, {"no", 0}, {"yes", 1}, {"auto", -1}),
.flags = UPDATE_BUILTIN_SCRIPTS},
#endif
// ------------------------- stream options --------------------
#if HAVE_DVDNAV
{"", OPT_SUBSTRUCT(dvd_opts, dvd_conf)},
#endif
{"edition", OPT_CHOICE(edition_id, {"auto", -1}), M_RANGE(0, 8190)},
#if HAVE_LIBBLURAY
{"bluray-device", OPT_STRING(bluray_device), .flags = M_OPT_FILE},
#endif /* HAVE_LIBBLURAY */
// ------------------------- demuxer options --------------------
{"frames", OPT_CHOICE(play_frames, {"all", -1}), M_RANGE(0, INT_MAX)},
{"start", OPT_REL_TIME(play_start)},
{"end", OPT_REL_TIME(play_end)},
{"length", OPT_REL_TIME(play_length)},
{"play-dir", OPT_CHOICE(play_dir,
{"forward", 1}, {"+", 1}, {"backward", -1}, {"-", -1})},
Implement backwards playback See manpage additions. This is a huge hack. You can bet there are shit tons of bugs. It's literally forcing square pegs into round holes. Hopefully, the manpage wall of text makes it clear enough that the whole shit can easily crash and burn. (Although it shouldn't literally crash. That would be a bug. It possibly _could_ start a fire by entering some sort of endless loop, not a literal one, just something where it tries to do work without making progress.) (Some obvious bugs I simply ignored for this initial version, but there's a number of potential bugs I can't even imagine. Normal playback should remain completely unaffected, though.) How this works is also described in the manpage. Basically, we demux in reverse, then we decode in reverse, then we render in reverse. The decoding part is the simplest: just reorder the decoder output. This weirdly integrates with the timeline/ordered chapter code, which also has special requirements on feeding the packets to the decoder in a non-straightforward way (it doesn't conflict, although a bugmessmass breaks correct slicing of segments, so EDL/ordered chapter playback is broken in backward direction). Backward demuxing is pretty involved. In theory, it could be much easier: simply iterating the usual demuxer output backward. But this just doesn't fit into our code, so there's a cthulhu nightmare of shit. To be specific, each stream (audio, video) is reversed separately. At least this means we can do backward playback within cached content (for example, you could play backwards in a live stream; on that note, it disables prefetching, which would lead to losing new live video, but this could be avoided). The fuckmess also meant that I didn't bother trying to support subtitles. Subtitles are a problem because they're "sparse" streams. They need to be "passively" demuxed: you don't try to read a subtitle packet, you demux audio and video, and then look whether there was a subtitle packet. This means to get subtitles for a time range, you need to know that you demuxed video and audio over this range, which becomes pretty messy when you demux audio and video backwards separately. Backward display is the most weird (and potentially buggy) part. To avoid that we need to touch a LOT of timing code, we negate all timestamps. The basic idea is that due to the navigation, all comparisons and subtractions of timestamps keep working, and you don't need to touch every single of them to "reverse" them. E.g.: bool before = pts_a < pts_b; would need to be: bool before = forward ? pts_a < pts_b : pts_a > pts_b; or: bool before = pts_a * dir < pts_b * dir; or if you, as it's implemented now, just do this after decoding: pts_a *= dir; pts_b *= dir; and then in the normal timing/renderer code: bool before = pts_a < pts_b; Consequently, we don't need many changes in the latter code. But some assumptions inhererently true for forward playback may have been broken anyway. What is mainly needed is fixing places where values are passed between positive and negative "domains". For example, seeking and timestamp user display always uses positive timestamps. The main mess is that it's not obvious which domain a given variable should or does use. Well, in my tests with a single file, it suddenly started to work when I did this. I'm honestly surprised that it did, and that I didn't have to change a single line in the timing code past decoder (just something minor to make external/cached text subtitles display). I committed it immediately while avoiding thinking about it. But there really likely are subtle problems of all sorts. As far as I'm aware, gstreamer also supports backward playback. When I looked at this years ago, I couldn't find a way to actually try this, and I didn't revisit it now. Back then I also read talk slides from the person who implemented it, and I'm not sure if and which ideas I might have taken from it. It's possible that the timestamp reversal is inspired by it, but I didn't check. (I think it claimed that it could avoid large changes by changing a sign?) VapourSynth has some sort of reverse function, which provides a backward view on a video. The function itself is trivial to implement, as VapourSynth aims to provide random access to video by frame numbers (so you just request decreasing frame numbers). From what I remember, it wasn't exactly fluid, but it worked. It's implemented by creating an index, and seeking to the target on demand, and a bunch of caching. mpv could use it, but it would either require using VapourSynth as demuxer and decoder for everything, or replacing the current file every time something is supposed to be played backwards. FFmpeg's libavfilter has reversal filters for audio and video. These require buffering the entire media data of the file, and don't really fit into mpv's architecture. It could be used by playing a libavfilter graph that also demuxes, but that's like VapourSynth but worse.
2019-05-18 02:10:51 +02:00
{"rebase-start-time", OPT_BOOL(rebase_start_time)},
{"ab-loop-a", OPT_TIME(ab_loop[0]), .flags = M_OPT_ALLOW_NO},
{"ab-loop-b", OPT_TIME(ab_loop[1]), .flags = M_OPT_ALLOW_NO},
{"ab-loop-count", OPT_CHOICE(ab_loop_count, {"inf", -1}),
M_RANGE(0, INT_MAX)},
{"playlist-start", OPT_CHOICE(playlist_pos, {"auto", -1}, {"no", -1}),
M_RANGE(0, INT_MAX)},
{"pause", OPT_BOOL(pause)},
{"keep-open", OPT_CHOICE(keep_open,
{"no", 0},
{"yes", 1},
{"always", 2})},
{"keep-open-pause", OPT_BOOL(keep_open_pause)},
{"image-display-duration", OPT_DOUBLE(image_display_duration),
M_RANGE(0, INFINITY)},
{"index", OPT_CHOICE(index_mode, {"default", 1}, {"recreate", 0})},
// select audio/video/subtitle stream
// keep in sync with num_ptracks[] and MAX_PTRACKS
{"aid", OPT_TRACKCHOICE(stream_id[0][STREAM_AUDIO])},
{"vid", OPT_TRACKCHOICE(stream_id[0][STREAM_VIDEO])},
{"sid", OPT_TRACKCHOICE(stream_id[0][STREAM_SUB])},
{"secondary-sid", OPT_TRACKCHOICE(stream_id[1][STREAM_SUB])},
{"sub", OPT_ALIAS("sid")},
{"video", OPT_ALIAS("vid")},
{"audio", OPT_ALIAS("aid")},
{"alang", OPT_STRINGLIST(stream_lang[STREAM_AUDIO])},
{"slang", OPT_STRINGLIST(stream_lang[STREAM_SUB])},
{"vlang", OPT_STRINGLIST(stream_lang[STREAM_VIDEO])},
{"track-auto-selection", OPT_BOOL(stream_auto_sel)},
{"subs-with-matching-audio", OPT_BOOL(subs_with_matching_audio)},
{"lavfi-complex", OPT_STRING(lavfi_complex), .flags = UPDATE_LAVFI_COMPLEX},
{"audio-display", OPT_CHOICE(audio_display, {"no", 0},
{"embedded-first", 1}, {"external-first", 2})},
{"hls-bitrate", OPT_CHOICE(hls_bitrate,
{"no", -1}, {"min", 0}, {"max", INT_MAX}), M_RANGE(0, INT_MAX)},
{"display-tags", OPT_STRINGLIST(display_tags)},
#if HAVE_CDDA
{"cdda", OPT_SUBSTRUCT(stream_cdda_opts, stream_cdda_conf)},
{"cdrom-device", OPT_STRING(cdrom_device), .flags = M_OPT_FILE},
#endif
// demuxer.c - select audio/sub file/demuxer
{"demuxer", OPT_STRING(demuxer_name), .help = demuxer_help},
{"audio-demuxer", OPT_STRING(audio_demuxer_name), .help = demuxer_help},
{"sub-demuxer", OPT_STRING(sub_demuxer_name), .help = demuxer_help},
{"demuxer-thread", OPT_BOOL(demuxer_thread)},
{"demuxer-termination-timeout", OPT_DOUBLE(demux_termination_timeout)},
{"demuxer-cache-wait", OPT_BOOL(demuxer_cache_wait)},
{"prefetch-playlist", OPT_BOOL(prefetch_open)},
{"cache-pause", OPT_BOOL(cache_pause)},
{"cache-pause-initial", OPT_BOOL(cache_pause_initial)},
{"cache-pause-wait", OPT_FLOAT(cache_pause_wait), M_RANGE(0, DBL_MAX)},
{"mf-fps", OPT_DOUBLE(mf_fps)},
{"mf-type", OPT_STRING(mf_type)},
#if HAVE_DVBIN
{"dvbin", OPT_SUBSTRUCT(stream_dvb_opts, stream_dvb_conf)},
#endif
{"", OPT_SUBSTRUCT(stream_lavf_opts, stream_lavf_conf)},
// ------------------------- a-v sync options --------------------
// set A-V sync correction speed (0=disables it):
{"mc", OPT_FLOAT(default_max_pts_correction), M_RANGE(0, 100)},
{"audio-samplerate", OPT_INT(force_srate), .flags = UPDATE_AUDIO,
M_RANGE(0, 16*48000)},
{"audio-channels", OPT_CHANNELS(audio_output_channels), .flags = UPDATE_AUDIO},
{"audio-format", OPT_AUDIOFORMAT(audio_output_format), .flags = UPDATE_AUDIO},
{"speed", OPT_DOUBLE(playback_speed), M_RANGE(0.01, 100.0)},
{"audio-pitch-correction", OPT_BOOL(pitch_correction)},
// set a-v distance
{"audio-delay", OPT_FLOAT(audio_delay)},
// ------------------------- codec/vfilter options --------------------
{"af-defaults", OPT_SETTINGSLIST(af_defs, &af_obj_list),
.deprecation_message = "use --af + enable/disable flags"},
{"af", OPT_SETTINGSLIST(af_settings, &af_obj_list)},
{"vf-defaults", OPT_SETTINGSLIST(vf_defs, &vf_obj_list),
.deprecation_message = "use --vf + enable/disable flags"},
{"vf", OPT_SETTINGSLIST(vf_settings, &vf_obj_list)},
core: redo how codecs are mapped, remove codecs.conf Use codec names instead of FourCCs to identify codecs. Rewrite how codecs are selected and initialized. Now each decoder exports a list of decoders (and the codec it supports) via add_decoders(). The order matters, and the first decoder for a given decoder is preferred over the other decoders. E.g. all ad_mpg123 decoders are preferred over ad_lavc, because it comes first in the mpcodecs_ad_drivers array. Likewise, decoders within ad_lavc that are enumerated first by libavcodec (using av_codec_next()) are preferred. (This is actually critical to select h264 software decoding by default instead of vdpau. libavcodec and ffmpeg/avconv use the same method to select decoders by default, so we hope this is sane.) The codec names follow libavcodec's codec names as defined by AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders have names different from the canonical codec name. The AVCodecDescriptor API is relatively new, so we need a compatibility layer for older libavcodec versions for codec names that are referenced internally, and which are different from the decoder name. (Add a configure check for that, because checking versions is getting way too messy.) demux/codec_tags.c is generated from the former codecs.conf (minus "special" decoders like vdpau, and excluding the mappings that are the same as the mappings libavformat's exported RIFF tables). It contains all the mappings from FourCCs to codec name. This is needed for demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the codec as determined by libavformat, while the other demuxers have to do this on their own, using the mp_set_audio/video_codec_from_tag() functions. Note that the sh_audio/video->format members don't uniquely identify the codec anymore, and sh->codec takes over this role. Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which provide cover the functionality of the removed switched. Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure container/video combinations (e.g. the sample Film_200_zygo_pro.mov) are played flipped. ffplay/avplay doesn't handle this properly either, so we don't care and blame ffmeg/libav instead.
2013-02-09 15:15:19 +01:00
{"", OPT_SUBSTRUCT(filter_opts, filter_conf)},
core: add --deinterlace option, restore it with resume functionality The --deinterlace option does on playback start what the "deinterlace" property normally does at runtime. You could do this before by using the --vf option or by messing with the vo_vdpau default options, but this new option is supposed to be a "foolproof" way. The main motivation for adding this is so that the deinterlace property can be restored when using the video resume functionality (quit_watch_later command). Implementation-wise, this is a bit messy. The video chain is rebuilt in mpcodecs_reconfig_vo(), where we don't have access to MPContext, so the usual mechanism for enabling deinterlacing can't be used. Further, mpcodecs_reconfig_vo() is called by the video decoder, which doesn't have access to MPContext either. Moving this call to mplayer.c isn't currently possible either (see below). So we just do this before frames are filtered, which potentially means setting the deinterlacing every frame. Fortunately, setting deinterlacing is stable and idempotent, so this is hopefully not a problem. We also add a counter that is incremented on each reconfig to reduce the amount of additional work per frame to nearly zero. The reason we can't move mpcodecs_reconfig_vo() to mplayer.c is because of hardware decoding: we need to check whether the video chain works before we decide that we can use hardware decoding. Changing it so that this can be decided in advance without building a filter chain sounds like a good idea and should be done, but we aren't there yet.
2013-09-13 18:06:08 +02:00
{"", OPT_SUBSTRUCT(dec_wrapper, dec_wrapper_conf)},
{"", OPT_SUBSTRUCT(vd_lavc_params, vd_lavc_conf)},
{"ad-lavc", OPT_SUBSTRUCT(ad_lavc_params, ad_lavc_conf)},
{"", OPT_SUBSTRUCT(demux_lavf, demux_lavf_conf)},
{"demuxer-rawaudio", OPT_SUBSTRUCT(demux_rawaudio, demux_rawaudio_conf)},
{"demuxer-rawvideo", OPT_SUBSTRUCT(demux_rawvideo, demux_rawvideo_conf)},
{"demuxer-mkv", OPT_SUBSTRUCT(demux_mkv, demux_mkv_conf)},
{"demuxer-cue", OPT_SUBSTRUCT(demux_cue, demux_cue_conf)},
// ------------------------- subtitles options --------------------
{"sub-files", OPT_PATHLIST(sub_name), .flags = M_OPT_FILE},
{"sub-file", OPT_CLI_ALIAS("sub-files-append")},
{"audio-files", OPT_PATHLIST(audio_files), .flags = M_OPT_FILE},
{"audio-file", OPT_CLI_ALIAS("audio-files-append")},
{"cover-art-files", OPT_PATHLIST(coverart_files), .flags = M_OPT_FILE},
{"cover-art-file", OPT_CLI_ALIAS("cover-art-files-append")},
{"sub-file-paths", OPT_PATHLIST(sub_paths), .flags = M_OPT_FILE},
{"audio-file-paths", OPT_PATHLIST(audiofile_paths), .flags = M_OPT_FILE},
{"external-files", OPT_PATHLIST(external_files), .flags = M_OPT_FILE},
{"external-file", OPT_CLI_ALIAS("external-files-append")},
{"autoload-files", OPT_BOOL(autoload_files)},
{"sub-auto", OPT_CHOICE(sub_auto,
{"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})},
{"audio-file-auto", OPT_CHOICE(audiofile_auto,
{"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})},
{"cover-art-auto", OPT_CHOICE(coverart_auto,
{"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})},
{"cover-art-whitelist", OPT_BOOL(coverart_whitelist)},
{"", OPT_SUBSTRUCT(subs_rend, mp_subtitle_sub_opts)},
{"", OPT_SUBSTRUCT(subs_filt, mp_sub_filter_opts)},
{"", OPT_SUBSTRUCT(osd_rend, mp_osd_render_sub_opts)},
{"osd-bar", OPT_BOOL(osd_bar_visible), .flags = UPDATE_OSD},
//---------------------- libao/libvo options ------------------------
{"", OPT_SUBSTRUCT(ao_opts, ao_conf)},
{"audio-exclusive", OPT_BOOL(audio_exclusive), .flags = UPDATE_AUDIO},
{"audio-fallback-to-null", OPT_BOOL(ao_null_fallback)},
{"audio-stream-silence", OPT_BOOL(audio_stream_silence)},
{"audio-wait-open", OPT_FLOAT(audio_wait_open), M_RANGE(0, 60)},
{"force-window", OPT_CHOICE(force_vo,
{"no", 0}, {"yes", 1}, {"immediate", 2})},
{"volume-max", OPT_FLOAT(softvol_max), M_RANGE(100, 1000)},
// values <0 for volume and mute are legacy and ignored
{"volume", OPT_FLOAT(softvol_volume), .flags = UPDATE_VOL,
M_RANGE(-1, 1000)},
{"mute", OPT_CHOICE(softvol_mute,
{"no", 0},
{"auto", 0},
{"yes", 1}),
.flags = UPDATE_VOL},
{"replaygain", OPT_CHOICE(rgain_mode,
{"no", 0},
{"track", 1},
{"album", 2}),
.flags = UPDATE_VOL},
{"replaygain-preamp", OPT_FLOAT(rgain_preamp), .flags = UPDATE_VOL,
M_RANGE(-150, 150)},
{"replaygain-clip", OPT_BOOL(rgain_clip), .flags = UPDATE_VOL},
{"replaygain-fallback", OPT_FLOAT(rgain_fallback), .flags = UPDATE_VOL,
M_RANGE(-200, 60)},
{"gapless-audio", OPT_CHOICE(gapless_audio,
{"no", 0},
{"yes", 1},
{"weak", -1})},
{"title", OPT_STRING(wintitle)},
{"force-media-title", OPT_STRING(media_title)},
{"cursor-autohide", OPT_CHOICE(cursor_autohide_delay,
{"no", -1}, {"always", -2}), M_RANGE(0, 30000)},
{"cursor-autohide-fs-only", OPT_BOOL(cursor_autohide_fs)},
{"stop-screensaver", OPT_CHOICE(stop_screensaver,
{"no", 0},
{"yes", 1},
{"always", 2}),
.flags = UPDATE_SCREENSAVER},
{"", OPT_SUBSTRUCT(video_equalizer, mp_csp_equalizer_conf)},
{"use-filedir-conf", OPT_BOOL(use_filedir_conf)},
{"osd-level", OPT_CHOICE(osd_level,
{"0", 0}, {"1", 1}, {"2", 2}, {"3", 3})},
{"osd-on-seek", OPT_CHOICE(osd_on_seek,
{"no", 0},
{"bar", 1},
{"msg", 2},
{"msg-bar", 3})},
{"osd-duration", OPT_INT(osd_duration), M_RANGE(0, 3600000)},
{"osd-fractions", OPT_BOOL(osd_fractions)},
{"sstep", OPT_DOUBLE(step_sec), M_RANGE(0, DBL_MAX)},
{"framedrop", OPT_CHOICE(frame_dropping,
{"no", 0},
{"vo", 1},
{"decoder", 2},
{"decoder+vo", 3})},
{"video-latency-hacks", OPT_BOOL(video_latency_hacks)},
{"untimed", OPT_BOOL(untimed)},
{"stream-dump", OPT_STRING(stream_dump), .flags = M_OPT_FILE},
{"stop-playback-on-init-failure", OPT_BOOL(stop_playback_on_init_failure)},
{"loop-playlist", OPT_CHOICE(loop_times,
{"no", 1},
{"inf", -1}, {"yes", -1},
{"force", -2}),
M_RANGE(1, 10000)},
{"loop-file", OPT_CHOICE(loop_file,
{"no", 0},
{"inf", -1},
{"yes", -1}),
M_RANGE(0, 10000)},
{"loop", OPT_ALIAS("loop-file")},
{"resume-playback", OPT_BOOL(position_resume)},
{"resume-playback-check-mtime", OPT_BOOL(position_check_mtime)},
{"save-position-on-quit", OPT_BOOL(position_save_on_quit)},
{"write-filename-in-watch-later-config",
OPT_BOOL(write_filename_in_watch_later_config)},
{"ignore-path-in-watch-later-config",
OPT_BOOL(ignore_path_in_watch_later_config)},
{"watch-later-directory", OPT_STRING(watch_later_directory),
.flags = M_OPT_FILE},
{"watch-later-options", OPT_STRINGLIST(watch_later_options)},
{"ordered-chapters", OPT_BOOL(ordered_chapters)},
{"ordered-chapters-files", OPT_STRING(ordered_chapters_files),
.flags = M_OPT_FILE},
{"chapter-merge-threshold", OPT_INT(chapter_merge_threshold),
M_RANGE(0, 10000)},
{"chapter-seek-threshold", OPT_DOUBLE(chapter_seek_threshold)},
{"chapters-file", OPT_STRING(chapter_file), .flags = M_OPT_FILE},
{"merge-files", OPT_BOOL(merge_files)},
// a-v sync stuff:
{"initial-audio-sync", OPT_BOOL(initial_audio_sync)},
{"video-sync-max-video-change", OPT_DOUBLE(sync_max_video_change),
M_RANGE(0, DBL_MAX)},
{"video-sync-max-audio-change", OPT_DOUBLE(sync_max_audio_change),
M_RANGE(0, 1)},
{"video-sync-max-factor", OPT_INT(sync_max_factor), M_RANGE(1, 10)},
{"hr-seek", OPT_CHOICE(hr_seek,
{"no", -1}, {"absolute", 0}, {"yes", 1}, {"always", 1}, {"default", 2})},
{"hr-seek-demuxer-offset", OPT_FLOAT(hr_seek_demuxer_offset)},
{"hr-seek-framedrop", OPT_BOOL(hr_seek_framedrop)},
{"autosync", OPT_CHOICE(autosync, {"no", -1}), M_RANGE(0, 10000)},
{"term-osd", OPT_CHOICE(term_osd,
{"force", 1}, {"auto", 2}, {"no", 0}), .flags = UPDATE_OSD},
{"term-osd-bar", OPT_BOOL(term_osd_bar), .flags = UPDATE_OSD},
{"term-osd-bar-chars", OPT_STRING(term_osd_bar_chars), .flags = UPDATE_OSD},
{"term-title", OPT_STRING(term_title), .flags = UPDATE_OSD},
{"term-playing-msg", OPT_STRING(playing_msg)},
{"osd-playing-msg", OPT_STRING(osd_playing_msg)},
2022-04-08 00:00:00 +02:00
{"osd-playing-msg-duration", OPT_INT(osd_playing_msg_duration),
M_RANGE(0, 3600000)},
{"term-status-msg", OPT_STRING(status_msg), .flags = UPDATE_OSD},
{"osd-status-msg", OPT_STRING(osd_status_msg), .flags = UPDATE_OSD},
{"osd-msg1", OPT_STRING(osd_msg[0]), .flags = UPDATE_OSD},
{"osd-msg2", OPT_STRING(osd_msg[1]), .flags = UPDATE_OSD},
{"osd-msg3", OPT_STRING(osd_msg[2]), .flags = UPDATE_OSD},
{"video-osd", OPT_BOOL(video_osd), .flags = UPDATE_OSD},
{"idle", OPT_CHOICE(player_idle_mode,
{"no", 0}, {"once", 1}, {"yes", 2})},
{"input-terminal", OPT_BOOL(consolecontrols), .flags = UPDATE_TERM},
{"input-ipc-server", OPT_STRING(ipc_path), .flags = M_OPT_FILE},
#if HAVE_POSIX
{"input-ipc-client", OPT_STRING(ipc_client)},
#endif
{"screenshot", OPT_SUBSTRUCT(screenshot_image_opts, screenshot_conf)},
{"screenshot-template", OPT_STRING(screenshot_template)},
{"screenshot-directory", OPT_STRING(screenshot_directory),
.flags = M_OPT_FILE},
{"screenshot-sw", OPT_BOOL(screenshot_sw)},
{"record-file", OPT_STRING(record_file), .flags = M_OPT_FILE,
.deprecation_message = "use --stream-record or the dump-cache command"},
{"", OPT_SUBSTRUCT(resample_opts, resample_conf)},
{"", OPT_SUBSTRUCT(input_opts, input_config)},
{"", OPT_SUBSTRUCT(vo, vo_sub_opts)},
{"", OPT_SUBSTRUCT(demux_opts, demux_conf)},
{"", OPT_SUBSTRUCT(demux_cache_opts, demux_cache_conf)},
{"", OPT_SUBSTRUCT(stream_opts, stream_conf)},
{"", OPT_SUBSTRUCT(ra_ctx_opts, ra_ctx_conf)},
{"", OPT_SUBSTRUCT(gl_video_opts, gl_video_conf)},
{"", OPT_SUBSTRUCT(spirv_opts, spirv_conf)},
vo_opengl: refactor into vo_gpu This is done in several steps: 1. refactor MPGLContext -> struct ra_ctx 2. move GL-specific stuff in vo_opengl into opengl/context.c 3. generalize context creation to support other APIs, and add --gpu-api 4. rename all of the --opengl- options that are no longer opengl-specific 5. move all of the stuff from opengl/* that isn't GL-specific into gpu/ (note: opengl/gl_utils.h became opengl/utils.h) 6. rename vo_opengl to vo_gpu 7. to handle window screenshots, the short-term approach was to just add it to ra_swchain_fns. Long term (and for vulkan) this has to be moved to ra itself (and vo_gpu altered to compensate), but this was a stop-gap measure to prevent this commit from getting too big 8. move ra->fns->flush to ra_gl_ctx instead 9. some other minor changes that I've probably already forgotten Note: This is one half of a major refactor, the other half of which is provided by rossy's following commit. This commit enables support for all linux platforms, while his version enables support for all non-linux platforms. Note 2: vo_opengl_cb.c also re-uses ra_gl_ctx so it benefits from the --opengl- options like --opengl-early-flush, --opengl-finish etc. Should be a strict superset of the old functionality. Disclaimer: Since I have no way of compiling mpv on all platforms, some of these ports were done blindly. Specifically, the blind ports included context_mali_fbdev.c and context_rpi.c. Since they're both based on egl_helpers, the port should have gone smoothly without any major changes required. But if somebody complains about a compile error on those platforms (assuming anybody actually uses them), you know where to complain.
2017-09-14 08:04:55 +02:00
#if HAVE_GL
{"", OPT_SUBSTRUCT(opengl_opts, opengl_conf)},
vo_opengl: refactor into vo_gpu This is done in several steps: 1. refactor MPGLContext -> struct ra_ctx 2. move GL-specific stuff in vo_opengl into opengl/context.c 3. generalize context creation to support other APIs, and add --gpu-api 4. rename all of the --opengl- options that are no longer opengl-specific 5. move all of the stuff from opengl/* that isn't GL-specific into gpu/ (note: opengl/gl_utils.h became opengl/utils.h) 6. rename vo_opengl to vo_gpu 7. to handle window screenshots, the short-term approach was to just add it to ra_swchain_fns. Long term (and for vulkan) this has to be moved to ra itself (and vo_gpu altered to compensate), but this was a stop-gap measure to prevent this commit from getting too big 8. move ra->fns->flush to ra_gl_ctx instead 9. some other minor changes that I've probably already forgotten Note: This is one half of a major refactor, the other half of which is provided by rossy's following commit. This commit enables support for all linux platforms, while his version enables support for all non-linux platforms. Note 2: vo_opengl_cb.c also re-uses ra_gl_ctx so it benefits from the --opengl- options like --opengl-early-flush, --opengl-finish etc. Should be a strict superset of the old functionality. Disclaimer: Since I have no way of compiling mpv on all platforms, some of these ports were done blindly. Specifically, the blind ports included context_mali_fbdev.c and context_rpi.c. Since they're both based on egl_helpers, the port should have gone smoothly without any major changes required. But if somebody complains about a compile error on those platforms (assuming anybody actually uses them), you know where to complain.
2017-09-14 08:04:55 +02:00
#endif
vo_gpu: vulkan: initial implementation This time based on ra/vo_gpu. 2017 is the year of the vulkan desktop! Current problems / limitations / improvement opportunities: 1. The swapchain/flipping code violates the vulkan spec, by assuming that the presentation queue will be bounded (in cases where rendering is significantly faster than vsync). But apparently, there's simply no better way to do this right now, to the point where even the stupid cube.c examples from LunarG etc. do it wrong. (cf. https://github.com/KhronosGroup/Vulkan-Docs/issues/370) 2. The memory allocator could be improved. (This is a universal constant) 3. Could explore using push descriptors instead of descriptor sets, especially since we expect to switch descriptors semi-often for some passes (like interpolation). Probably won't make a difference, but the synchronization overhead might be a factor. Who knows. 4. Parallelism across frames / async transfer is not well-defined, we either need to use a better semaphore / command buffer strategy or a resource pooling layer to safely handle cross-frame parallelism. (That said, I gave resource pooling a try and was not happy with the result at all - so I'm still exploring the semaphore strategy) 5. We aggressively use pipeline barriers where events would offer a much more fine-grained synchronization mechanism. As a result of this, we might be suffering from GPU bubbles due to too-short dependencies on objects. (That said, I'm also exploring the use of semaphores as a an ordering tactic which would allow cross-frame time slicing in theory) Some minor changes to the vo_gpu and infrastructure, but nothing consequential. NOTE: For safety, all use of asynchronous commands / multiple command pools is currently disabled completely. There are some left-over relics of this in the code (e.g. the distinction between dev_poll and pool_poll), but that is kept in place mostly because this will be re-extended in the future (vulkan rev 2). The queue count is also currently capped to 1, because of the lack of cross-frame semaphores means we need the implicit synchronization from the same-queue semantics to guarantee a correct result.
2016-09-14 20:54:18 +02:00
#if HAVE_VULKAN
{"", OPT_SUBSTRUCT(vulkan_opts, vulkan_conf)},
#if HAVE_VK_KHR_DISPLAY
{"", OPT_SUBSTRUCT(vulkan_display_opts, vulkan_display_conf)},
vo_gpu: vulkan: initial implementation This time based on ra/vo_gpu. 2017 is the year of the vulkan desktop! Current problems / limitations / improvement opportunities: 1. The swapchain/flipping code violates the vulkan spec, by assuming that the presentation queue will be bounded (in cases where rendering is significantly faster than vsync). But apparently, there's simply no better way to do this right now, to the point where even the stupid cube.c examples from LunarG etc. do it wrong. (cf. https://github.com/KhronosGroup/Vulkan-Docs/issues/370) 2. The memory allocator could be improved. (This is a universal constant) 3. Could explore using push descriptors instead of descriptor sets, especially since we expect to switch descriptors semi-often for some passes (like interpolation). Probably won't make a difference, but the synchronization overhead might be a factor. Who knows. 4. Parallelism across frames / async transfer is not well-defined, we either need to use a better semaphore / command buffer strategy or a resource pooling layer to safely handle cross-frame parallelism. (That said, I gave resource pooling a try and was not happy with the result at all - so I'm still exploring the semaphore strategy) 5. We aggressively use pipeline barriers where events would offer a much more fine-grained synchronization mechanism. As a result of this, we might be suffering from GPU bubbles due to too-short dependencies on objects. (That said, I'm also exploring the use of semaphores as a an ordering tactic which would allow cross-frame time slicing in theory) Some minor changes to the vo_gpu and infrastructure, but nothing consequential. NOTE: For safety, all use of asynchronous commands / multiple command pools is currently disabled completely. There are some left-over relics of this in the code (e.g. the distinction between dev_poll and pool_poll), but that is kept in place mostly because this will be re-extended in the future (vulkan rev 2). The queue count is also currently capped to 1, because of the lack of cross-frame semaphores means we need the implicit synchronization from the same-queue semantics to guarantee a correct result.
2016-09-14 20:54:18 +02:00
#endif
#endif
vo_gpu: vulkan: initial implementation This time based on ra/vo_gpu. 2017 is the year of the vulkan desktop! Current problems / limitations / improvement opportunities: 1. The swapchain/flipping code violates the vulkan spec, by assuming that the presentation queue will be bounded (in cases where rendering is significantly faster than vsync). But apparently, there's simply no better way to do this right now, to the point where even the stupid cube.c examples from LunarG etc. do it wrong. (cf. https://github.com/KhronosGroup/Vulkan-Docs/issues/370) 2. The memory allocator could be improved. (This is a universal constant) 3. Could explore using push descriptors instead of descriptor sets, especially since we expect to switch descriptors semi-often for some passes (like interpolation). Probably won't make a difference, but the synchronization overhead might be a factor. Who knows. 4. Parallelism across frames / async transfer is not well-defined, we either need to use a better semaphore / command buffer strategy or a resource pooling layer to safely handle cross-frame parallelism. (That said, I gave resource pooling a try and was not happy with the result at all - so I'm still exploring the semaphore strategy) 5. We aggressively use pipeline barriers where events would offer a much more fine-grained synchronization mechanism. As a result of this, we might be suffering from GPU bubbles due to too-short dependencies on objects. (That said, I'm also exploring the use of semaphores as a an ordering tactic which would allow cross-frame time slicing in theory) Some minor changes to the vo_gpu and infrastructure, but nothing consequential. NOTE: For safety, all use of asynchronous commands / multiple command pools is currently disabled completely. There are some left-over relics of this in the code (e.g. the distinction between dev_poll and pool_poll), but that is kept in place mostly because this will be re-extended in the future (vulkan rev 2). The queue count is also currently capped to 1, because of the lack of cross-frame semaphores means we need the implicit synchronization from the same-queue semantics to guarantee a correct result.
2016-09-14 20:54:18 +02:00
vo_gpu: d3d11: initial implementation This is a new RA/vo_gpu backend that uses Direct3D 11. The GLSL generated by vo_gpu is cross-compiled to HLSL with SPIRV-Cross. What works: - All of mpv's internal shaders should work, including compute shaders. - Some external shaders have been tested and work, including RAVU and adaptive-sharpen. - Non-dumb mode works, even on very old hardware. Most features work at feature level 9_3 and all features work at feature level 10_0. Some features also work at feature level 9_1 and 9_2, but without high-bit- depth FBOs, it's not very useful. (Hardware this old is probably not fast enough for advanced features anyway.) Note: This is more compatible than ANGLE, which requires 9_3 to work at all (GLES 2.0,) and 10_1 for non-dumb-mode (GLES 3.0.) - Hardware decoding with D3D11VA, including decoding of 10-bit formats without truncation to 8-bit. What doesn't work / can be improved: - PBO upload and direct rendering does not work yet. Direct rendering requires persistent-mapped PBOs because the decoder needs to be able to read data from images that have already been decoded and uploaded. Unfortunately, it seems like persistent-mapped PBOs are fundamentally incompatible with D3D11, which requires all resources to use driver- managed memory and requires memory to be unmapped (and hence pointers to be invalidated) when a resource is used in a draw or copy operation. However it might be possible to use D3D11's limited multithreading capabilities to emulate some features of PBOs, like asynchronous texture uploading. - The blit() and clear() operations don't have equivalents in the D3D11 API that handle all cases, so in most cases, they have to be emulated with a shader. This is currently done inside ra_d3d11, but ideally it would be done in generic code, so it can take advantage of mpv's shader generation utilities. - SPIRV-Cross is used through a NIH C-compatible wrapper library, since it does not expose a C interface itself. The library is available here: https://github.com/rossy/crossc - The D3D11 context could be made to support more modern DXGI features in future. For example, it should be possible to add support for high-bit-depth and HDR output with DXGI 1.5/1.6.
2017-09-07 12:18:06 +02:00
#if HAVE_D3D11
{"", OPT_SUBSTRUCT(d3d11_opts, d3d11_conf)},
#if HAVE_D3D_HWACCEL
{"", OPT_SUBSTRUCT(d3d11va_opts, d3d11va_conf)},
#endif
vo_gpu: d3d11: initial implementation This is a new RA/vo_gpu backend that uses Direct3D 11. The GLSL generated by vo_gpu is cross-compiled to HLSL with SPIRV-Cross. What works: - All of mpv's internal shaders should work, including compute shaders. - Some external shaders have been tested and work, including RAVU and adaptive-sharpen. - Non-dumb mode works, even on very old hardware. Most features work at feature level 9_3 and all features work at feature level 10_0. Some features also work at feature level 9_1 and 9_2, but without high-bit- depth FBOs, it's not very useful. (Hardware this old is probably not fast enough for advanced features anyway.) Note: This is more compatible than ANGLE, which requires 9_3 to work at all (GLES 2.0,) and 10_1 for non-dumb-mode (GLES 3.0.) - Hardware decoding with D3D11VA, including decoding of 10-bit formats without truncation to 8-bit. What doesn't work / can be improved: - PBO upload and direct rendering does not work yet. Direct rendering requires persistent-mapped PBOs because the decoder needs to be able to read data from images that have already been decoded and uploaded. Unfortunately, it seems like persistent-mapped PBOs are fundamentally incompatible with D3D11, which requires all resources to use driver- managed memory and requires memory to be unmapped (and hence pointers to be invalidated) when a resource is used in a draw or copy operation. However it might be possible to use D3D11's limited multithreading capabilities to emulate some features of PBOs, like asynchronous texture uploading. - The blit() and clear() operations don't have equivalents in the D3D11 API that handle all cases, so in most cases, they have to be emulated with a shader. This is currently done inside ra_d3d11, but ideally it would be done in generic code, so it can take advantage of mpv's shader generation utilities. - SPIRV-Cross is used through a NIH C-compatible wrapper library, since it does not expose a C interface itself. The library is available here: https://github.com/rossy/crossc - The D3D11 context could be made to support more modern DXGI features in future. For example, it should be possible to add support for high-bit-depth and HDR output with DXGI 1.5/1.6.
2017-09-07 12:18:06 +02:00
#endif
#if HAVE_EGL_ANGLE_WIN32
{"", OPT_SUBSTRUCT(angle_opts, angle_conf)},
#endif
#if HAVE_GL_COCOA
{"", OPT_SUBSTRUCT(cocoa_opts, cocoa_conf)},
#endif
#if HAVE_COCOA
{"", OPT_SUBSTRUCT(macos_opts, macos_conf)},
#endif
#if HAVE_DRM
{"", OPT_SUBSTRUCT(drm_opts, drm_conf)},
#endif
#if HAVE_WAYLAND
{"", OPT_SUBSTRUCT(wayland_opts, wayland_conf)},
#endif
#if HAVE_GL_WIN32
{"opengl-dwmflush", OPT_CHOICE(wingl_dwm_flush,
{"no", -1}, {"auto", 0}, {"windowed", 1}, {"yes", 2})},
#endif
#if HAVE_CUDA_HWACCEL
{"cuda-decode-device", OPT_CHOICE(cuda_device, {"auto", -1}),
M_RANGE(0, INT_MAX)},
#endif
#if HAVE_VAAPI
{"vaapi", OPT_SUBSTRUCT(vaapi_opts, vaapi_conf)},
#endif
{"sws", OPT_SUBSTRUCT(sws_opts, sws_conf)},
#if HAVE_ZIMG
{"zimg", OPT_SUBSTRUCT(zimg_opts, zimg_conf)},
#endif
{"", OPT_SUBSTRUCT(encode_opts, encode_config)},
{"a52drc", OPT_REMOVED("use --ad-lavc-ac3drc=level")},
{"afm", OPT_REMOVED("use --ad=...")},
{"aspect", OPT_REPLACED("video-aspect-override")},
{"ass-bottom-margin", OPT_REMOVED("use --vf=sub=bottom:top")},
{"ass", OPT_REPLACED("sub-ass")},
{"audiofile", OPT_REPLACED("audio-file")},
{"benchmark", OPT_REMOVED("use --untimed (no stats)")},
{"capture", OPT_REMOVED(NULL)},
{"stream-capture", OPT_REMOVED(NULL)},
{"channels", OPT_REMOVED("use --audio-channels (changed semantics)")},
{"cursor-autohide-delay", OPT_REPLACED("cursor-autohide")},
{"delay", OPT_REPLACED("audio-delay")},
{"dumpstream", OPT_REMOVED("use --stream-dump=<filename>")},
{"dvdangle", OPT_REPLACED("dvd-angle")},
{"endpos", OPT_REPLACED("length")},
{"font", OPT_REPLACED("osd-font")},
{"forcedsubsonly", OPT_REPLACED("sub-forced-only")},
{"format", OPT_REPLACED("audio-format")},
{"hardframedrop", OPT_REMOVED(NULL)},
{"identify", OPT_REMOVED("use TOOLS/mpv_identify.sh")},
{"lavdopts", OPT_REMOVED("use --vd-lavc-...")},
{"lavfdopts", OPT_REMOVED("use --demuxer-lavf-...")},
{"lua", OPT_REPLACED("script")},
{"lua-opts", OPT_REPLACED("script-opts")},
{"mixer-channel", OPT_REMOVED("use AO suboptions (alsa, oss)")},
{"mixer", OPT_REMOVED("use AO suboptions (alsa, oss)")},
{"mouse-movements", OPT_REPLACED("input-cursor")},
{"msgcolor", OPT_REPLACED("msg-color")},
{"msglevel", OPT_REMOVED("use --msg-level (changed semantics)")},
{"msgmodule", OPT_REPLACED("msg-module")},
{"name", OPT_REPLACED("x11-name")},
{"noar", OPT_REPLACED("no-input-appleremote")},
{"noautosub", OPT_REPLACED("no-sub-auto")},
{"noconsolecontrols", OPT_REPLACED("no-input-terminal")},
{"nosound", OPT_REPLACED("no-audio")},
{"osdlevel", OPT_REPLACED("osd-level")},
{"panscanrange", OPT_REMOVED("use --video-zoom, --video-pan-x/y")},
{"playing-msg", OPT_REPLACED("term-playing-msg")},
{"pp", OPT_REMOVED(NULL)},
{"pphelp", OPT_REMOVED(NULL)},
{"rawaudio", OPT_REMOVED("use --demuxer-rawaudio-...")},
{"rawvideo", OPT_REMOVED("use --demuxer-rawvideo-...")},
{"spugauss", OPT_REPLACED("sub-gauss")},
{"srate", OPT_REPLACED("audio-samplerate")},
{"ss", OPT_REPLACED("start")},
{"stop-xscreensaver", OPT_REPLACED("stop-screensaver")},
{"sub-fuzziness", OPT_REPLACED("sub-auto")},
{"subcp", OPT_REPLACED("sub-codepage")},
{"subdelay", OPT_REPLACED("sub-delay")},
{"subfile", OPT_REPLACED("sub-file")},
{"subfont-text-scale", OPT_REPLACED("sub-scale")},
{"subfont", OPT_REPLACED("sub-text-font")},
{"subfps", OPT_REPLACED("sub-fps")},
{"subpos", OPT_REPLACED("sub-pos")},
{"tvscan", OPT_REPLACED("tv-scan")},
{"use-filename-title", OPT_REMOVED("use --title='${filename}'")},
{"vc", OPT_REMOVED("use --vd=..., --hwdec=...")},
{"vobsub", OPT_REMOVED("use --sub-file (pass the .idx file)")},
{"xineramascreen", OPT_REMOVED("use --screen (different values)")},
{"xy", OPT_REMOVED("use --autofit")},
{"zoom", OPT_REMOVED("Inverse available as ``--video-unscaled")},
{"media-keys", OPT_REPLACED("input-media-keys")},
{"right-alt-gr", OPT_REPLACED("input-right-alt-gr")},
{"autosub", OPT_REPLACED("sub-auto")},
{"autosub-match", OPT_REPLACED("sub-auto")},
{"status-msg", OPT_REPLACED("term-status-msg")},
{"idx", OPT_REPLACED("index")},
{"forceidx", OPT_REPLACED("index")},
{"cache-pause-below", OPT_REMOVED("for 'no', use --no-cache-pause")},
{"no-cache-pause-below", OPT_REMOVED("use --no-cache-pause")},
{"volstep", OPT_REMOVED("edit input.conf directly instead")},
{"fixed-vo", OPT_REMOVED("--fixed-vo=yes is now the default")},
{"mkv-subtitle-preroll", OPT_REPLACED("demuxer-mkv-subtitle-preroll")},
{"ass-use-margins", OPT_REPLACED("sub-use-margins")},
{"media-title", OPT_REPLACED("force-media-title")},
{"input-unix-socket", OPT_REPLACED("input-ipc-server")},
{"softvol-max", OPT_REPLACED("volume-max")},
{"bluray-angle", OPT_REMOVED("this didn't do anything for a few releases")},
{"sub-text-font", OPT_REPLACED("sub-font")},
{"sub-text-font-size", OPT_REPLACED("sub-font-size")},
{"sub-text-color", OPT_REPLACED("sub-color")},
{"sub-text-border-color", OPT_REPLACED("sub-border-color")},
{"sub-text-shadow-color", OPT_REPLACED("sub-shadow-color")},
{"sub-text-back-color", OPT_REPLACED("sub-back-color")},
{"sub-text-border-size", OPT_REPLACED("sub-border-size")},
{"sub-text-shadow-offset", OPT_REPLACED("sub-shadow-offset")},
{"sub-text-spacing", OPT_REPLACED("sub-spacing")},
{"sub-text-margin-x", OPT_REPLACED("sub-margin-x")},
{"sub-text-margin-y", OPT_REPLACED("sub-margin-y")},
{"sub-text-align-x", OPT_REPLACED("sub-align-x")},
{"sub-text-align-y", OPT_REPLACED("sub-align-y")},
{"sub-text-blur", OPT_REPLACED("sub-blur")},
{"sub-text-bold", OPT_REPLACED("sub-bold")},
{"sub-text-italic", OPT_REPLACED("sub-italic")},
{"ass-line-spacing", OPT_REPLACED("sub-ass-line-spacing")},
{"ass-force-margins", OPT_REPLACED("sub-ass-force-margins")},
{"ass-vsfilter-aspect-compat", OPT_REPLACED("sub-ass-vsfilter-aspect-compat")},
{"ass-vsfilter-color-compat", OPT_REPLACED("sub-ass-vsfilter-color-compat")},
{"ass-vsfilter-blur-compat", OPT_REPLACED("sub-ass-vsfilter-blur-compat")},
{"ass-force-style", OPT_REPLACED("sub-ass-force-style")},
{"ass-styles", OPT_REPLACED("sub-ass-styles")},
{"ass-hinting", OPT_REPLACED("sub-ass-hinting")},
{"ass-shaper", OPT_REPLACED("sub-ass-shaper")},
{"ass-style-override", OPT_REPLACED("sub-ass-style-override")},
{"ass-scale-with-window", OPT_REPLACED("sub-ass-scale-with-window")},
{"sub-ass-style-override", OPT_REPLACED("sub-ass-override")},
{"fs-black-out-screens", OPT_REMOVED(NULL)},
{"sub-paths", OPT_REPLACED("sub-file-paths")},
{"heartbeat-cmd", OPT_REMOVED("use Lua scripting instead")},
{"no-ometadata", OPT_REMOVED("use --no-ocopy-metadata")},
{"video-stereo-mode", OPT_REMOVED("removed, try --vf=stereo3d")},
{"chapter", OPT_REMOVED("use '--start=#123' '--end=#124' (for chapter 123)")},
{"video-aspect", OPT_REPLACED("video-aspect-override")},
{"display-fps", OPT_REPLACED("override-display-fps")},
{0}
};
static const struct MPOpts mp_default_opts = {
.use_terminal = true,
.msg_color = true,
.softvol_max = 130,
.softvol_volume = 100,
.gapless_audio = -1,
.wintitle = "${?media-title:${media-title}}${!media-title:No file} - mpv",
.stop_screensaver = 1,
.cursor_autohide_delay = 1000,
.video_osd = true,
.osd_level = 1,
.osd_on_seek = 1,
.osd_duration = 1000,
#if HAVE_LUA
.lua_load_osc = true,
.lua_load_ytdl = true,
.lua_ytdl_format = NULL,
.lua_ytdl_raw_options = NULL,
.lua_load_stats = true,
.lua_load_console = true,
.lua_load_auto_profiles = -1,
#endif
.auto_load_scripts = true,
.loop_times = 1,
.ordered_chapters = true,
.chapter_merge_threshold = 100,
.chapter_seek_threshold = 5.0,
.hr_seek = 2,
.hr_seek_framedrop = true,
.sync_max_video_change = 1,
.sync_max_audio_change = 0.125,
.sync_max_factor = 5,
.load_config = true,
.position_resume = true,
.autoload_files = true,
.demuxer_thread = true,
player: make playback termination asynchronous Until now, stopping playback aborted the demuxer and I/O layer violently by signaling mp_cancel (bound to libavformat's AVIOInterruptCB mechanism). Change it to try closing them gracefully. The main purpose is to silence those libavformat errors that happen when you request termination. Most of libavformat barely cares about the termination mechanism (AVIOInterruptCB), and essentially it's like the network connection is abruptly severed, or file I/O suddenly returns I/O errors. There were issues with dumb TLS warnings, parsers complaining about incomplete data, and some special protocols that require server communication to gracefully disconnect. We still want to abort it forcefully if it refuses to terminate on its own, so a timeout is required. Users can set the timeout to 0, which should give them the old behavior. This also removes the old mechanism that treats certain commands (like "quit") specially, and tries to terminate the demuxers even if the core is currently frozen. This is for situations where the core synchronized to the demuxer or stream layer while network is unresponsive. This in turn can only happen due to the "program" or "cache-size" properties in the current code (see one of the previous commits). Also, the old mechanism doesn't fit particularly well with the new one. We wouldn't want to abort playback immediately on a "quit" command - the new code is all about giving it a chance to end it gracefully. We'd need some sort of watchdog thread or something equally complicated to handle this. So just remove it. The change in osd.c is to prevent that it clears the status line while waiting for termination. The normal status line code doesn't output anything useful at this point, and the code path taken clears it, both of which is an annoying behavior change, so just let it show the old one.
2018-05-19 18:41:13 +02:00
.demux_termination_timeout = 0.1,
.hls_bitrate = INT_MAX,
.cache_pause = true,
.cache_pause_wait = 1.0,
.ab_loop = {MP_NOPTS_VALUE, MP_NOPTS_VALUE},
.ab_loop_count = -1,
.edition_id = -1,
.default_max_pts_correction = -1,
.initial_audio_sync = true,
2014-08-17 02:51:13 +02:00
.frame_dropping = 1,
.term_osd = 2,
.term_osd_bar_chars = "[-+-]",
.consolecontrols = true,
.playlist_pos = -1,
.play_frames = -1,
.rebase_start_time = true,
.keep_open_pause = true,
.image_display_duration = 1.0,
.stream_id = { { [STREAM_AUDIO] = -1,
[STREAM_VIDEO] = -1,
[STREAM_SUB] = -1, },
{ [STREAM_AUDIO] = -2,
[STREAM_VIDEO] = -2,
[STREAM_SUB] = -2, }, },
.stream_auto_sel = true,
.subs_with_matching_audio = true,
.audio_display = 1,
.audio_output_format = 0, // AF_FORMAT_UNKNOWN
.playback_speed = 1.,
.pitch_correction = true,
.audiofile_auto = -1,
.coverart_whitelist = true,
.osd_bar_visible = true,
.screenshot_template = "mpv-shot%n",
Implement backwards playback See manpage additions. This is a huge hack. You can bet there are shit tons of bugs. It's literally forcing square pegs into round holes. Hopefully, the manpage wall of text makes it clear enough that the whole shit can easily crash and burn. (Although it shouldn't literally crash. That would be a bug. It possibly _could_ start a fire by entering some sort of endless loop, not a literal one, just something where it tries to do work without making progress.) (Some obvious bugs I simply ignored for this initial version, but there's a number of potential bugs I can't even imagine. Normal playback should remain completely unaffected, though.) How this works is also described in the manpage. Basically, we demux in reverse, then we decode in reverse, then we render in reverse. The decoding part is the simplest: just reorder the decoder output. This weirdly integrates with the timeline/ordered chapter code, which also has special requirements on feeding the packets to the decoder in a non-straightforward way (it doesn't conflict, although a bugmessmass breaks correct slicing of segments, so EDL/ordered chapter playback is broken in backward direction). Backward demuxing is pretty involved. In theory, it could be much easier: simply iterating the usual demuxer output backward. But this just doesn't fit into our code, so there's a cthulhu nightmare of shit. To be specific, each stream (audio, video) is reversed separately. At least this means we can do backward playback within cached content (for example, you could play backwards in a live stream; on that note, it disables prefetching, which would lead to losing new live video, but this could be avoided). The fuckmess also meant that I didn't bother trying to support subtitles. Subtitles are a problem because they're "sparse" streams. They need to be "passively" demuxed: you don't try to read a subtitle packet, you demux audio and video, and then look whether there was a subtitle packet. This means to get subtitles for a time range, you need to know that you demuxed video and audio over this range, which becomes pretty messy when you demux audio and video backwards separately. Backward display is the most weird (and potentially buggy) part. To avoid that we need to touch a LOT of timing code, we negate all timestamps. The basic idea is that due to the navigation, all comparisons and subtractions of timestamps keep working, and you don't need to touch every single of them to "reverse" them. E.g.: bool before = pts_a < pts_b; would need to be: bool before = forward ? pts_a < pts_b : pts_a > pts_b; or: bool before = pts_a * dir < pts_b * dir; or if you, as it's implemented now, just do this after decoding: pts_a *= dir; pts_b *= dir; and then in the normal timing/renderer code: bool before = pts_a < pts_b; Consequently, we don't need many changes in the latter code. But some assumptions inhererently true for forward playback may have been broken anyway. What is mainly needed is fixing places where values are passed between positive and negative "domains". For example, seeking and timestamp user display always uses positive timestamps. The main mess is that it's not obvious which domain a given variable should or does use. Well, in my tests with a single file, it suddenly started to work when I did this. I'm honestly surprised that it did, and that I didn't have to change a single line in the timing code past decoder (just something minor to make external/cached text subtitles display). I committed it immediately while avoiding thinking about it. But there really likely are subtle problems of all sorts. As far as I'm aware, gstreamer also supports backward playback. When I looked at this years ago, I couldn't find a way to actually try this, and I didn't revisit it now. Back then I also read talk slides from the person who implemented it, and I'm not sure if and which ideas I might have taken from it. It's possible that the timestamp reversal is inspired by it, but I didn't check. (I think it claimed that it could avoid large changes by changing a sign?) VapourSynth has some sort of reverse function, which provides a backward view on a video. The function itself is trivial to implement, as VapourSynth aims to provide random access to video by frame numbers (so you just request decreasing frame numbers). From what I remember, it wasn't exactly fluid, but it worked. It's implemented by creating an index, and seeking to the target on demand, and a bunch of caching. mpv could use it, but it would either require using VapourSynth as demuxer and decoder for everything, or replacing the current file every time something is supposed to be played backwards. FFmpeg's libavfilter has reversal filters for audio and video. These require buffering the entire media data of the file, and don't really fit into mpv's architecture. It could be used by playing a libavfilter graph that also demuxes, but that's like VapourSynth but worse.
2019-05-18 02:10:51 +02:00
.play_dir = 1,
.audio_output_channels = {
.set = 1,
.auto_safe = 1,
},
.index_mode = 1,
.mf_fps = 1.0,
.display_tags = (char **)(const char*[]){
"Artist", "Album", "Album_Artist", "Comment", "Composer",
"Date", "Description", "Genre", "Performer", "Rating",
"Series", "Title", "Track", "icy-title", "service_name",
"Uploader", "Channel_URL",
NULL
},
.cuda_device = -1,
.watch_later_options = (char **)(const char*[]){
"start",
"osd-level",
"speed",
"edition",
"pause",
"volume",
"mute",
"audio-delay",
"fullscreen",
"ontop",
"border",
"gamma",
"brightness",
"contrast",
"saturation",
"hue",
"deinterlace",
"vf",
"af",
"panscan",
"aid",
"vid",
"sid",
"sub-delay",
"sub-speed",
"sub-pos",
"sub-visibility",
"sub-scale",
"sub-use-margins",
"sub-ass-force-margins",
"sub-ass-vsfilter-aspect-compat",
"sub-ass-override",
"ab-loop-a",
"ab-loop-b",
"video-aspect-override",
NULL
},
};
const struct m_sub_options mp_opt_root = {
.opts = mp_opts,
.size = sizeof(struct MPOpts),
.defaults = &mp_default_opts,
};
#endif /* MPLAYER_CFG_MPLAYER_H */