diff options
Diffstat (limited to 'video')
112 files changed, 6336 insertions, 3482 deletions
diff --git a/video/csputils.c b/video/csputils.c index 69d3b80944..ffa1f82a6d 100644 --- a/video/csputils.c +++ b/video/csputils.c @@ -77,6 +77,7 @@ const struct m_opt_choice_alternatives mp_csp_trc_names[] = { {"gamma2.2", MP_CSP_TRC_GAMMA22}, {"gamma2.8", MP_CSP_TRC_GAMMA28}, {"prophoto", MP_CSP_TRC_PRO_PHOTO}, + {"st2084", MP_CSP_TRC_SMPTE_ST2084}, {0} }; @@ -170,6 +171,9 @@ enum mp_csp_trc avcol_trc_to_mp_csp_trc(int avtrc) case AVCOL_TRC_LINEAR: return MP_CSP_TRC_LINEAR; case AVCOL_TRC_GAMMA22: return MP_CSP_TRC_GAMMA22; case AVCOL_TRC_GAMMA28: return MP_CSP_TRC_GAMMA28; +#if HAVE_AVUTIL_ST2084 + case AVCOL_TRC_SMPTEST2084: return MP_CSP_TRC_SMPTE_ST2084; +#endif default: return MP_CSP_TRC_AUTO; } } @@ -213,12 +217,15 @@ int mp_csp_trc_to_avcol_trc(enum mp_csp_trc trc) { switch (trc) { // We just call it BT.1886 since we're decoding, but it's still BT.709 - case MP_CSP_TRC_BT_1886: return AVCOL_TRC_BT709; - case MP_CSP_TRC_SRGB: return AVCOL_TRC_IEC61966_2_1; - case MP_CSP_TRC_LINEAR: return AVCOL_TRC_LINEAR; - case MP_CSP_TRC_GAMMA22: return AVCOL_TRC_GAMMA22; - case MP_CSP_TRC_GAMMA28: return AVCOL_TRC_GAMMA28; - default: return AVCOL_TRC_UNSPECIFIED; + case MP_CSP_TRC_BT_1886: return AVCOL_TRC_BT709; + case MP_CSP_TRC_SRGB: return AVCOL_TRC_IEC61966_2_1; + case MP_CSP_TRC_LINEAR: return AVCOL_TRC_LINEAR; + case MP_CSP_TRC_GAMMA22: return AVCOL_TRC_GAMMA22; + case MP_CSP_TRC_GAMMA28: return AVCOL_TRC_GAMMA28; +#if HAVE_AVUTIL_ST2084 + case MP_CSP_TRC_SMPTE_ST2084: return AVCOL_TRC_SMPTEST2084; +#endif + default: return AVCOL_TRC_UNSPECIFIED; } } diff --git a/video/csputils.h b/video/csputils.h index 1d8d3b1d14..19dd88f145 100644 --- a/video/csputils.h +++ b/video/csputils.h @@ -78,6 +78,7 @@ enum mp_csp_trc { MP_CSP_TRC_GAMMA22, MP_CSP_TRC_GAMMA28, MP_CSP_TRC_PRO_PHOTO, + MP_CSP_TRC_SMPTE_ST2084, MP_CSP_TRC_COUNT }; diff --git a/video/d3d.h b/video/d3d.h deleted file mode 100644 index 30bee49adc..0000000000 --- a/video/d3d.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef MP_D3D_H_ -#define MP_D3D_H_ - -#include <d3d9.h> - -#include "hwdec.h" - -struct mp_d3d_ctx { - struct mp_hwdec_ctx hwctx; - IDirect3DDevice9 *d3d9_device; -}; - -#endif diff --git a/video/d3d11va.c b/video/d3d11va.c deleted file mode 100644 index a9be571e9c..0000000000 --- a/video/d3d11va.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "mp_image.h" -#include "d3d11va.h" - -struct d3d11va_surface { - HMODULE d3d11_dll; - ID3D11Texture2D *texture; - ID3D11VideoDecoderOutputView *surface; -}; - -ID3D11VideoDecoderOutputView *d3d11_surface_in_mp_image(struct mp_image *mpi) -{ - return mpi && mpi->imgfmt == IMGFMT_D3D11VA ? - (ID3D11VideoDecoderOutputView *)mpi->planes[3] : NULL; -} - -ID3D11Texture2D *d3d11_texture_in_mp_image(struct mp_image *mpi) -{ - if (!mpi || mpi->imgfmt != IMGFMT_D3D11VA) - return NULL; - struct d3d11va_surface *surface = (void *)mpi->planes[0]; - return surface->texture; -} - -static void d3d11va_release_img(void *arg) -{ - struct d3d11va_surface *surface = arg; - if (surface->surface) - ID3D11VideoDecoderOutputView_Release(surface->surface); - - if (surface->texture) - ID3D11Texture2D_Release(surface->texture); - - if (surface->d3d11_dll) - FreeLibrary(surface->d3d11_dll); - - talloc_free(surface); -} - -struct mp_image *d3d11va_new_ref(ID3D11VideoDecoderOutputView *view, - int w, int h) -{ - if (!view) - return NULL; - struct d3d11va_surface *surface = talloc_zero(NULL, struct d3d11va_surface); - - surface->d3d11_dll = LoadLibrary(L"d3d11.dll"); - if (!surface->d3d11_dll) - goto fail; - - surface->surface = view; - ID3D11VideoDecoderOutputView_AddRef(surface->surface); - ID3D11VideoDecoderOutputView_GetResource( - surface->surface, (ID3D11Resource **)&surface->texture); - - struct mp_image *mpi = mp_image_new_custom_ref( - &(struct mp_image){0}, surface, d3d11va_release_img); - if (!mpi) - abort(); - - mp_image_setfmt(mpi, IMGFMT_D3D11VA); - mp_image_set_size(mpi, w, h); - mpi->planes[0] = (void *)surface; - mpi->planes[3] = (void *)surface->surface; - - return mpi; -fail: - d3d11va_release_img(surface); - return NULL; -} diff --git a/video/d3d11va.h b/video/d3d11va.h deleted file mode 100644 index db2f295241..0000000000 --- a/video/d3d11va.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef MPV_D3D11_H -#define MPV_D3D11_H - -#include <d3d11.h> - -struct mp_image; - -ID3D11VideoDecoderOutputView *d3d11_surface_in_mp_image(struct mp_image *mpi); -ID3D11Texture2D *d3d11_texture_in_mp_image(struct mp_image *mpi); -struct mp_image *d3d11va_new_ref(ID3D11VideoDecoderOutputView *view, - int w, int h); - -#endif diff --git a/video/decode/d3d.c b/video/decode/d3d.c index 35d1af9243..b978472723 100644 --- a/video/decode/d3d.c +++ b/video/decode/d3d.c @@ -15,6 +15,8 @@ * License along with mpv. If not, see <http://www.gnu.org/licenses/>. */ +#include <pthread.h> + #include <libavcodec/avcodec.h> #include "lavc.h" @@ -48,7 +50,6 @@ DEFINE_GUID(DXVA2_ModeVP9_VLD_Profile0, 0x463707f8, 0xa1d0, 0x4585, 0x87 DEFINE_GUID(DXVA2_NoEncrypt, 0x1b81beD0, 0xa0c7, 0x11d3, |