summaryrefslogtreecommitdiffstats
path: root/video/out/vo_opengl.c
Commit message (Collapse)AuthorAgeFilesLines
* vo_opengl: add infrastructure for hardware decoding OpenGL interopwm42013-11-041-1/+72
| | | | | | | | | | | | Most hardware decoding APIs provide some OpenGL interop. This allows using vo_opengl, without having to read the video data back from GPU. This requires adding a backend for each hardware decoding API. (Each backend is an entry in gl_hwdec_vaglx[].) The backends expose video data as a set of OpenGL textures. Add infrastructure to support this. The next commit will add support for VA-API.
* m_config: refactor option defaults handlingwm42013-10-241-4/+7
| | | | | | | | | | | | | Keep track of the default values directly, instead of creating a new instance of the option struct just to get the defaults. Also get rid of the special handling of m_obj_desc.init_options. Instead, handle it purely by the option parser. Originally, I wanted to handle --vo=opengl-hq and --vo=direct3d_shaders with this (by making them aliases to the real VOs with a different preset), but since --vo =opengl-hq=help prints the wrong values (as consequence of the simplification), I'm not doing that, and instead use something different.
* video/out: remove useless info struct and redundant fieldswm42013-10-231-12/+6
| | | | The author and comment fields were printed only in -v mode.
* vo_opengl: don't enable PBOs with opengl-hqwm42013-10-231-1/+1
| | | | | The speed advantages are marginal (at least with the way it's currently used), and it might actually be slower on some drivers, like Mesa.
* vo_opengl: blend alpha components by defaultwm42013-09-191-1/+1
| | | | | | Improves display of images and video with alpha channel, especially if the transparent regions contain (supposed to be invisible) garbage color values.
* gl_lcms: mp_msg conversionwm42013-09-121-1/+1
| | | | | Have to deal with some dumb stuff in LittleCMS2's API: its error handler is global.
* video: handle video output levels with mp_image_paramswm42013-08-241-7/+0
| | | | | | | | | | | | Until now, video output levels (obscure feature, like using TV screens that require RGB output in limited range, similar to YUY) still required handling of VOCTRL_SET_YUV_COLORSPACE. Simplify this, and use the new mp_image_params code. This gets rid of some code. VOCTRL_SET_YUV_COLORSPACE is not needed at all anymore in VOs that use the reconfig callback. The result of VOCTRL_GET_YUV_COLORSPACE is now used only used for the colormatrix related properties (basically, for display on OSD). For other VOs, VOCTRL_SET_YUV_COLORSPACE will be sent only once after config instead of twice.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-4/+4
| | | | Followup commit. Fixes all the files references.
* video/out: use new mp_msg stuff for vo.c and vo_openglwm42013-07-311-2/+2
| | | | The first step; also serves as example.
* options: handle presets directly in m_configwm42013-07-311-4/+2
| | | | | This means that "mpv -vo opengl-hq:help" will actually show the correct defaults, instead those of plain vo_opengl.
* m_config: refactor some thingswm42013-07-281-6/+6
| | | | | | | | | | | | | | Change how m_config is initialized. Make it more uniform; now all m_config structs are intialized in exactly the same way. Make sure there's only a single m_option[] array defining the options, and keep around the pointer to the optstruct default value, and the optstruct size as well. This will allow reconstructing the option default values in the following commit. In particular, stop pretending that the handling of some special options (like --profile, --v, and some others) is in any way elegant, and make them explicit hacks. This is really more readable and easier to understand than what was before, and simplifies the code.
* video/out: remove options argument from preinit()wm42013-07-221-1/+1
| | | | | All VOs use proper option parsing now, and compatibility hacks are not needed.
* vo_opengl_old: use new option APIwm42013-07-221-9/+1
|
* options: use new code for parsing --vowm42013-07-211-37/+0
| | | | | | | | | Nothing should change from user perspective. mpv --vo=opengl:help now works. Remove the vo_opengl inline help text. The new code can list option names for you, but that's it. Refer to the manpage if you have trouble.
* video: add a new method to configure filters and VOswm42013-06-281-8/+5
| | | | | | | | | | | | | | | | | | The filter chain and the video ouputs have config() functions. They are strictly limited to transfering the video size and format. Other parameters (like color levels) have to be transferred separately. Improve upon this by introducing a separate set of reconfig() functions, which use mp_image_params to carry format parameters. This struct contains all image format related parameters from config(), plus additional parameters such as colorspace. Change vf_rotate to use it, as well as vo_opengl. vf_rotate is just an example/test case, but vo_opengl will need it later. The intention is also to get rid of VOCTRL_SET_YUV_COLORSPACE. This information is now handed to the VOs via reconfig(). The getter, VOCTRL_GET_YUV_COLORSPACE, will still be needed though.
* vo_opengl: remove most of the "inline" documentationwm42013-05-261-86/+8
| | | | | | | | | | | There's no point duplicating all the text that is already in the man pages, and synchronizing them is a pain. Place a link to the github generated pages instead. Unfortunately, the anchor '#vo-opengl' does not work. Maybe github's rst converter just sucks, as the actually generated HTML contains links using that anchor too, but does not generate the anchor itself. Too bad.
* video/out: introduce vo_control for gl_common based VOswm42013-05-261-58/+11
| | | | | | | | | | | | | | | | Instead of having separate callbacks for each backend-handled feature (like MPGLContext.fullscreen, MPGLContext.border, etc.), pass the VOCTRL responsible for this directly to the backend. This allows removing a bunch of callbacks, that currently must be set even for optional/lesser features (like VOCTRL_BORDER). This requires changes to all VOs using gl_common, as well as all backends that support gl_common. Also introduce VOCTRL_CHECK_EVENTS. vo.check_events is now optional. VO backends can use VOCTRL_CHECK_EVENTS instead to implementing check_events. This has the advantage that the event handling code in VOs doesn't have to be duplicated if vo_control() is used.
* OSX: run native event loop in a separate threadStefano Pigozzi2013-05-121-0/+13
| | | | | | | | | | | | | | This commit is a followup on the previous one and uses a solution I like more since it totally decouples the Cocoa code from mpv's core and tries to emulate a generic Cocoa application's lifecycle as much as possible without fighting the framework. mpv's main is executed in a pthread while the main thread runs the native cocoa event loop. All of the thread safety is mainly accomplished with additional logic in cocoa_common as to not increase complexity on the crossplatform parts of the code.
* vo_opengl: lock OpenGL contextwm42013-05-121-4/+55
| | | | | | | | | | To simplify things, we just assume that all OpenGL calls as well as all calls into gl_video must be locked. Currently, also assume that anything GUI related must be locked as well (stuff like VOCTRL_BORDER). In its current state, this commit does nothing, but it will allow us to move the Cocoa GUI out of the playloop, as well as possibly implementing better framedropping.
* gl_video: use choice option type for dither-depth suboptionwm42013-03-281-6/+6
| | | | | Replaces the numeric magic values -1 and 0 with "no" and "auto". The numeric values are still allowed for compatibility.
* vo_opengl: add alpha outputwm42013-03-281-0/+3
| | | | | | | | | | | | | | | | | | | Allows playing video with alpha information on X11, as long as the video contains alpha and the window manager does compositing. See vo.rst. Whether a window can be transparent is decided by the choice of the X Visual used for window creation. Unfortunately, there's no direct way to request such a Visual through the GLX or the X API, and use of the XRender extension is required to find out whether a Visual implies a framebuffer with alpha used by XRender (see for example [1]). Instead of depending on the XRender wrapper library (which would require annoying configure checks, even though XRender is virtually always supported), use a simple heuristics to find out whether a Visual has alpha. Since getting it wrong just means an optional feature will not work as expected, we consider this ok. [1] http://stackoverflow.com/questions/4052940/how-to-make-an-opengl- rendering-context-with-transparent-background/9215724#9215724
* vo_opengl: split into multiple files, convert to new option APIwm42013-03-281-1957/+117
| | | | | | gl_video.c contains all rendering code, gl_lcms.c the .icc loader and creation of 3D LUT (and all LittleCMS specific code). vo_opengl.c is reduced to interfacing between the various parts.
* gl_common: split into platform specific fileswm42013-03-281-3/+3
| | | | | | | | | | | Do this instead of stuffing all x11/cocoa/win32/wayland specific code into gl_common.c. The cocoa specific parts could probably go directly into cocoa_common.m, possibly same with wayland. Also redo how the list of backends is managed. Get rid of the GLTYPE_ constants. Instead of having a big switch() on GLTYPE_, each backend entry has a function pointer to setup the MPGLContext callback (e.g. mpgl_set_backend_x11()).
* video: remove aspect.h includes from files which don't need itwm42013-03-171-1/+0
|
* vo_opengl: insert a magical glFlush callwm42013-03-111-0/+6
| | | | | Helps a little bit with stuttering with pans and "heavy" subtitles covering the screen.
* options: remove --no-vsyncwm42013-03-061-1/+1
| | | | | | Latest nvidia drivers ignore the application setting, so this switch makes even less sense than before. It's still possible to control this with VO specific suboptions.
* vo: Separate vo options from MPOptsAlexander Preisinger2013-03-041-2/+2
| | | | | | | Separate the video output options from the big MPOpts structure and also only pass the new mp_vo_opts structure to the vo backend. Move video_driver_list into mp_vo_opts
* vo: remove and cleanup globalsAlexander Preisinger2013-03-041-1/+1
| | | | | | | | Removes almost every global variabel in vo.h and puts them in a special struct in MPOpts for video output related options. Also we completly remove the options/globals pts and refresh rate because they were unused.
* vo_opengl: don't destroy VOFLAG_HIDDEN windowwm42013-03-031-6/+0
| | | | | | | This was done so because the X11 code had a hard to track down issue with some window managers, and caused the VO window to be placed incorrectly. This was fixed in the previous commit. Consequently, we can remove this bad hack.
* video/out: remove VO_EVENT_REINITwm42013-03-031-6/+0
| | | | | | | It was once used for vo_sdl (the old one based on SDL 1.2), since SDL apparently lost the GL state when switching to fullscreen. The new vo_sdl (using SDL 1.3) doesn't use or need this. It's dead code, so get rid of it.
* core: simplify OSD capability handling, remove VFCAP_OSDwm42013-03-011-2/+1
| | | | | | | | | | | | | | | | | | | VFCAP_OSD was used to determine at runtime whether the VO supports OSD rendering. This was mostly unused. vo_direct3d had an option to disable OSD (was supposed to allow to force auto-insertion of vf_ass, but we removed that anyway). vo_opengl_old could disable OSD rendering when a very old OpenGL version was detected, and had an option to explicitly disable it as well. Remove VFCAP_OSD from everything (and some associated logic). Now the vo_driver.draw_osd callback can be set to NULL to indicate missing OSD support (important so that vo_null etc. don't single-step on OSD redraw), and if OSD support depends on runtime support, the VO's draw_osd should just do nothing if OSD is not available. Also, do not access vo->want_redraw directly. Change the want_redraw reset logic for this purpose, too. (Probably unneeded, vo_flip_page resets it already.)
* wayland: add wayland supportAlexander Preisinger2013-02-281-0/+1
| | | | | | | | | | | | | | | | | | | | | All wayland only specific routines are placed in wayland_common. This makes it easier to write other video outputs. The EGL specific parts, as well as opengl context creation, are in gl_common. This backend works for: * opengl-old * opengl * opengl-hq To use it just specify the opengl backend --vo=opengl:backend=wayland or disable the x11 build. Don't forget to set EGL_PLATFORM to wayland. Co-Author: Scott Moreau (Sorry I lost the old commit history due to the file structure changes)
* video/out: rename create_window to config_windowwm42013-02-261-4/+4
| | | | | | create_window is really bad naming, because this function can be called multiple times, while the name implies that it always creates a new window. At least the name config_window is not actively misleading.
* vo_opengl: always ditherWessel Dankers2013-01-271-25/+12
| | | | | | | | | | | | Dithering was disabled if the input bit depth was not larger than the output bit depth of the screen framebuffer. But since scaling, RGB conversion, and other filters change the number of significant bits anyway, dithering could still benefit image quality even in these cases. Always do dithering, unless dithering is completely disabled. The original intention of this mechanism was not to change the image needlessly when playing video that matches the native bit depth of the screen.
* options: move -geometry parsing to m_option.cwm42013-01-231-1/+0
| | | | | | | | | This also means the option is verified on program start, not when the VO is created. The actual code becomes a bit more complex, because the screen width/height is not available at program start. The actual parsing code is still the same, with its unusual sscanf() usage.
* video: remove img_format compat hackswm42013-01-131-11/+13
| | | | | | | | | | | | | | | | | Remove the strange things the old mp_image_setfmt() code did to the image format parameters. This includes setting chroma shift to 31 for gray (Y8) formats and more. Y8 + vo_opengl_old didn't actually work for unknown reasons (regression in this branch). Fix this. The difference is that Y8 is now interpreted as gray RGB (LUMINANCE texture) instead of involving YUV (and levels) conversion. Get rid of distinguishing RGB and BGR. There wasn't really any good reason for this. Remove mp_get_chroma_shift() and IMGFMT_IS_YUVP16*(). mp_imgfmt_desc gives the same information and more.
* video: decouple internal pixel formats from FourCCswm42013-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mplayer's video chain traditionally used FourCCs for pixel formats. For example, it used IMGFMT_YV12 for 4:2:0 YUV, which was defined to the string 'YV12' interpreted as unsigned int. Additionally, it used to encode information into the numeric values of some formats. The RGB formats had their bit depth and endian encoded into the least significant byte. Extended planar formats (420P10 etc.) had chroma shift, endian, and component bit depth encoded. (This has been removed in recent commits.) Replace the FourCC mess with a simple enum. Remove all the redundant formats like YV12/I420/IYUV. Replace some image format names by something more intuitive, most importantly IMGFMT_YV12 -> IMGFMT_420P. Add img_fourcc.h, which contains the old IDs for code that actually uses FourCCs. Change the way demuxers, that output raw video, identify the video format: they set either MP_FOURCC_RAWVIDEO or MP_FOURCC_IMGFMT to request the rawvideo decoder, and sh_video->imgfmt specifies the pixel format. Like the previous hack, this is supposed to avoid the need for a complete codecs.cfg entry per format, or other lookup tables. (Note that the RGB raw video FourCCs mostly rely on ffmpeg's mappings for NUT raw video, but this is still considered better than adding a raw video decoder - even if trivial, it would be full of annoying lookup tables.) The TV code has not been tested. Some corrective changes regarding endian and other image format flags creep in.
* video: cleanup: replace old mp_image function nameswm42013-01-131-2/+2
| | | | | mp_image_alloc() also changes argument order compared to alloc_mpi(). The format now comes first, then width/height.
* video: remove things related to old DR codewm42013-01-131-24/+12
| | | | | | | | | | | | | | | Remove mp_image.width/height. The w/h members are the ones to use. width/height were used internally by vf_get_image(), and sometimes for other purposes. Remove some image flags, most of which are now useless or completely unused. This includes VFCAP_ACCEPT_STRIDE: the vf_expand insertion in vf.c does nothing. Remove some other unused mp_image fields. Some rather messy changes in vo_opengl[_old] to get rid of legacy mp_image flags and fields. This is left from when vo_gl supported DR.
* mp_image: require using mp_image_set_size() for setting w/hwm42013-01-131-5/+2
| | | | | | | | | | | | | | Setting the size of a mp_image must be done with mp_image_set_size() now. Do this to guarantee that the redundant fields (like chroma_width) are updated consistently. Replacing the redundant fields by function calls would probably be better, but there are too many uses of them, and is a bit less convenient. Most code actually called mp_image_setfmt(), which did this as well. This commit just makes things a bit more explicit. Warning: the video filter chain still sets up mp_images manually, and vf_get_image() is not updated.
* video: remove slice based filtering and video outputwm42013-01-131-25/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Slices allowed filtering or drawing video in horizontal bands or blocks. This allowed working on the video in smaller units. In theory, this could bring a performance win by lowering cache pressure, as you didn't have to keep the whole video frame in cache while filtering, only the slice. In practice, the slice code path was barely used for the following reasons: - Multithreaded decoding with ffmpeg didn't use slices. The ffmpeg slice callback was disabled, because it can be called from another thread, and the mplayer video chain is not thread-safe. - There was nothing that would turn "full" images into appropriate slices, so slices were rarely used. - Most filters didn't actually support slices. On the other hand, supporting slices lead to code duplication and more complex code in general. I made some experiments and didn't find any actual measurable performance improvements when using slices. Even ffmpeg removed slices based filtering from libavfilter in favor of simpler code. The most broken thing about the slices code path is that slices can't be queued, like it is done for images in vo.c.
* video/out: replace VOCTRL_QUERY_FORMAT with vo_driver.query_formatwm42013-01-131-3/+3
|
* video/out: make draw_image mandatory, remove VOCTRL_DRAW_IMAGEwm42013-01-131-6/+4
| | | | | | | | | | | | | Remove VOCTRL_DRAW_IMAGE and always set vo_driver.draw_image in VOs. Make draw_image mandatory: change some VOs (like vo_x11) to support it, and remove the image-to-slices fallback in vf_vo. Remove vo_driver.is_new. This member indicated whether draw_image is supported unconditionally, which is now always the case. draw_image_pts is a hack until the video filter chain is changed to include the PTS as field in mp_image. Then vo_vdpau and vo_lavc will be changed to use draw_image.
* vo_opengl: use more precise gamma for BT.709 with color managementnand2012-12-281-2/+2
| | | | | | | | | | Change from gamma 2.2 to the slightly more precise 1/0.45 as per BT.709. https://www.itu.int/rec/R-REC-BT.709-5-200204-I/en mentions a value of γ=0.45 for the conceptual non-linear precorrection of video signals. This is approximately the inverse of 2.22, and not 2.20 as the code had been using until now.
* vo_opengl: remove osdcolor suboptionwm42012-11-161-16/+0
| | | | | | This wasn't actually used since the old gray-alpha OSD rendering has been removed. Removing the documentation for the vo_opengl_old osdcolor suboption was forgotten as well.
* options, vo_x11: remove -zoom option, make it defaultwm42012-11-161-2/+1
| | | | | | | | | | | | | | The -zoom option enabled scaling with vo_x11. Remove the -zoom option, and make its behavior default. Since vo_x11 has to use libswscale for colorspace conversion anyway, which doesn't do actual extra scaling when vo_x11 is run in windowed mode, there should be no speed difference with this change. The code removed from vf_scale attempted to scale the video to d_width/ d_height, which matters for anamorphic video and the --xy option only. vo_x11 can handle these natively. The only case for which the removed vf_scale code could matter is encoding with vo_lavc, but since that didn't set VOFLAG_SWSCALE, nothing actually changes.
* clang: fix all warnings except deprecationsStefano Pigozzi2012-11-131-1/+1
|
* Rename directories, move files (step 2 of 2)wm42012-11-121-9/+9
| | | | | | | | | | | | Finish renaming directories and moving files. Adjust all include statements to make the previous commit compile. The two commits are separate, because git is bad at tracking renames and content changes at the same time. Also take this as an opportunity to remove the separation between "common" and "mplayer" sources in the Makefile. ("common" used to be shared between mplayer and mencoder.)
* Rename directories, move files (step 1 of 2) (does not compile)wm42012-11-121-0/+2419
Tis drops the silly lib prefixes, and attempts to organize the tree in a more logical way. Make the top-level directory less cluttered as well. Renames the following directories: libaf -> audio/filter libao2 -> audio/out libvo -> video/out libmpdemux -> demux Split libmpcodecs: vf* -> video/filter vd*, dec_video.* -> video/decode mp_image*, img_format*, ... -> video/ ad*, dec_audio.* -> audio/decode libaf/format.* is moved to audio/ - this is similar to how mp_image.* is located in video/. Move most top-level .c/.h files to core. (talloc.c/.h is left on top- level, because it's external.) Park some of the more annoying files in compat/. Some of these are relicts from the time mplayer used ffmpeg internals. sub/ is not split, because it's too much of a mess (subtitle code is mixed with OSD display and rendering). Maybe the organization of core is not ideal: it mixes playback core (like mplayer.c) and utility helpers (like bstr.c/h). Should the need arise, the playback core will be moved somewhere else, while core contains all helper and common code.