## GESProject GESProject — A GESAsset that is used to manage projects |

## Functions

gboolean | ges_project_load ()
gboolean | ges_project_add_asset ()
gboolean | ges_project_remove_asset ()
GList * | ges_project_list_assets ()
GESAsset * | ges_project_get_asset ()
gboolean | ges_project_save ()
gboolean | ges_project_create_asset ()
GESAsset * | ges_project_create_asset_sync ()
GType | ges_project_get_type ()
gchar * | ges_project_get_uri ()
GESProject * | ges_project_new ()
gboolean | ges_project_add_encoding_profile ()
const GList * | ges_project_list_encoding_profiles ()
GList * | ges_project_get_loading_assets ()

## Properties

gchar * | uri | Read / Write / Construct Only

## Signals

void | asset-added | Run Last
void | asset-loading | Run Last
void | asset-removed | Run Last
void | error-loading-asset | Run Last
void | loaded | Run First
gchar* | missing-uri | Run Last

## Types and Values

| GESProject

## Object Hierarchy

        GObject
        ╰── GESAsset
            ╰── GESProject

## Implemented Interfaces

GESProject implements GAsyncInitable, GInitable and GESMetaContainer.

## Includes

    #include <ges/ges.h>

## Description

The GESProject is used to control a set of GESAsset and is a GESAsset with GES_TYPE_TIMELINE as `extractable_type` itself. That means that you can extract GESTimeline from a project as followed:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    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 GESProject class offers a higher level API to handle GESAsset-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 GstElement and lets you try to recover from those.

## Functions

### ges_project_load ()

    gboolean
    ges_project_load (GESProject *project,
                      GESTimeline *timeline,
                      GError **error);

Loads `project` into `timeline`

#### Parameters

project | A GESProject that has an `uri` set already |
timeline | A blank timeline to load `project` into |
error | An error to be set in case something wrong happens or `NULL`. | [out][allow-none]

#### Returns

`TRUE` if the project could be loaded `FALSE` otherwize.

### ges_project_add_asset ()

    gboolean
    ges_project_add_asset (GESProject *project,
                           GESAsset *asset);

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

#### Parameters

project | A GESProject |
asset | A GESAsset to add to `project` . | [transfer none]

#### Returns

`TRUE` if the asset could be added `FALSE` it was already in the project

### ges_project_remove_asset ()

    gboolean
    ges_project_remove_asset (GESProject *project,
                              GESAsset *asset);

remove a `asset` to from `project` .

#### Parameters

project | A GESProject |
asset | A GESAsset to remove from `project` . | [transfer none]

#### Returns

`TRUE` if the asset could be removed `FALSE` otherwise

### ges_project_list_assets ()

    GList *
    ges_project_list_assets (GESProject *project,
                             GType filter);

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

#### Parameters

project | A GESProject |
filter | Type of assets to list, GES_TYPE_EXTRACTABLE will list all assets |

#### Returns

The list of GESAsset the object contains.

[transfer full][element-type GESAsset]

### ges_project_get_asset ()

    GESAsset *
    ges_project_get_asset (GESProject *project,
                           const gchar *id,
                           GType extractable_type);

#### Parameters

project | A GESProject |
id | The id of the asset to retrieve |
extractable_type | The extractable_type of the asset to retrieve from `object` |

#### Returns

The GESAsset with `id` or `NULL` if no asset with `id` as an ID.

[transfer full][allow-none]

### ges_project_save ()

    gboolean
    ges_project_save (GESProject *project,
                      GESTimeline *timeline,
                      const gchar *uri,
                      GESAsset *formatter_asset,
                      gboolean overwrite,
                      GError **error);

Save the timeline of `project` to `uri` . You should make sure that `timeline` is one of the timelines that have been extracted from `project` (using ges_asset_extract (`project` );)

#### Parameters

project | A GESProject to save |
timeline | The GESTimeline to save, it must have been extracted from `project` |
uri | The uri where to save `project` and `timeline` |
formatter_asset | The formatter asset to use or `NULL`. If `NULL`, will try to save in the same format as the one from which the timeline as been loaded or default to the formatter with highest rank. | [allow-none]
overwrite | `TRUE` to overwrite file if it exists |
error | An error to be set in case something wrong happens or `NULL`. | [out][allow-none]

#### Returns

`TRUE` if the project could be save, `FALSE` otherwize

### ges_project_create_asset ()

    gboolean
    ges_project_create_asset (GESProject *project,
                              const gchar *id,
                              GType extractable_type);

Create and add a GESAsset to `project` . You should connect to the "asset-added" signal to get the asset when it finally gets added to `project`

