Asset.request


Description:

[ CCode ( cname = "ges_asset_request" , has_construct_function = false ) ]
public Asset.request (Type extractable_type, string? id) throws Error

Returns an asset with the given properties.

If such an asset already exists in the cache (it has been previously created in GES), then a reference to the existing asset is returned. Otherwise, a newly created asset is returned, and also added to the cache.

If the requested asset has been loaded with an error, then throws is set, if given, and null will be returned instead.

Note that the given id may not be exactly the id that is set on the returned asset. For instance, it may be adjusted into a standard format. Or, if a Extractable type does not have its extraction parametrised, as is the case by default, then the given id may be ignored entirely and the id set to some standard, in which case a null id can be given.

Similarly, the given extractable_type may not be exactly the extractable_type that is set on the returned asset. Instead, the actual extractable type may correspond to a subclass of the given extractable_type, depending on the given id .

Moreover, depending on the given extractable_type, the returned asset may belong to a subclass of Asset.

Finally, if the requested asset has a proxy, then the proxy that is found at the end of the chain of proxies is returned (a proxy's proxy will take its place, and so on, unless it has no proxy).

Some asset subclasses only support asynchronous construction of its assets, such as UriClip. For such assets this method will fail, and you should use Asset.request_async instead. In the case of UriClip, you can use UriClipAsset.request_sync if you only want to wait for the request to finish.

Parameters:

extractable_type

The extractable_type of the asset

id

The id of the asset

Returns:

A reference to the requested asset, or null if an error occurred.