summaryrefslogtreecommitdiffstats
path: root/options/m_option.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove some unneeded NULL checkswm42014-11-211-16/+13
| | | | Found by Coverity; also see commit 85fb2af3.
* command: implement A-B loopswm42014-11-181-2/+7
| | | | | | | | | | | | | Probably needs to be polished a bit more. Also, might require a key binding that can set/clear the loop points in a more intuitive way. For now, something like this can be put into input.conf to use it: ctrl+y set ab-loop-a ${time-pos} # set A ctrl+x set ab-loop-b ${time-pos} # set B ctrl+c set ab-loop-a no # clear (mostly) Fixes #1241.
* command: export some option metadatawm42014-11-131-1/+1
| | | | | | | This might be interesting for GUIs and such. It's probably still a little bit insufficient. For example, the filter and audio/video output lists are not available through this.
* m_option: format mpv_node as jsonwm42014-10-231-1/+7
| | | | | Useful for debugging and informational purposes. Not sure if it's sane in any form.
* lua: strictly free memory on errorswm42014-10-191-1/+2
| | | | | | | Thanks to the recently introduced mp_lua_PITA(), this is "simple" now. It fixes leaks on Lua errors. The hack to avoid stack overflows manually isn't needed anymore, and the Lua error handler will take care of this.
* video: initial Matroska 3D supportwm42014-08-301-0/+53
| | | | | | | | | | | | | | | | | | | | | This inserts an automatic conversion filter if a Matroska file is marked as 3D (StereoMode element). The basic idea is similar to video rotation and colorspace handling: the 3D mode is added as a property to the video params. Depending on this property, a video filter can be inserted. As of this commit, extending mp_image_params is actually completely unnecessary - but the idea is that it will make it easier to integrate with VOs supporting stereo 3D mogrification. Although vo_opengl does support some stereo rendering, it didn't support the mode my sample file used, so I'll leave that part for later. Not that most mappings from Matroska mode to vf_stereo3d mode are probably wrong, and some are missing. Assuming that Matroska modes, and vf_stereo3d in modes, and out modes are all the same might be an oversimplification - we'll see. See issue #1045.
* options: more detailed output for --vf-... error messagewm42014-08-281-2/+4
|
* options: fix key-value-list optionswm42014-08-051-6/+11
| | | | | | | | The parser can be called with dst (the target) set to NULL if the option should be verified only. The code didn't respect this, and could result in crashes when used in config profiles or filter sub-options. Fixes #981.
* Audit and replace all ctype.h useswm42014-07-011-1/+0
| | | | | | | | | | | | | | | | Something like "char *s = ...; isdigit(s[0]);" triggers undefined behavior, because char can be signed, and thus s[0] can be a negative value. The is*() functions require unsigned char _or_ EOF. EOF is a special value outside of unsigned char range, thus the argument to the is*() functions can't be a char. This undefined behavior can actually trigger crashes if the implementation of these functions e.g. uses lookup tables, which are then indexed with out-of-range values. Replace all <ctype.h> uses with our own custom mp_is*() functions added with misc/ctype.h. As a bonus, these functions are locale-independent. (Although currently, we _require_ C locale for other reasons.)
* options: support setting start time relative to start PTSTsukasa OMOTO2014-06-291-2/+5
| | | | Signed-off-by: wm4 <wm4@nowhere>
* options: remove some more stuffwm42014-06-131-7/+0
| | | | | | | | The "classic" sub-option stuff is not really needed anymore. The only remaining use can be emulated in a simpler way. But note that this breaks the --screenshot option (instead of the "flat" options like --screenshot-...). This was undocumented and discouraged, so it shouldn't affect anyone.
* options: remove OPT_FLAG_CONSTANTSwm42014-06-131-13/+10
| | | | | | | This means use of the min/max fields can be dropped for the flag option type, which makes some things slightly easier. I'm also not sure if the client API handled the case of flag not being 0 or 1 correctly, and this change gets rid of this concern.
* options: change --sub-file behaviorwm42014-06-081-0/+36
| | | | | | | | | | | | | | | | | | | --sub-file is actually a string list, so you can add multipel external subtitle files. But to be able to set a list, the option value was split on ",". This made it impossible to add filenames. One possible solution would be adding escaping. That's probably a good idea (and some other options already do this), but it's also complicated both to implement and for the user. The simpler solution is making --sub-file appending, and make it take only a single entry. I'm not quite sure about this yet. It breaks the invariant that if a value is printed and parsed, you get the same value back. So for now, just go with the simple solution. Fixes #840.
* m_option: use isfinite() instead of isnormal()wm42014-06-011-1/+1
| | | | | | This accidentally rejected d==0. We can actually deal with sub-normals fine, we just want to exclude nan and infinity (although infinity is already accounted for, but anyway).
* command: allow native access to "vf" propertywm42014-04-241-0/+101
| | | | | | This allows client API users and Lua scripts to side-step the pretty horrible video filter string "language" (although it's back and can't be avoided when using libavfilter).
* options: don't allow --no-foo=yeswm42014-04-141-2/+2
| | | | | | | | | It's a bit strange to allow this, so get rid of it. This probably breaks a bunch of user config files. The client API still allows setting them with MPV_FORMAT_FLAG with a value of 1 (i.e. true), but I guess this is tolerable.
* video: change image format names, prefer mostly FFmpeg nameswm42014-04-141-2/+4
| | | | | | | | | | | | | | | The most user visible change is that "420p" is now displayed as "yuv420p". This is what FFmpeg uses (almost), and is also less confusing since "420p" is often confused with "420 pixels vertical resolution". In general, we return the FFmpeg pixel format name. We still use our own old mechanism to keep a list of exceptions to provide compatibility for a while. Also, never return NULL for image format names. If the format is unset (0/IMGFMT_NONE), return "none". If the format has no name (probably never happens, FFmpeg seems to guarantee that a name is set), return "unknown".
* m_option: fix handling of empty channel layoutswm42014-03-101-2/+2
| | | | | Even if a channel map option signaled that empty layouts are accepted, the option parser never actually accepted them.
* m_option: make converting mpv_node to string always failwm42014-02-261-1/+1
|
* m_option: fix key/value list string conversionwm42014-02-261-1/+1
| | | | Meh.
* m_option: don't make "unset" string and string list return NULL stringswm42014-02-261-2/+2
| | | | | | | | | | This is a bit weird: m_option_string types (i.e. char*) can be NULL. But they're supposed to be treated just like empty strings. So don't make the m_option_type.print function return NULL for these values. Returning NULL would mean failure. This didn't matter much before, but was quite visible through the client API.
* m_option: add a way to convert values to/from mpv_nodewm42014-02-241-14/+425
| | | | | | | m_option is basically the mechanism to handle C data types in a dynamic way. Add functions to convert values to and from mpv_node. For example, string lists are turned into mpv_node using MPV_FORMAT_NODE_ARRAY, and so on.
* m_option: fix printf format specifierwm42014-02-241-1/+2
|
* m_option: explicitly allow m_option.name==NULLwm42014-02-231-10/+11
| | | | | | | | Doesn't require other code to care about this, which will allow us to simplify the property code. Only "wildcard" options like "vf" and string lists used this, and m_option_list_findb() (which is excused).
* options: handle escape sequences in e.g. --playing-msg differentlywm42014-02-201-59/+8
| | | | | | | | | | M_OPT_PARSE_ESCAPES was pretty stupid, and broke the (useful) assumption that string variables contain exactly the same value as set by the option. Simplify it, and move escape handling to the place where it's used. Escape handling itself is not terribly useful, but still allows useful things like multiline custom OSD with "\n".
* options: alternative way to specify color optionswm42014-01-311-2/+43
| | | | | | | | | | | | | | | | Try to make it more intuitive by not requiring hex values. The new way uses float values in the range 0.0-1.0, separated by '/' (':' was suggested, but that wouldn't allow color options in sub-options). Example: --osd-color=1.0/0.0/0.0/0.75 Using the range 0.0-1.0 has the advantage that it could be easily extended to colors beyond 8 bit. Details see manpage. Suggestions for alternative syntax or value ranges are welcome, but be quick with it.
* options: add key/value pair list option typewm42014-01-161-0/+64
|
* msg: move special declarations to msg_control.hwm42014-01-161-0/+1
| | | | | While almost everything uses msg.h, the moved definitions are rarely needed by anything.
* options: make --msglevel=help print something helpfulwm42014-01-011-0/+11
|
* common: simplify and optimize string escape parsingwm42013-12-301-11/+8
| | | | | | | | | | | This code is shared between input.conf parser and option parser. Until now, the performance didn't really matter. But I want to use this code for JSON parsing too, and since JSON will have to be parsed a lot, it should probably try to avoid realloc'ing too much. This commit moves parsing of C-style escaped strings into a common function, and allows using it in a way realloc can be completely avoided, if the already allocated buffer is large enough.
* options: simplify handling of some help optionswm42013-12-261-28/+3
|
* options: make --msglevel extend previous settingswm42013-12-221-3/+10
| | | | | | Make it so --msglevel extends previous --msglevel uses, instead of overwriting them. Do this by literally appending the --msglevel option value to the previous one.
* m_option: add mp_log context to sub-module print_help callbackwm42013-12-211-1/+1
|
* m_option: add mp_log callback to OPT_STRING_VALIDATE optionswm42013-12-211-1/+1
| | | | | And also convert a bunch of other code, especially ao_wasapi and ao_portaudio.
* m_option, m_config: mp_msg conversionswm42013-12-211-185/+154
| | | | | | | | Always pass around mp_log contexts in the option parser code. This of course affects all users of this API as well. In stream.c, pass a mp_null_log, because we can't do it properly yet. This will be fixed later.
* msg: change --msglevel, reduce legacy gluewm42013-12-201-0/+41
| | | | | | | | | | | | Basically, reimplement --msglevel. Instead of making the new msg code use the legacy code, make the legacy code use the reimplemented functionality. The handling of the deprecated --identify switch changes. It temporarily stops working; this will be fixed in later commits. The actual sub-options syntax (like --msglevel-vo=...) goes away, but I bet nobody knew about this or used this anyway.
* m_option: don't include config.h in headerwm42013-12-181-0/+8
| | | | Requires a small workaround.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-2/+2
|
* Move options/config related files from mpvcore/ to options/wm42013-12-171-0/+2477
Since m_option.h and options.h are extremely often included, a lot of files have to be changed. Moving path.c/h to options/ is a bit questionable, but since this is mainly about access to config files (which are also handled in options/), it's probably ok.