mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
657370a91c
Add two examples to demonstrate "draw-on-shared-texture" use cases. d3d11videosink will draw application's own texture without copy by using: - Enable "draw-on-shared-texture" property - make use of "begin-draw" and "draw" signals And then, application will render the shared application's texture to swapchain's backbuffer by using 1) Direct3D11 APIs 2) Or, Direct3D9Ex + interop APIs Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1873>
63 lines
No EOL
2 KiB
C
63 lines
No EOL
2 KiB
C
/*
|
|
* GStreamer
|
|
* Copyright (C) 2020 Seungha Yang <seungha@centricular.com>
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Library General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library 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
|
|
* Library General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Library General Public
|
|
* License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
* Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#include <gst/gst.h>
|
|
#include <windows.h>
|
|
#include <d3d11.h>
|
|
#include <dxgi1_2.h>
|
|
|
|
typedef struct
|
|
{
|
|
struct {
|
|
FLOAT x;
|
|
FLOAT y;
|
|
FLOAT z;
|
|
} position;
|
|
struct {
|
|
FLOAT x;
|
|
FLOAT y;
|
|
} texture;
|
|
} VertexData;
|
|
|
|
HRESULT
|
|
prepare_d3d11_device (ID3D11Device ** d3d11_device,
|
|
ID3D11DeviceContext ** d3d11_context,
|
|
IDXGIFactory2 ** dxgi_factory);
|
|
|
|
HRESULT
|
|
prepare_shared_texture (ID3D11Device * d3d11_device,
|
|
guint width,
|
|
guint height,
|
|
DXGI_FORMAT format,
|
|
UINT misc_flags,
|
|
ID3D11Texture2D ** texture,
|
|
ID3D11ShaderResourceView ** srv,
|
|
IDXGIKeyedMutex ** keyed_mutex,
|
|
HANDLE * shared_handle);
|
|
|
|
HRESULT
|
|
prepare_shader (ID3D11Device * d3d11_device,
|
|
ID3D11DeviceContext * context,
|
|
ID3D11SamplerState ** sampler,
|
|
ID3D11PixelShader ** ps,
|
|
ID3D11VertexShader ** vs,
|
|
ID3D11InputLayout ** layout,
|
|
ID3D11Buffer ** vertex,
|
|
ID3D11Buffer ** index); |