# GESAsset

A GESAsset in the GStreamer Editing Services represents a resources that can be used. In particular, any class that implements the GESExtractable interface may have some associated assets with a corresponding extractable-type, from which its objects can be extracted using ges_asset_extract. Some examples would be GESClip, GESFormatter and GESTrackElement.

All assets that are created within GES are stored in a cache; one per each id and extractable-type pair. These assets can be fetched, and initialized if they do not yet exist in the cache, using ges_asset_request.

    GESAsset *effect_asset;
    GESEffect *effect;

    // You create an asset for an effect
    effect_asset = ges_asset_request (GES_TYPE_EFFECT, "agingtv", NULL);

    // And now you can extract an instance of GESEffect from that asset
    effect = GES_EFFECT (ges_asset_extract (effect_asset));

The advantage of using assets, rather than simply creating the object directly, is that the currently loaded resources can be listed with ges_list_assets and displayed to an end user. For example, to show which media files have been loaded, and a standard list of effects. In fact, the GES library already creates assets for GESTransitionClip and GESFormatter, which you can use to list all the available transition types and supported formats.

The other advantage is that GESAsset implements GESMetaContainer, so metadata can be set on the asset, with some subclasses automatically creating this metadata on initiation.

For example, to display information about the supported formats, you could do the following:

        GList *formatter_assets, *tmp;

        //  List all  the transitions
        formatter_assets = ges_list_assets (GES_TYPE_FORMATTER);

        // Print some infos about the formatter GESAsset
        for (tmp = formatter_assets; tmp; tmp = tmp->next) {
          gst_print ("Name of the formatter: %s, file extension it produces: %s",
            ges_meta_container_get_string (
              GES_META_CONTAINER (tmp->data), GES_META_FORMATTER_NAME),
            ges_meta_container_get_string (
              GES_META_CONTAINER (tmp->data), GES_META_FORMATTER_EXTENSION));
        }

        g_list_free (transition_assets);

## ID

Each asset is uniquely defined in the cache by its extractable-type and id. Depending on the extractable-type, the id can be used to parametrise the creation of the object upon extraction. By default, a class that implements GESExtractable will only have a single associated asset, with an id set to the type name of its objects. However, this is overwritten by some implementations, which allow a class to have multiple associated assets. For example, for GESTransitionClip the id will be a nickname of the vtype. You should check the documentation for each extractable type to see if they differ from the default.

Moreover, each extractable-type may also associate itself with a specific asset subclass. In such cases, when their asset is requested, an asset of this subclass will be returned instead.

## Managing

You can use a GESProject to easily manage the assets of a GESTimeline.

## Proxies

Some assets can (temporarily) act as the proxy of another asset. When the original asset is requested from the cache, the proxy will be returned in its place. This can be useful if, say, you want to substitute a GESUriClipAsset corresponding to a high resolution media file with the asset of a lower resolution stand in.

An asset may even have several proxies, the first of which will act as its default and be returned on requests, but the others will be ordered to take its place once it is removed. You can add a proxy to an asset, or set its default, using ges_asset_set_proxy, and you can remove them with ges_asset_unproxy.

## GESAsset

    GObject
        ╰──GESAsset
            ╰──GESClipAsset
            ╰──GESProject
            ╰──GESTrackElementAsset

### Members

`parent` (GObject) –
No description available

### Class structure

#### GESAssetClass

##### Fields

`parent` (GObjectClass) –
No description available
`_ges_reserved` (gpointer *) –
No description available

### GES.AssetClass

##### Attributes

`parent` (GObject.ObjectClass) –
No description available
`_ges_reserved` ([ Object ]) –
No description available

### GES.AssetClass

##### Attributes

`parent` (GObject.ObjectClass) –
No description available
`_ges_reserved` ([ object ]) –
No description available

## GES.Asset

    GObject.Object
        ╰──GES.Asset
            ╰──GES.ClipAsset
            ╰──GES.Project
            ╰──GES.TrackElementAsset

### Members

`parent` (GObject.Object) –
No description available

## GES.Asset

    GObject.Object
        ╰──GES.Asset
            ╰──GES.ClipAsset
            ╰──GES.Project
            ╰──GES.TrackElementAsset

### Members

`parent` (GObject.Object) –
No description available

### Methods

#### ges_asset_extract

    GESExtractable *
    ges_asset_extract (GESAsset * self,
                       GError ** error)

Extracts a new extractable-type object from the asset. The id of the asset may determine the properties and state of the newly created object.

Parameters:

`self` –

The GESAsset to extract an object from

`error` ( [allow-none]) –

An error to be set in case something goes wrong, or NULL to ignore

Returns ( [transfer: floating]) –

A newly created object, or NULL if an error occurred.

