mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-05-11 04:52:42 +00:00
Compare commits
4 commits
7001351f0f
...
ff4bb302ef
Author | SHA1 | Date | |
---|---|---|---|
ff4bb302ef | |||
d7eeb62f38 | |||
753aeccde7 | |||
fb92af246f |
|
@ -441,12 +441,13 @@ gst_d3d12_encoder_src_query (GstVideoEncoder * encoder, GstQuery * query)
|
|||
}
|
||||
|
||||
static GstBufferPool *
|
||||
gst_d3d12_encoder_create_upload_pool (GstD3D12Encoder * self)
|
||||
gst_d3d12_encoder_create_upload_pool (GstD3D12Encoder * self,
|
||||
GstVideoFormat format)
|
||||
{
|
||||
auto priv = self->priv;
|
||||
GstVideoInfo info;
|
||||
|
||||
gst_video_info_set_format (&info, GST_VIDEO_FORMAT_NV12,
|
||||
gst_video_info_set_format (&info, format,
|
||||
priv->config.resolution.Width, priv->config.resolution.Height);
|
||||
auto caps = gst_video_info_to_caps (&info);
|
||||
auto pool = gst_d3d12_buffer_pool_new (self->device);
|
||||
|
@ -609,7 +610,7 @@ gst_d3d12_encoder_set_format (GstVideoEncoder * encoder,
|
|||
auto & resource_req = priv->resource_req;
|
||||
resource_req.Codec = klass->codec;
|
||||
resource_req.Profile = config.profile_desc;
|
||||
resource_req.InputFormat = DXGI_FORMAT_NV12;
|
||||
resource_req.InputFormat = config.encoder_format;
|
||||
resource_req.PictureTargetResolution = config.resolution;
|
||||
auto hr = video_device->CheckFeatureSupport
|
||||
(D3D12_FEATURE_VIDEO_ENCODER_RESOURCE_REQUIREMENTS,
|
||||
|
@ -628,7 +629,7 @@ gst_d3d12_encoder_set_format (GstVideoEncoder * encoder,
|
|||
}
|
||||
|
||||
auto device = gst_d3d12_device_get_device_handle (self->device);
|
||||
priv->format_info.Format = DXGI_FORMAT_NV12;
|
||||
priv->format_info.Format = config.encoder_format;
|
||||
hr = device->CheckFeatureSupport (D3D12_FEATURE_FORMAT_INFO,
|
||||
&priv->format_info, sizeof (priv->format_info));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
@ -686,7 +687,8 @@ gst_d3d12_encoder_set_format (GstVideoEncoder * encoder,
|
|||
resource_req.MaxEncoderOutputMetadataBufferSize,
|
||||
resolved_metadata_size, bitstream_size, ASYNC_DEPTH);
|
||||
|
||||
session->upload_pool = gst_d3d12_encoder_create_upload_pool (self);
|
||||
session->upload_pool = gst_d3d12_encoder_create_upload_pool (self,
|
||||
GST_VIDEO_INFO_FORMAT (&state->info));
|
||||
if (!session->upload_pool)
|
||||
return FALSE;
|
||||
|
||||
|
@ -1401,7 +1403,7 @@ gst_d3d12_encoder_handle_frame (GstVideoEncoder * encoder,
|
|||
|
||||
meta_in_args.EncoderCodec = klass->codec;
|
||||
meta_in_args.EncoderProfile = config.profile_desc;
|
||||
meta_in_args.EncoderInputFormat = DXGI_FORMAT_NV12;
|
||||
meta_in_args.EncoderInputFormat = config.encoder_format;
|
||||
meta_in_args.EncodedPictureEffectiveResolution = config.resolution;
|
||||
meta_in_args.HWLayoutMetadata.pBuffer = metadata.Get ();
|
||||
meta_in_args.HWLayoutMetadata.Offset = 0;
|
||||
|
|
|
@ -50,6 +50,7 @@ struct GstD3D12EncoderConfig
|
|||
D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR qvbr;
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL rate_control;
|
||||
guint max_subregions;
|
||||
DXGI_FORMAT encoder_format;
|
||||
};
|
||||
|
||||
enum GstD3D12EncoderSeiInsertMode
|
||||
|
|
|
@ -647,6 +647,7 @@ gst_d3d12_h264_enc_class_init (GstD3D12H264EncClass * klass, gpointer data)
|
|||
encoder_class->transform_meta =
|
||||
GST_DEBUG_FUNCPTR (gst_d3d12_h264_enc_transform_meta);
|
||||
|
||||
d3d12enc_class->codec = D3D12_VIDEO_ENCODER_CODEC_H264;
|
||||
d3d12enc_class->adapter_luid = cdata->luid;
|
||||
d3d12enc_class->device_id = cdata->device_id;
|
||||
d3d12enc_class->vendor_id = cdata->vendor_id;
|
||||
|
@ -1831,6 +1832,8 @@ gst_d3d12_h264_enc_new_sequence (GstD3D12Encoder * encoder,
|
|||
config->resolution.Width = GST_ROUND_UP_16 (info->width);
|
||||
config->resolution.Height = GST_ROUND_UP_16 (info->height);
|
||||
|
||||
config->encoder_format = DXGI_FORMAT_NV12;
|
||||
|
||||
priv->selected_profile = GST_H264_PROFILE_MAIN;
|
||||
priv->profile_h264 = D3D12_VIDEO_ENCODER_PROFILE_H264_MAIN;
|
||||
|
||||
|
|
2853
subprojects/gst-plugins-bad/sys/d3d12/gstd3d12h265enc.cpp
Normal file
2853
subprojects/gst-plugins-bad/sys/d3d12/gstd3d12h265enc.cpp
Normal file
File diff suppressed because it is too large
Load diff
33
subprojects/gst-plugins-bad/sys/d3d12/gstd3d12h265enc.h
Normal file
33
subprojects/gst-plugins-bad/sys/d3d12/gstd3d12h265enc.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2024 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include "gstd3d12.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gst_d3d12_h265_enc_register (GstPlugin * plugin,
|
||||
GstD3D12Device * device,
|
||||
ID3D12VideoDevice * video_device,
|
||||
guint rank);
|
||||
|
||||
G_END_DECLS
|
|
@ -12,6 +12,7 @@ d3d12_sources = [
|
|||
'gstd3d12h264dec.cpp',
|
||||
'gstd3d12h264enc.cpp',
|
||||
'gstd3d12h265dec.cpp',
|
||||
'gstd3d12h265enc.cpp',
|
||||
'gstd3d12ipc.cpp',
|
||||
'gstd3d12ipcclient.cpp',
|
||||
'gstd3d12ipcserver.cpp',
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "gstd3d12h264dec.h"
|
||||
#include "gstd3d12h264enc.h"
|
||||
#include "gstd3d12h265dec.h"
|
||||
#include "gstd3d12h265enc.h"
|
||||
#include "gstd3d12vp8dec.h"
|
||||
#include "gstd3d12vp9dec.h"
|
||||
#include "gstd3d12av1dec.h"
|
||||
|
@ -108,6 +109,8 @@ plugin_init (GstPlugin * plugin)
|
|||
|
||||
gst_d3d12_h264_enc_register (plugin, device, video_device.Get (),
|
||||
GST_RANK_NONE);
|
||||
gst_d3d12_h265_enc_register (plugin, device, video_device.Get (),
|
||||
GST_RANK_NONE);
|
||||
|
||||
gst_object_unref (device);
|
||||
}
|
||||
|
|
|
@ -45,35 +45,53 @@ pylib_loc = get_option('libpython-dir')
|
|||
fsmod = import('fs')
|
||||
pylib_prefix = 'lib'
|
||||
pylib_suffix = 'so'
|
||||
pylib_ver = python_dep.version()
|
||||
pylib_locs = []
|
||||
if host_system == 'windows'
|
||||
if cc.get_argument_syntax() == 'msvc'
|
||||
pylib_prefix = ''
|
||||
endif
|
||||
pylib_suffix = 'dll'
|
||||
pylib_ver = pylib_ver.replace('.', '')
|
||||
elif host_system == 'darwin'
|
||||
pylib_suffix = 'dylib'
|
||||
endif
|
||||
pylib_fnames = []
|
||||
# Library name with soversion, non-devel package
|
||||
pylib_fnames += python.get_variable('INSTSONAME', [])
|
||||
if python.has_variable('INSTSONAME')
|
||||
# For example, libpython3.12.so.1.0 (Linux), libpython3.11.dll.a (MSYS2), etc.
|
||||
pylib_fnames += python.get_variable('INSTSONAME')
|
||||
endif
|
||||
# Library name without soversion, devel package, framework, etc.
|
||||
pylib_fnames += python.get_variable('LDLIBRARY', [])
|
||||
if python.has_variable('LDLIBRARY')
|
||||
# For example, libpython3.12.so (Linux), libpython3.11.dll.a (MSYS2), etc.
|
||||
pylib_fnames += python.get_variable('LDLIBRARY')
|
||||
endif
|
||||
# Manually construct name as a fallback
|
||||
pylib_fnames += [
|
||||
pylib_prefix + 'python' + python_dep.version() + python_abi_flags + '.' + pylib_suffix
|
||||
pylib_prefix + 'python' + pylib_ver + python_abi_flags + '.' + pylib_suffix
|
||||
]
|
||||
if pylib_loc != ''
|
||||
pylib_locs = [pylib_loc]
|
||||
else
|
||||
pylib_locs = [
|
||||
python.get_variable('LIBDIR', ''),
|
||||
python.get_variable('LIBPL', ''),
|
||||
]
|
||||
if python.has_variable('LIBDIR')
|
||||
pylib_locs += python.get_variable('LIBDIR')
|
||||
endif
|
||||
if python.has_variable('LIBPL')
|
||||
pylib_locs += python.get_variable('LIBPL')
|
||||
endif
|
||||
# On Windows, python312.dll is in the rootdir where Python is installed,
|
||||
# which is configured as the "prefix" in sysconfig.
|
||||
if host_system == 'windows'
|
||||
pylib_locs += python.get_variable('prefix')
|
||||
endif
|
||||
endif
|
||||
pylib_fname = ''
|
||||
foreach loc: pylib_locs
|
||||
foreach fname: pylib_fnames
|
||||
if fsmod.exists(loc / fname)
|
||||
fpath = loc / fname
|
||||
debug(f'Looking for Python library at: @fpath@')
|
||||
if fsmod.exists(fpath)
|
||||
pylib_fname = fname
|
||||
message(f'PY_LIB_FNAME = @fname@ (@loc@)')
|
||||
break
|
||||
|
@ -81,12 +99,7 @@ foreach loc: pylib_locs
|
|||
endforeach
|
||||
endforeach
|
||||
if pylib_fname == ''
|
||||
error_msg = 'Could not find python library to load'
|
||||
if python_opt.enabled()
|
||||
error(error_msg)
|
||||
else
|
||||
message(error_msg)
|
||||
endif
|
||||
message('Could not find python library to load, will try loading at runtime')
|
||||
endif
|
||||
|
||||
pygi_override_dir = get_option('pygi-overrides-dir')
|
||||
|
|
Loading…
Reference in a new issue