summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* video: replace d_video->pts field, change PTS jump checkswm42013-11-272-5/+6
| | | | | | | | | | | | | The d_video->pts field was a bit strange. The code overwrote it multiple times (on decoding, on filtering, then once again...), and it wasn't really clear what purpose this field had exactly. Replace it with the mpctx->video_next_pts field, which is relatively unambiguous. Move the decreasing PTS check to dec_video.c. This means it acts on decoder output, not on filter output. (Just like in the previous commit, assume the filter chain is sane.) Drop the jitter vs. reset semantics; the dec_video.c determined PTS never goes backwards, and demuxer timestamps don't "jitter".
* video: if PTS is missing, make something up using the frameratewm42013-11-271-3/+7
| | | | | | Also get rid of the PTS check _after_ filters. This means if there's a video filter which unsets PTS, no warning will be printed. But we assume that all filters are well-behaved enough by now.
* video: refactor PTS code, add fall back heuristic to DTSwm42013-11-273-70/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the PTS handling code to make it cleaner, and to separate the bits that use PTS sorting. Add a heuristic to fall back to DTS if the PTS us non-monotonic. This code is based on what FFmpeg/Libav use for ffplay/avplay and also best_effort_timestamp (which is only in FFmpeg). Basically, this 1. just uses the DTS if PTS is unset, and 2. ignores PTS entirely if PTS is non- monotonic, but DTS is sorted. The code is pretty much the same as in Libav [1]. I'm not sure if all of it is really needed, or if it does more than what the paragraph above mentions. But maybe it's fine to cargo-cult this. This heuristic fixes playback of mpeg4 in ogm, which returns packets with PTS==DTS, even though the PTS timestamps should follow codec reordering. This is probably a libavformat demuxer bug, but good luck trying to fix it. The way vd_lavc.c returns the frame PTS and DTS to dec_video.c is a bit inelegant, but maybe better than trying to mess the PTS back into the decoder callback again. [1] https://git.libav.org/?p=libav.git;a=blob;f=cmdutils.c;h=3f1c667075724c5cde69d840ed5ed7d992898334;hb=fa515c2088e1d082d45741bbd5c05e13b0500804#l1431
* Move some code from player to audio/video reset functionswm42013-11-271-0/+7
|
* cosmetics: rename video/audio reset functionswm42013-11-274-10/+10
| | | | | | | | | | These used the suffix _resync_stream, which is a bit misleading. Nothing gets "resynchronized", they really just reset state. (Some audio decoders actually used to "resync" by reading packets for resuming playback, but that's not the case anymore.) Also move the function in dec_video.c to the top of the file.
* video: remove commented codewm42013-11-271-13/+2
|
* video: use dts as fallback when determining pts by sortingwm42013-11-271-11/+10
| | | | | This makes the new code equivalent with the old one, which often passed dts as pts. Also rename some variables to clear up things.
* video/filter: fix PIC compile on x86Natanael Copa2013-11-262-3/+9
| | | | | | | | | | | | | When using PIC on x86 (eg with hardened toolchains) the ebx register is reserverd and cannot be used in assembly code. For vf_eq we allow the compiler to use memory as input. For vf_noise we temoporarily borrow the ebp register. This fixes #361. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
* video: unbreak --no-correct-pts with demuxers that use DTSwm42013-11-262-4/+6
|
* cocoa: unlock on uninitStefano Pigozzi2013-11-261-1/+3
| | | | NSLock should be unlocked before dealloc is called on it.
* video: move timestamp determination code to dec_videowm42013-11-252-0/+44
| | | | | | | | | | This means the code that tries to figure out the timestamp from demuxer and decoder output is now all in dec_video.c. We set the final timestamp on the returned image (mp_image.pts), as well as the d_video->pts field. The way the player uses d_video->pts field is still a bit messy. Maybe this could be cleaned up later.
* video: disable PTS sorting fallback by defaultwm42013-11-251-2/+3
| | | | | | | | | | | | | | | | It appears PTS sorting was useful only for avi files (and VfW-muxed mkv). Maybe it was historically also important for decoders with broken or non-existent PTS reordering (win32 codecs?). But now that we handle demuxers which outputs DTS only correctly, it just seems dead weight. Disable it by default. The --pts-association-mode option is now forced to always use the decoder's PTS value. You can still enable the old default (auto) or force sorting. But we will probably remove this option entirely at some point. Make demux_mkv export timestamps at DTS when it's in VfW mode. This is needed to get correct timestamps with the new default mode. demux_lavf already does that.
* demux: export dts from demux_lavf, use it for aviwm42013-11-251-4/+1
| | | | | | | | | Having the DTS directly can be useful for restoring PTS values. The avi file format doesn't actually store PTS values, just DTS. An older hack explicitly exported the DTS as PTS (ignoring the [I assume] genpts generated non-sense PTS), which is not necessary anymore due to this change.
* player: merge no-correct-pts with correct-pts codewm42013-11-252-0/+4
| | | | | | Now the --no-correct-pts mode is like the normal mode, just with different timestamp calculations. The semantics should be about the same as before this commit.
* player: change semantics of --no-correct-ptswm42013-11-251-1/+0
| | | | | | | | | | | | | Before this commit, this mode estimated the frame time by subtracting successive packet PTS values. This is complete non-sense for video codecs which use reordering. The code compensated frame times for these non-sense using the FPS value, but confused the rest of the player with non-sense jumping around timestamps. So, all in all this mode is not very useful. Repurpose this mode for fixed frame rate playback. This gives almost the same behavior as the old mode with forced framerate (--fps option). The result is simpler and often more robust.
* dec_video: fix function signaturewm42013-11-252-4/+6
| | | | Just why...? And why did this take 7 years?
* video: pass PTS as part of demux_packet/AVPacket and mp_image/AVFramewm42013-11-254-17/+22
| | | | | | | | | | | | | | | Instead of passing the PTS as separate field, pass it as part of the usual data structures. Basically, this removes strange artifacts from the API. (It's not finished, though: the final decoded PTS goes through strange paths, and filter_video() finally overwrites the decoded mp_image's pts field with it.) We also stop using libavcodec's reordered_opaque fields, and use AVPacket.pts and AVFrame.pkt_pts. This is slightly unorthodox, because these pts fields are not "really" opaque anymore, yet we treat them as such. But the end result should be the same, and reordered_opaque is marked as partially deprecated (it's not clear whether it's really deprecated).
* osd: remove mp_osd_res.video_par fieldwm42013-11-247-8/+1
| | | | | | This is not needed anymore, because we decided that the PAR of the decoded video matters, and not the PAR of the filtered video that arrives at the VO.
* Rename sub.c/.h to osd.c/.hwm42013-11-2418-21/+16
| | | | | This was way too misleading. osd.c merely calls the subtitle renderers, instead of actually dealing with subtitles.
* vd_lavc: improve a commentwm42013-11-241-1/+2
|
* vd_lavc: when falling back to software, revert filter error statuswm42013-11-231-0/+2
| | | | | | | | | | | | | | | | | | | When mpv is started with some video filters set (--vf is used), and hardware decoding is requested, and hardware decoding would be possible, but is prevented due to video filters that accept software formats only, the fallback didn't work properly sometimes. This fallback works rather violently: it tries to initialize the filter chain, and if it fails it throws away the frame decoded using the hardware, and retries with software. The case that didn't work was when decoding the current packet didn't immediately lead to a new frame. Then the filter chain wouldn't be reinitialized, and the playloop would stop playback as soon as it encounters the error flag. Fix this by resetting the filter error flag (back to "uninitialized"), which is a rather violent, but somewhat working solution. The fallback in general should perhaps be cleaned up later.
* Attempt to fix build on older libavcodec versionswm42013-11-232-0/+2
|
* video: don't overwrite demuxer FPS valuewm42013-11-231-1/+1
| | | | | | | | | | | | | | | | If the --fps option was given (MPOpts->force_fps), the demuxer FPS value was overwritten with the forced value. This was fine, since the demuxer value wasn't needed anymore. But with the recent changes not to write to the demuxer stream headers, we don't want to do this anymore. So maintain the (forced/updated) FPS value in dec_video->fps. The removed code in loadfile.c is probably redundant, and an artifact from past refactorings. Note that sub.c will now always use the demuxer FPS value, instead of the user override value. I think this is fine, because it used the demuxer's video size values too. (And it's rare that these values are used at all.)
* video: move handling of container vs. stream AR out of vd_lavc.cwm42013-11-234-39/+34
| | | | | | | Now the actual decoder doesn't need to care about this anymore, and it's handled in generic code instead. This simplifies vd_lavc.c, and in particular we don't need to detect format changes in the old way anymore.
* dec_video: make vf_input and hwdec_info statically allocatedwm42013-11-233-7/+5
| | | | | | | | | | | The only reason why these structs were dynamically allocated was to avoid recursive includes in stheader.h, which is (or was) a very central file included by almost all other files. (If a struct is referenced via a pointer type only, it can be forward referenced, and the definition of the struct is not needed.) Now that they're out of stheader.h, this difference doesn't matter anymore, and the code can be simplified. Also sneak in some sanity checks.
* dec_video: remove "initialized" fieldwm42013-11-232-13/+8
| | | | It's redundant.
* demux: remove gsh field from sh_audio/sh_video/sh_subwm42013-11-231-3/+3
| | | | | | | | | This used to be needed to access the generic stream header from the specific headers, which in turn was needed because the decoders had access only to the specific headers. This is not the case anymore, so this can finally be removed again. Also move the "format" field from the specific headers to sh_stream.
* video: move decoder context from sh_video into new structwm42013-11-236-187/+216
| | | | | | | | | | This is similar to the sh_audio commit. This is mostly cosmetic in nature, except that it also adds automatical freeing of the decoder driver's state struct (which was in sh_video->context, now in dec_video->priv). Also remove all the stheader.h fields that are not needed anymore.
* options: print lavfi filter list with --vf=lavfi=helpwm42013-11-231-0/+40
|
* options: implement --pphelp differentlywm42013-11-233-0/+8
| | | | Make it work via --vf=pp:help instead.
* video: remove vf_pp auto-insertionwm42013-11-234-34/+0
| | | | | | | | | | This drops the --pp option, which was probably broken for a while. The option automatically inserted the "pp" filter. The value passed to it was ignored (which is probably broken, it always selected maximal quality). Inserting this filter can be done simply with --vf=pp, so this is not needed anymore.
* video: merge vd.c into dec_video.cwm42013-11-232-175/+138
| | | | | I don't feel like the separation ever made sense, and it was hard to tell which file a function you were looking for was in.
* video: move struct mp_hwdec_info into its own header filewm42013-11-2312-23/+30
| | | | | | | | This means most code accessing this struct must now include hwdec.h instead of dec_video.h. I just put it into dec_video.h at first because I thought a separate file would be a waste, but it's more proper to do it this way, as there are too many files which include dec_video.h only to get the mp_hwdec_info definition.
* vo_opengl: fix compilationwm42013-11-221-2/+2
| | | | Never do a trivial change while drunk and without actually testing it.
* vf_vavpp: make it work with vo_opengl and software decodingwm42013-11-223-5/+5
| | | | | | | | | | vo_opengl always loads the hwdec backend lazily, so hwdec_request_api() has to be called to possibly load it. This makes vf_vavpp work with software decoding. (Hardware decoding loads the backend before the filter is initialized, so this case is different.) Also, the VFCTRL_GET_HWDEC_INFO call doesn't need to be checked. If it fails, the info will be left blank.
* vo_opengl: initialize all fields for VFCTRL_GET_HWDEC_INFOwm42013-11-221-4/+8
| | | | | | This initialized only the load_api and load_api_ctx fields, and left the other fields as they were. This failed with vf_vavpp, which assumed all fields are initialized.
* cocoa: use window-scale to support video scaling functionalityStefano Pigozzi2013-11-223-6/+10
| | | | | In the cocoa backend you can use cmd+0/1/2 to scale the window. This commit makes it use the new window-scale functionality.
* cocoa: implement window-scaleStefano Pigozzi2013-11-221-0/+20
|
* switch the build system to wafStefano Pigozzi2013-11-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | This commit adds a new build system based on waf. configure and Makefile are deprecated effective immediately and someday in the future they will be removed (they are still available by running ./old-configure). You can find how the choice for waf came to be in `DOCS/waf-buildsystem.rst`. TL;DR: we couldn't get the same level of abstraction and customization with other build systems we tried (CMake and autotools). For guidance on how to build the software now, take a look at README.md and the cross compilation guide. CREDITS: This is a squash of ~250 commits. Some of them are not by me, so here is the deserved attribution: - @wm4 contributed some Windows fixes, renamed configure to old-configure and contributed to the bootstrap script. Also, GNU/Linux testing. - @lachs0r contributed some Windows fixes and the bootstrap script. - @Nikoli contributed a lot of testing and discovered many bugs. - @CrimsonVoid contributed changes to the bootstrap script.
* vdpau_old: enable OpenGL interopwm42013-11-191-0/+1
| | | | | OpenGL interop was essentially disabled, because the decoder didn't request vdpau device creation from vo_opengl.
* demux: rename demux_packet.h to packet.hwm42013-11-182-2/+2
| | | | This always bothered me.
* vo_vdpau: don't calculate destination alpha when drawing OSDwm42013-11-181-2/+2
| | | | | | Same as MPlayer svn commit r36515 "Chose cheaper alpha blend equation." No idea if this is actually faster, but can't hurt.
* gl_common: print SW renderer warning only if it was the only reason we ↵wm42013-11-141-1/+1
| | | | rejected it
* vd_lavc: select correct hw decoder profile for constrained baseline h264wm42013-11-141-2/+4
| | | | | | | | | | | | | | | | | | | | The existing code tried to remove the "extra" profile flags for h264. FF_PROFILE_H264_INTRA doesn't matter for us at all, because it's set only for profiles the vdpau/vaapi APIs don't support. The FF_PROFILE_H264_CONSTRAINED flag on the other hand is added to H264_BASELINE, except that it makes the file a real subset of H264_MAIN and H264_HIGH. Removing that flag would select the BASELINE profile, which appears to be rarely supported by hardware decoders. This means we accidentally rejected perfectly hardware decodable files. Use MAIN for it instead. (vaapi has explicit support for CONSTRAINED_BASELINE, but it seems to be a new thing, and is not reported as supported where I tried. So don't bother to check it, and do the same as on vdpau.) See github issue #204.
* gl_common: remove unneeded callbackwm42013-11-144-4/+0
| | | | We got rid of this some time ago, but apparently not completely.
* wayland: create xkbcommon keymap from stringAlexander Preisinger2013-11-131-2/+1
| | | | Fixes a problem where the passed size doesn't match the actuall string.
* waylad: implement functionality for window-scalingAlexander Preisinger2013-11-121-0/+12
|
* vo_lavc: fix -ovoffset.Rudolf Polzer2013-11-111-1/+3
| | | | Previously, using it led to no single frame being output, ever.
* vo_opengl: fix alpha values written to the framebufferwm42013-11-103-5/+16
| | | | | | | | | | | | | | | | | | | | | | | When blending OSD and subtitles onto the video, we write bogus alpha values. This doesn't normally matter, because these values are normally unused and discarded. But at least on Wayland, the alpha values are used by the compositor and leads to transparent windows even with opaque video on places where the OSD happens to use transparency. (Also see github issue #338.) Until now, the alpha basically contained garbage. The source factor GL_SRC_ALPHA meant that alpha was multiplied with itself. Use GL_ONE instead (which is why we have to use glBlendFuncSeparate()). This should give correct results, even with video that has alpha. (Or at least it's something close to correct, I haven't thought too hard how the compositor will blend it, and in fact I couldn't manage to test it.) If glBlendFuncSeparate() is not available, fall back to glBlendFunc(), which does the same as the code did before this commit. Technically, we support GL 1.1, but glBlendFuncSeparate is 1.4, and I guess we should try not to crash if vo_opengl_old runs on a system with GL 1.1 drivers only.
* gl_hwdec_vdpau: silence warning caused by buggy GL_NV_vdpau_interop specwm42013-11-091-2/+6
| | | | | VDPAU handles are integers, but for some reasons the VDPAU GL extension expects them as void*.
* vdpau: unbreakwm42013-11-091-0/+1
| | | | Obviously I didn't test commit 1b8cd01, and it just crashed. Oops.
* vdpau: drop dummy render functionwm42013-11-071-14/+2
| | | | | | | | | This was supposed to handle preemption better. I still think the current state isn't very nice, since the decoder can "accidentally" call the previous render function after preemption (instead of calling the reloaded function), so there might be issues. But all in all, this dummy_render function is a bit confusing, and still not entirely correct, so it's not worth it.
* memcpy_pic: reformatwm42013-11-061-27/+17
| | | | | Besides cosmetic changes, also change memcpy_pic return type and remove config.h include.
* vd_lavc: remove explicit crystalhd supportwm42013-11-061-14/+0
| | | | | | | | | | | | | | | | This removes "--hwdec=crystalhd". I doubt anyone even tried to use this. But even if someone wants to use it, the decoders can still be explicitly invoked with e.g.: --vd=lavc:h264_crystalhd The only advantage our special code provided was fallback to software decoding. (But I'm not sure how the ffmpeg crystalhd pseudo-decoder actually behaves.) Removing this will allow some simplifications as soon as we don't need vdpau_old.c anymore.
* gl_header_fixes: fix inverted conditionwm42013-11-051-1/+1
| | | | | Could possibly leading to failing compilation on systems with headers that miss the vdpau extension.
* vo_opengl: support for vdpau hardware decodingwm42013-11-055-0/+294
| | | | | | | | | | | | This uses vdpau OpenGL interop to convert a vdpau surface to a texture. Note that this is a bit weak and primitive. Deinterlacing (or any other form of vdpau postprocessing) is not supported. vo_opengl chroma scaling and chroma sample position are not supported. Internally, the vdpau video surfaces are converted to a RGBA surface first, because using the video surfaces directly is too complicated. (These surfaces are always split into separate fields, and the vo_opengl core expects progressive frames or frames with weaved fields.)
* vdpau: move device and video surface management from vo_vdpau.c to vdpau.cwm42013-11-053-220/+271
| | | | | The goal is being able to use vdpau decoding independently from vo_vdpau.c.
* vo_opengl: redo aspects of initialization, change hwdec APIwm42013-11-053-38/+38
| | | | | | | | | | | Instead of checking for resolution and image format changes, always fully reinit on any parameter change. Let init_video do all required initializations, which simplifies things a little bit. Change the gl_video/hardware decoding interop API slightly, so that hwdec initialization gets the full image parameters. Also make some cosmetic changes.
* vo_opengl/vaapi: use IMGFMT_RGB0wm42013-11-051-1/+1
| | | | | More correct, might make things slightly faster (probably insignificant).
* video: make IMGFMT_RGB0 etc. exist even if libavutil doesn't support itwm42013-11-053-27/+36
| | | | | | | | These formats are helpful for distinguishing surfaces with and without alpha. Unfortunately, Libav and older version of FFmpeg don't support them, so code will break. Fix this by treating these formats specially on the mpv side, mapping them to RGBA on Libav, and unseting the alpha bit in the mp_imgfmt_desc struct.
* vo_xv: fix compilation of SHM not availablewm42013-11-051-1/+1
|