#### GES.Asset.prototype.extract

    function GES.Asset.prototype.extract(): {
        // javascript wrapper for 'ges_asset_extract'
    }

Extracts a new extractable-type object from the asset. The id of the asset may determine the properties and state of the newly created object.

Parameters:

`self` (GES.Asset) –

The GES.Asset to extract an object from

Returns (GES.Extractable) –

A newly created object, or null if an error occurred.

#### GES.Asset.extract

    @raises(GLib.GError)
    def GES.Asset.extract (self):
        #python wrapper for 'ges_asset_extract'

Extracts a new extractable_type object from the asset. The id of the asset may determine the properties and state of the newly created object.

Parameters:

`self` (GES.Asset) –

The GES.Asset to extract an object from

Returns (GES.Extractable) –

A newly created object, or None if an error occurred.

#### ges_asset_get_error

    GError *
    ges_asset_get_error (GESAsset * self)

Retrieve the error that was set on the asset when it was loaded.

Parameters:

`self` –

A GESAsset

Returns ( [transfer: none][nullable]) –

The error set on asset, or NULL if no error occurred when asset was loaded.

Since : 1.8

#### GES.Asset.prototype.get_error

    function GES.Asset.prototype.get_error(): {
        // javascript wrapper for 'ges_asset_get_error'
    }

Retrieve the error that was set on the asset when it was loaded.

Parameters:

`self` (GES.Asset) –

A GES.Asset

Returns (GLib.Error) –

The error set on asset, or null if no error occurred when asset was loaded.

Since : 1.8

#### GES.Asset.get_error

    def GES.Asset.get_error (self):
        #python wrapper for 'ges_asset_get_error'

Retrieve the error that was set on the asset when it was loaded.

Parameters:

`self` (GES.Asset) –

A GES.Asset

Returns (GLib.Error) –

The error set on asset, or None if no error occurred when asset was loaded.

Since : 1.8

#### ges_asset_get_extractable_type

    GType
    ges_asset_get_extractable_type (GESAsset * self)

Gets the extractable-type of the asset.

Parameters:

`self` –

The GESAsset

Returns –

The extractable type of self.

#### GES.Asset.prototype.get_extractable_type

    function GES.Asset.prototype.get_extractable_type(): {
        // javascript wrapper for 'ges_asset_get_extractable_type'
    }

Gets the extractable-type of the asset.

Parameters:

`self` (GES.Asset) –

The GES.Asset

Returns (GObject.Type) –

The extractable type of self.

#### GES.Asset.get_extractable_type

    def GES.Asset.get_extractable_type (self):
        #python wrapper for 'ges_asset_get_extractable_type'

Gets the extractable_type of the asset.

Parameters:

`self` (GES.Asset) –

The GES.Asset

Returns (GObject.Type) –

The extractable type of self.

#### ges_asset_get_id

    const gchar *
    ges_asset_get_id (GESAsset * self)

Gets the id of the asset.

Parameters:

`self` –

A GESAsset

Returns –

The ID of self.

#### GES.Asset.prototype.get_id

    function GES.Asset.prototype.get_id(): {
        // javascript wrapper for 'ges_asset_get_id'
    }

Gets the id of the asset.

Parameters:

`self` (GES.Asset) –

A GES.Asset

Returns (String) –

The ID of self.

#### GES.Asset.get_id

    def GES.Asset.get_id (self):
        #python wrapper for 'ges_asset_get_id'

Gets the id of the asset.

Parameters:

`self` (GES.Asset) –

A GES.Asset

Returns (str) –

The ID of self.

#### ges_asset_get_proxy

    GESAsset *
    ges_asset_get_proxy (GESAsset * asset)

Gets the default proxy of the asset.

Parameters:

`asset` –

A GESAsset

Returns ( [transfer: none][nullable]) –

The default proxy of asset.

#### GES.Asset.prototype.get_proxy

    function GES.Asset.prototype.get_proxy(): {
        // javascript wrapper for 'ges_asset_get_proxy'
    }

Gets the default proxy of the asset.

Parameters:

`asset` (GES.Asset) –

A GES.Asset

Returns (GES.Asset) –

The default proxy of asset.

#### GES.Asset.get_proxy

    def GES.Asset.get_proxy (self):
        #python wrapper for 'ges_asset_get_proxy'

Gets the default proxy of the asset.

Parameters:

`asset` (GES.Asset) –

A GES.Asset

Returns (GES.Asset) –

The default proxy of asset.

#### ges_asset_get_proxy_target

    GESAsset *
    ges_asset_get_proxy_target (GESAsset * proxy)

Gets the proxy-target of the asset.

Note that the proxy target may have loaded with an error, so you should call ges_asset_get_error on the returned target.

Parameters:

`proxy` –

A GESAsset

