summaryrefslogtreecommitdiffstats
path: root/screenshot.c
Commit message (Collapse)AuthorAgeFilesLines
* image_writer: add option parsingwm42012-08-061-6/+3
| | | | | image_writer now provides its own option parsing, and screenshot.c and the mplayer frontend use it.
* screenshot: move image writer code into new file image_writer.cwm42012-08-061-204/+16
|
* bstr: rename bstr() function to bstr0(), and typedef bstr to struct bstrwm42012-07-281-1/+1
| | | | | Replace all uses of bstr() with bstr0(). Also remove the ridiculous C++ workaround.
* screenshot: fix minor memory leakwm42012-05-151-0/+1
| | | | Introduced in commit 5fe14d5bf "screenshot: improve error messages".
* screenshot: improve error messageswm42012-04-291-6/+6
| | | | | | | Include filename in the error message, if the screenshot destination file already exists. Consistently quote filenames with 'quotes' in messages.
* screenshot, vo_png: fix dependency on sizeof(AVFrame)wm42012-04-291-7/+11
| | | | | | | | | In order to stay binary compatible with libavcodec, applications should not dependent on sizeof(AVFrame). This means allocating AVFrame on the stack is not allowed, and the function avcodec_alloc_frame() must be used to allocate an AVFrame instead. Partially based on a patch by uau.
* windows support: use UTF-8 for screenshot filenameswm42012-03-171-0/+2
|
* Merge remote-tracking branch 'origin/master' into my_masterwm42012-03-161-9/+2
|\ | | | | | | | | | | | | | | Conflicts: command.c mp_core.h mplayer.c screenshot.c
| * 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.
* | Merge remote-tracking branch 'origin/master' into my_masterwm42012-03-051-14/+20
|\| | | | | | | | | | | Conflicts: mplayer.c screenshot.c
| * 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.
* | screenshot: don't convert image if it's already in required formatwm42012-02-291-17/+27
| |
* | screenshot: move code to open file out of image writer functionswm42012-02-291-29/+16
| | | | | | | | | | | | | | This is a minor simplification. The original intend was to only open a file if opening the image encoder went well, but this obscure special case is not worth bothering the image writer functions with more error handling.
* | screenshot: make screenshot filenames configurablewm42012-02-291-31/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
* | screenshot: allow forcing taking screenshots with the video filterwm42012-02-291-1/+16
| | | | | | | | | | | | | | | | | | | | If the screenshot_force video filter is inserted, taking screenshots will always use the video filter, and skip the VO specific screenshot code. This can be useful if the VO code causes problems, or if it's intended to take screenshots from a specific location in the filter chain. The 'screenshot' filter is intended as fallback, it's not used if possible.
* | screenshot: fix error messagewm42012-02-191-1/+1
| | | | | | | | This happens with JPG screenshots as well.
* | screenshot: add png compression settingwm42012-01-181-1/+1
| | | | | | | | | | | | | | | | The default compression setting is 7, which is hopefully a good balance between speed of compression, and resulting file sizes. The maximum png compression will be very slow even on fast computers. On the other hand, the lowest compression setting produces files of several MB size with normal video resolutions, which should be avoided as well.
* | screenshot: add jpg supportwm42012-01-181-12/+115
| | | | | | | | | | | | The screenshot image file type can now be selected with the --screenshot-filetype option. The --screenshot-jpeg-quality option controls the compression setting of the written JPEG image file.
* | screenshot: improve quality by using additional swscale flagswm42012-01-181-7/+7
|/ | | | | | | | | Adding these flags improves the quality of the YUV->RGB conversion when screenshots are taken. It trades precision for performance. This doesn't affect any other swscale uses, such as vf_scale or vo_x11. Based on a patch by cantabile. Fixes #140.
* 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.