From 87925a72dab8adc417e4afca1b346709537c6bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Mon, 21 Jan 2019 11:53:44 +0100 Subject: [PATCH] uri-asset: Add ges_uri_clip_asset_finish to get better introspection Vala requires a matching _finish function to correctly bind the method with the right finish method. --- ges/ges-uri-asset.c | 33 +++++++++++++++++++++++++++++---- ges/ges-uri-asset.h | 2 ++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/ges/ges-uri-asset.c b/ges/ges-uri-asset.c index b314bcd26d..bb8d8c12dd 100644 --- a/ges/ges-uri-asset.c +++ b/ges/ges-uri-asset.c @@ -525,7 +525,7 @@ ges_uri_clip_asset_is_image (GESUriClipAsset * self) * GError *error = NULL; * GESUriClipAsset *filesource_asset; * - * filesource_asset = GES_URI_CLIP_ASSET (ges_asset_request_finish (res, &error)); + * filesource_asset = ges_uri_clip_asset_finish (res, &error); * if (filesource_asset) { * g_print ("The file: %s is usable as a FileSource, it is%s an image and lasts %" GST_TIME_FORMAT, * ges_asset_get_id (GES_ASSET (filesource_asset)) @@ -551,17 +551,42 @@ ges_uri_clip_asset_new (const gchar * uri, GCancellable * cancellable, callback, user_data); } + +/** + * ges_uri_clip_asset_finish: + * @res: The #GAsyncResult from which to get the newly created #GESUriClipAsset + * @error: An error to be set in case something wrong happens or %NULL + * + * Finalize the request of an async #GESUriClipAsset + * + * Returns: (transfer full): The #GESUriClipAsset previously requested + */ +GESUriClipAsset * +ges_uri_clip_asset_finish (GAsyncResult * res, GError ** error) +{ + GESAsset *asset; + + g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL); + + asset = ges_asset_request_finish (res, error); + if (asset != NULL) { + return GES_URI_CLIP_ASSET (asset); + } + + return NULL; +} + /** * ges_uri_clip_asset_request_sync: * @uri: The URI of the file for which to create a #GESUriClipAsset. * You can also use multi file uris for #GESMultiFileSource. - * @error: (allow-none): An error to be set in case something wrong happens or %NULL + * @error: An error to be set in case something wrong happens or %NULL * * Creates a #GESUriClipAsset for @uri syncronously. You should avoid * to use it in application, and rather create #GESUriClipAsset asynchronously * - * Returns: (transfer none) (nullable): A reference to the requested asset or - * %NULL if an error happened + * Returns: (transfer full): A reference to the requested asset or %NULL if + * an error happened */ GESUriClipAsset * ges_uri_clip_asset_request_sync (const gchar * uri, GError ** error) diff --git a/ges/ges-uri-asset.h b/ges/ges-uri-asset.h index d1c041f7d6..abed2da11b 100644 --- a/ges/ges-uri-asset.h +++ b/ges/ges-uri-asset.h @@ -80,6 +80,8 @@ void ges_uri_clip_asset_new (const gchar *uri, GAsyncReadyCallback callback, gpointer user_data); GES_API +GESUriClipAsset * ges_uri_clip_asset_finish (GAsyncResult * res, GError ** error); +GES_API GESUriClipAsset* ges_uri_clip_asset_request_sync (const gchar *uri, GError **error); GES_API void ges_uri_clip_asset_class_set_timeout (GESUriClipAssetClass *klass,