mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
vaapih264enc: update level in src caps
And, if downstream requests a specific level, the caps are not negotiated, because there is no mechanism right now to specify a custom level in the internal encoder.
This commit is contained in:
parent
3df5bfc06d
commit
9f627ef234
1 changed files with 13 additions and 7 deletions
|
@ -319,7 +319,12 @@ gst_vaapiencode_h264_set_config (GstVaapiEncode * base_encode)
|
||||||
stream_format = gst_structure_get_string (structure, "stream-format");
|
stream_format = gst_structure_get_string (structure, "stream-format");
|
||||||
encode->is_avc = (g_strcmp0 (stream_format, "avc") == 0);
|
encode->is_avc = (g_strcmp0 (stream_format, "avc") == 0);
|
||||||
|
|
||||||
if (profile != GST_VAAPI_PROFILE_UNKNOWN) {
|
if (gst_structure_has_field (structure, "level")) {
|
||||||
|
/* @TODO(victor): add a mechansim for user set a specific
|
||||||
|
* level */
|
||||||
|
GST_WARNING_OBJECT (encode, "cannot set level configuration");
|
||||||
|
ret = FALSE;
|
||||||
|
} else if (profile != GST_VAAPI_PROFILE_UNKNOWN) {
|
||||||
GST_INFO ("using %s profile as target decoder constraints",
|
GST_INFO ("using %s profile as target decoder constraints",
|
||||||
gst_vaapi_utils_h264_get_profile_string (profile));
|
gst_vaapi_utils_h264_get_profile_string (profile));
|
||||||
ret = gst_vaapi_encoder_h264_set_max_profile (encoder, profile);
|
ret = gst_vaapi_encoder_h264_set_max_profile (encoder, profile);
|
||||||
|
@ -346,7 +351,7 @@ fail:
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_compatible_profile (GstVaapiEncodeH264 * encode, GstCaps * caps,
|
set_compatible_profile (GstVaapiEncodeH264 * encode, GstCaps * caps,
|
||||||
GstVaapiProfile profile)
|
GstVaapiProfile profile, GstVaapiLevelH264 level)
|
||||||
{
|
{
|
||||||
GstCaps *allowed_caps, *tmp_caps;
|
GstCaps *allowed_caps, *tmp_caps;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
@ -380,7 +385,9 @@ retry:
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gst_caps_set_simple (caps, "profile", G_TYPE_STRING,
|
gst_caps_set_simple (caps, "profile", G_TYPE_STRING,
|
||||||
gst_vaapi_utils_h264_get_profile_string (profile), NULL);
|
gst_vaapi_utils_h264_get_profile_string (profile),
|
||||||
|
"level", G_TYPE_STRING, gst_vaapi_utils_h264_get_level_string (level),
|
||||||
|
NULL);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,6 +406,7 @@ gst_vaapiencode_h264_get_caps (GstVaapiEncode * base_encode)
|
||||||
GstVaapiEncoderH264 *const encoder =
|
GstVaapiEncoderH264 *const encoder =
|
||||||
GST_VAAPI_ENCODER_H264 (base_encode->encoder);
|
GST_VAAPI_ENCODER_H264 (base_encode->encoder);
|
||||||
GstVaapiProfile profile;
|
GstVaapiProfile profile;
|
||||||
|
GstVaapiLevelH264 level;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
caps = gst_caps_from_string (GST_CODEC_CAPS);
|
caps = gst_caps_from_string (GST_CODEC_CAPS);
|
||||||
|
@ -407,13 +415,11 @@ gst_vaapiencode_h264_get_caps (GstVaapiEncode * base_encode)
|
||||||
encode->is_avc ? "avc" : "byte-stream", NULL);
|
encode->is_avc ? "avc" : "byte-stream", NULL);
|
||||||
|
|
||||||
/* Update profile determined by encoder */
|
/* Update profile determined by encoder */
|
||||||
gst_vaapi_encoder_h264_get_profile_and_level (encoder, &profile, NULL);
|
gst_vaapi_encoder_h264_get_profile_and_level (encoder, &profile, &level);
|
||||||
if (profile != GST_VAAPI_PROFILE_UNKNOWN)
|
if (profile != GST_VAAPI_PROFILE_UNKNOWN)
|
||||||
set_compatible_profile (encode, caps, profile);
|
set_compatible_profile (encode, caps, profile, level);
|
||||||
|
|
||||||
GST_INFO_OBJECT (base_encode, "out caps %" GST_PTR_FORMAT, caps);
|
GST_INFO_OBJECT (base_encode, "out caps %" GST_PTR_FORMAT, caps);
|
||||||
|
|
||||||
/* XXX: update level information */
|
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue