diff options
author | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2019-08-18 13:09:58 +0200 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2019-08-19 17:26:55 +0000 |
commit | 13e369aad64260c4f08972db1c6bb3256f2a4352 (patch) | |
tree | 251a9d8830c79c8cd3c199078f188399fff79af4 /gst-libs/gst/vaapi/gstvaapiprofilecaps.c | |
parent | 6f61252f9d28080469eb19252eca8e3d1fc89283 (diff) |
libs: profilecaps: refactor common code
Diffstat (limited to 'gst-libs/gst/vaapi/gstvaapiprofilecaps.c')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiprofilecaps.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiprofilecaps.c b/gst-libs/gst/vaapi/gstvaapiprofilecaps.c index 83dc712b..fcd6981f 100644 --- a/gst-libs/gst/vaapi/gstvaapiprofilecaps.c +++ b/gst-libs/gst/vaapi/gstvaapiprofilecaps.c @@ -75,6 +75,22 @@ append_caps (GstVaapiContext * context, GstStructure * structure) return TRUE; } +static gboolean +append_caps_with_context_info (GstVaapiDisplay * display, + GstVaapiContextInfo * cip, GstStructure * structure) +{ + GstVaapiContext *context; + gboolean ret; + + context = create_context (display, cip); + if (!context) + return FALSE; + + ret = append_caps (context, structure); + gst_vaapi_object_unref (context); + return ret; +} + /** * gst_vaapi_decoder_add_profile_caps: * @display: a #GstVaapiDisplay @@ -92,22 +108,14 @@ gboolean gst_vaapi_profile_caps_append_decoder (GstVaapiDisplay * display, GstVaapiProfile profile, GstStructure * structure) { - GstVaapiContext *context; GstVaapiContextInfo cip = { GST_VAAPI_CONTEXT_USAGE_DECODE, profile, GST_VAAPI_ENTRYPOINT_VLD, 0, }; - gboolean ret; g_return_val_if_fail (display != NULL, FALSE); g_return_val_if_fail (structure != NULL, FALSE); - context = create_context (display, &cip); - if (!context) - return FALSE; - - ret = append_caps (context, structure); - gst_vaapi_object_unref (context); - return ret; + return append_caps_with_context_info (display, &cip, structure); } /** @@ -129,20 +137,12 @@ gst_vaapi_profile_caps_append_encoder (GstVaapiDisplay * display, GstVaapiProfile profile, GstVaapiEntrypoint entrypoint, GstStructure * structure) { - GstVaapiContext *context; GstVaapiContextInfo cip = { GST_VAAPI_CONTEXT_USAGE_ENCODE, profile, entrypoint, 0, }; - gboolean ret; g_return_val_if_fail (display != NULL, FALSE); g_return_val_if_fail (structure != NULL, FALSE); - context = create_context (display, &cip); - if (!context) - return FALSE; - - ret = append_caps (context, structure); - gst_vaapi_object_unref (context); - return ret; + return append_caps_with_context_info (display, &cip, structure); } |