GES.Project

g GES.Asset GES.Asset GES.Project GES.Project GES.Asset->GES.Project 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

None

Methods

Inherited

GES.Asset (13), GObject.Object (37), GES.MetaContainer (40), Gio.AsyncInitable (4), Gio.Initable (2)

Structs

GObject.ObjectClass (5)

class

new (uri)

add_asset (asset)

add_encoding_profile (profile)

add_formatter (formatter)

create_asset (id, extractable_type)

create_asset_sync (id, extractable_type)

get_asset (id, extractable_type)

get_loading_assets ()

get_uri ()

list_assets (filter)

list_encoding_profiles ()

load (timeline)

remove_asset (asset)

save (timeline, uri, formatter_asset, overwrite)

Virtual Methods

Inherited

GES.Asset (5), GObject.Object (7), Gio.AsyncInitable (2), Gio.Initable (1)

do_asset_added (asset)

do_asset_loading (asset)

do_asset_removed (asset)

do_loaded (timeline)

do_loading (timeline)

do_loading_error (error, id, extractable_type)

do_missing_uri (error, wrong_asset)

Properties

Inherited

GES.Asset (4)

Name

Type

Flags

Short Description

uri

str

r/w/co

uri of the project

Signals

Inherited

GObject.Object (1), GES.MetaContainer (1)

Name

Short Description

asset-added

asset-loading

asset-removed

error-loading

error-loading-asset

Informs you that a GES.Asset could not be created.

loaded

loading

missing-uri

Fields

Inherited

GObject.Object (1), GES.MetaContainer (1)

Name

Type

Access

Description

parent

GES.Asset

r

Class Details

class GES.Project(**kwargs)
Bases

GES.Asset

Abstract

No

Structure

GES.ProjectClass

The GES.Project is used to control a set of GES.Asset and is a GES.Asset with GES_TYPE_TIMELINE as extractable_type itself. That means that you can extract GES.Timeline from a project as followed:

GESProject *project;
GESTimeline *timeline;

project = ges_project_new ("file:///path/to/a/valid/project/uri");

// Here you can connect to the various signal to get more infos about
// what is happening and recover from errors if possible
...

timeline = ges_asset_extract (GES_ASSET (project));

The GES.Project class offers a higher level API to handle GES.Asset-s. It lets you request new asset, and it informs you about new assets through a set of signals. Also it handles problem such as missing files/missing Gst.Element and lets you try to recover from those.

Subprojects

In order to add a subproject, the only thing to do is to add the subproject to the main project:

`` c ges_project_add_asset (project, GES_ASSET (subproject)); `` then the subproject will be serialized in the project files. To use the subproject in a timeline, you should use a GES.UriClip with the same subproject URI.

When loading a project with subproject, subprojects URIs will be temporary writable local files. If you want to edit the subproject timeline, you should retrieve the subproject from the parent project asset list and extract the timeline with GES.Asset.extract() and save it at the same temporary location.

classmethod new(uri)[source]
Parameters

uri (str or None) – The uri to be set after creating the project.

Returns

A newly created GES.Project

Return type

GES.Project

Creates a new GES.Project and sets its uri to uri if provided. Note that if uri is not valid or None, the uri of the project will then be set the first time you save the project. If you then save the project to other locations, it will never be updated again and the first valid URI is the URI it will keep refering to.

add_asset(asset)[source]
Parameters

asset (GES.Asset) – A GES.Asset to add to self

Returns

True if the asset could be added False it was already in the project

Return type

bool

Adds a GES.Asset to self, the project will keep a reference on asset.

add_encoding_profile(profile)[source]
Parameters

profile (GstPbutils.EncodingProfile) – A GstPbutils.EncodingProfile to add to the project. If a profile with the same name already exists, it will be replaced

Returns

True if profile could be added, False otherwize

Return type

bool

Adds profile to the project. It lets you save in what format the project has been renders and keep a reference to those formats. Also, those formats will be saves to the project file when possible.

add_formatter(formatter)[source]
Parameters

formatter (GES.Formatter) – A formatter used by self

Adds a formatter as used to load self

New in version 1.18.

create_asset(id, extractable_type)[source]
Parameters
Returns

True if the asset started to be added False it was already in the project

Return type

bool

Create and add a GES.Asset to self. You should connect to the “asset-added” signal to get the asset when it finally gets added to self

create_asset_sync(id, extractable_type)[source]
Parameters
Raises

GLib.Error

Returns

The newly created GES.Asset or None.

Return type

GES.Asset or None

Create and add a GES.Asset to self. You should connect to the “asset-added” signal to get the asset when it finally gets added to self

get_asset(id, extractable_type)[source]
Parameters
  • id (str) – The id of the asset to retrieve

  • extractable_type (GObject.GType) – The extractable_type of the asset to retrieve from object

Returns

The GES.Asset with id or None if no asset with id as an ID

Return type

GES.Asset or None

get_loading_assets()[source]
Returns

