summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* vo_opengl, vo_rpi: unbreak a few thingswm42016-02-243-4/+4
| | | | | Commit 2f562825 didn't remove the "color" declaration for these. Since the shader header already declares it, shader compilation broke.
* vo_opengl: declare vec4 color inside fragment shader stubNiklas Haas2016-02-233-43/+27
| | | | | | Why was this done so stupidly, with so many complicated special cases, before? Declare it once so the shader bits don't have to figure out where and when to do so themselves.
* vo_opengl: set uniform variable "pixel_size"igv2016-02-221-0/+2
| | | | | pixel_size is often used variable, also reciprocal is a costly operation for AMD and older nVidia (prior to Kepler) GPUs.
* vo_opengl: set the correct size of the input imageigv2016-02-221-2/+2
|
* vo_x11: add 16bpp supportGusar3212016-02-221-0/+1
|
* vd_lavc: simplify hwdec pixfmt checkwm42016-02-201-1/+1
| | | | | Instead of checking whether the format is a hwaccel format, check whether it's the exact format we've requested for hardware decoding.
* dxva2: fix autoprobingwm42016-02-191-1/+6
| | | | | | | | | | | Doing --hwdec=auto ends up picking dxva2, creating a decoder, and then sending D3D frames down the video chain, which immediately fails and falls back to software. Consider dxva2 only if the VO provides a context. If this fails, autoprobing will proceed to try dxva2-copy as usual. Fixes #2844.
* video: allow the decoder to consume packets partiallywm42016-02-192-2/+9
| | | | | | | | | | | | | | | | | | | | This is in preparation for a hypothetical API change in libavcodec, which would allow the decoder to return multiple video frames before accepting a new input packet. In theory, the body of the if() added to vd_lavc.c could be replaced with this code: packet->buffer += ret; packet->len -= ret; but currently this is not needed, as libavformat already outputs one frame per packet. Also, using libavcodec this way could lead to a "deadlock" if the decoder refuses to consume e.g. garbage padding, so enabling this now would introduce bugs. (Adding this now for easier testing, and for symmetry with the audio code.)
* video: move packet timestamp fudgingwm42016-02-191-9/+8
| | | | | | | | | | There is some strange code which sets the DTS of the packet to PTS (but only if it's not AVI), which apparently helps with timestamp determination with some broken files. This code is annoying because it tries to avoid mutating the packet (which it logically doesn't own). Move it to where it does and get rid of the packet_copy mess. Needed for the following commit.
* video: move unreliable-packet-PTS checkwm42016-02-191-5/+8
| | | | | | | This tries to determine whether packet PTS values are accurate and can be used for frame dropping during seeking. Move both checks (PTS is missing; PTs is non-monotonic) to the earliest place where they can be done.
* dxva2: fix shared surface typeJames Ross-Gowan2016-02-191-22/+22
| | | | | | | | | | | The WGL_NV_DX_interop spec says that a shared IDirect3DSurface9 must not be lockable, but off-screen plain surfaces are always lockable and using them causes Nvidia drivers to crash. Use a rendertarget for the shared surface instead. This also changes the name of the DX_interop handle for the rendertarget to match the name of the DirectX object (rather than the GL one) to match the convention used in context_dxinterop.c.
* vo_opengl: use correct gl_target variablewm42016-02-181-2/+2
| | | | | p->gl_target and plane->gl_target are always the same value here, but semantically plane->gl_target is the correct one.
* vo_opengl: don't use normalized coords for debanding rectangle textureswm42016-02-181-1/+2
| | | | Fixes #2831.
* vo_opengl: pass the correct target to deband functionswm42016-02-181-4/+4
| | | | | | | | Apple crap (namely hardware decoding interop) forces us to use rectangle textures for input. But after that we continue with normal textures. This was not considered for debanding, and the sampler type used for it can be different depending on the exact render chain. Simply use the target type of the input texture.
* wscript: remove dxva2-dxinterop configure testKevin Mitchell2016-02-171-2/+2
| | | | Wasn't really necessary as it was equivalent to gl-dxinterop.
* vo_opengl: dxinterop: add dxva2 passthroughKevin Mitchell2016-02-173-0/+229
| | | | | Use dxva2 surface to fill RGB IDirect3DSurface9 shared with opengl via DXRegisterObjectNV.
* dxva2: add interop (non-copyback) hwdec_typeKevin Mitchell2016-02-173-4/+19
| | | | | This always falls back to software decoding right now. VO support will be added in future commits.
* vo_opengl: dxinterop: improve error messagesKevin Mitchell2016-02-171-21/+37
| | | | | | | * use mp_HRESULT_to_str/mp_LastError_to_str * make some messages non-identical * replace "GL" -> "OpenGL" * change some MP_FATAL to MP_ERR that don't actually kill the vo
* dxva2: avoid using AV_PIX_FMT_P010 directlywm42016-02-171-3/+4
| | | | | | | The new code is essentially equivalent, but compiles against older ffmpeg. Fixes #2832.
* dxva2: use mp_HESULT_to_str on FAILED(hr)Kevin Mitchell2016-02-161-11/+20
|
* dxva2: use mp_image_pool_get_no_alloc for decoder imagesKevin Mitchell2016-02-161-1/+2
| | | | | This makes it more explicit that the pool doesn't ever actually do any allocating itself.
* dxva2: check for failure of mp_image_new_custom_refKevin Mitchell2016-02-161-5/+8
| | | | previously, this may have caused a leak
* dxva2: another attempt at using mp_image poolKevin Mitchell2016-02-163-81/+46
| | | | | | | | | | Apparently, some drivers require you to allocate all of the decoder d3d surfaces at once. This commit changes the strategy from allocating surfaces as needed via mp_image_pool_set_allocator, to allocating all the surfaces in one call to IDirectXVideoDecoderService_CreateSurface and adding them to the pool with mp_image_pool_add. fixes #2822
* mp_image_pool: add mp_image_pool_addKevin Mitchell2016-02-162-4/+11
| | | | | | Provide a way for the user to add mp_images to the pool. This is required for dxva2, for which using set_allocator is extremely awkward since all the d3d9 surfaces must be allocated in advance and all together.
* dxva2: fix license on some newly added files to lgpl v2.1+Kevin Mitchell2016-02-162-14/+14
| | | | | | I mistakenly copied the wrong license text into these files when I created them. Since I'm the only one to have touched these files, it should be OK to change them.
* Rewrite ordered chapters and timeline stuffwm42016-02-152-7/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This uses a different method to piece segments together. The old approach basically changes to a new file (with a new start offset) any time a segment ends. This meant waiting for audio/video end on segment end, and then changing to the new segment all at once. It had a very weird impact on the playback core, and some things (like truly gapless segment transitions, or frame backstepping) just didn't work. The new approach adds the demux_timeline pseudo-demuxer, which presents an uniform packet stream from the many segments. This is pretty similar to how ordered chapters are implemented everywhere else. It also reminds of the FFmpeg concat pseudo-demuxer. The "pure" version of this approach doesn't work though. Segments can actually have different codec configurations (different extradata), and subtitles are most likely broken too. (Subtitles have multiple corner cases which break the pure stream-concatenation approach completely.) To counter this, we do two things: - Reinit the decoder with each segment. We go as far as allowing concatenating files with completely different codecs for the sake of EDL (which also uses the timeline infrastructure). A "lighter" approach would try to make use of decoder mechanism to update e.g. the extradata, but that seems fragile. - Clip decoded data to segment boundaries. This is equivalent to normal playback core mechanisms like hr-seek, but now the playback core doesn't need to care about these things. These two mechanisms are equivalent to what happened in the old implementation, except they don't happen in the playback core anymore. In other words, the playback core is completely relieved from timeline implementation details. (Which honestly is exactly what I'm trying to do here. I don't think ordered chapter behavior deserves improvement, even if it's bad - but I want to get it out from the playback core.) There is code duplication between audio and video decoder common code. This is awful and could be shareable - but this will happen later. Note that the audio path has some code to clip audio frames for the purpose of codec preroll/gapless handling, but it's not shared as sharing it would cause more pain than it would help.
* audio/video: expose codec info as separate fieldwm42016-02-153-8/+8
| | | | | Preparation for the timeline rewrite. The codec will be able to change, the stream header not.
* video: remove pointless parameter indirectionwm42016-02-152-3/+5
| | | | This is always the same value.
* vo_opengl_cb: unbreak destroying+recreating GL contextwm42016-02-151-2/+2
| | | | | | A client API user is allowed to call mpv_opengl_cb_uninit_gl() followed by mpv_opengl_cb_init_gl(). This crashed; fix it by fixing the lifetime of ctx->gl.
* dxva2: support HEVC Main 10wm42016-02-151-8/+35
|
* dxva2: use mp_image pool for d3d surfacesKevin Mitchell2016-02-143-131/+221
| | | | | | | | | | | | | This is required so that the individual surfaces can pass beyond the dxva2 decoder and be passed to the vo. This also adds additional data to mp_image->planes[0] for IMGFMT_DXVA2, which is required for maintaining and releasing the surface even if the decoder code is uninited. The IDirectXVideoDecoder itself is encapsulated together with its surface pool and configuration in a dxva2_decoder structure whose creation and destruction is managed by talloc.
* dxva2: remove unused structure membersKevin Mitchell2016-02-141-5/+1
|
* dxva2: streamline number of surface calculationKevin Mitchell2016-02-141-9/+2
| | | | | use hwdec_get_max_refs and put the "4 base work surfaces" into ADDITIONAL_SURFACES macro.
* mp_image: force display size to at least 1x1wm42016-02-121-2/+2
| | | | | | | | Don't allow rounding to let it underflow to 0. 0 width or height is simply not allowed and could cause problems otherwhere. Indirectly fixes CID 1350057, which complains about not checking the resulting output size values before using it in divisions.
* vo_opengl: unconfuse Coveritywm42016-02-121-1/+1
| | | | | | | | | It thinks that integer_conv_fbo[index] is implied to be accessed with up to index=5. Although that is theoretical only, it has a point that this makes no sense. Use the same constant for the array allocation, to make it more uniform and robust. Fixes CID 1350060.
* video: approximate AVI timestamps via DTS handlingwm42016-02-114-54/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now (and in mplayer traditionally), avi timestamps were handled with a timestamp FIFO. AVI timestamps are essentially just strictly increasing frame numbers and are not reordered like normal timestamps. Limiting the FIFO is required because frames can be dropped. To make it worse, frame dropping can't be distinguished from the decoder not returning output due to increasing the buffering required for B-frames. ("Measuring" the buffering at playback start seems like an interesting idea, but won't work as the buffering could be increased mid-playback.) Another problem are skipped frames (packets with data, but which do not contain a video frame). Besides dropped and skipped frames, there is the problem that we can't always know the delay. External decoders like MMAL are not going to tell us. (And later perhaps others, like direct VideoToolbox usage.) In general, this works not-well enough that I prefer the solution of passing through AVI timestamps as DTS. This is slightly incorrect, because most decoders treat DTS as mpeg-style timestamps, which already include a b-frame delay, and thus will be shifted by a few frames. This means there will be a problem with A/V sync in some situations. Note that the FFmpeg AVI demuxer shifts timestamps by an additional amount (which increases after the first seek!?!?), which makes the situation worse. It works well with VfW-muxed Matroska files, though. On RPI, the first X timestamps are broken until the MMAL decoder "locks on".
* Enable building the opengl-cb video renderer on AndroidJan Ekström2016-02-102-0/+26
| | | | | | * Add Android-specific OpenGL ES feature and checks * Add missing GL_* symbols for Android (list gathered by Ilya Zhuravlev <whatever@xyz.is>)
* player: fix crash if no video decoder can be initializedwm42016-02-101-0/+2
| | | | Caused by the recent refactoring for complex filters.
* vo_opengl_cb: do also not block when drawing nothingwm42016-02-091-1/+1
| | | | | | | The ctx->redrawing field signals whether flip_page() should block. Do not block if a black frame (i.e. nothing) is to be rendered. Also, frame==NULL can never happen.
* image_writer: take care of prediction_method deprecationwm42016-02-091-1/+3
| | | | | | | The field was recently deprecated, and you're supposed to set the private codec option instead. Not sure if this really works as intended.
* vo_opengl: vdpau: call glVDPAUFiniNV only if initializedwm42016-02-081-6/+8
| | | | This is "more correct". See #2798.
* wayland: set fs mode on every configureAlexander Preisinger2016-02-071-5/+6
| | | | | Check and set the fullscreen mode on every surface configure event. This prevents gnome from resizing mpvs fullscreen window to a smaller size.
* video/decode/dxva2.c: GUID_NULL conflictskwkam2016-02-061-1/+1
| | | | | | | GUID_NULL is defined in <ks.h> gcc 6.0 refuses to link the executable because of that Signed-off-by: wm4 <wm4@nowhere>
* vd_lavc: fix use after free in some hwdecsKevin Mitchell2016-02-061-8/+3
| | | | | | | | | | | | | | fd339e3f53996efd2dae9525990da433d1e1bf89 introduced a regression that caused segfault while uniniting dxva2 decoder (and possibly vdpau too). The problem was that it freed the avctx earlier, before calling the backend-specific uninit which referenced it. Revert some of the changes of that commit, and avoid calling flush by checking whether the codec is open instead. (Based on a PR by Kevin Mitchell.) Signed-off-by: wm4 <wm4@nowhere>
* build: make libavfilter mandatorywm42016-02-051-2/+0
| | | | | | The complex filter support that will be added makes much more complex use of libavfilter, and I'm not going to bother with adding hacks to keep libavfilter optional.
* vo_rpi: add geometry handlingUros Vampl2016-02-051-10/+59
| | | | | | This makes it possible to set video size and position using the --geometry and/or --autofit options. It's also possible to switch between fullscreen/non-fullscreen playback during runtime.
* vd_lavc: avoid calling flush on an unopened AVCodecContextwm42016-02-051-6/+9
| | | | | | | It can be "dangerous". In particular, the decoder might have failed to initialize, and is now in a broken state. avcodec_flush_buffers() is not expected to be called in this state, and could trigger undefined behavior.
* video: remove AVI timestamps for dropped frameswm42016-02-041-1/+5
| | | | | Might possible improve A/V sync, although this is at best approximate. (AVI is just fucked.)
* vd_lavc: remove redundant best_csp fieldwm42016-02-032-15/+3
| | | | And some other simplifications.
* vd_lavc: force microsecond timestamps on RPIwm42016-02-032-3/+9
| | | | | | | | | | Avoids "problems". In particular, it makes MMAL output a NOPTS timestamp if the input timestamp was NOPTS. Don't do it for other decoders. Ideally, we will at some point in the future switch to integer fractions for timestamps at least up until the filter layer. But this would be a larger change, and for now I'd prefer keeping the not-rounded demuxer timestamps (if we have them).
* w32_common: switch to UniformResourceLocatorWwm42016-02-021-3/+5
| | | | | | | | This is the "unicode" version of it. It appears Firefox uses it now? I'm not sure if we still need to support the old variant, but hopefully not. Fixes #2782.
* audio/video: merge decoder return valueswm42016-02-012-23/+18
| | | | | | Will be helpful for the coming filter support. I planned on merging audio/video decoding, but this will have to wait a bit longer, so only remove the duplicate status codes.
* vo_opengl: hwdec: use IDs for API, and log which backend is usedwm42016-02-017-17/+30
| | | | | | | Since there can be multiple backends for a single API (vaapi can use GLX or EGL), not logging the exact backend name is annoying. So add it. At the same time, there is no need to duplicate the name as used by the --hwdec options, so replace it with using the numeric hwdec API ID.
* x11: stop waiting for MapNotify when WM_STATE changesTracerneo2016-01-311-1/+3
| | | | Signed-off-by: wm4 <wm4@nowhere>
* vd_lavc: release surfaces before destroying decoderwm42016-01-301-4/+3
| | | | | | | | | | Commit b53cb8de added a delay queue for decoded frames. This is supposed to be used with copy-back decoders like dxva2-copy and vaapi-copy. Surfaces returned by them can't be referenced after uninitializing the decoders, so they have to be released before destroying the decoder. Move the flush_all() call above decoder uninit accordingly. Also move the destruction of the AVFrame used for decoding (just for being defensive - normally it doesn't hold any reference).
* vd_lavc: allow switching between hw/sw decoding any timewm42016-01-292-21/+34
| | | | | | | We just need to provide an entrypoint for it, and move the main init code to a separate function. This gets rid of the messy video chain full reinit in command.c, which completely destroyed and recreated the video state for the purpose of mid-stream hw/sw switching.
* vd_lavc: simplify an aspect of hwdec fallbackwm42016-01-292-10/+5
| | | | | | Don't give the "software_fallback_decoder" field special meaning. Alwass set it, and rename it to "decoder". Whether hw decoding is used is determined by the "hwdec" field already.
* video: fix broken-PTS fallback determinationwm42016-01-291-11/+6
| | | | | | | | | | This codes tries to deal with broken PTS timestamps, but since commit 271cabe6 it didn't always overwrite the previous timestamp as it should have. This mattered only if there were broken timestamps in the video stream. Also remove the pointless prev_codec_pts variables, since the decoder doesn't overwrite these fields anymore.
* rpi: add VC-1 supportwm42016-01-281-0/+1
| | | | | Oops, this was forgotten earlier. Enables automatic use of the VC-1 hardware decoder on RPI.
* mp_image: copy dts as part of mp_image attributes toowm42016-01-281-0/+1
| | | | | Fixes DTS handling with certain container formats broken in commit b53cb8de (when using vaapi-copy or dxva2-copy).
* rpi: add mpeg-4 decoding supportwm42016-01-271-0/+1
|
* vo_opengl: do chroma merging in integer conversion stagewm42016-01-271-3/+13
| | | | | | This is a huge win when playing yuv420p10 on ANGLE - the 2 conversion stages for planes 1 and 2 and the chroma merging stage are all merged into one.
* vo_opengl: add precision qualifier to usampler2D on ANGLEwm42016-01-271-1/+1
| | | | | | | | GLES requires this. Some more common sampler types have default precisions, but not usampler2D. Newer ANGLE builds verify this more strictly than older builds, so this wasn't caught before. Fixes #2761.
* vo_opengl: replace tscale-interpolates-only with interpolation-thresholdwm42016-01-272-9/+12
| | | | | The previous approach was too naive, and can e.g. ruin playback if scheduling switches e.g. between 1 and 2 vsync per frame.
* vo_opengl: support 10 bit support with ANGLEwm42016-01-263-10/+120