Compare commits

...

4 commits

Author SHA1 Message Date
Edward Hervey 0d70e94c1b Merge branch 'alloc-params-serialization' into 'main'
gstvalue: Add a GstAllocationParams to String conversion

See merge request gstreamer/gstreamer!6714
2024-04-27 14:48:33 +00:00
Nirbheek Chauhan d7eeb62f38 meson: Fix Python library searching on Windows
Neither LIBDIR nor LIBPL are set with the native windows Python
(unlike MSYS2), so we need to use `prefix` which takes us to the
rootdir of the Python installation.

The name is also different: it's python312.dll, not python3.12.dll.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6734>
2024-04-27 01:30:21 +00:00
Nirbheek Chauhan 753aeccde7 meson: Fix Python library name fetching on Windows
`python.get_variable('FOO', [])` becomes `python.get_variable('FOO')`
due to how Meson treats empty arrays in arguments, which breaks the
fallback feature of get_variable().

So we need to actually check whether the variable exists before trying
to fetch it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6734>
2024-04-27 01:30:21 +00:00
Edward Hervey 7f37f45708 gstvalue: Add a GstAllocationParams to String conversion
Avoids ending up with plenty of warnings when serializing GstStructure
containing GstAllocationParams
2024-04-23 11:04:39 +02:00
4 changed files with 51 additions and 16 deletions

View file

@ -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')

View file

@ -80,7 +80,7 @@ static const gchar *_quark_strings[] = {
"GstEventInstantRateChange",
"GstEventInstantRateSyncTime", "GstMessageInstantRateRequest",
"upstream-running-time", "base", "offset", "plugin-api", "plugin-api-flags",
"gap-flags", "GstQuerySelectable", "selectable"
"gap-flags", "GstQuerySelectable", "selectable", "GstAllocationParams"
};
GQuark _priv_gst_quark_table[GST_QUARK_MAX];

View file

@ -233,7 +233,8 @@ typedef enum _GstQuarkId
GST_QUARK_GAP_FLAGS = 202,
GST_QUARK_QUERY_SELECTABLE = 203,
GST_QUARK_SELECTABLE = 204,
GST_QUARK_MAX = 205
GST_QUARK_ALLOCATION_PARAMS = 205,
GST_QUARK_MAX = 206
} GstQuarkId;
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];

View file

@ -8043,6 +8043,25 @@ gst_value_compare_allocation_params (const GValue * value1,
return GST_VALUE_UNORDERED;
}
static void
gst_value_transform_allocation_params_string (const GValue * value1,
GValue * dest_value)
{
GstAllocationParams *params = value1->data[0].v_pointer;
gchar *res;
GstStructure *s;
s = gst_structure_new_id (GST_QUARK (ALLOCATION_PARAMS),
GST_QUARK (FLAGS), GST_TYPE_MEMORY_FLAGS, params->flags,
GST_QUARK (ALIGN), G_TYPE_UINT64, params->align,
GST_QUARK (PREFIX), G_TYPE_UINT64, params->prefix,
GST_QUARK (PADDING), G_TYPE_UINT64, params->padding, NULL);
res = gst_structure_to_string (s);
gst_structure_free (s);
dest_value->data[0].v_pointer = res;
}
/************
* GObject *
@ -8398,6 +8417,8 @@ _priv_gst_value_initialize (void)
gst_value_transform_flagset_string);
g_value_register_transform_func (G_TYPE_STRING, GST_TYPE_FLAG_SET,
gst_value_transform_string_flagset);
g_value_register_transform_func (GST_TYPE_ALLOCATION_PARAMS, G_TYPE_STRING,
gst_value_transform_allocation_params_string);
/* Only register intersection functions for *different* types.
* Identical type intersection should be specified directly in