Returns ( [transfer: none][nullable]) –

The asset that proxy is a proxy of.

#### GES.Asset.prototype.get_proxy_target

    function GES.Asset.prototype.get_proxy_target(): {
        // javascript wrapper for 'ges_asset_get_proxy_target'
    }

Gets the proxy-target of the asset.

Note that the proxy target may have loaded with an error, so you should call GES.Asset.prototype.get_error on the returned target.

Parameters:

`proxy` (GES.Asset) –

A GES.Asset

Returns (GES.Asset) –

The asset that proxy is a proxy of.

#### GES.Asset.get_proxy_target

    def GES.Asset.get_proxy_target (self):
        #python wrapper for 'ges_asset_get_proxy_target'

Gets the proxy_target of the asset.

Note that the proxy target may have loaded with an error, so you should call GES.Asset.get_error on the returned target.

Parameters:

`proxy` (GES.Asset) –

A GES.Asset

Returns (GES.Asset) –

The asset that proxy is a proxy of.

#### ges_asset_list_proxies

    GList *
    ges_asset_list_proxies (GESAsset * asset)

Get all the proxies that the asset has. The first item of the list will be the default proxy. The second will be the proxy that is 'next in line' to be default, and so on.

Parameters:

`asset` –

A GESAsset

Returns ( [element-typeGESAsset][transfer: none]) –

The list of proxies that asset has.

#### GES.Asset.prototype.list_proxies

    function GES.Asset.prototype.list_proxies(): {
        // javascript wrapper for 'ges_asset_list_proxies'
    }

Get all the proxies that the asset has. The first item of the list will be the default proxy. The second will be the proxy that is 'next in line' to be default, and so on.

Parameters:

`asset` (GES.Asset) –

A GES.Asset

Returns ([ GES.Asset ]) –

The list of proxies that asset has.

#### GES.Asset.list_proxies

    def GES.Asset.list_proxies (self):
        #python wrapper for 'ges_asset_list_proxies'

Get all the proxies that the asset has. The first item of the list will be the default proxy. The second will be the proxy that is 'next in line' to be default, and so on.

Parameters:

`asset` (GES.Asset) –

A GES.Asset

Returns ([ GES.Asset ]) –

The list of proxies that asset has.

#### ges_asset_set_proxy

    gboolean
    ges_asset_set_proxy (GESAsset * asset,
                         GESAsset * proxy)

Sets the proxy for the asset.

If proxy is among the existing proxies of the asset (see ges_asset_list_proxies) it will be moved to become the default proxy. Otherwise, if proxy is not NULL, it will be added to the list of proxies, as the new default. The previous default proxy will become 'next in line' for if the new one is removed, and so on. As such, this will **not** actually remove the previous default proxy (use ges_asset_unproxy for that).

Note that an asset can only act as a proxy for one other asset.

As a special case, if proxy is NULL, then this method will actually remove all proxies from the asset.

Parameters:

`asset` –

The GESAsset to proxy

`proxy` ( [allow-none]) –

A new default proxy for asset

Returns –

TRUE if proxy was successfully set as the default for asset.

#### GES.Asset.prototype.set_proxy

    function GES.Asset.prototype.set_proxy(proxy: GES.Asset): {
        // javascript wrapper for 'ges_asset_set_proxy'
    }

Sets the proxy for the asset.

If proxy is among the existing proxies of the asset (see GES.Asset.prototype.list_proxies) it will be moved to become the default proxy. Otherwise, if proxy is not null, it will be added to the list of proxies, as the new default. The previous default proxy will become 'next in line' for if the new one is removed, and so on. As such, this will **not** actually remove the previous default proxy (use GES.Asset.prototype.unproxy for that).

Note that an asset can only act as a proxy for one other asset.

As a special case, if proxy is null, then this method will actually remove all proxies from the asset.

Parameters:

`asset` (GES.Asset) –

The GES.Asset to proxy

`proxy` (GES.Asset) –

A new default proxy for asset

Returns (Number) –

true if proxy was successfully set as the default for asset.

#### GES.Asset.set_proxy

    def GES.Asset.set_proxy (self, proxy):
        #python wrapper for 'ges_asset_set_proxy'

Sets the proxy for the asset.

If proxy is among the existing proxies of the asset (see GES.Asset.list_proxies) it will be moved to become the default proxy. Otherwise, if proxy is not None, it will be added to the list of proxies, as the new default. The previous default proxy will become 'next in line' for if the new one is removed, and so on. As such, this will **not** actually remove the previous default proxy (use GES.Asset.unproxy for that).

Note that an asset can only act as a proxy for one other asset.

As a special case, if proxy is None, then this method will actually remove all proxies from the asset.

Parameters:

`asset` (GES.Asset) –

