summaryrefslogtreecommitdiffstats
path: root/player/screenshot.c
Commit message (Collapse)AuthorAgeFilesLines
* Relicense some non-MPlayer source files to LGPL 2.1 or laterwm42016-01-191-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This covers source files which were added in mplayer2 and mpv times only, and where all code is covered by LGPL relicensing agreements. There are probably more files to which this applies, but I'm being conservative here. A file named ao_sdl.c exists in MPlayer too, but the mpv one is a complete rewrite, and was added some time after the original ao_sdl.c was removed. The same applies to vo_sdl.c, for which the SDL2 API is radically different in addition (MPlayer supports SDL 1.2 only). common.c contains only code written by me. But common.h is a strange case: although it originally was named mp_common.h and exists in MPlayer too, by now it contains only definitions written by uau and me. The exceptions are the CONTROL_ defines - thus not changing the license of common.h yet. codec_tags.c contained once large tables generated from MPlayer's codecs.conf, but all of these tables were removed. From demux_playlist.c I'm removing a code fragment from someone who was not asked; this probably could be done later (see commit 15dccc37). misc.c is a bit complicated to reason about (it was split off mplayer.c and thus contains random functions out of this file), but actually all functions have been added post-MPlayer. Except get_relative_time(), which was written by uau, but looks similar to 3 different versions of something similar in each of the Unix/win32/OSX timer source files. I'm not sure what that means in regards to copyright, so I've just moved it into another still-GPL source file for now. screenshot.c once had some minor parts of MPlayer's vf_screenshot.c, but they're all gone.
* player: refactor: eliminate MPContext.d_videowm42016-01-171-2/+2
| | | | | | | | | | | | | | Eventually we want the VO be driven by a A->V filter, so a decoder doesn't even have to exist. Some features definitely require a decoder though (like reporting the decoder in use, hardware decoding, etc.), so for each thing which accessed d_video, it has to be redecided if and how it can access decoder state. At least the "framedrop" property slightly changes semantics: you can now always set this property, even if no video is active. Some untested changes in this commit, but our bio-based distributed test suite has to take care of this.
* mpv_talloc.h: rename from talloc.hDmitrij D. Czarkoff2016-01-111-1/+1
| | | | This change helps avoiding conflict with talloc.h from libtalloc.
* video: switch from using display aspect to sample aspectwm42015-12-191-8/+1
| | | | | | | | | | | | | | | | MPlayer traditionally always used the display aspect ratio, e.g. 16:9, while FFmpeg uses the sample (aka pixel) aspect ratio. Both have a bunch of advantages and disadvantages. Actually, it seems using sample aspect ratio is generally nicer. The main reason for the change is making mpv closer to how FFmpeg works in order to make life easier. It's also nice that everything uses integer fractions instead of floats now (except --video-aspect option/property). Note that there is at least 1 user-visible change: vf_dsize now does not set the display size, only the display aspect ratio. This is because the image_params d_w/d_h fields did not just set the display aspect, but also the size (except in encoding mode).
* screenshot: avoid confusing template error message with no fileKevin Mitchell2015-09-021-9/+11
| | | | | | | Previously, with mpv --force-window=yes --idle=yes --screenshot-template="%f", mpv would display an error saying that the template was incorrect, which it isn't, there's just no file to put in the format. In this case, just use the string "NO_FILE".
* path: make mp_path_join accept normal C stringswm42015-05-091-1/+1
| | | | | Instead of bstr. Most callers of this function do not need bstr. The bstr version of this function is now mp_path_join_bstr().
* options: fix typo in variable namewm42015-05-031-1/+1
|
* screenshots: create screenshot dirwm42015-05-021-0/+2
| | | | Minor user convenience.
* screenshots: add --screenshot-directory optionwm42015-05-011-0/+8
| | | | | The plan is to use this to change the screenshot default location in pseudo-gui mode.
* client API: add a screenshot_raw commandwm42015-04-201-0/+10
| | | | | | | | | Requested. The wild code for setting up the mpv_node probably deserves to be cleaned up later. Fixes #1800.
* vf_screenshot: remove this filterwm42015-04-161-6/+1
| | | | | | It's entirely useless, especially now that vo.c handles screenshots in a generic way, and requires no special VO support. There are some potential weird use-cases, but actually I've never seen it being used.
* command: let screenshot_to_file command overwrite fileswm42015-04-161-5/+0
| | | | | | | The old behavior does not make too much sense after all. If you don't want to file to be overwritten, the user can check this manually. This is a change in behavior - let's hope nobody actually relied on it.
* Update license headersMarcin Kurczewski2015-04-131-5/+4
| | | | Signed-off-by: wm4 <wm4@nowhere>
* screenshot: use GPU readback only for hardware decoded imageswm42015-04-071-1/+1
| | | | | | Avoids a confusing message printed by the vdpau code when taking a screenshot while using software decoding (because obviously GPU readback won't work on normal in-memory video frames).
* player: fix crash when taking screenshots in idle modewm42015-03-111-0/+2
| | | | | | | | | | mpctx->filename is obviously not set if no file is playing. When this code was written, it probably couldn't happen, because the normal screenshot path fails much earlier in idle mode. But you can still take screenshots in "full window" mode, and recently the screenshot code was changed to use the "full window" mode if the normal path does not work.
* options: list correct default value for --screenshot-templatewm42015-01-261-1/+1
| | | | | | Make the default value part of the option metadata, instead of doing this in the screenshot code. Makes more sense with --list-options and the command.c option metadata properties.
* vo: simplify VOs by adding generic screenshot supportwm42015-01-241-1/+1
| | | | | | | | | | | At the time screenshot support was added, images weren't refcounted yet, so screenshots required specialized implementations in the VOs. But now we can handle these things much simpler. Also see commit 5bb24980. If there are VOs in the future which can't do this (e.g. they need to write to the image passed to vo_driver->draw_image), this still could be disabled on a per-VO basis etc., so we lose no potential performance advantages.
* video: separate screenshot modeswm42015-01-231-24/+25
| | | | | | | | | Use different VOCTRLs for "window" and normal screenshot modes. The normal one will probably be removed, and replaced by generic code in vo.c, and this commit is preparation for this. (Doing it the other way around would be slightly simpler, but I haven't decided yet about the second one, and touching every VO is needed anyway in order to remove the unneeded crap. E.g. has_osd has been unused for a long time.)
* video: handle hwdec screenshots differentlywm42015-01-221-0/+10
| | | | | | | | Instead of converting the hw surface to an image in the VO, provide a generic way to convet hw surfaces, and use this in the screenshot code. It's all relatively straightforward, except vdpau is being terrible. It needs a huge chunk of new code, because copying back is not simple.
* Move compat/ and bstr/ directory contents somewhere elsewm42014-08-291-1/+1
| | | | | | | | | bstr.c doesn't really deserve its own directory, and compat had just a few files, most of which may as well be in osdep. There isn't really any justification for these extra directories, so get rid of them. The compat/libav.h was empty - just delete it. We changed our approach to API compatibility, and will likely not need it anymore.
* video: move display and timing to a separate threadwm42014-08-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The VO is run inside its own thread. It also does most of video timing. The playloop hands the image data and a realtime timestamp to the VO, and the VO does the rest. In particular, this allows the playloop to do other things, instead of blocking for video redraw. But if anything accesses the VO during video timing, it will block. This also fixes vo_sdl.c event handling; but that is only a side-effect, since reimplementing the broken way would require more effort. Also drop --softsleep. In theory, this option helps if the kernel's sleeping mechanism is too inaccurate for video timing. In practice, I haven't ever encountered a situation where it helps, and it just burns CPU cycles. On the other hand it's probably actively harmful, because it prevents the libavcodec decoder threads from doing real work. Side note: Originally, I intended that multiple frames can be queued to the VO. But this is not done, due to problems with OSD and other certain features. OSD in particular is simply designed in a way that it can be neither timed nor copied, so you do have to render it into the video frame before you can draw the next frame. (Subtitles have no such restriction. sd_lavc was even updated to fix this.) It seems the right solution to queuing multiple VO frames is rendering on VO-backed framebuffers, like vo_vdpau.c does. This requires VO driver support, and is out of scope of this commit. As consequence, the VO has a queue size of 1. The existing video queue is just needed to compute frame duration, and will be moved out in the next commit.
* player: make the time display relative to start PTSTsukasa OMOTO2014-06-291-2/+2
| | | | | | This commit makes the playback start time always at time 0. Signed-off-by: wm4 <wm4@nowhere>
* video/out: change aspects of OSD handlingwm42014-06-151-1/+1
| | | | | | | | | Let the VOs draw the OSD on their own, instead of making OSD drawing a separate VO driver call. Further, let it be the VOs responsibility to request subtitles with the correct PTS. We also basically allow the VO to request OSD/subtitles at any time. OSX changes untested.
* video: remove redundant mp_image display_w/_h memberswm42014-04-291-4/+1
| | | | | | | | | | | | | | | | | Commit 5e4e248 added a mp_image_params field to mp_image, and moved many parameters to that struct. display_w/h was left redundant with mp_image_params.d_w/d_h. These fields were supposed to be always in sync, but it seems some code forgot to do this correctly, such as vf_fix_img_params() or mp_image_copy_attributes(). This led to the problem in github issue #756, because display_w/_h could become incorrect. It turns out that most code didn't use the old fields anyway. Just remove them. Note that mp_image_params.d_w/d_h are supposed to be always valid, so the additional checks for 0 shouldn't be needed. Remove these checks as well. Fixes #756.
* sub: uglify OSD code path with lockingwm42014-01-181-3/+3
| | | | | | | | | | | | | | | Do two things: 1. add locking to struct osd_state 2. make struct osd_state opaque While 1. is somewhat simple, 2. is quite horrible. Lots of code accesses lots of osd_state (and osd_object) members. To make sure everything is accessed synchronously, I prefer making osd_state opaque, even if it means adding pretty dumb accessors. All of this is meant to allow running VO in their own threads. Eventually, VOs will request OSD on their own, which means osd_state will be accessed from foreign threads.
* player: remove OSD message IDswm42014-01-171-4/+2
| | | | | | These were needed before the last commit, but now they don't do anything anymore. (They were used to decide whether to replace or stack the previous OSD message when a new one was displayed.)
* screenshot: add format specifiers to get file directory pathwm42014-01-081-0/+21
| | | | | Useful if you want to put the screenshot into the same directory as the file that is being played.
* path: change mp_splitext() semanticswm42013-12-221-1/+1
| | | | | | | | | Including the "." in the returned extension was too inconvenient. I think originally, the semantics were supposed to work like in Python, but screw this. Also, return NULL instead of "" on failure (which is what its only user actually seems to expect).
* path lookup functions: mp_msg conversionswm42013-12-211-1/+1
| | | | | | | | | | | | | | | | | There's a single mp_msg() in path.c, but all path lookup functions seem to depend on it, so we get a rat-tail of stuff we have to change. This is probably a good thing though, because we can have the path lookup functions also access options, so we could allow overriding the default config path, or ignore the MPV_HOME environment variable, and such things. Also take the chance to consistently add talloc_ctx parameters to the path lookup functions. Also, this change causes a big mess on configfiles.c. It's the same issue: everything suddenly needs a (different) context argument. Make it less wild by providing a mp_load_auto_profiles() function, which isolates most of it to configfiles.c.
* image_writer: mp_msg conversionswm42013-12-211-2/+2
| | | | Adds an awkward mp_log argument for error messages.
* player: replace some overlooked mp_msgswm42013-12-191-1/+1
| | | | | There are still some using IDENTIFY, and some without context in configfiles.c.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-2/+2
|
* Move options/config related files from mpvcore/ to options/wm42013-12-171-1/+1
| | | | | | | | | 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.
* Rename mp_core.h to core.hwm42013-12-171-1/+1
| | | | Get rid of the mp_ prefix.
* Move mpvcore/player/ to player/wm42013-12-171-0/+404