Asset.request_async


Description:

[ CCode ( cname = "ges_asset_request_async" , has_construct_function = false , type = "void" ) ]
public async Asset.request_async (Type extractable_type, string? id, Cancellable? cancellable) throws Error

Requests an asset with the given properties asynchronously (see Asset.request).

When the asset has been initialized or fetched from the cache, the given callback function will be called. The asset can then be retrieved in the callback using the Asset.request_async.end method on the given AsyncResult.

Note that the source object passed to the callback will be the Asset corresponding to the request, but it may not have loaded correctly and therefore can not be used as is. Instead, Asset.request_async.end should be used to fetch a usable asset, or indicate that an error occurred in the asset's creation.

Note that the callback will be called in the MainLoop running under the same MainContext that init was called in. So, if you wish the callback to be invoked outside the default MainContext, you can call push_thread_default in a new thread before calling init.

Example of an asynchronous asset request: ``` c // The request callback static void asset_loaded_cb (GESAsset * source, GAsyncResult * res, gpointer user_data) { GESAsset *asset; GError *error = NULL;

asset = ges_asset_request_finish (res, &error); if (asset) { gst_print ("The file: s is usable as a GESUriClip", ges_asset_get_id (asset)); } else { gst_print ("The file: s is *not* usable as a GESUriClip because: s", ges_asset_get_id (source), error->message); }

gst_object_unref (asset); }

// The request: ges_asset_request_async (GES_TYPE_URI_CLIP, some_uri, NULL, (GAsyncReadyCallback) asset_loaded_cb, user_data); ```

Parameters:

extractable_type

The extractable_type of the asset

id

The id of the asset

cancellable

An object to allow cancellation of the asset request, or null to ignore

callback

A function to call when the initialization is finished

user_data

Data to be passed to callback




2022 vala-language.org