summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'sub_mess'wm42013-06-041-11/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This branch heavily refactors the subtitle code (both loading and rendering), and adds support for a few new formats through FFmpeg. We don't remove any of the old code yet. There are still some subtleties related to subreader.c to be resolved: code page detection & conversion, timing post-processing, UTF-16 subtitle support, support for the -subfps option. Also, SRT reading and loading ASS via libass should be turned into proper demuxers. (SRT is needed because Libav's is gravely broken, and we want ASS loading via libass to cover full libass format support. Both should be demuxers which are probed _before_ libavformat, so that all subtitles can be loaded through the demuxer infrastructure, and libavformat subtitles don't need to be treated in a special way.)
| * core: add common function to initialize AVPacketwm42013-06-031-11/+2
| | | | | | | | | | | | | | | | | | | | Audio and video had their own (very similar) functions to initialize an AVPacket (ffmpeg's packet struct) from a demux_packet (mplayer's packet struct). Add a common function for these. Also use this function for sd_lavc_conv. This is actually a functional change, as some libavfilter subtitle demuxers add weird out-of-band stuff as side-data.
* | osx: cocoa_common: use default wakeup periodStefano Pigozzi2013-06-031-1/+0
| | | | | | | | | | Now that Cocoa's input handling is done on a separate thread from the playloop it is ridicolously simple to have longer asynchronous sleeps when paused.
* | osx: create macosx_events to deal with keyDown eventsStefano Pigozzi2013-06-033-194/+9
| | | | | | | | | | | | On OSX with Cocoa enabled keyDown events are now handled with addLocalMonitorForEventsMatchingMask:handler:. This allows to respond to events even when there is no VO initialized but the GUI is focused.
* | osx_common: remove outdated ifdefferyStefano Pigozzi2013-06-031-52/+0
| | | | | | | | It was definining keycodes not defined in OS X < 10.5.
* | gl_video: reduce output with -v, skip useless header partswm42013-06-031-5/+8
| | | | | | | | | | | | Originally, the header wasn't supposed to contain random compatibility stuff, but now all that is printed with -v. Add a hack to skip it and to reduce the noise.
* | gl_video: explicitly clamp colormatrix outputwm42013-06-031-0/+1
| | | | | | | | | | | | | | This could lead to quite visible artifacts when using an appropriate ICC and float FBOs. The float FBOs allow storing out of range values, and my guess is that the rest of the precessing chain elevated these out of range values, resulting in artifacts.
* | cocoa_common: autohide dock/menubar on fs only if on same screenStefano Pigozzi2013-06-011-7/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | Autohide the menubar and/or dock only if they are present in the screen the player is going to go fullscreen into. I thought the GUI would handle this for me when I switched 0057aa476 but lack of hardware to test made me embarass myself yet again. I reimplemented this feature with nicer code and behaviour. The code checks separately wether to hide menubar and dock separatly, while the old code used a single check possibly hiding stuff without need. Added the key checks as a some category additions to NSScreen for readability.
* | cocoa_common: don't autohide mouse on mousedownStefano Pigozzi2013-06-011-2/+10
| | | | | | | | | | Previews code allowed to click the same spot for a long time and the cursor would autohide. No more!
* | cocoa_common: avoid window creation with VOFLAG_HIDDENStefano Pigozzi2013-06-011-76/+92
| | | | | | | | | | | | | | | | This takes an approach similar to the wayland OpenGL backend. VOFLAG_HIDDEN flag semantics doesn't mean "hide the window" but is simply ever used only to do detection of available OpenGL extensions. On OSX it's possibile to accomplish this task just by creating the OpenGL context without attaching it to a drawable.
* | cocoa_common: dehack mouse autohide by clipping view bounds to visible screenStefano Pigozzi2013-06-011-17/+19
| | | | | | | | | | This prevents the mouse to autohide when hovering the dock/menubar without any particular hack and seems to finally cover all edge cases.
* | cocoa_common: fix mouse autohide on MenuBar/Dock interactionStefano Pigozzi2013-05-311-1/+7
| | | | | | | | | | This is needed after last commit. A bug within a bug (yo dawg)! Serious explaination in the source code comment so that it's not forgotten.
* | cocoa_common: fix empty window when going fs on different screenStefano Pigozzi2013-05-311-0/+9
| | | | | | | | | | | | | | | | | | Using `enterFullScreenMode:withOptions:` with a screen handle than the current screen doesn't hide the current window in the current screen. This is a bug in Cocoa (preparing an isolated test case and sending the rdar later). To work around this, manually hide/show the window that the toolkit should hide/show for us.
* | cocoa_common: fix mouse hiding outside of player viewStefano Pigozzi2013-05-301-9/+21
| | | | | | | | | | | | | | | | | | | | | | | | This bug was the result of crappy position detection in the previous code combined with the commits moving autohide delay out of the cocoa backend and into the core. The hit detection was improved and now takes also account of interactions with the Dock and Menubar. Moreover VOCTRL_SET_CURSOR_VISIBILITY now has an effect only if the mouse position matches with this improved hit detection. This means that both interaction with the Dock and Menubar are considered as well as moving the mouse inside another screen.
* | cocoa_common: refactor fullscreen code for readabilityStefano Pigozzi2013-05-301-31/+53
| | | | | | | | | | Break up the code into several methods and reduce code duplication. Also add comments to make the intention of all this clearer.
* | cocoa_common: fix native-fs state savingStefano Pigozzi2013-05-301-1/+2
| | | | | | | | `opts->fs = VO_FALSE` was forgotten
* | cocoa_common: fix a bug in window initialization errorStefano Pigozzi2013-05-301-1/+3
| | | | | | | | We didn't bail out soon enough. Bug was introduced by 134f3e97.
* | cocoa_common: use cocoa APIs to go fullscreenStefano Pigozzi2013-05-302-219/+165
| | | | | | | | | | | | | | | | | | | | | | | | This removes a bit of ugly code and bookeeping which is never bad. `drawRect` needs to guard against different window instances since in fullscreen the view is wrapped in a fullscreen window provided by the toolkit (a instance of NSFullScreenWindow to be precise). The event handling was moved to the view so that it can still get all the events when in the fullscreen window. Ideally these should be moved to some NSResponder subclass within macosx_application and made available even when no window is present. I refrained from this because "small steps".
* | macosx_application: move escape_loadfile_name in this fileStefano Pigozzi2013-05-302-24/+0
| | | | | | | | This allows to move back osx_common to raw C.
* | cocoa_common: use better power management activity descriptionStefano Pigozzi2013-05-301-1/+1
| | | | | | | | | | Now one might actually undestand why this power management assertion is used in the first place.
* | osx: remove compatibility conditionals for 10.6Stefano Pigozzi2013-05-303-106/+13
|/ | | | | | | | At this point 10.6 is pretty old and we don't want to supporting old platforms. I'm killing all the 10.6 compatibility code before doing more refactorings. Next commits will also use newer Objective-C syntax such as literals and @autoreleasepool.
* gl_common: fix invalid alignmentwm42013-05-301-2/+2
| | | | | | | | 0 is invalid. The intention of the code turning off any additional alignment, so we need 1. Change a comment: obviously we don't try to set alignment parameters etc.to handle stride correctly, and instead do everything by row.
* gl_video: add some debug code for testing texture depthwm42013-05-301-7/+60
| | | | | | | | | | | | | | | | | | This probes and prints the depth of some texture formats with the help of a FBO. By default it tests the format used for scaling, as well as the format used for dithering and the 3D LUT (if any of these are enabled). The output is visible only with -v. Some representative values are probed, and the difference of input and output value is printed as hex- float. Hex-floats are used because they make the implied precision more obvious. Originally I wanted to do some more sophisticated guessing of the implied depth/precision for more user-friendly reporting, but then I decided that printing raw data is better for debugging, especially if things go wrong. This does not try to disable any functionality and does not print any warnings if the depth is lower than what it should be.
* gl_video: change a GLSL statementwm42013-05-301-1/+1
| | | | | | This might be better with dumb shader compilers, which won't vectorize this to a single vector-division, assuming the hardware does have such an instruction. Affects "bicubic_fast" scale mode only.
* gl_video: fix some dithering bugswm42013-05-302-15/+11
| | | | | | | | | | | | | | The internal texture format GL_RED is typically 8 bit, which is clearly not good enough for the new dither matrix. The idea was to use a float texture format, but this was somehow "forgotten". Use GL_R16, since 16 bit textures are more robust, and provide more precision for the same memory usage. Change how the offset for centering the dither matrix is applied. This is needed for making it possible to round up values to the target depth. Before this commit, this changed the output even if the input was exact and input and output depth were the same, which is not really what you want. Now it doesn't do that anymore.
* options: remove some questionable -lavdopts suboptionswm42013-05-291-15/+0
| | | | | | Most of these are rather questionable, the rest you rarely need to set manually. You still can set all of them with -lavdopts-o (because libavcodec has AVOptions for them).
* 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.
* vf_delogo: copy in non-direct case, fix double-freewm42013-05-261-9/+1
| | | | | | | | | If the image is not writeable, the image actually has to be copied beforehand. This was overlooked when converting the video chain to reference counted images. Fix a double free issue. This was overlooked when vf.c was changed to free filter priv data automatically.
* gl_video: improve ditheringwm42013-05-267-23/+330
| | | | | | | | | | | | | | | | | | | | | | | | | | Use a different algorithm to generate the dithering matrix. This looks much better than the previous ordered dither matrix with its cross-hatch artifacts. The matrix generation algorithm as well as its implementation was contributed by Wessel Dankers aka Fruit. The code in dither.c is his implementation, reformatted and with static global variables removed by me. The new matrix is uploaded as float texture - before this commit, it was a normal integer fixed point matrix. This means dithering will be disabled on systems without float textures. The size of the dithering matrix can be configured, as the matrix is generated at runtime. The generation of the matrix can take rather long, and is already unacceptable with size 8. The default is at 6, which takes about 100 ms on a Core2 Duo system with dither.c compiled at -O2, which I consider just about acceptable. The old ordered dithering is still available and can be selected by putting the dither=ordered sub-option. The ordered dither matrix generation code was moved to dither.c. This function was originally written by Uoti Urpala.
* gl_video: add scaler-resizes-only sub-optionwm42013-05-262-0/+25
| | | | | This option disables the scaler set with lscale if the video image is not resized.
* Replace calls to usec_sleep()wm42013-05-262-2/+2
| | | | | | This is just dumb sed replacement to mp_sleep_us(). Also remove the now unused usec_sleep() wrapper.
* Replace all calls to GetTimer()/GetTimerMS()wm42013-05-265-18/+22
| | | | | | | | | | | | | | | | | | | | | | GetTimer() is generally replaced with mp_time_us(). Both calls return microseconds, but the latter uses int64_t, us defined to never wrap, and never returns 0 or negative values. GetTimerMS() has no direct replacement. Instead the other functions are used. For some code, switch to mp_time_sec(), which returns the time as double float value in seconds. The returned time is offset to program start time, so there is enough precision left to deliver microsecond resolution for at least 100 years. Unless it's casted to a float (or the CPU reduces precision), which is why we still use mp_time_us() out of paranoia in places where precision is clearly needed. Always switch to the correct time. The whole point of the new timer calls is that they don't wrap, and storing microseconds in unsigned int variables would negate this. In some cases, remove wrap-around handling for time values.
* vo: rip out VO timer wakeup mechanism againwm42013-05-262-19/+0
| | | | | | | This was used by some VOs to do timing of cursor autohiding, but we recently moved that out of the VOs. Even though this mechanism might be a good idea and could be needed again in future (but for what?), it's unused now. So better just get rid of it.
* cocoa_common: send mouse moved events to core when draggingStefano Pigozzi2013-05-261-2/+7
| | | | This change fixes mouse autohide when dragging mouse.
* wayland: use VOCTRL_SET_CURSOR_VISIBILITYAlexander Preisinger2013-05-262-36/+25
|
* wayland: introduce vo_wayland_configAlexander Preisinger2013-05-263-26/+24
| | | | | This removes the need for exposing vo_wayland_fullscreen and other functions also this will be usefull for other vos in the future.
* cocoa_common: implement VOCTRL_SET_CURSOR_VISIBILITYStefano Pigozzi2013-05-261-39/+20
| | | | Pass along cursor visibility hints to be more consistent with OSX's behaviour.
* cocoa_common: implement mouse movement notificationsStefano Pigozzi2013-05-261-0/+10
| | | | | | Notify the core of mouse movement events. The coordinates are converted to a coordinate system with the origin in upper left corner, since Cocoa has it in the lower left corner.
* w32: use VOCTRL_SET_CURSOR_VISIBILITYwm42013-05-261-6/+7
| | | | | This didn't even implement --cursor-autohide. Now it does, and the behavior of the VOs under Windows change accordingly.
* vo_sdl: use VOCTRL_SET_CURSOR_VISIBILITYwm42013-05-261-39/+3
|
* x11: remove cursor hiding logic, use VOCTRL_SET_CURSOR_VISIBILITYwm42013-05-262-48/+33
|
* core: do mouse cursor hiding business in frontendwm42013-05-261-0/+2
| | | | | Do this so that not every VO backend has to setup a timer for cursor hiding and interpret the --cursor-autohide option.
* vo: remove vo.check_events callbackwm42013-05-267-25/+8
| | | | | | Use VOCTRL_CHECK_EVENTS instead. Change the remaining VOs to use it. Only vo_sdl and vo_caca actually need this, and vo_null, vo_lavc, and vo_image had stubs only.
* w32: use vo_w32_control() for all VOswm42013-05-263-40/+15
|
* x11: use vo_x11_control() for all VOswm42013-05-265-80/+31
|
* video/out: introduce vo_control for gl_common based VOswm42013-05-2618-158/+138
| | | | | | | | | | | | | | | | 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.
* vf_lavfi: allow setting avoptswm42013-05-261-0/+9
|
* cocoa_common: authohide menu/dock in fullscreenStefano Pigozzi2013-05-261-2/+3
| | | | | This simple fix makes it possible to access the MainManu and Dock when in fullscreen when not using `--native-fs`.
* m_option, vf: add label supportwm42013-05-232-1/+18
| | | | | | | | | | | | | | | | | Can be used to refer to filters by name. Intended to be used when the filter chain is changed at runtime. A label can be assigned to a filter by prefixing it with '@name:', where 'name' is an user-chosen identifier. For example, a filter added with '-vf-add @label1:gradfun=123' can be removed with '-vf-del @label1'. If a filter with an already existing label is added, the existing filter is replaced with the new filter (this happens for both -vf-add and -vf-pre). If a filter is replaced, the new filter takes the position of the old filter, instead of being appended/prepended to the filter chain as usual. For -vf-toggle, labels are compared if at least one of the filters has a label; otherwise they are compared by filter name and arguments (like before). This means two filters are never considered equal if one has a label and the other one does not.
* vo: remove unused callbackwm42013-05-231-1/+0
|
* dec_video: get rid of two global variableswm42013-05-213-10/+3
|
* dec_video: remove emms usagewm42013-05-211-10/+0
| | | | | | | libavcodec generally shouldn't have this problem anymore (if libavcodec ever had it). All other video decoders are gone. In any case, if this commit actually causes regressions, these are libavcodec bugs and should be fixed there instead.
* vf_lavfi: remove redundant statementswm42013-05-211-4/+0
|
* Silence some compiler warningswm42013-05-213-4/+4
| | | | None of these were actual issues.
* vo_image: start image file numbers at 1wm42013-05-181-2/+2
| | | | Requested by a user.
* video/filter: fix option parser memory leakwm42013-05-186-16/+3
| | | | | | | This happens only if an option actually allocates memory (like strings). Change filter API such that vf->priv is free'd by vf.c instead by the filters. vf.c will free the option values as well.
* core: allow changing filter filters at runtimewm42013-05-181-0/+1
| | | | | | | | | | | | | | | | Add the "vf" command, which allows changing the video filter chain at runtime. For example, the 'y' key could be bound to toggle deinterlacing by adding 'y vf toggle yadif' to the input.conf. Reconfiguring the video filter chain normally resets the VO, so that it will be "stuck" until a new video frame is rendered. To mitigate this, a seek to the current position is issued when the filter chain is changed. This is done only if playback is paused, because normal playback will show an actual new frame quickly enough. If vdpau hardware decoding is used, filter insertion (whether it fails or not) will break the video for a while. T