The GES.Asset to proxy

`proxy` (GES.Asset) –

A new default proxy for asset

Returns (bool) –

True if proxy was successfully set as the default for asset.

#### ges_asset_unproxy

    gboolean
    ges_asset_unproxy (GESAsset * asset,
                       GESAsset * proxy)

Removes the proxy from the available list of proxies for the asset. If the given proxy is the default proxy of the list, then the next proxy in the available list (see ges_asset_list_proxies) will become the default. If there are no other proxies, then the asset will no longer have a default proxy.

Parameters:

`asset` –

The GESAsset to no longer proxy with proxy

`proxy` –

An existing proxy of asset

Returns –

TRUE if proxy was successfully removed from asset's proxy list.

#### GES.Asset.prototype.unproxy

    function GES.Asset.prototype.unproxy(proxy: GES.Asset): {
        // javascript wrapper for 'ges_asset_unproxy'
    }

Removes the proxy from the available list of proxies for the asset. If the given proxy is the default proxy of the list, then the next proxy in the available list (see GES.Asset.prototype.list_proxies) will become the default. If there are no other proxies, then the asset will no longer have a default proxy.

Parameters:

`asset` (GES.Asset) –

The GES.Asset to no longer proxy with proxy

`proxy` (GES.Asset) –

An existing proxy of asset

Returns (Number) –

true if proxy was successfully removed from asset's proxy list.

#### GES.Asset.unproxy

    def GES.Asset.unproxy (self, proxy):
        #python wrapper for 'ges_asset_unproxy'

Removes the proxy from the available list of proxies for the asset. If the given proxy is the default proxy of the list, then the next proxy in the available list (see GES.Asset.list_proxies) will become the default. If there are no other proxies, then the asset will no longer have a default proxy.

Parameters:

`asset` (GES.Asset) –

The GES.Asset to no longer proxy with proxy

`proxy` (GES.Asset) –

An existing proxy of asset

Returns (bool) –

True if proxy was successfully removed from asset's proxy list.

### Functions

#### ges_asset_needs_reload

    gboolean
    ges_asset_needs_reload (GType extractable_type,
                            const gchar * id)

Indicate that an existing GESAsset in the cache should be reloaded upon the next request. This can be used when some condition has changed, which may require that an existing asset should be updated. For example, if an external resource has changed or now become available.

Note, the asset is not immediately changed, but will only actually reload on the next call to ges_asset_request or ges_asset_request_async.

Parameters:

`extractable_type` –

The extractable-type of the asset that needs reloading

`id` ( [allow-none]) –

The id of the asset asset that needs reloading

Returns –

TRUE if the specified asset exists in the cache and could be marked for reloading.

#### GES.Asset.prototype.needs_reload

    function GES.Asset.prototype.needs_reload(extractable_type: GObject.Type, id: String): {
        // javascript wrapper for 'ges_asset_needs_reload'
    }

Indicate that an existing GES.Asset in the cache should be reloaded upon the next request. This can be used when some condition has changed, which may require that an existing asset should be updated. For example, if an external resource has changed or now become available.

Note, the asset is not immediately changed, but will only actually reload on the next call to GES.Asset.prototype.request or GES.Asset.prototype.request_async.

Parameters:

`extractable_type` (GObject.Type) –

The extractable-type of the asset that needs reloading

`id` (String) –

The id of the asset asset that needs reloading

Returns (Number) –

true if the specified asset exists in the cache and could be marked for reloading.

#### GES.Asset.needs_reload

    def GES.Asset.needs_reload (extractable_type, id):
        #python wrapper for 'ges_asset_needs_reload'

Indicate that an existing GES.Asset in the cache should be reloaded upon the next request. This can be used when some condition has changed, which may require that an existing asset should be updated. For example, if an external resource has changed or now become available.

Note, the asset is not immediately changed, but will only actually reload on the next call to GES.Asset.request or GES.Asset.request_async.

Parameters:

`extractable_type` (GObject.Type) –

The extractable_type of the asset that needs reloading

`id` (str) –

The id of the asset asset that needs reloading

Returns (bool) –

True if the specified asset exists in the cache and could be marked for reloading.