#### Parameters

project | A GESProject |
id | The id of the asset to create and add to `project` . | [allow-none]
extractable_type | The GType of the asset to create |

#### Returns

`TRUE` if the asset started to be added `FALSE` it was already in the project

### ges_project_create_asset_sync ()

    GESAsset *
    ges_project_create_asset_sync (GESProject *project,
                                   const gchar *id,
                                   GType extractable_type,
                                   GError **error);

Create and add a GESAsset to `project` . You should connect to the "asset-added" signal to get the asset when it finally gets added to `project`

#### Parameters

project | A GESProject |
id | The id of the asset to create and add to `project` . | [allow-none]
extractable_type | The GType of the asset to create |
error | A GError to be set in case of error |

#### Returns

The newly created GESAsset or `NULL`.

[transfer full][nullable]

### ges_project_get_type ()

    GType
    ges_project_get_type (void);

### ges_project_get_uri ()

    gchar *
    ges_project_get_uri (GESProject *project);

Retrieve the uri that is currently set on `project`

#### Parameters

project | A GESProject |

#### Returns

a newly allocated string representing uri.

[transfer full][nullable]

### ges_project_new ()

    GESProject *
    ges_project_new (const gchar *uri);

Creates a new GESProject and sets its uri to `uri` if provided. Note that if `uri` is not valid or `NULL`, 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.

#### Parameters

uri | The uri to be set after creating the project. | [allow-none]

#### Returns

A newly created GESProject

### ges_project_add_encoding_profile ()

    gboolean
    ges_project_add_encoding_profile (GESProject *project,
                                      GstEncodingProfile *profile);

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.

#### Parameters

project | A GESProject |
profile | A GstEncodingProfile 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

### ges_project_list_encoding_profiles ()

    const GList *
    ges_project_list_encoding_profiles (GESProject *project);

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

#### Parameters

project | A GESProject |

#### Returns

The list of GstEncodingProfile used in `project` .

[transfer none][element-type GstPbutils.EncodingProfile][allow-none]

### ges_project_get_loading_assets ()

    GList *
    ges_project_get_loading_assets (GESProject *project);

Get the assets that are being loaded

#### Parameters

project | A GESProject |

#### Returns

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

[transfer full][element-type GES.Asset]

## Types and Values

### GESProject

    typedef struct _GESProject GESProject;

## Property Details

### The `“uri”` property

      “uri”                      gchar *

uri of the project.

Flags: Read / Write / Construct Only

Default value: NULL

## Signal Details

### The `“asset-added”` signal

    void
    user_function (GESProject *project,
                   GESAsset   *asset,
                   gpointer    user_data)

#### Parameters

project | the GESProject |
asset | The GESAsset that has been added to `project` |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“asset-loading”` signal

    void
    user_function (GESProject *project,
                   GESAsset   *asset,
                   gpointer    user_data)

#### Parameters

project | the GESProject |
asset | The GESAsset that started loading |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.8

### The `“asset-removed”` signal

    void
    user_function (GESProject *project,
                   GESAsset   *asset,
                   gpointer    user_data)

#### Parameters

project | the GESProject |
asset | The GESAsset that has been removed from `project` |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“error-loading-asset”` signal

    void
    user_function (GESProject *project,
                   GError     *error,
                   gchar      *id,
                   GType      *extractable_type,
                   gpointer    user_data)

Informs you that a GESAsset could not be created. In case of missing GStreamer plugins, the error will be set to GST_CORE_ERROR GST_CORE_ERROR_MISSING_PLUGIN

#### Parameters

project | the GESProject on which a problem happend when creted a GESAsset |
error | The GError defining the error that occured, might be `NULL` |
id | The `id` of the asset that failed loading |
extractable_type | The `extractable_type` of the asset that failed loading |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“loaded”` signal

    void
    user_function (GESProject  *project,
                   GESTimeline *timeline,
                   gpointer     user_data)

#### Parameters

project | the GESProject that is done loading a project. |
timeline | The GESTimeline that complete loading |
user_data | user data set when the signal handler was connected. |

Flags: Run First

### The `“missing-uri”` signal

    gchar*
    user_function (GESProject *project,
                   GError     *error,
                   GESAsset   *wrong_asset,
                   gpointer    user_data)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    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));
    }

#### Parameters

project | the GESProject reporting that a file has moved |
error | The error that happened |
wrong_asset | The asset with the wrong ID, you should us it and its content only to find out what the new location is. |
user_data | user data set when the signal handler was connected. |

#### Returns

The new URI of `wrong_asset` .

[transfer full][allow-none]

Flags: Run Last