encoding-profile: Add a way to specify a factory-name when specifying caps

In some cases you want to ensure that a specific element factory is used
while requiring some specific caps but this was not possible. You can
now do `qtmux:video/x-prores,variant=standard|factory-name=avenc_prores_ks`
to ensure that the `avenc_prores_ks` factory is used to produce the
'standard' variant of prores video stream.

This also enhances a bit the documentation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6875>
This commit is contained in:
Thibault Saunier 2024-05-17 09:32:19 -04:00 committed by GStreamer Marge Bot
parent f4fdae1ce0
commit 5be3f255b0
2 changed files with 57 additions and 9 deletions

View file

@ -2116,9 +2116,26 @@ container profile. If 0, it is not a mandatory stream</doc>
</parameters>
</method>
<method name="set_preset" c:identifier="gst_encoding_profile_set_preset">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.c">Sets the name of the #GstElement that implements the #GstPreset interface
to use for the profile.
This is the name that has been set when saving the preset.</doc>
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.c">Sets the name of the preset to be used in the profile.
This is the name that has been set when saving the preset.
You can list the available presets for a specific element factory
using `$ gst-inspect-1.0 element-factory-name`, for example for
`x264enc`:
``` bash
$ gst-inspect-1.0 x264enc
...
Presets:
"Profile Baseline": Baseline Profile
"Profile High": High Profile
"Profile Main": Main Profile
"Profile YouTube": YouTube recommended settings (https://support.google.com/youtube/answer/1722171)
"Quality High": High quality
"Quality Low": Low quality
"Quality Normal": Normal quality
"Zero Latency"
```
}</doc>
<source-position filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.h"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
@ -2135,7 +2152,9 @@ This is the name that has been set when saving the preset.</doc>
</parameters>
</method>
<method name="set_preset_name" c:identifier="gst_encoding_profile_set_preset_name">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.c">Sets the name of the #GstPreset's factory to be used in the profile.</doc>
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.c">Sets the name of the #GstPreset's factory to be used in the profile. This
is the name of the **element factory** that implements the #GstPreset interface not
the name of the preset itself (see #gst_encoding_profile_set_preset).</doc>
<source-position filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.h"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
@ -2146,7 +2165,7 @@ This is the name that has been set when saving the preset.</doc>
<type name="EncodingProfile" c:type="GstEncodingProfile*"/>
</instance-parameter>
<parameter name="preset_name" transfer-ownership="none" nullable="1" allow-none="1">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.c">The name of the preset to use in this @profile.</doc>
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/encoding-profile.c">The name of the element factory to use in this @profile.</doc>
<type name="utf8" c:type="const gchar*"/>
</parameter>
</parameters>
@ -3850,6 +3869,7 @@ Moreover, you can set the extra properties:
* `|single-segment=true` (See #gst_encoding_profile_set_single_segment)
* `|single-segment=true` (See
#gst_encoding_video_profile_set_variableframerate)
* `|factory-name=element-factory-name` (See #gst_encoding_profile_set_preset_name)
for example:

View file

@ -109,6 +109,7 @@
* * `|single-segment=true` (See #gst_encoding_profile_set_single_segment)
* * `|single-segment=true` (See
* #gst_encoding_video_profile_set_variableframerate)
* * `|factory-name=element-factory-name` (See #gst_encoding_profile_set_preset_name)
*
* for example:
*
@ -765,9 +766,26 @@ gst_encoding_profile_set_single_segment (GstEncodingProfile * profile,
* @profile: a #GstEncodingProfile
* @preset: (nullable): the element preset to use
*
* Sets the name of the #GstElement that implements the #GstPreset interface
* to use for the profile.
* Sets the name of the preset to be used in the profile.
* This is the name that has been set when saving the preset.
* You can list the available presets for a specific element factory
* using `$ gst-inspect-1.0 element-factory-name`, for example for
* `x264enc`:
*
* ``` bash
* $ gst-inspect-1.0 x264enc
* ...
* Presets:
* "Profile Baseline": Baseline Profile
* "Profile High": High Profile
* "Profile Main": Main Profile
* "Profile YouTube": YouTube recommended settings (https://support.google.com/youtube/answer/1722171)
* "Quality High": High quality
* "Quality Low": Low quality
* "Quality Normal": Normal quality
* "Zero Latency"
* ```
}
*/
void
gst_encoding_profile_set_preset (GstEncodingProfile * profile,
@ -782,9 +800,11 @@ gst_encoding_profile_set_preset (GstEncodingProfile * profile,
/**
* gst_encoding_profile_set_preset_name:
* @profile: a #GstEncodingProfile
* @preset_name: (nullable): The name of the preset to use in this @profile.
* @preset_name: (nullable): The name of the element factory to use in this @profile.
*
* Sets the name of the #GstPreset's factory to be used in the profile.
* Sets the name of the #GstPreset's factory to be used in the profile. This
* is the name of the **element factory** that implements the #GstPreset interface not
* the name of the preset itself (see #gst_encoding_profile_set_preset).
*/
void
gst_encoding_profile_set_preset_name (GstEncodingProfile * profile,
@ -1908,6 +1928,14 @@ create_encoding_stream_profile (gchar * serialized_profile,
single_segment = g_value_get_boolean (&v);
g_value_reset (&v);
} else if (!g_strcmp0 (propv[0], "factory-name")) {
if (factory_name) {
g_warning ("Multiple factory names specified");
g_strfreev (propv);
goto cleanup;
}
factory_name = g_strdup (propv[1]);
} else {
g_warning ("Unsupported property: %s", propv[0]);
g_strfreev (propv);