summaryrefslogtreecommitdiffstats
path: root/screenshot.c
Commit message (Collapse)AuthorAgeFilesLines
* screenshot: fix dependency on sizeof(AVFrame)Uoti Urpala2012-04-151-7/+21
| | | | | | | | | The AVFrame data structure may be extended at the end in new binary-compatible libavcodec versions. Therefore applications should not depend on the size of the structure. But screenshot.c declared an "AVFrame pic;" on stack. Change the code to allocate an AVFrame with avcodec_alloc_frame() instead. The frame is now stored in struct screenshot_ctx (rather than reallocated each time).
* windows support: unicode filenameswm42012-03-091-9/+2
| | | | | | | | | | | | | | | | | | | Windows uses a legacy codepage for char* / runtime functions accepting char *. Using UTF-8 as the codepage with setlocale() is explicitly forbidden. Work this around by overriding the MSVCRT functions with wrapper macros, that assume UTF-8 and use "proper" API calls like _wopen etc. to deal with unicode filenames. All code that uses standard functions that take or return filenames must now include osdep/io.h. stat() can't be overridden, because MinGW-w64 itself defines "stat" as a macro. Change code to use use mp_stat() instead. This is not perfectly clean, but still somewhat sane, and much better than littering the rest of the mplayer code with MinGW specific hacks. It's also a bit fragile, but that's actually little different from the previous situation. Also, MinGW is unlikely to ever include a nice way of dealing with this.
* screenshot: fix libav API use (pix_fmt and some other things)wm42012-02-251-8/+13
| | | | | | | | | | | Libavcodec started checking that avctx->pix_fmt is set when opening an encoder. The existing code (originally from vf_screenshot.c) only set it afterwards, which now made screenshots fail. Fix the code to set parameters before calling avcodec_open2(). Also fix some minor things, which seems to make it work for other encoders. This could be used to add more libavcodec based image writers. Fix memory leak (missing av_free(avctx)).
* Update Libav API usesUoti Urpala2012-02-011-4/+8
| | | | | | | | | | | | | | | | | | | Change various code to use the latest Libav API. The libavcodec error_recognition setting has been removed and replaced with different semantics. I removed the "--lavdopts=er=<value>" option accordingly, as I don't think it's widely enough used to be worth attempting to emulate the old option semantics using the new API. A new option with the new semantics can be added later if needed. Libav dropped APIs that were necessary with all Libav versions until quite recently (like setting avctx->age), and it would thus not be possible to keep compatibility with previous Libav versions without adding workarounds. The new APIs also had some bugs/limitations in the recent Libav release 0.8, and it would not work fully (at least some avcodec options would not be set correctly). Because of those issues, this commit makes no attempt to maintain compatibility with anything but the latest Libav git head. Hopefully the required fixes and improvements will be included in a following Libav point release.
* core: add screenshot mode for actual VO window contentswm42011-11-251-4/+7
| | | | | | | | | | | | | | The screenshot command normally converts the currently displayed video frame to an image. Add support for an alternative screenshot mode that is supposed to capture the real window contents. Such a screenshot contains a possibly scaled version of the frame, the OSD, and subtitles. Add a default key binding Alt+s for taking screenshots in this mode. This needs special VO support, and might not work with all VOs (this commit does not yet contain an implementation for any VO, only the infrastructure).
* core: add infrastructure to get screenshots from VOswm42011-11-251-0/+230
Add a VO command (VOCTRL_SCREENSHOT) which requests a screenshot directly from the VO. If VO support is available, screenshots will be taken instantly (no more 1 or 2 frames delay). Taking screenshots when hardware decoding is in use will also work (vdpau). Additionally, the screenshots will now use the same colorspace as the video display. Change the central MPContext to be allocated with talloc so that it can be used as a talloc parent context. This commit does not yet implement the functionality for any VO (added in subsequent commits). The old screenshot video filter is not needed anymore if VO support is present, and in that case will not be used even if it is present in the filter chain. If VO support is not available then the filter is used like before. Note that the filter still has some of the old problems, such as delaying the screenshot by at least 1 frame.