A set of loading asset that will be added to self. Note that those Asset are *not* loaded yet, and thus can not be used

Return type

[GES.Asset]

Get the assets that are being loaded

get_uri()[source]
Returns

a newly allocated string representing uri.

Return type

str or None

Retrieve the uri that is currently set on self

list_assets(filter)[source]
Parameters

filter (GObject.GType) – Type of assets to list, GES_TYPE_EXTRACTABLE will list all assets

Returns

The list of GES.Asset the object contains

Return type

[GES.Asset]

List all asset contained in self filtering per extractable_type as defined by filter. It copies the asset and thus will not be updated in time.

list_encoding_profiles()[source]
Returns

The list of GstPbutils.EncodingProfile used in self

Return type

[GstPbutils.EncodingProfile] or None

Lists the encoding profile that have been set to self. The first one is the latest added.

load(timeline)[source]
Parameters

timeline (GES.Timeline) – A blank timeline to load self into

Raises

GLib.Error

Returns

True if the project could be loaded False otherwize.

Return type

bool

Loads self into timeline

remove_asset(asset)[source]
Parameters

asset (GES.Asset) – A GES.Asset to remove from self

Returns

True if the asset could be removed False otherwise

Return type

bool

remove a asset to from self.

save(timeline, uri, formatter_asset, overwrite)[source]
Parameters
  • timeline (GES.Timeline) – The GES.Timeline to save, it must have been extracted from self

  • uri (str) – The uri where to save self and timeline

  • formatter_asset (GES.Asset or None) – The formatter asset to use or None. If None, will try to save in the same format as the one from which the timeline as been loaded or default to the best formatter as defined in GES.find_formatter_for_uri

  • overwrite (bool) – True to overwrite file if it exists

Raises

GLib.Error

Returns

True if the project could be save, False otherwize

Return type

bool

Save the timeline of self to uri. You should make sure that timeline is one of the timelines that have been extracted from self (using GES.Asset.extract (self);)

do_asset_added(asset) virtual
Parameters

asset (GES.Asset) –

do_asset_loading(asset) virtual
Parameters

asset (GES.Asset) –

do_asset_removed(asset) virtual
Parameters

asset (GES.Asset) –

do_loaded(timeline) virtual
Parameters

timeline (GES.Timeline) –

Return type

bool

do_loading(timeline) virtual
Parameters

timeline (GES.Timeline) – The loading timeline

New in version 1.18.

do_loading_error(error, id, extractable_type) virtual
Parameters
Return type

bool

do_missing_uri(error, wrong_asset) virtual
Parameters
Return type

str

Signal Details

GES.Project.signals.asset_added(project, asset)
Signal Name

asset-added

Flags

RUN_LAST

Parameters
GES.Project.signals.asset_loading(project, asset)
Signal Name

asset-loading

Flags

RUN_LAST

Parameters

New in version 1.8.

GES.Project.signals.asset_removed(project, asset)
Signal Name

asset-removed

Flags

RUN_LAST

Parameters
GES.Project.signals.error_loading(project, timeline, error)
Signal Name

error-loading

Flags

RUN_LAST

Parameters

New in version 1.18.

GES.Project.signals.error_loading_asset(project, error, id, extractable_type)
Signal Name

error-loading-asset

Flags

RUN_LAST

Parameters
  • project (GES.Project) – The object which received the signal

  • error (GLib.Error) – The GLib.Error defining the error that occured, might be None

  • id (str) – The id of the asset that failed loading

  • extractable_type (GObject.GType) – The extractable_type of the asset that failed loading

Informs you that a GES.Asset could not be created. In case of missing GStreamer plugins, the error will be set to #GST_CORE_ERROR Gst.CoreError.MISSING_PLUGIN

GES.Project.signals.loaded(project, timeline)
Signal Name

loaded

Flags

RUN_FIRST

Parameters
GES.Project.signals.loading(project, timeline)
Signal Name

loading

Flags

RUN_FIRST

Parameters

New in version 1.18.

GES.Project.signals.missing_uri(project, error, wrong_asset)
Signal Name

missing-uri

Flags

RUN_LAST

Parameters
  • project (GES.Project) – The object which received the signal

  • error (GLib.Error) – The error that happened

  • wrong_asset (GES.Asset) – The asset with the wrong ID, you should us it and its content only to find out what the new location is.

Returns

The new URI of wrong_asset

Return type

str or None

static gchar
source_moved_cb (GESProject *project, GError *error, GESAsset *asset_with_error)
{
  return g_strdup ("file:///the/new/uri.ogg");
}

static int
main (int argc, gchar ** argv)
{
  GESTimeline *timeline;
  GESProject *project = ges_project_new ("file:///some/uri.xges");

  g_signal_connect (project, "missing-uri", source_moved_cb, NULL);
  timeline = ges_asset_extract (GES_ASSET (project));
}

Property Details

GES.Project.props.uri
Name

uri

Type

str

Default Value

None

Flags

READABLE, WRITABLE, CONSTRUCT_ONLY

uri of the project