mpv/options/options.h

365 lines
8.4 KiB
C
Raw Normal View History

#ifndef MPLAYER_OPTIONS_H
#define MPLAYER_OPTIONS_H
#include <stdbool.h>
#include <stdint.h>
#include "m_option.h"
#include "common/common.h"
typedef struct mp_vo_opts {
struct m_obj_settings *video_driver_list;
int taskbar_progress;
int snap_window;
int ontop;
int ontop_level;
int fullscreen;
int border;
int fit_border;
int all_workspaces;
int screen_id;
int fsscreen_id;
char *winname;
int x11_netwm;
int x11_bypass_compositor;
int native_keyrepeat;
float panscan;
float zoom;
float pan_x, pan_y;
float align_x, align_y;
int unscaled;
struct m_geometry geometry;
struct m_geometry autofit;
struct m_geometry autofit_larger;
struct m_geometry autofit_smaller;
double window_scale;
int keepaspect;
int keepaspect_window;
int hidpi_window_scale;
int native_fs;
int64_t WinID;
float force_monitor_aspect;
float monitor_pixel_aspect;
int force_window_position;
char *mmcss_profile;
vo_gpu: make it possible to load multiple hwdec interop drivers Make the VO<->decoder interface capable of supporting multiple hwdec APIs at once. The main gain is that this simplifies autoprobing a lot. Before this change, it could happen that the VO loaded the "wrong" hwdec API, and the decoder was stuck with the choice (breaking hw decoding). With the change applied, the VO simply loads all available APIs, so autoprobing trickery is left entirely to the decoder. In the past, we were quite careful about not accidentally loading the wrong interop drivers. This was in part to make sure autoprobing works, but also because libva had this obnoxious bug of dumping garbage to stderr when using the API. libva was fixed, so this is not a problem anymore. The --opengl-hwdec-interop option is changed in various ways (again...), and renamed to --gpu-hwdec-interop. It does not have much use anymore, other than debugging. It's notable that the order in the hwdec interop array ra_hwdec_drivers[] still matters if multiple drivers support the same image formats, so the option can explicitly force one, if that should ever be necessary, or more likely, for debugging. One example are the ra_hwdec_d3d11egl and ra_hwdec_d3d11eglrgb drivers, which both support d3d11 input. vo_gpu now always loads the interop lazily by default, but when it does, it loads them all. vo_opengl_cb now always loads them when the GL context handle is initialized. I don't expect that this causes any problems. It's now possible to do things like changing between vdpau and nvdec decoding at runtime. This is also preparation for cleaning up vd_lavc.c hwdec autoprobing. It's another reason why hwdec_devices_request_all() does not take a hwdec type anymore.
2017-12-01 04:05:00 +00:00
// vo_drm
struct sws_opts *sws_opts;
// vo_drm
struct drm_opts *drm_opts;
} mp_vo_opts;
struct mp_cache_opts {
int size;
int def_size;
int initial;
int seek_min;
int back_buffer;
char *file;
int file_max;
};
// Subtitle options needed by the subtitle decoders/renderers.
struct mp_subtitle_opts {
int sub_visibility;
int sub_pos;
float sub_delay;
float sub_fps;
float sub_speed;
int forced_subs_only;
int stretch_dvd_subs;
int stretch_image_subs;
int image_subs_video_res;
int sub_fix_timing;
int sub_scale_by_window;
int sub_scale_with_window;
int ass_scale_with_window;
struct osd_style_opts *sub_style;
float sub_scale;
float sub_gauss;
int sub_gray;
int sub_filter_SDH;
int sub_filter_SDH_harder;
int ass_enabled;
float ass_line_spacing;
int ass_use_margins;
int sub_use_margins;
int ass_vsfilter_aspect_compat;
int ass_vsfilter_color_compat;
int ass_vsfilter_blur_compat;
int use_embedded_fonts;
char **ass_force_style_list;
char *ass_styles_file;
int ass_style_override;
int ass_hinting;
int ass_shaper;
int ass_justify;
int sub_clear_on_seek;
int teletext_page;
};
struct mp_osd_render_opts {
float osd_bar_align_x;
float osd_bar_align_y;
float osd_bar_w;
float osd_bar_h;
float osd_scale;
int osd_scale_by_window;
struct osd_style_opts *osd_style;
int force_rgba_osd;
};
typedef struct MPOpts {
int property_print_help;
int use_terminal;
char *dump_stats;
2013-12-21 22:11:12 +00:00
int verbose;
int msg_really_quiet;
char **msg_levels;
2013-12-21 22:11:12 +00:00
int msg_color;
int msg_module;
int msg_time;
char *log_file;
int operation_mode;
char **reset_options;
char **script_files;
char **script_opts;
int lua_load_osc;
2014-11-19 17:51:53 +00:00
int lua_load_ytdl;
char *lua_ytdl_format;
char **lua_ytdl_raw_options;
int lua_load_stats;
int auto_load_scripts;
struct m_obj_settings *audio_driver_list;
char *audio_device;
int audio_exclusive;
char *audio_client_name;
int ao_null_fallback;
int audio_stream_silence;
float audio_wait_open;
int force_vo;
float softvol_volume;
int rgain_mode;
float rgain_preamp; // Set replaygain pre-amplification
int rgain_clip; // Enable/disable clipping prevention
float rgain_fallback;
int softvol_mute;
float softvol_max;
int gapless_audio;
double audio_buffer;
mp_vo_opts *vo;
char *wintitle;
char *media_title;
struct mp_csp_equalizer_opts *video_equalizer;
int stop_screensaver;
int cursor_autohide_delay;
int cursor_autohide_fs;
int video_rotate;
int video_stereo_mode;
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 14:15:19 +00:00
char *audio_decoders;
char *video_decoders;
char *audio_spdif;
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 14:15:19 +00:00
struct mp_subtitle_opts *subs_rend;
struct mp_osd_render_opts *osd_rend;
int osd_level;
int osd_duration;
int osd_fractions;
int video_osd;
int untimed;
char *stream_dump;
char *record_file;
int stop_playback_on_init_failure;
2008-04-21 02:18:40 +00:00
int loop_times;
int loop_file;
int shuffle;
2009-04-07 23:37:27 +00:00
int ordered_chapters;
char *ordered_chapters_files;
int chapter_merge_threshold;
double chapter_seek_threshold;
char *chapter_file;
int load_unsafe_playlists;
2013-11-19 21:36:33 +00:00
int merge_files;
int quiet;
int load_config;
char *force_configdir;
int use_filedir_conf;
int hls_bitrate;
struct mp_cache_opts *stream_cache;
int chapterrange[2];
int edition_id;
int correct_pts;
int initial_audio_sync;
int video_sync;
double sync_max_video_change;
double sync_max_audio_change;
double sync_audio_drop_size;
int hr_seek;
float hr_seek_demuxer_offset;
int hr_seek_framedrop;
float audio_delay;
float default_max_pts_correction;
int autosync;
int frame_dropping;
double frame_drop_fps;
int term_osd;
int term_osd_bar;
char *term_osd_bar_chars;
char *playing_msg;
2014-09-01 22:09:03 +00:00
char *osd_playing_msg;
char *status_msg;
char *osd_status_msg;
char *osd_msg[3];
int player_idle_mode;
int consolecontrols;
int playlist_pos;
struct m_rel_time play_start;
struct m_rel_time play_end;
struct m_rel_time play_length;
int rebase_start_time;
int play_frames;
double ab_loop[2];
double step_sec;
int position_resume;
int position_save_on_quit;
int write_filename_in_watch_later_config;
int ignore_path_in_watch_later_config;
char *watch_later_directory;
int pause;
int keep_open;
int keep_open_pause;
double image_display_duration;
char *lavfi_complex;
int stream_id[2][STREAM_TYPE_COUNT];
char **stream_lang[STREAM_TYPE_COUNT];
int stream_auto_sel;
int audio_display;
char **display_tags;
2013-04-28 23:49:20 +00:00
char **audio_files;
char *demuxer_name;
int demuxer_thread;
int prefetch_open;
char *audio_demuxer_name;
char *sub_demuxer_name;
int cache_pausing;
float cache_pause_wait;
struct image_writer_opts *screenshot_image_opts;
screenshot: make screenshot filenames configurable This adds the --screenshot-template option, which specifies a template for the filename used for a screenshot. The '%' character is parsed as format specifier. These format specifiers insert metadata into the filename. For example, '%f' is replaced with the filename of the currently played file. The following format specifiers are available: %n Insert sequence number (padded with 4 zeros), e.g. "0002". %0Nn Like %n, but pad to N zeros (N = 0 to 9). %n behaves like %04n. %#n Like %n, but reset the sequence counter on every screenshot. (Useful if other parts in the template make the resulting filename already mostly unique.) %#0Nn Use %0Nn and %#n at the same time. %f Insert filename of the currently played video. %F Like %f, but with stripped file extension ("." and rest). %p Insert current playback time, in HH:MM:SS format. %P Like %p, but adds milliseconds: HH:MM:SS.mmmm %tX Insert the current local date/time, using the date format X. X is a single letter and is passed to strftime() as "%X". E.g. "%td" inserts the number of the current day. %{prop} Insert the value of the slave property 'prop'. E.g. %{filename} is the same as %f. If the property doesn't exist or is not available, nothing is inserted, unless a fallback is specified as in %{prop:fallback text}. %% Insert the character '%'. The strings inserted by format specifiers will be checked for characters not allowed in filenames (including '/' and '\'), and replaced with the placeholder '_'. (This doesn't happen for text that was passed with the --screenshot-template option, and allows specifying a screenshot target directory by prefixing the template with a relative or absolute path.)
2012-02-29 02:46:25 +00:00
char *screenshot_template;
2015-05-03 12:44:42 +00:00
char *screenshot_directory;
double force_fps;
int index_mode;
struct m_channels audio_output_channels;
int audio_output_format;
int audio_normalize;
int force_srate;
double playback_speed;
int pitch_correction;
struct m_obj_settings *vf_settings, *vf_defs;
struct m_obj_settings *af_settings, *af_defs;
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 16:06:08 +00:00
int deinterlace;
2008-04-24 04:36:43 +00:00
float movie_aspect;
int aspect_method;
char **sub_name;
2011-03-03 10:31:12 +00:00
char **sub_paths;
char **audiofile_paths;
char **external_files;
int autoload_files;
int sub_auto;
int audiofile_auto;
int osd_bar_visible;
char *hwdec_api;
char *hwdec_codecs;
int hwdec_image_format;
int w32_priority;
struct tv_params *tv_params;
struct pvr_params *stream_pvr_opts;
struct cdda_params *stream_cdda_opts;
struct dvb_params *stream_dvb_opts;
struct stream_lavf_params *stream_lavf_opts;
char *cdrom_device;
char *bluray_device;
double mf_fps;
char *mf_type;
struct demux_rawaudio_opts *demux_rawaudio;
struct demux_rawvideo_opts *demux_rawvideo;
struct demux_lavf_opts *demux_lavf;
struct demux_mkv_opts *demux_mkv;
struct demux_opts *demux_opts;
struct vd_lavc_params *vd_lavc_params;
struct ad_lavc_params *ad_lavc_params;
struct input_opts *input_opts;
// may be NULL if encoding is not compiled-in
struct encode_opts *encode_opts;
char *ipc_path;
char *input_file;
int wingl_dwm_flush;
struct gl_video_opts *gl_video_opts;
struct angle_opts *angle_opts;
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 06:04:55 +00:00
struct opengl_opts *opengl_opts;
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 18:54:18 +00:00
struct vulkan_opts *vulkan_opts;
struct spirv_opts *spirv_opts;
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 10:18:06 +00:00
struct d3d11_opts *d3d11_opts;
struct d3d11va_opts *d3d11va_opts;
struct cocoa_opts *cocoa_opts;
struct android_opts *android_opts;
struct dvd_opts *dvd_opts;
int cuda_device;
} MPOpts;
struct dvd_opts {
int angle;
int speed;
char *device;
};
extern const m_option_t mp_opts[];
extern const struct MPOpts mp_default_opts;
extern const struct m_sub_options vo_sub_opts;
extern const struct m_sub_options stream_cache_conf;
extern const struct m_sub_options dvd_conf;
extern const struct m_sub_options mp_subtitle_sub_opts;
extern const struct m_sub_options mp_osd_render_sub_opts;
int hwdec_validate_opt(struct mp_log *log, const m_option_t *opt,
struct bstr name, struct bstr param);
#endif