GES.Asset

g GES.Asset GES.Asset GES.MetaContainer GES.MetaContainer GES.MetaContainer->GES.Asset GObject.GInterface GObject.GInterface GObject.GInterface->GES.MetaContainer Gio.AsyncInitable Gio.AsyncInitable GObject.GInterface->Gio.AsyncInitable Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object GObject.Object->GES.Asset Gio.AsyncInitable->GES.Asset Gio.Initable->GES.Asset

Subclasses:GES.ClipAsset, GES.Project, GES.TrackElementAsset

Methods

Inherited:GObject.Object (40), GES.MetaContainer (37), Gio.AsyncInitable (4), Gio.Initable (2)
Structs:GObject.ObjectClass (5)
class needs_reload (extractable_type, id)
class request (extractable_type, id)
class request_async (extractable_type, id, cancellable, callback, *user_data)
class request_finish (res)
  extract ()
  get_error ()
  get_extractable_type ()
  get_id ()
  get_proxy ()
  get_proxy_target ()
  list_proxies ()
  set_proxy (proxy)

Virtual Methods

Inherited:GObject.Object (7), Gio.AsyncInitable (2), Gio.Initable (1)
  do_extract ()
  do_inform_proxy (proxy_id)
  do_proxied (proxy)
  do_request_id_update (proposed_new_id, error)
  do_start_loading ()

Properties

Name Type Flags Short Description
extractable-type GObject.GType r/w/co The type of the Object that can be extracted out of the asset
id str r/w/co The unic identifier of the asset
proxy GES.Asset r/w The asset default proxy.
proxy-target GES.Asset r/w The target of a proxy asset.

Fields

Inherited:GObject.Object (1), GES.MetaContainer (1)
Name Type Access Description
parent GObject.Object r  

Class Details

class GES.Asset(**kwargs)
Bases:GObject.Object, GES.MetaContainer, Gio.AsyncInitable, Gio.Initable
Abstract:No
Structure:GES.AssetClass

The Assets in the GStreamer Editing Services represent the resources that can be used. You can create assets for any type that implements the GES.Extractable interface, for example GES.Clips, GES.Formatter, and GES.TrackElement do implement it. This means that assets will represent for example a GES.UriClips, GES.BaseEffect etc, and then you can extract objects of those types with the appropriate parameters from the asset using the GES.Asset.extract method:

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));

In that example, the advantages of having a GES.Asset are that you can know what effects you are working with and let your user know about the avalaible ones, you can add metadata to the GES.Asset through the GES.MetaContainer interface and you have a model for your custom effects. Note that GES.Asset management is making easier thanks to the GES.Project class.

Each asset is represented by a pair of extractable_type and id (string). Actually the extractable_type is the type that implements the GES.Extractable interface, that means that for example for a GES.UriClip, the type that implements the GES.Extractable interface is GES.Clip. The identifier represents different things depending on the extractable_type and you should check the documentation of each type to know what the ID of GES.Asset actually represents for that type. By default, we only have one GES.Asset per type, and the id is the name of the type, but this behaviour is overriden to be more useful. For example, for GESTransitionClips, the ID is the vtype of the transition you will extract from it (ie crossfade, box-wipe-rc etc..) For GES.Effect the ID is the bin-description property of the extracted objects (ie the gst-launch style description of the bin that will be used).

Each and every GES.Asset is cached into GES, and you can query those with the GES.list_assets function. Also the system will automatically register GES.Assets for GES.Formatters and GES.TransitionClips and standard effects (actually not implemented yet) and you can simply query those calling:

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) {
  g_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);

You can request the creation of GES.Assets using either GES.Asset.request_async or GES.Asset.request_async. All the GES.Assets are cached and thus any asset that has already been created can be requested again without overhead.

classmethod needs_reload(extractable_type, id)[source]
Parameters:
  • extractable_type (GObject.GType) – The GObject.GType of the object that can be extracted from the asset to be reloaded.
  • id (str) – The identifier of the asset to mark as needing reload
Returns:

True if the asset was in the cache and could be set as needing reload, False otherwise.

Return type:

bool

Sets an asset from the internal cache as needing reload. An asset needs reload in the case where, for example, we were missing a Gst.Plugin to use it and that plugin has been installed, or, that particular asset content as changed meanwhile (in the case of the usage of proxies).