#### ges_asset_request

    GESAsset *
    ges_asset_request (GType extractable_type,
                       const gchar * id,
                       GError ** 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 error 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 GESExtractable 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 GESAsset.

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 GESUriClip. For such assets this method will fail, and you should use ges_asset_request_async instead. In the case of GESUriClip, you can use ges_uri_clip_asset_request_sync if you only want to wait for the request to finish.

Parameters:

`extractable_type` –

The extractable-type of the asset

`id` ( [allow-none]) –

The id of the asset

`error` ( [allow-none]) –

An error to be set if the requested asset has loaded with an error, or NULL to ignore

Returns ( [transfer: full][allow-none]) –

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

#### GES.Asset.prototype.request

    function GES.Asset.prototype.request(extractable_type: GObject.Type, id: String): {
        // javascript wrapper for 'ges_asset_request'
    }

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 error 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 GES.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 GES.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 GES.UriClip. For such assets this method will fail, and you should use GES.Asset.prototype.request_async instead. In the case of GES.UriClip, you can use GES.UriClipAsset.prototype.request_sync if you only want to wait for the request to finish.

Parameters:

`extractable_type` (GObject.Type) –

The extractable-type of the asset

`id` (String) –

The id of the asset

Returns (GES.Asset) –

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

#### GES.Asset.request

    @raises(GLib.GError)
    def GES.Asset.request (extractable_type, id):
        #python wrapper for 'ges_asset_request'

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 error is set, if given, and None 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 GES.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 None 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 GES.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 GES.UriClip. For such assets this method will fail, and you should use GES.Asset.request_async instead. In the case of GES.UriClip, you can use GES.UriClipAsset.request_sync if you only want to wait for the request to finish.

Parameters:

`extractable_type` (GObject.Type) –

The extractable_type of the asset

`id` (str) –

The id of the asset

Returns (GES.Asset) –

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

#### ges_asset_request_async

    ges_asset_request_async (GType extractable_type,
                             const gchar * id,
                             GCancellable * cancellable,
                             GAsyncReadyCallback callback,
                             gpointer user_data)

Requests an asset with the given properties asynchronously (see ges_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 ges_asset_request_finish method on the given GAsyncResult.

Note that the source object passed to the callback will be the GESAsset corresponding to the request, but it may not have loaded correctly and therefore can not be used as is. Instead, ges_asset_request_finish 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 GMainLoop running under the same GMainContext that ges_init was called in. So, if you wish the callback to be invoked outside the default GMainContext, you can call g_main_context_push_thread_default in a new thread before calling ges_init.

Example of an asynchronous asset request:

    // 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` ( [allow-none]) –

The id of the asset

`cancellable` ( [allow-none]) –

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

#### GES.Asset.prototype.request_async

    function GES.Asset.prototype.request_async(extractable_type: GObject.Type, id: String, cancellable: Gio.Cancellable, callback: Gio.AsyncReadyCallback, user_data: Object): {
        // javascript wrapper for 'ges_asset_request_async'
    }

Requests an asset with the given properties asynchronously (see GES.Asset.prototype.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 GES.Asset.prototype.request_finish method on the given Gio.AsyncResult.

Note that the source object passed to the callback will be the GES.Asset corresponding to the request, but it may not have loaded correctly and therefore can not be used as is. Instead, GES.Asset.prototype.request_finish 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 GLib.MainLoop running under the same GLib.MainContext that GES.prototype.init was called in. So, if you wish the callback to be invoked outside the default GLib.MainContext, you can call GLib.MainContext.prototype.push_thread_default in a new thread before calling GES.prototype.init.

Example of an asynchronous asset request:

    // 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` (GObject.Type) –

The extractable-type of the asset

`id` (String) –

The id of the asset

`cancellable` (Gio.Cancellable) –

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

`callback` (Gio.AsyncReadyCallback) –

A function to call when the initialization is finished

`user_data` (Object) –

Data to be passed to callback

#### GES.Asset.request_async

    def GES.Asset.request_async (extractable_type, id, cancellable, callback, *user_data):
        #python wrapper for 'ges_asset_request_async'

Requests an asset with the given properties asynchronously (see GES.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 GES.Asset.request_finish method on the given Gio.AsyncResult.

Note that the source object passed to the callback will be the GES.Asset corresponding to the request, but it may not have loaded correctly and therefore can not be used as is. Instead, GES.Asset.request_finish 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 GLib.MainLoop running under the same GLib.MainContext that GES.init was called in. So, if you wish the callback to be invoked outside the default GLib.MainContext, you can call GLib.MainContext.push_thread_default in a new thread before calling GES.init.

Example of an asynchronous asset request:

    // 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` (GObject.Type) –

The extractable_type of the asset

`id` (str) –

The id of the asset

`cancellable` (Gio.Cancellable) –

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

`callback` (Gio.AsyncReadyCallback) –

A function to call when the initialization is finished

`user_data` (variadic) –

Data to be passed to callback

#### ges_asset_request_finish

    GESAsset *
    ges_asset_request_finish (GAsyncResult * res,
                              GError ** error)

Fetches an asset requested by ges_asset_request_async, which finalises the request.

Parameters:

`res` –

The task result to fetch the asset from

`error` ( [out][allow-none][transfer: full]) –

An error to be set in case something goes wrong, or NULL to ignore

Returns ( [transfer: full]) –

The requested asset, or NULL if an error occurred.

#### GES.Asset.prototype.request_finish

    function GES.Asset.prototype.request_finish(res: Gio.AsyncResult): {
        // javascript wrapper for 'ges_asset_request_finish'
    }

Fetches an asset requested by GES.Asset.prototype.request_async, which finalises the request.

Parameters:

`res` (Gio.AsyncResult) –

The task result to fetch the asset from

Returns (GES.Asset) –

The requested asset, or null if an error occurred.

#### GES.Asset.request_finish

    @raises(GLib.GError)
    def GES.Asset.request_finish (res):
        #python wrapper for 'ges_asset_request_finish'

Fetches an asset requested by GES.Asset.request_async, which finalises the request.

Parameters:

`res` (Gio.AsyncResult) –

The task result to fetch the asset from

Returns (GES.Asset) –

The requested asset, or None if an error occurred.

### Properties

#### extractable-type

    “extractable-type” GType

The GESExtractable object type that can be extracted from the asset.

Flags : Read / Write / Construct Only

#### extractable-type

    “extractable-type” GObject.Type

The GES.Extractable object type that can be extracted from the asset.

Flags : Read / Write / Construct Only

#### extractable_type

    “self.props.extractable_type” GObject.Type

The GES.Extractable object type that can be extracted from the asset.

Flags : Read / Write / Construct Only

#### id

    “id” gchar *

The ID of the asset. This should be unique amongst all assets with the same extractable-type. Depending on the associated GESExtractable implementation, this id may convey some information about the GObject that should be extracted. Note that, as such, the ID will have an expected format, and you can not choose this value arbitrarily. By default, this will be set to the type name of the extractable-type, but you should check the documentation of the extractable type to see whether they differ from the default behaviour.

Flags : Read / Write / Construct Only

#### id

    “id” String

The ID of the asset. This should be unique amongst all assets with the same extractable-type. Depending on the associated GES.Extractable implementation, this id may convey some information about the GObject.Object that should be extracted. Note that, as such, the ID will have an expected format, and you can not choose this value arbitrarily. By default, this will be set to the type name of the extractable-type, but you should check the documentation of the extractable type to see whether they differ from the default behaviour.

Flags : Read / Write / Construct Only

#### id

    “self.props.id” str

The ID of the asset. This should be unique amongst all assets with the same extractable_type. Depending on the associated GES.Extractable implementation, this id may convey some information about the GObject.Object that should be extracted. Note that, as such, the ID will have an expected format, and you can not choose this value arbitrarily. By default, this will be set to the type name of the extractable_type, but you should check the documentation of the extractable type to see whether they differ from the default behaviour.

Flags : Read / Write / Construct Only

#### proxy

    “proxy” GESAsset *

The default proxy for this asset, or NULL if it has no proxy. A proxy will act as a substitute for the original asset when the original is requested (see ges_asset_request).

Setting this property will not usually remove the existing proxy, but will replace it as the default (see ges_asset_set_proxy).

Flags : Read / Write

#### proxy

    “proxy” GES.Asset

The default proxy for this asset, or null if it has no proxy. A proxy will act as a substitute for the original asset when the original is requested (see GES.Asset.prototype.request).

Setting this property will not usually remove the existing proxy, but will replace it as the default (see GES.Asset.prototype.set_proxy).

Flags : Read / Write

#### proxy

    “self.props.proxy” GES.Asset

The default proxy for this asset, or None if it has no proxy. A proxy will act as a substitute for the original asset when the original is requested (see GES.Asset.request).

Setting this property will not usually remove the existing proxy, but will replace it as the default (see GES.Asset.set_proxy).

Flags : Read / Write

#### proxy-target

    “proxy-target” GESAsset *

The asset that this asset is a proxy for, or NULL if it is not a proxy for another asset.

Note that even if this asset is acting as a proxy for another asset, but this asset is not the default proxy, then proxy-target will still point to this other asset. So you should check the proxy property of target-proxy before assuming it is the current default proxy for the target.

Note that the notify for this property is emitted after the proxy notify for the corresponding (if any) asset it is now the proxy of/no longer the proxy of.

Flags : Read

#### proxy-target

    “proxy-target” GES.Asset

The asset that this asset is a proxy for, or null if it is not a proxy for another asset.

Note that even if this asset is acting as a proxy for another asset, but this asset is not the default proxy, then proxy-target will still point to this other asset. So you should check the proxy property of target-proxy before assuming it is the current default proxy for the target.

Note that the notify for this property is emitted after the proxy notify for the corresponding (if any) asset it is now the proxy of/no longer the proxy of.

Flags : Read

#### proxy_target

    “self.props.proxy_target” GES.Asset

The asset that this asset is a proxy for, or None if it is not a proxy for another asset.

Note that even if this asset is acting as a proxy for another asset, but this asset is not the default proxy, then proxy-target will still point to this other asset. So you should check the proxy property of target-proxy before assuming it is the current default proxy for the target.

Note that the notify for this property is emitted after the proxy notify for the corresponding (if any) asset it is now the proxy of/no longer the proxy of.

Flags : Read

### Virtual Methods

#### extract

    GESExtractable *
    extract (GESAsset * self,
             GError ** error)

A method that returns a new object of the asset's extractable-type, or NULL if an error occurs. The default implementation will fetch the properties of the GESExtractable from its get_parameters_from_id class method and set them on a new extractable-type GObject, which is returned.

Parameters:

`self` –
No description available
`error` –
No description available
Returns –
No description available

#### vfunc_extract

    function vfunc_extract(self: GES.Asset): {
        // javascript implementation of the 'extract' virtual method
    }

A method that returns a new object of the asset's extractable-type, or null if an error occurs. The default implementation will fetch the properties of the GES.Extractable from its get_parameters_from_id class method and set them on a new extractable-type GObject.Object, which is returned.

Parameters:

`self` (GES.Asset) –
No description available
Returns (GES.Extractable) –
No description available

#### do_extract

    def do_extract (self):
        #python implementation of the 'extract' virtual method

A method that returns a new object of the asset's extractable_type, or None if an error occurs. The default implementation will fetch the properties of the GES.Extractable from its get_parameters_from_id class method and set them on a new extractable_type GObject.Object, which is returned.

Parameters:

`self` (GES.Asset) –
No description available
Returns (GES.Extractable) –
No description available

#### inform_proxy

    inform_proxy (GESAsset * self,
                  const gchar * proxy_id)

Parameters:

`self` –
No description available
`proxy_id` –
No description available

#### vfunc_inform_proxy

    function vfunc_inform_proxy(self: GES.Asset, proxy_id: String): {
        // javascript implementation of the 'inform_proxy' virtual method
    }

Parameters:

`self` (GES.Asset) –
No description available
`proxy_id` (String) –
No description available

#### do_inform_proxy

    def do_inform_proxy (self, proxy_id):
        #python implementation of the 'inform_proxy' virtual method

Parameters:

`self` (GES.Asset) –
No description available
`proxy_id` (str) –
No description available

#### proxied

    proxied (GESAsset * self,
             GESAsset * proxy)

Deprecated: 1.18: This vmethod is no longer called.

Parameters:

`self` –
No description available
`proxy` –
No description available

#### vfunc_proxied

    function vfunc_proxied(self: GES.Asset, proxy: GES.Asset): {
        // javascript implementation of the 'proxied' virtual method
    }

Deprecated: 1.18: This vmethod is no longer called.

Parameters:

`self` (GES.Asset) –
No description available
`proxy` (GES.Asset) –
No description available

#### do_proxied

    def do_proxied (self, proxy):
        #python implementation of the 'proxied' virtual method

Deprecated: 1.18: This vmethod is no longer called.

Parameters:

`self` (GES.Asset) –
No description available
`proxy` (GES.Asset) –
No description available

#### request_id_update

    gboolean
    request_id_update (GESAsset * self,
                       gchar ** proposed_new_id,
                       GError * error)

A method called by a GESProject when an asset has failed to load. error is the error given by ges_asset_request_finish (). Returns: TRUE if a new id for self was passed to proposed_new_id.

Parameters:

`self` –
No description available
`proposed_new_id` –
No description available
`error` –
No description available
Returns –
No description available

#### vfunc_request_id_update

    function vfunc_request_id_update(self: GES.Asset, proposed_new_id: String, error: GLib.Error): {
        // javascript implementation of the 'request_id_update' virtual method
    }

A method called by a GES.Project when an asset has failed to load. error is the error given by ges_asset_request_finish (). Returns: true if a new id for self was passed to proposed_new_id.

Parameters:

`self` (GES.Asset) –
No description available
`proposed_new_id` (String) –
No description available
`error` (GLib.Error) –
No description available
Returns (Number) –
No description available

#### do_request_id_update

    def do_request_id_update (self, proposed_new_id, error):
        #python implementation of the 'request_id_update' virtual method

A method called by a GES.Project when an asset has failed to load. error is the error given by ges_asset_request_finish (). Returns: True if a new id for self was passed to proposed_new_id.

Parameters:

`self` (GES.Asset) –
No description available
`proposed_new_id` (str) –
No description available
`error` (GLib.Error) –
No description available
Returns (bool) –
No description available

#### start_loading

    GESAssetLoadingReturn
    start_loading (GESAsset * self,
                   GError ** error)

A method to be called when an asset is being requested asynchronously. This will be after the properties of the asset have been set, so it is tasked with (re)loading the 'state' of the asset. The return value should indicated whether the loading is complete, is carrying on asynchronously, or an error occurred. The default implementation will simply return that loading is already complete (the asset is already in a usable state after the properties have been set).

Parameters:

`self` –
No description available
`error` –
No description available
Returns –
No description available

#### vfunc_start_loading

    function vfunc_start_loading(self: GES.Asset): {
        // javascript implementation of the 'start_loading' virtual method
    }

A method to be called when an asset is being requested asynchronously. This will be after the properties of the asset have been set, so it is tasked with (re)loading the 'state' of the asset. The return value should indicated whether the loading is complete, is carrying on asynchronously, or an error occurred. The default implementation will simply return that loading is already complete (the asset is already in a usable state after the properties have been set).

Parameters:

`self` (GES.Asset) –
No description available
Returns (GES.AssetLoadingReturn) –
No description available

#### do_start_loading

    def do_start_loading (self):
        #python implementation of the 'start_loading' virtual method

A method to be called when an asset is being requested asynchronously. This will be after the properties of the asset have been set, so it is tasked with (re)loading the 'state' of the asset. The return value should indicated whether the loading is complete, is carrying on asynchronously, or an error occurred. The default implementation will simply return that loading is already complete (the asset is already in a usable state after the properties have been set).

Parameters:

`self` (GES.Asset) –
No description available
Returns (GES.AssetLoadingReturn) –
No description available

## Functions

### ges_list_assets

    GList *
    ges_list_assets (GType filter)

List all the assets in the current cache whose extractable-type are of the given type (including subclasses).

Note that, since only a GESExtractable can be extracted from an asset, using `GES_TYPE_EXTRACTABLE` as filter will return all the assets in the current cache.

Parameters:

`filter` –

The type of object that can be extracted from the asset

Returns ( [transfer: container][element-typeGESAsset]) –

A list of all GESAsset-s currently in the cache whose extractable-type is of the filter type.

### GES.prototype.list_assets

    function GES.prototype.list_assets(filter: GObject.Type): {
        // javascript wrapper for 'ges_list_assets'
    }

List all the assets in the current cache whose extractable-type are of the given type (including subclasses).

Note that, since only a GES.Extractable can be extracted from an asset, using `GES_TYPE_EXTRACTABLE` as filter will return all the assets in the current cache.

Parameters:

`filter` (GObject.Type) –

The type of object that can be extracted from the asset

Returns ([ GES.Asset ]) –

A list of all GES.Asset-s currently in the cache whose extractable-type is of the filter type.

### GES.list_assets

    def GES.list_assets (filter):
        #python wrapper for 'ges_list_assets'

List all the assets in the current cache whose extractable_type are of the given type (including subclasses).

Note that, since only a GES.Extractable can be extracted from an asset, using `GES_TYPE_EXTRACTABLE` as filter will return all the assets in the current cache.

Parameters:

`filter` (GObject.Type) –

The type of object that can be extracted from the asset

Returns ([ GES.Asset ]) –

A list of all GES.Asset-s currently in the cache whose extractable_type is of the filter type.

## Enumerations

### GESAssetLoadingReturn

##### Members

`GES_ASSET_LOADING_ERROR` (0) –

Indicates that an error occurred

`GES_ASSET_LOADING_ASYNC` (1) –

Indicates that the loading is being performed asynchronously

`GES_ASSET_LOADING_OK` (2) –

Indicates that the loading is complete, without error

### GES.AssetLoadingReturn

##### Members

`GES.AssetLoadingReturn.ERROR` (0) –

Indicates that an error occurred

`GES.AssetLoadingReturn.ASYNC` (1) –

Indicates that the loading is being performed asynchronously

`GES.AssetLoadingReturn.OK` (2) –

Indicates that the loading is complete, without error

### GES.AssetLoadingReturn

##### Members

`GES.AssetLoadingReturn.ERROR` (0) –

Indicates that an error occurred

`GES.AssetLoadingReturn.ASYNC` (1) –

Indicates that the loading is being performed asynchronously

`GES.AssetLoadingReturn.OK` (2) –

Indicates that the loading is complete, without error

## Constants

### GES_TYPE_ASSET

    #define GES_TYPE_ASSET ges_asset_get_type()

Subpages:

GESUriClipAsset – A GESAsset subclass specialized in GESUriClip extraction

GESClipAsset – A GESAsset subclass specialized in GESClip extraction

GESEffectAsset – A GESAsset subclass specialized in GESEffect extraction

GESTrackElementAsset – A GESAsset subclass specialized in GESTrackElement extraction

GESSourceClipAsset – A GESAsset subclass, baseclass for #GESSourceClip-s extraction

The results of the search are