mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 10:10:32 +00:00
vaapidecode: move GstCapsFeatures near to its use
Move the handling of the GstCapsFeatures just after it is used, in order to avoid handling its memory.
This commit is contained in:
parent
3531dfa35e
commit
eb911e9eab
1 changed files with 14 additions and 21 deletions
|
@ -240,14 +240,14 @@ gst_vaapidecode_update_src_caps (GstVaapiDecode * decode)
|
||||||
GstCaps *templ;
|
GstCaps *templ;
|
||||||
GstVideoCodecState *state, *ref_state;
|
GstVideoCodecState *state, *ref_state;
|
||||||
GstVaapiCapsFeature feature;
|
GstVaapiCapsFeature feature;
|
||||||
GstCapsFeatures *features = NULL;
|
GstCapsFeatures *features;
|
||||||
GstCaps *allocation_caps;
|
GstCaps *allocation_caps;
|
||||||
GstVideoInfo *vi;
|
GstVideoInfo *vi;
|
||||||
GstVideoFormat format;
|
GstVideoFormat format;
|
||||||
GstClockTime latency;
|
GstClockTime latency;
|
||||||
gint fps_d, fps_n;
|
gint fps_d, fps_n;
|
||||||
guint width, height;
|
guint width, height;
|
||||||
const gchar *format_str;
|
const gchar *format_str, *feature_str;
|
||||||
|
|
||||||
if (!decode->input_state)
|
if (!decode->input_state)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -276,20 +276,6 @@ gst_vaapidecode_update_src_caps (GstVaapiDecode * decode)
|
||||||
(&decode->decoded_info)), gst_video_format_to_string (format));
|
(&decode->decoded_info)), gst_video_format_to_string (format));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (feature) {
|
|
||||||
case GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META:
|
|
||||||
features =
|
|
||||||
gst_caps_features_new
|
|
||||||
(GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, NULL);
|
|
||||||
break;
|
|
||||||
case GST_VAAPI_CAPS_FEATURE_VAAPI_SURFACE:
|
|
||||||
features =
|
|
||||||
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, NULL);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
width = decode->display_width;
|
width = decode->display_width;
|
||||||
height = decode->display_height;
|
height = decode->display_height;
|
||||||
|
|
||||||
|
@ -303,18 +289,25 @@ gst_vaapidecode_update_src_caps (GstVaapiDecode * decode)
|
||||||
if (!state
|
if (!state
|
||||||
|| GST_VIDEO_INFO_WIDTH (&state->info) == 0
|
|| GST_VIDEO_INFO_WIDTH (&state->info) == 0
|
||||||
|| GST_VIDEO_INFO_HEIGHT (&state->info) == 0) {
|
|| GST_VIDEO_INFO_HEIGHT (&state->info) == 0) {
|
||||||
if (features)
|
|
||||||
gst_caps_features_free (features);
|
|
||||||
if (state)
|
if (state)
|
||||||
gst_video_codec_state_unref (state);
|
gst_video_codec_state_unref (state);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
vi = &state->info;
|
vi = &state->info;
|
||||||
|
|
||||||
state->caps = gst_video_info_to_caps (vi);
|
state->caps = gst_video_info_to_caps (vi);
|
||||||
if (features)
|
|
||||||
gst_caps_set_features (state->caps, 0, features);
|
switch (feature) {
|
||||||
|
case GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META:
|
||||||
|
case GST_VAAPI_CAPS_FEATURE_VAAPI_SURFACE:{
|
||||||
|
feature_str = gst_vaapi_caps_feature_to_string (feature);
|
||||||
|
features = gst_caps_features_new (feature_str, NULL);
|
||||||
|
gst_caps_set_features (state->caps, 0, features);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocation query is different from pad's caps */
|
/* Allocation query is different from pad's caps */
|
||||||
allocation_caps = NULL;
|
allocation_caps = NULL;
|
||||||
|
|
Loading…
Reference in a new issue