Once an asset has been set as “needs reload”, requesting that asset again will lead to it being re discovered, and reloaded as if it was not in the cache before.

classmethod request(extractable_type, id)[source]
Parameters:
Raises:

GLib.Error

Returns:

A reference to the wanted GES.Asset or None

Return type:

GES.Asset or None

Create a GES.Asset in the most simple cases, you should look at the extractable_type documentation to see if that constructor can be called for this particular type

As it is recommanded not to instanciate assets for GES.UriClip synchronously, it will not work with this method, but you can instead use the specific GES.UriClipAsset.request_sync method if you really want to.

classmethod request_async(extractable_type, id, cancellable, callback, *user_data)[source]
Parameters:

Request a new GES.Asset asyncronously, callback will be called when the materail is ready to be used or if an error occured.

Example of request of a GES.Asset async:

// 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) {
   g_print ("The file: %s is usable as a FileSource",
       ges_asset_get_id (asset));
  } else {
   g_print ("The file: %s is *not* usable as a FileSource because: %s",
       ges_asset_get_id (source), error->message);
  }

  gst_object_unref (mfs);
}

// The request:
ges_asset_request_async (GES_TYPE_URI_CLIP, some_uri, NULL,
   (GAsyncReadyCallback) asset_loaded_cb, user_data);
classmethod request_finish(res)[source]
Parameters:res (Gio.AsyncResult) – The Gio.AsyncResult from which to get the newly created GES.Asset
Raises:GLib.Error
Returns:The GES.Asset previously requested
Return type:GES.Asset or None

Finalize the request of an async GES.Asset

extract()[source]
Raises:GLib.Error
Returns:A newly created GES.Extractable
Return type:GES.Extractable or None

Extracts a new GObject.Object from asset. The type of the object is defined by the extractable-type of asset, you can check what type will be extracted from asset using GES.Asset.get_extractable_type

get_error()[source]
Returns:The GLib.Error of the asset or None if the asset was loaded without issue
Return type:GLib.Error or None

New in version 1.8.

get_extractable_type()[source]
Returns:the type of object that can be extracted from self
Return type:GObject.GType

Gets the type of object that can be extracted from self

get_id()[source]
Returns:The ID of self
Return type:str

Gets the ID of a GES.Asset

get_proxy()[source]
Returns:The proxy in use for self
Return type:GES.Asset or None
get_proxy_target()[source]
Returns:The GES.Asset that is proxied by self
Return type:GES.Asset or None
list_proxies()[source]
Returns:The list of proxies self has. Note that the default asset to be used is always the first in that list.
Return type:[GES.Asset]
set_proxy(proxy)[source]
Parameters:proxy (GES.Asset or None) – The GES.Asset that should be used as default proxy for self or None if you want to use the currently set proxy. Note that an asset can proxy one and only one other asset.
Returns:True if proxy has been set on self, False otherwise.
Return type:bool

A proxying asset is an asset that can substitue the real self. For example if you have a full HD GES.UriClipAsset you might want to set a lower resolution (HD version of the same file) as proxy. Note that when an asset is proxied, calling GES.Asset.request will actually return the proxy asset.

do_extract() virtual
Returns:A newly created GES.Extractable
Return type:GES.Extractable or None

Extracts a new GObject.Object from asset. The type of the object is defined by the extractable-type of asset, you can check what type will be extracted from asset using GES.Asset.get_extractable_type

do_inform_proxy(proxy_id) virtual
Parameters:proxy_id (str) –
do_proxied(proxy) virtual
Parameters:proxy (GES.Asset) –
do_request_id_update(proposed_new_id, error) virtual
Parameters:
Return type:

bool

do_start_loading() virtual
Return type:GES.AssetLoadingReturn

Property Details

GES.Asset.props.extractable_type
Name:extractable-type
Type:GObject.GType
Default Value:<GType GObject (80)>
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The type of the Object that can be extracted out of the asset

GES.Asset.props.id
Name:id
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The unic identifier of the asset

GES.Asset.props.proxy
Name:proxy
Type:GES.Asset
Default Value:None
Flags:READABLE, WRITABLE

The asset default proxy.

GES.Asset.props.proxy_target
Name:proxy-target
Type:GES.Asset
Default Value:None
Flags:READABLE, WRITABLE

The target of a proxy asset.