2012-09-02 12:14:27 +00:00
|
|
|
/* GStreamer Editing Services
|
|
|
|
*
|
|
|
|
* Copyright (C) <2012> Thibault Saunier <thibault.saunier@collabora.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
/**
|
2014-04-07 19:02:48 +00:00
|
|
|
* SECTION: gesproject
|
2017-03-08 21:13:48 +00:00
|
|
|
* @title: GESProject
|
2012-12-21 23:17:41 +00:00
|
|
|
* @short_description: A GESAsset that is used to manage projects
|
2012-09-02 12:14:27 +00:00
|
|
|
*
|
|
|
|
* The #GESProject is used to control a set of #GESAsset and is a
|
2018-10-22 09:39:03 +00:00
|
|
|
* #GESAsset with `GES_TYPE_TIMELINE` as @extractable_type itself. That
|
2012-09-02 12:14:27 +00:00
|
|
|
* means that you can extract #GESTimeline 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 #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.
|
2019-07-08 00:55:53 +00:00
|
|
|
*
|
|
|
|
* ## Subprojects
|
|
|
|
*
|
|
|
|
* In order to add a subproject, the only thing to do is to add the subproject
|
2019-08-14 19:48:46 +00:00
|
|
|
* to the main project:
|
2019-07-08 00:55:53 +00:00
|
|
|
*
|
|
|
|
* ``` 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 #GESUriClip 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.
|
2012-09-02 12:14:27 +00:00
|
|
|
*/
|
2018-09-24 14:41:24 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
#include "ges.h"
|
|
|
|
#include "ges-internal.h"
|
|
|
|
|
2014-11-03 10:51:51 +00:00
|
|
|
static GPtrArray *new_paths = NULL;
|
|
|
|
static GHashTable *tried_uris = NULL;
|
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
struct _GESProjectPrivate
|
|
|
|
{
|
|
|
|
GHashTable *assets;
|
2013-01-11 14:49:02 +00:00
|
|
|
/* Set of asset ID being loaded */
|
|
|
|
GHashTable *loading_assets;
|
2013-01-11 22:07:22 +00:00
|
|
|
GHashTable *loaded_with_error;
|
2012-09-02 12:14:27 +00:00
|
|
|
GESAsset *formatter_asset;
|
|
|
|
|
|
|
|
GList *formatters;
|
|
|
|
|
|
|
|
gchar *uri;
|
|
|
|
|
|
|
|
GList *encoding_profiles;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct EmitLoadedInIdle
|
|
|
|
{
|
|
|
|
GESProject *project;
|
|
|
|
GESTimeline *timeline;
|
|
|
|
} EmitLoadedInIdle;
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2019-05-01 22:20:42 +00:00
|
|
|
LOADING_SIGNAL,
|
2012-09-02 12:14:27 +00:00
|
|
|
LOADED_SIGNAL,
|
2019-07-11 19:54:27 +00:00
|
|
|
ERROR_LOADING,
|
2012-09-02 12:14:27 +00:00
|
|
|
ERROR_LOADING_ASSET,
|
|
|
|
ASSET_ADDED_SIGNAL,
|
|
|
|
ASSET_REMOVED_SIGNAL,
|
|
|
|
MISSING_URI_SIGNAL,
|
2015-11-07 17:21:53 +00:00
|
|
|
ASSET_LOADING_SIGNAL,
|
2012-09-02 12:14:27 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2018-09-06 01:55:02 +00:00
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GESProject, ges_project, GES_TYPE_ASSET);
|
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
static guint _signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
static guint nb_projects = 0;
|
|
|
|
|
2019-07-08 00:35:14 +00:00
|
|
|
/* Find the type that implemented the GESExtractable interface */
|
|
|
|
static inline const gchar *
|
|
|
|
_extractable_type_name (GType type)
|
|
|
|
{
|
|
|
|
while (1) {
|
|
|
|
if (g_type_is_a (g_type_parent (type), GES_TYPE_EXTRACTABLE))
|
|
|
|
type = g_type_parent (type);
|
|
|
|
else
|
|
|
|
return g_type_name (type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_URI,
|
|
|
|
PROP_LAST,
|
|
|
|
};
|
|
|
|
|
|
|
|
static GParamSpec *_properties[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
_emit_loaded_in_idle (EmitLoadedInIdle * data)
|
|
|
|
{
|
|
|
|
g_signal_emit (data->project, _signals[LOADED_SIGNAL], 0, data->timeline);
|
|
|
|
|
|
|
|
gst_object_unref (data->project);
|
|
|
|
gst_object_unref (data->timeline);
|
|
|
|
g_slice_free (EmitLoadedInIdle, data);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-02-05 19:08:10 +00:00
|
|
|
/**
|
|
|
|
* ges_project_add_formatter:
|
|
|
|
* @project: The project to add a formatter to
|
|
|
|
* @formatter: A formatter used by @project
|
|
|
|
*
|
|
|
|
* Adds a formatter as used to load @project
|
|
|
|
*
|
|
|
|
* Since: 1.18
|
|
|
|
*/
|
|
|
|
void
|
2012-09-02 12:14:27 +00:00
|
|
|
ges_project_add_formatter (GESProject * project, GESFormatter * formatter)
|
|
|
|
{
|
|
|
|
GESProjectPrivate *priv = GES_PROJECT (project)->priv;
|
|
|
|
|
|
|
|
ges_formatter_set_project (formatter, project);
|
|
|
|
priv->formatters = g_list_append (priv->formatters, formatter);
|
|
|
|
|
2013-03-18 12:49:18 +00:00
|
|
|
gst_object_ref_sink (formatter);
|
2012-09-02 12:14:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_project_remove_formatter (GESProject * project, GESFormatter * formatter)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
GESProjectPrivate *priv = GES_PROJECT (project)->priv;
|
|
|
|
|
|
|
|
for (tmp = priv->formatters; tmp; tmp = tmp->next) {
|
|
|
|
if (tmp->data == formatter) {
|
|
|
|
gst_object_unref (formatter);
|
2012-12-29 21:04:25 +00:00
|
|
|
priv->formatters = g_list_delete_link (priv->formatters, tmp);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_project_set_uri (GESProject * project, const gchar * uri)
|
|
|
|
{
|
|
|
|
GESProjectPrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (GES_IS_PROJECT (project));
|
|
|
|
|
|
|
|
priv = project->priv;
|
|
|
|
if (priv->uri) {
|
2020-03-09 14:49:02 +00:00
|
|
|
if (g_strcmp0 (priv->uri, uri))
|
|
|
|
GST_WARNING_OBJECT (project, "Trying to reset URI, this is prohibited");
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-02-23 13:48:18 +00:00
|
|
|
if (uri == NULL) {
|
|
|
|
GST_LOG_OBJECT (project, "Uri should not be NULL");
|
2012-09-02 12:14:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->uri = g_strdup (uri);
|
|
|
|
|
|
|
|
/* We use that URI as ID */
|
|
|
|
ges_asset_set_id (GES_ASSET (project), uri);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
_load_project (GESProject * project, GESTimeline * timeline, GError ** error)
|
|
|
|
{
|
|
|
|
GError *lerr = NULL;
|
|
|
|
GESProjectPrivate *priv;
|
|
|
|
GESFormatter *formatter;
|
|
|
|
|
|
|
|
priv = GES_PROJECT (project)->priv;
|
|
|
|
|
2019-05-01 22:20:42 +00:00
|
|
|
g_signal_emit (project, _signals[LOADING_SIGNAL], 0, timeline);
|
2012-09-02 12:14:27 +00:00
|
|
|
if (priv->uri == NULL) {
|
2019-08-12 01:20:21 +00:00
|
|
|
const gchar *id = ges_asset_get_id (GES_ASSET (project));
|
2012-09-02 12:14:27 +00:00
|
|
|
|
2019-08-12 01:20:21 +00:00
|
|
|
if (id && gst_uri_is_valid (id)) {
|
2019-07-09 04:05:21 +00:00
|
|
|
ges_project_set_uri (project, ges_asset_get_id (GES_ASSET (project)));
|
|
|
|
GST_INFO_OBJECT (project, "Using asset ID %s as URI.", priv->uri);
|
|
|
|
} else {
|
|
|
|
EmitLoadedInIdle *data = g_slice_new (EmitLoadedInIdle);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
2019-07-09 04:05:21 +00:00
|
|
|
GST_INFO_OBJECT (project, "%s, Loading an empty timeline %s"
|
|
|
|
" as no URI set yet", GST_OBJECT_NAME (timeline),
|
|
|
|
ges_asset_get_id (GES_ASSET (project)));
|
2012-09-02 12:14:27 +00:00
|
|
|
|
2019-07-09 04:05:21 +00:00
|
|
|
data->timeline = gst_object_ref (timeline);
|
|
|
|
data->project = gst_object_ref (project);
|
|
|
|
|
|
|
|
/* Make sure the signal is emitted after the functions ends */
|
2019-07-09 05:03:56 +00:00
|
|
|
ges_idle_add ((GSourceFunc) _emit_loaded_in_idle, data, NULL);
|
2019-07-09 04:05:21 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2012-09-02 12:14:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->formatter_asset == NULL)
|
2015-02-23 13:48:18 +00:00
|
|
|
priv->formatter_asset = _find_formatter_asset_for_id (priv->uri);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
2015-04-03 14:48:03 +00:00
|
|
|
if (priv->formatter_asset == NULL) {
|
|
|
|
lerr = g_error_new (GES_ERROR, 0, "Could not find a suitable formatter");
|
2012-09-02 12:14:27 +00:00
|
|
|
goto failed;
|
2015-04-03 14:48:03 +00:00
|
|
|
}
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
formatter = GES_FORMATTER (ges_asset_extract (priv->formatter_asset, &lerr));
|
|
|
|
if (lerr) {
|
|
|
|
GST_WARNING_OBJECT (project, "Could not create the formatter: %s",
|
2015-09-30 08:27:26 +00:00
|
|
|
lerr->message);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
ges_project_add_formatter (GES_PROJECT (project), formatter);
|
|
|
|
ges_formatter_load_from_uri (formatter, timeline, priv->uri, &lerr);
|
|
|
|
if (lerr) {
|
|
|
|
GST_WARNING_OBJECT (project, "Could not load the timeline,"
|
|
|
|
" returning: %s", lerr->message);
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
failed:
|
|
|
|
if (lerr)
|
|
|
|
g_propagate_error (error, lerr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
_uri_missing_accumulator (GSignalInvocationHint * ihint, GValue * return_accu,
|
|
|
|
const GValue * handler_return, gpointer data)
|
|
|
|
{
|
|
|
|
const gchar *ret = g_value_get_string (handler_return);
|
|
|
|
|
2014-04-30 14:26:03 +00:00
|
|
|
if (ret) {
|
|
|
|
if (!gst_uri_is_valid (ret)) {
|
|
|
|
GST_INFO ("The uri %s was not valid, can not work with it!", ret);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
g_value_set_string (return_accu, ret);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* GESAsset vmethod implementation */
|
|
|
|
static GESExtractable *
|
|
|
|
ges_project_extract (GESAsset * project, GError ** error)
|
|
|
|
{
|
2013-11-28 18:13:06 +00:00
|
|
|
GESTimeline *timeline = g_object_new (GES_TYPE_TIMELINE, NULL);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
2013-11-25 18:17:33 +00:00
|
|
|
ges_extractable_set_asset (GES_EXTRACTABLE (timeline), GES_ASSET (project));
|
2012-09-02 12:14:27 +00:00
|
|
|
if (_load_project (GES_PROJECT (project), timeline, error))
|
|
|
|
return GES_EXTRACTABLE (timeline);
|
|
|
|
|
|
|
|
gst_object_unref (timeline);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-11-03 10:51:51 +00:00
|
|
|
static void
|
|
|
|
_add_media_new_paths_recursing (const gchar * value)
|
|
|
|
{
|
|
|
|
GFileInfo *info;
|
|
|
|
GFileEnumerator *fenum;
|
|
|
|
GFile *file = g_file_new_for_uri (value);
|
|
|
|
|
|
|
|
if (!(fenum = g_file_enumerate_children (file,
|
|
|
|
"standard::*", G_FILE_QUERY_INFO_NONE, NULL, NULL))) {
|
|
|
|
GST_INFO ("%s is not a folder", value);
|
|
|
|
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_INFO ("Adding folder: %s", value);
|
|
|
|
g_ptr_array_add (new_paths, g_strdup (value));
|
2015-09-30 08:26:31 +00:00
|
|
|
info = g_file_enumerator_next_file (fenum, NULL, NULL);
|
|
|
|
while (info != NULL) {
|
2014-11-03 10:51:51 +00:00
|
|
|
if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
|
|
|
|
GFile *f = g_file_enumerator_get_child (fenum, info);
|
|
|
|
gchar *uri = g_file_get_uri (f);
|
|
|
|
|
|
|
|
_add_media_new_paths_recursing (uri);
|
|
|
|
gst_object_unref (f);
|
|
|
|
g_free (uri);
|
|
|
|
}
|
2015-09-30 08:26:31 +00:00
|
|
|
g_object_unref (info);
|
|
|
|
info = g_file_enumerator_next_file (fenum, NULL, NULL);
|
2014-11-03 10:51:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
gst_object_unref (file);
|
|
|
|
if (fenum)
|
|
|
|
gst_object_unref (fenum);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2014-11-03 11:18:35 +00:00
|
|
|
ges_add_missing_uri_relocation_uri (const gchar * uri, gboolean recurse)
|
2014-11-03 10:51:51 +00:00
|
|
|
{
|
2014-11-03 11:18:35 +00:00
|
|
|
g_return_val_if_fail (gst_uri_is_valid (uri), FALSE);
|
2014-11-03 10:51:51 +00:00
|
|
|
|
|
|
|
if (new_paths == NULL)
|
|
|
|
new_paths = g_ptr_array_new_with_free_func (g_free);
|
|
|
|
|
2014-11-03 11:18:35 +00:00
|
|
|
if (recurse)
|
|
|
|
_add_media_new_paths_recursing (uri);
|
|
|
|
else
|
|
|
|
g_ptr_array_add (new_paths, g_strdup (uri));
|
2014-11-03 10:51:51 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
ges_missing_uri_default (GESProject * self, GError * error,
|
|
|
|
GESAsset * wrong_asset)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
const gchar *old_uri = ges_asset_get_id (wrong_asset);
|
2018-07-28 02:11:33 +00:00
|
|
|
gchar *new_id = NULL;
|
|
|
|
|
|
|
|
if (ges_asset_request_id_update (wrong_asset, &new_id, error) && new_id) {
|
|
|
|
GST_INFO_OBJECT (self, "Returned guessed new ID: %s", new_id);
|
|
|
|
|
|
|
|
return new_id;
|
|
|
|
}
|
2014-11-03 10:51:51 +00:00
|
|
|
|
|
|
|
if (new_paths == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (tried_uris == NULL)
|
|
|
|
tried_uris = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
|
|
|
|
|
|
|
for (i = 0; i < new_paths->len; i++) {
|
|
|
|
gchar *basename, *res;
|
|
|
|
|
|
|
|
basename = g_path_get_basename (old_uri);
|
|
|
|
res = g_build_filename (new_paths->pdata[i], basename, NULL);
|
|
|
|
g_free (basename);
|
|
|
|
|
|
|
|
if (g_strcmp0 (old_uri, res) == 0) {
|
|
|
|
g_hash_table_add (tried_uris, res);
|
|
|
|
} else if (g_hash_table_lookup (tried_uris, res)) {
|
|
|
|
GST_DEBUG_OBJECT (self, "File already tried: %s", res);
|
|
|
|
g_free (res);
|
|
|
|
} else {
|
|
|
|
g_hash_table_add (tried_uris, g_strdup (res));
|
|
|
|
GST_DEBUG_OBJECT (self, "Trying: %s\n", res);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2019-01-18 18:45:39 +00:00
|
|
|
gchar *
|
|
|
|
ges_uri_asset_try_update_id (GError * error, GESAsset * wrong_asset)
|
|
|
|
{
|
|
|
|
return ges_missing_uri_default (NULL, error, wrong_asset);
|
|
|
|
}
|
|
|
|
|
2014-11-03 10:51:51 +00:00
|
|
|
static void
|
|
|
|
ges_uri_assets_validate_uri (const gchar * nid)
|
|
|
|
{
|
|
|
|
if (tried_uris)
|
|
|
|
g_hash_table_remove (tried_uris, nid);
|
|
|
|
}
|
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
/* GObject vmethod implementation */
|
|
|
|
static void
|
|
|
|
_dispose (GObject * object)
|
|
|
|
{
|
|
|
|
GESProjectPrivate *priv = GES_PROJECT (object)->priv;
|
|
|
|
|
|
|
|
if (priv->assets)
|
|
|
|
g_hash_table_unref (priv->assets);
|
2013-01-11 14:49:02 +00:00
|
|
|
if (priv->loading_assets)
|
|
|
|
g_hash_table_unref (priv->loading_assets);
|
2013-01-11 22:07:22 +00:00
|
|
|
if (priv->loaded_with_error)
|
|
|
|
g_hash_table_unref (priv->loaded_with_error);
|
2012-09-02 12:14:27 +00:00
|
|
|
if (priv->formatter_asset)
|
|
|
|
gst_object_unref (priv->formatter_asset);
|
|
|
|
|
2019-04-12 22:31:07 +00:00
|
|
|
while (priv->formatters)
|
|
|
|
ges_project_remove_formatter (GES_PROJECT (object), priv->formatters->data);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (ges_project_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GESProjectPrivate *priv = GES_PROJECT (object)->priv;
|
|
|
|
|
|
|
|
if (priv->uri)
|
|
|
|
g_free (priv->uri);
|
2019-03-28 16:06:37 +00:00
|
|
|
g_list_free_full (priv->encoding_profiles, g_object_unref);
|
2014-03-07 20:48:06 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (ges_project_parent_class)->finalize (object);
|
2012-09-02 12:14:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_get_property (GESProject * project, guint property_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GESProjectPrivate *priv = project->priv;
|
|
|
|
|
|
|
|
switch (property_id) {
|
|
|
|
case PROP_URI:
|
|
|
|
g_value_set_string (value, priv->uri);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (project, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_set_property (GESProject * project, guint property_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
switch (property_id) {
|
|
|
|
case PROP_URI:
|
|
|
|
project->priv->uri = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (project, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_project_class_init (GESProjectClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
klass->asset_added = NULL;
|
2014-11-03 10:51:51 +00:00
|
|
|
klass->missing_uri = ges_missing_uri_default;
|
2012-09-02 12:14:27 +00:00
|
|
|
klass->loading_error = NULL;
|
|
|
|
klass->asset_removed = NULL;
|
|
|
|
object_class->get_property = (GObjectGetPropertyFunc) _get_property;
|
|
|
|
object_class->set_property = (GObjectSetPropertyFunc) _set_property;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GESProject::uri:
|
|
|
|
*
|
|
|
|
* The location of the project to use.
|
|
|
|
*/
|
|
|
|
_properties[PROP_URI] = g_param_spec_string ("uri", "URI",
|
|
|
|
"uri of the project", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
|
|
|
|
|
|
|
g_object_class_install_properties (object_class, PROP_LAST, _properties);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GESProject::asset-added:
|
2015-11-07 17:21:53 +00:00
|
|
|
* @project: the #GESProject
|
2012-09-02 12:14:27 +00:00
|
|
|
* @asset: The #GESAsset that has been added to @project
|
|
|
|
*/
|
|
|
|
_signals[ASSET_ADDED_SIGNAL] =
|
|
|
|
g_signal_new ("asset-added", G_TYPE_FROM_CLASS (klass),
|
2015-12-11 14:20:53 +00:00
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GESProjectClass, asset_added),
|
2019-08-29 05:45:45 +00:00
|
|
|
NULL, NULL, NULL, G_TYPE_NONE, 1, GES_TYPE_ASSET);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
2015-11-07 17:21:53 +00:00
|
|
|
/**
|
|
|
|
* GESProject::asset-loading:
|
|
|
|
* @project: the #GESProject
|
|
|
|
* @asset: The #GESAsset that started loading
|
|
|
|
*
|
|
|
|
* Since: 1.8
|
|
|
|
*/
|
|
|
|
_signals[ASSET_LOADING_SIGNAL] =
|
|
|
|
g_signal_new ("asset-loading", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GESProjectClass, asset_loading),
|
2019-08-29 05:45:45 +00:00
|
|
|
NULL, NULL, NULL, G_TYPE_NONE, 1, GES_TYPE_ASSET);
|
2015-11-07 17:21:53 +00:00
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
/**
|
|
|
|
* GESProject::asset-removed:
|
2015-11-07 17:21:53 +00:00
|
|
|
* @project: the #GESProject
|
2012-09-02 12:14:27 +00:00
|
|
|
* @asset: The #GESAsset that has been removed from @project
|
|
|
|
*/
|
|
|
|
_signals[ASSET_REMOVED_SIGNAL] =
|
|
|
|
g_signal_new ("asset-removed", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GESProjectClass, asset_removed),
|
2019-08-29 05:45:45 +00:00
|
|
|
NULL, NULL, NULL, G_TYPE_NONE, 1, GES_TYPE_ASSET);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
2019-05-01 22:20:42 +00:00
|
|
|
/**
|
|
|
|
* GESProject::loading:
|
|
|
|
* @project: the #GESProject that is starting to load a timeline
|
|
|
|
* @timeline: The #GESTimeline that started loading
|
|
|
|
*
|
|
|
|
* Since: 1.18
|
|
|
|
*/
|
|
|
|
_signals[LOADING_SIGNAL] =
|
|
|
|
g_signal_new ("loading", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GESProjectClass, loading),
|
2019-08-29 05:45:45 +00:00
|
|
|
NULL, NULL, NULL, G_TYPE_NONE, 1, GES_TYPE_TIMELINE);
|
2019-05-01 22:20:42 +00:00
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
/**
|
|
|
|
* GESProject::loaded:
|
2019-05-01 22:20:42 +00:00
|
|
|
* @project: the #GESProject that is done loading a timeline.
|
|
|
|
* @timeline: The #GESTimeline that completed loading
|
2012-09-02 12:14:27 +00:00
|
|
|
*/
|
|
|
|
_signals[LOADED_SIGNAL] =
|
|
|
|
g_signal_new ("loaded", G_TYPE_FROM_CLASS (klass),
|
2012-12-28 14:40:33 +00:00
|
|
|
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GESProjectClass, loaded),
|
2019-08-29 05:45:45 +00:00
|
|
|
NULL, NULL, NULL, G_TYPE_NONE, 1, GES_TYPE_TIMELINE);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GESProject::missing-uri:
|
|
|
|
* @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.
|
|
|
|
*
|
|
|
|
* |[
|
|
|
|
* static gchar
|
2013-09-12 21:34:55 +00:00
|
|
|
* source_moved_cb (GESProject *project, GError *error, GESAsset *asset_with_error)
|
2012-09-02 12:14:27 +00:00
|
|
|
* {
|
|
|
|
* 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));
|
|
|
|
* }
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* Returns: (transfer full) (allow-none): The new URI of @wrong_asset
|
|
|
|
*/
|
|
|
|
_signals[MISSING_URI_SIGNAL] =
|
|
|
|
g_signal_new ("missing-uri", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GESProjectClass, missing_uri),
|
2019-08-29 05:45:45 +00:00
|
|
|
_uri_missing_accumulator, NULL, NULL,
|
2012-09-02 12:14:27 +00:00
|
|
|
G_TYPE_STRING, 2, G_TYPE_ERROR, GES_TYPE_ASSET);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GESProject::error-loading-asset:
|
|
|
|
* @project: the #GESProject on which a problem happend when creted a #GESAsset
|
2019-01-18 20:25:11 +00:00
|
|
|
* @error: The #GError defining the error that occured, might be %NULL
|
2012-09-02 12:14:27 +00:00
|
|
|
* @id: The @id of the asset that failed loading
|
|
|
|
* @extractable_type: The @extractable_type of the asset that
|
|
|
|
* failed loading
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
_signals[ERROR_LOADING_ASSET] =
|
|
|
|
g_signal_new ("error-loading-asset", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GESProjectClass, loading_error),
|
2019-08-29 05:45:45 +00:00
|
|
|
NULL, NULL, NULL,
|
2012-09-02 12:14:27 +00:00
|
|
|
G_TYPE_NONE, 3, G_TYPE_ERROR, G_TYPE_STRING, G_TYPE_GTYPE);
|
|
|
|
|
2019-07-11 19:54:27 +00:00
|
|
|
/**
|
|
|
|
* GESProject::error-loading:
|
|
|
|
* @project: the #GESProject on which a problem happend when creted a #GESAsset
|
|
|
|
* @timeline: The timeline that failed loading
|
|
|
|
* @error: The #GError defining the error that occured
|
2020-04-09 15:24:44 +00:00
|
|
|
*
|
2019-07-11 19:54:27 +00:00
|
|
|
* Since: 1.18
|
|
|
|
*/
|
|
|
|
_signals[ERROR_LOADING] =
|
|
|
|
g_signal_new ("error-loading", G_TYPE_FROM_CLASS (klass),
|
2019-08-29 05:45:45 +00:00
|
|
|
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL,
|
|
|
|
G_TYPE_NONE, 2, GES_TYPE_TIMELINE, G_TYPE_ERROR);
|
2019-07-11 19:54:27 +00:00
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
object_class->dispose = _dispose;
|
2014-03-08 11:26:13 +00:00
|
|
|
object_class->finalize = _finalize;
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
GES_ASSET_CLASS (klass)->extract = ges_project_extract;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ges_project_init (GESProject * project)
|
|
|
|
{
|
|
|
|
GESProjectPrivate *priv = project->priv =
|
2018-09-06 01:55:02 +00:00
|
|
|
ges_project_get_instance_private (project);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
priv->uri = NULL;
|
|
|
|
priv->formatters = NULL;
|
|
|
|
priv->formatter_asset = NULL;
|
|
|
|
priv->encoding_profiles = NULL;
|
|
|
|
priv->assets = g_hash_table_new_full (g_str_hash, g_str_equal,
|
|
|
|
g_free, gst_object_unref);
|
2013-01-11 14:49:02 +00:00
|
|
|
priv->loading_assets = g_hash_table_new_full (g_str_hash, g_str_equal,
|
|
|
|
g_free, gst_object_unref);
|
2013-01-11 22:07:22 +00:00
|
|
|
priv->loaded_with_error = g_hash_table_new_full (g_str_hash, g_str_equal,
|
|
|
|
g_free, NULL);
|
2012-09-02 12:14:27 +00:00
|
|
|
}
|
|
|
|
|
2019-07-08 00:35:14 +00:00
|
|
|
static gchar *
|
|
|
|
ges_project_internal_extractable_type_id (GType extractable_type,
|
|
|
|
const gchar * id)
|
|
|
|
{
|
|
|
|
return g_strdup_printf ("%s:%s", _extractable_type_name (extractable_type),
|
|
|
|
id);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
ges_project_internal_asset_id (GESAsset * asset)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
ges_project_internal_extractable_type_id (ges_asset_get_extractable_type
|
|
|
|
(asset), ges_asset_get_id (asset));
|
|
|
|
}
|
|
|
|
|
2013-07-27 08:18:30 +00:00
|
|
|
static void
|
|
|
|
_send_error_loading_asset (GESProject * project, GESAsset * asset,
|
|
|
|
GError * error)
|
|
|
|
{
|
2019-07-08 00:35:14 +00:00
|
|
|
gchar *internal_id = ges_project_internal_asset_id (asset);
|
2013-07-27 08:18:30 +00:00
|
|
|
const gchar *id = ges_asset_get_id (asset);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (project, "Sending error loading asset for %s", id);
|
2019-07-08 00:35:14 +00:00
|
|
|
g_hash_table_remove (project->priv->loading_assets, internal_id);
|
|
|
|
g_hash_table_add (project->priv->loaded_with_error, internal_id);
|
|
|
|
g_signal_emit (project, _signals[ERROR_LOADING_ASSET], 0, error,
|
|
|
|
id, ges_asset_get_extractable_type (asset));
|
2013-07-27 08:18:30 +00:00
|
|
|
}
|
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
gchar *
|
|
|
|
ges_project_try_updating_id (GESProject * project, GESAsset * asset,
|
|
|
|
GError * error)
|
|
|
|
{
|
|
|
|
gchar *new_id = NULL;
|
2013-07-27 08:18:30 +00:00
|
|
|
const gchar *id;
|
2019-07-08 00:35:14 +00:00
|
|
|
gchar *internal_id;
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), NULL);
|
|
|
|
g_return_val_if_fail (GES_IS_ASSET (asset), NULL);
|
|
|
|
g_return_val_if_fail (error, NULL);
|
|
|
|
|
2013-07-27 08:18:30 +00:00
|
|
|
id = ges_asset_get_id (asset);
|
|
|
|
GST_DEBUG_OBJECT (project, "Try to proxy %s", id);
|
2012-09-02 12:14:27 +00:00
|
|
|
if (ges_asset_request_id_update (asset, &new_id, error) == FALSE) {
|
2014-01-16 14:25:06 +00:00
|
|
|
GST_DEBUG_OBJECT (project, "Type: %s can not be proxied for id: %s "
|
|
|
|
"and error: %s", g_type_name (G_OBJECT_TYPE (asset)), id,
|
|
|
|
error->message);
|
2013-07-27 08:18:30 +00:00
|
|
|
_send_error_loading_asset (project, asset, error);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2018-07-28 02:11:33 +00:00
|
|
|
/* Always send the MISSING_URI signal if requesting new ID is possible
|
|
|
|
* so that subclasses of GESProject are aware of the missing-uri */
|
|
|
|
g_signal_emit (project, _signals[MISSING_URI_SIGNAL], 0, error, asset,
|
|
|
|
&new_id);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
if (new_id) {
|
2013-07-27 08:18:30 +00:00
|
|
|
GST_DEBUG_OBJECT (project, "new id found: %s", new_id);
|
2015-11-20 22:33:12 +00:00
|
|
|
if (!ges_asset_try_proxy (asset, new_id)) {
|
2012-09-02 12:14:27 +00:00
|
|
|
g_free (new_id);
|
2012-12-29 21:04:25 +00:00
|
|
|
new_id = NULL;
|
|
|
|
}
|
2014-04-30 14:26:03 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (project, "No new id found for %s", id);
|
2012-09-02 12:14:27 +00:00
|
|
|
}
|
|
|
|
|
2019-07-08 00:35:14 +00:00
|
|
|
internal_id = ges_project_internal_asset_id (asset);
|
|
|
|
g_hash_table_remove (project->priv->loading_assets, internal_id);
|
|
|
|
g_free (internal_id);
|
2013-07-27 08:18:30 +00:00
|
|
|
|
|
|
|
if (new_id == NULL)
|
|
|
|
_send_error_loading_asset (project, asset, error);
|
|
|
|
|
2013-01-30 23:12:26 +00:00
|
|
|
|
2012-12-29 21:04:25 +00:00
|
|
|
return new_id;
|
2012-09-02 12:14:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
new_asset_cb (GESAsset * source, GAsyncResult * res, GESProject * project)
|
|
|
|
{
|
|
|
|
GError *error = NULL;
|
|
|
|
gchar *possible_id = NULL;
|
|
|
|
GESAsset *asset = ges_asset_request_finish (res, &error);
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
possible_id = ges_project_try_updating_id (project, source, error);
|
2019-04-05 14:24:39 +00:00
|
|
|
g_clear_error (&error);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
2013-07-27 08:18:30 +00:00
|
|
|
if (possible_id == NULL)
|
2012-09-02 12:14:27 +00:00
|
|
|
return;
|
2013-01-30 23:12:26 +00:00
|
|
|
|
|
|
|
ges_project_create_asset (project, possible_id,
|
|
|
|
ges_asset_get_extractable_type (source));
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
g_free (possible_id);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-04-09 15:24:44 +00:00
|
|
|
if (asset) {
|
|
|
|
ges_asset_finish_proxy (asset);
|
|
|
|
ges_project_add_asset (project, asset);
|
2012-09-02 12:14:27 +00:00
|
|
|
gst_object_unref (asset);
|
2020-04-09 15:24:44 +00:00
|
|
|
}
|
2012-09-02 12:14:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_project_set_loaded:
|
|
|
|
* @project: The #GESProject from which to emit the "project-loaded" signal
|
|
|
|
*
|
|
|
|
* Emits the "loaded" signal. This method should be called by sublasses when
|
|
|
|
* the project is fully loaded.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the signale could be emitted %FALSE otherwize
|
|
|
|
*/
|
|
|
|
gboolean
|
2019-07-11 19:54:27 +00:00
|
|
|
ges_project_set_loaded (GESProject * project, GESFormatter * formatter,
|
|
|
|
GError * error)
|
2012-09-02 12:14:27 +00:00
|
|
|
{
|
2019-07-11 19:54:27 +00:00
|
|
|
if (error) {
|
|
|
|
GST_ERROR_OBJECT (project, "Emit project error-loading %s", error->message);
|
|
|
|
g_signal_emit (project, _signals[ERROR_LOADING], 0, formatter->timeline,
|
|
|
|
error);
|
|
|
|
}
|
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
GST_INFO_OBJECT (project, "Emit project loaded");
|
2014-09-19 15:12:18 +00:00
|
|
|
if (GST_STATE (formatter->timeline) < GST_STATE_PAUSED) {
|
|
|
|
timeline_fill_gaps (formatter->timeline);
|
|
|
|
} else {
|
|
|
|
ges_timeline_commit (formatter->timeline);
|
|
|
|
}
|
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
g_signal_emit (project, _signals[LOADED_SIGNAL], 0, formatter->timeline);
|
|
|
|
|
|
|
|
/* We are now done with that formatter */
|
2013-06-20 12:23:26 +00:00
|
|
|
ges_project_remove_formatter (project, formatter);
|
2012-09-02 12:14:27 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-01-11 14:49:02 +00:00
|
|
|
void
|
|
|
|
ges_project_add_loading_asset (GESProject * project, GType extractable_type,
|
|
|
|
const gchar * id)
|
|
|
|
{
|
|
|
|
GESAsset *asset;
|
|
|
|
|
2015-11-07 17:21:53 +00:00
|
|
|
if ((asset = ges_asset_cache_lookup (extractable_type, id))) {
|
2019-07-08 00:35:14 +00:00
|
|
|
if (g_hash_table_insert (project->priv->loading_assets,
|
|
|
|
ges_project_internal_asset_id (asset), gst_object_ref (asset)))
|
2015-11-07 17:21:53 +00:00
|
|
|
g_signal_emit (project, _signals[ASSET_LOADING_SIGNAL], 0, asset);
|
|
|
|
}
|
2013-01-11 14:49:02 +00:00
|
|
|
}
|
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
/**************************************
|
|
|
|
* *
|
|
|
|
* API Implementation *
|
|
|
|
* *
|
|
|
|
**************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_project_create_asset:
|
|
|
|
* @project: A #GESProject
|
2013-04-19 22:58:21 +00:00
|
|
|
* @id: (allow-none): The id of the asset to create and add to @project
|
2012-09-02 12:14:27 +00:00
|
|
|
* @extractable_type: The #GType of the asset to create
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the asset started to be added %FALSE it was already
|
|
|
|
* in the project
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_project_create_asset (GESProject * project, const gchar * id,
|
|
|
|
GType extractable_type)
|
|
|
|
{
|
2019-07-08 00:35:14 +00:00
|
|
|
gchar *internal_id;
|
2012-09-02 12:14:27 +00:00
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), FALSE);
|
|
|
|
g_return_val_if_fail (g_type_is_a (extractable_type, GES_TYPE_EXTRACTABLE),
|
|
|
|
FALSE);
|
|
|
|
|
2013-04-19 22:58:21 +00:00
|
|
|
if (id == NULL)
|
|
|
|
id = g_type_name (extractable_type);
|
2019-07-08 00:35:14 +00:00
|
|
|
internal_id = ges_project_internal_extractable_type_id (extractable_type, id);
|
|
|
|
|
|
|
|
if (g_hash_table_lookup (project->priv->assets, internal_id) ||
|
|
|
|
g_hash_table_lookup (project->priv->loading_assets, internal_id) ||
|
|
|
|
g_hash_table_lookup (project->priv->loaded_with_error, internal_id)) {
|
2013-04-19 22:58:21 +00:00
|
|
|
|
2019-07-08 00:35:14 +00:00
|
|
|
g_free (internal_id);
|
2012-09-02 12:14:27 +00:00
|
|
|
return FALSE;
|
2019-07-08 00:35:14 +00:00
|
|
|
}
|
|
|
|
g_free (internal_id);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
/* TODO Add a GCancellable somewhere in our API */
|
|
|
|
ges_asset_request_async (extractable_type, id, NULL,
|
|
|
|
(GAsyncReadyCallback) new_asset_cb, project);
|
2013-01-11 14:49:02 +00:00
|
|
|
ges_project_add_loading_asset (project, extractable_type, id);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-11-03 10:54:10 +00:00
|
|
|
/**
|
|
|
|
* ges_project_create_asset_sync:
|
|
|
|
* @project: A #GESProject
|
|
|
|
* @id: (allow-none): The id of the asset to create and add to @project
|
|
|
|
* @extractable_type: The #GType of the asset to create
|
|
|
|
* @error: A #GError to be set in case of 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
|
|
|
|
*
|
2016-05-14 23:04:17 +00:00
|
|
|
* Returns: (transfer full) (nullable): The newly created #GESAsset or %NULL.
|
2014-11-03 10:54:10 +00:00
|
|
|
*/
|
|
|
|
GESAsset *
|
|
|
|
ges_project_create_asset_sync (GESProject * project, const gchar * id,
|
|
|
|
GType extractable_type, GError ** error)
|
|
|
|
{
|
|
|
|
GESAsset *asset;
|
2019-07-08 00:35:14 +00:00
|
|
|
gchar *possible_id = NULL, *internal_id;
|
2014-11-03 10:54:10 +00:00
|
|
|
gboolean retry = TRUE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), FALSE);
|
|
|
|
g_return_val_if_fail (g_type_is_a (extractable_type, GES_TYPE_EXTRACTABLE),
|
|
|
|
FALSE);
|
|
|
|
|
|
|
|
if (id == NULL)
|
|
|
|
id = g_type_name (extractable_type);
|
|
|
|
|
2019-07-08 00:35:14 +00:00
|
|
|
internal_id = ges_project_internal_extractable_type_id (extractable_type, id);
|
|
|
|
if ((asset = g_hash_table_lookup (project->priv->assets, internal_id))) {
|
|
|
|
g_free (internal_id);
|
|
|
|
|
2020-05-01 11:40:58 +00:00
|
|
|
return gst_object_ref (asset);
|
2019-07-08 00:35:14 +00:00
|
|
|
} else if (g_hash_table_lookup (project->priv->loading_assets, internal_id) ||
|
|
|
|
g_hash_table_lookup (project->priv->loaded_with_error, internal_id)) {
|
|
|
|
g_free (internal_id);
|
|
|
|
|
2014-11-03 10:54:10 +00:00
|
|
|
return NULL;
|
2019-07-08 00:35:14 +00:00
|
|
|
}
|
2020-02-20 20:13:46 +00:00
|
|
|
g_free (internal_id);
|
2014-11-03 10:54:10 +00:00
|
|
|
|
|
|
|
/* TODO Add a GCancellable somewhere in our API */
|
|
|
|
while (retry) {
|
|
|
|
|
|
|
|
if (g_type_is_a (extractable_type, GES_TYPE_URI_CLIP)) {
|
|
|
|
asset = GES_ASSET (ges_uri_clip_asset_request_sync (id, error));
|
|
|
|
} else {
|
|
|
|
asset = ges_asset_request (extractable_type, id, error);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (asset) {
|
|
|
|
retry = FALSE;
|
2019-07-08 00:35:14 +00:00
|
|
|
internal_id =
|
|
|
|
ges_project_internal_extractable_type_id (extractable_type, id);
|
|
|
|
if ((!g_hash_table_lookup (project->priv->assets, internal_id)))
|
2015-11-20 22:33:12 +00:00
|
|
|
g_signal_emit (project, _signals[ASSET_LOADING_SIGNAL], 0, asset);
|
2019-07-08 00:35:14 +00:00
|
|
|
g_free (internal_id);
|
2015-11-20 22:33:12 +00:00
|
|
|
|
2014-11-03 10:54:10 +00:00
|
|
|
if (possible_id) {
|
|
|
|
g_free (possible_id);
|
|
|
|
ges_uri_assets_validate_uri (id);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
GESAsset *tmpasset;
|
|
|
|
|
|
|
|
tmpasset = ges_asset_cache_lookup (extractable_type, id);
|
|
|
|
possible_id = ges_project_try_updating_id (project, tmpasset, *error);
|
|
|
|
|
2018-07-19 14:55:31 +00:00
|
|
|
if (possible_id == NULL) {
|
|
|
|
g_signal_emit (project, _signals[ASSET_LOADING_SIGNAL], 0, tmpasset);
|
|
|
|
g_signal_emit (project, _signals[ERROR_LOADING_ASSET], 0, *error, id,
|
|
|
|
extractable_type);
|
2014-11-03 10:54:10 +00:00
|
|
|
return NULL;
|
2018-07-19 14:55:31 +00:00
|
|
|
}
|
|
|
|
|
2014-11-03 10:54:10 +00:00
|
|
|
|
2017-02-28 10:59:35 +00:00
|
|
|
g_clear_error (error);
|
2014-11-03 10:54:10 +00:00
|
|
|
|
|
|
|
id = possible_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-20 22:33:12 +00:00
|
|
|
if (!ges_asset_get_proxy_target (asset))
|
2020-03-04 11:31:32 +00:00
|
|
|
ges_asset_finish_proxy (asset);
|
2015-11-20 22:33:12 +00:00
|
|
|
|
2014-11-03 10:54:10 +00:00
|
|
|
ges_project_add_asset (project, asset);
|
|
|
|
|
|
|
|
return asset;
|
|
|
|
}
|
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
/**
|
|
|
|
* ges_project_add_asset:
|
|
|
|
* @project: A #GESProject
|
|
|
|
* @asset: (transfer none): A #GESAsset to add to @project
|
|
|
|
*
|
2018-10-22 09:39:03 +00:00
|
|
|
* Adds a #GESAsset to @project, the project will keep a reference on
|
2012-09-02 12:14:27 +00:00
|
|
|
* @asset.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the asset could be added %FALSE it was already
|
|
|
|
* in the project
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_project_add_asset (GESProject * project, GESAsset * asset)
|
|
|
|
{
|
2019-07-08 00:35:14 +00:00
|
|
|
gchar *internal_id;
|
2012-09-02 12:14:27 +00:00
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), FALSE);
|
|
|
|
|
2019-07-08 00:35:14 +00:00
|
|
|
internal_id = ges_project_internal_asset_id (asset);
|
|
|
|
if (g_hash_table_lookup (project->priv->assets, internal_id)) {
|
|
|
|
g_free (internal_id);
|
2014-09-26 16:39:19 +00:00
|
|
|
return TRUE;
|
2019-07-08 00:35:14 +00:00
|
|
|
}
|
2012-09-02 12:14:27 +00:00
|
|
|
|
2019-07-08 00:35:14 +00:00
|
|
|
g_hash_table_insert (project->priv->assets, internal_id,
|
|
|
|
gst_object_ref (asset));
|
|
|
|
g_hash_table_remove (project->priv->loading_assets, internal_id);
|
2012-09-02 12:14:27 +00:00
|
|
|
GST_DEBUG_OBJECT (project, "Asset added: %s", ges_asset_get_id (asset));
|
|
|
|
g_signal_emit (project, _signals[ASSET_ADDED_SIGNAL], 0, asset);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_project_remove_asset:
|
|
|
|
* @project: A #GESProject
|
|
|
|
* @asset: (transfer none): A #GESAsset to remove from @project
|
|
|
|
*
|
|
|
|
* remove a @asset to from @project.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the asset could be removed %FALSE otherwise
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_project_remove_asset (GESProject * project, GESAsset * asset)
|
|
|
|
{
|
|
|
|
gboolean ret;
|
2019-07-08 00:35:14 +00:00
|
|
|
gchar *internal_id;
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), FALSE);
|
|
|
|
|
2019-07-08 00:35:14 +00:00
|
|
|
internal_id = ges_project_internal_asset_id (asset);
|
|
|
|
ret = g_hash_table_remove (project->priv->assets, internal_id);
|
|
|
|
g_free (internal_id);
|
2012-09-02 12:14:27 +00:00
|
|
|
g_signal_emit (project, _signals[ASSET_REMOVED_SIGNAL], 0, asset);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_project_get_asset:
|
|
|
|
* @project: A #GESProject
|
|
|
|
* @id: The id of the asset to retrieve
|
|
|
|
* @extractable_type: The extractable_type of the asset
|
|
|
|
* to retrieve from @object
|
|
|
|
*
|
|
|
|
* Returns: (transfer full) (allow-none): The #GESAsset with
|
|
|
|
* @id or %NULL if no asset with @id as an ID
|
|
|
|
*/
|
|
|
|
GESAsset *
|
|
|
|
ges_project_get_asset (GESProject * project, const gchar * id,
|
|
|
|
GType extractable_type)
|
|
|
|
{
|
|
|
|
GESAsset *asset;
|
2019-07-08 00:35:14 +00:00
|
|
|
gchar *internal_id;
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), NULL);
|
|
|
|
g_return_val_if_fail (g_type_is_a (extractable_type, GES_TYPE_EXTRACTABLE),
|
|
|
|
NULL);
|
|
|
|
|
2019-07-08 00:35:14 +00:00
|
|
|
internal_id = ges_project_internal_extractable_type_id (extractable_type, id);
|
|
|
|
asset = g_hash_table_lookup (project->priv->assets, internal_id);
|
|
|
|
g_free (internal_id);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
if (asset)
|
|
|
|
return gst_object_ref (asset);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_project_list_assets:
|
|
|
|
* @project: A #GESProject
|
2018-10-22 09:39:03 +00:00
|
|
|
* @filter: Type of assets to list, `GES_TYPE_EXTRACTABLE` will list
|
2012-09-02 12:14:27 +00:00
|
|
|
* all assets
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full) (element-type GESAsset): The list of
|
|
|
|
* #GESAsset the object contains
|
|
|
|
*/
|
|
|
|
GList *
|
|
|
|
ges_project_list_assets (GESProject * project, GType filter)
|
|
|
|
{
|
|
|
|
GList *ret = NULL;
|
|
|
|
GHashTableIter iter;
|
|
|
|
gpointer key, value;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), NULL);
|
2019-09-23 19:10:59 +00:00
|
|
|
g_return_val_if_fail (filter == G_TYPE_NONE
|
|
|
|
|| g_type_is_a (filter, GES_TYPE_EXTRACTABLE), NULL);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
g_hash_table_iter_init (&iter, project->priv->assets);
|
|
|
|
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
|
|
|
if (g_type_is_a (ges_asset_get_extractable_type (GES_ASSET (value)),
|
|
|
|
filter))
|
2013-03-16 22:05:04 +00:00
|
|
|
ret = g_list_append (ret, gst_object_ref (value));
|
2012-09-02 12:14:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_project_save:
|
|
|
|
* @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
|
2020-05-01 11:40:58 +00:00
|
|
|
* @formatter_asset: (transfer full) (allow-none): 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 best formatter
|
|
|
|
* as defined in #ges_find_formatter_for_uri
|
2012-09-02 12:14:27 +00:00
|
|
|
* @overwrite: %TRUE to overwrite file if it exists
|
|
|
|
* @error: (out) (allow-none): An error to be set in case something wrong happens or %NULL
|
|
|
|
*
|
|
|
|
* 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);)
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the project could be save, %FALSE otherwize
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_project_save (GESProject * project, GESTimeline * timeline,
|
|
|
|
const gchar * uri, GESAsset * formatter_asset, gboolean overwrite,
|
|
|
|
GError ** error)
|
|
|
|
{
|
|
|
|
GESAsset *tl_asset;
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
GESFormatter *formatter = NULL;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), FALSE);
|
|
|
|
g_return_val_if_fail (formatter_asset == NULL ||
|
|
|
|
g_type_is_a (ges_asset_get_extractable_type (formatter_asset),
|
|
|
|
GES_TYPE_FORMATTER), FALSE);
|
|
|
|
g_return_val_if_fail ((error == NULL || *error == NULL), FALSE);
|
|
|
|
|
|
|
|
tl_asset = ges_extractable_get_asset (GES_EXTRACTABLE (timeline));
|
|
|
|
if (tl_asset == NULL && project->priv->uri == NULL) {
|
|
|
|
GESAsset *asset = ges_asset_cache_lookup (GES_TYPE_PROJECT, uri);
|
|
|
|
|
|
|
|
if (asset) {
|
|
|
|
GST_WARNING_OBJECT (project, "Trying to save project to %s but we already"
|
|
|
|
"have %" GST_PTR_FORMAT " for that uri, can not save", uri, asset);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (project, "Timeline %" GST_PTR_FORMAT " has no asset"
|
|
|
|
" we have no uri set, so setting ourself as asset", timeline);
|
|
|
|
|
|
|
|
ges_extractable_set_asset (GES_EXTRACTABLE (timeline), GES_ASSET (project));
|
|
|
|
} else if (tl_asset != GES_ASSET (project)) {
|
|
|
|
GST_WARNING_OBJECT (project, "Timeline %" GST_PTR_FORMAT
|
|
|
|
" not created by this project can not save", timeline);
|
|
|
|
|
|
|
|
ret = FALSE;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2019-07-04 00:15:23 +00:00
|
|
|
if (formatter_asset == NULL) {
|
|
|
|
formatter_asset = gst_object_ref (ges_find_formatter_for_uri (uri));
|
|
|
|
}
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
formatter = GES_FORMATTER (ges_asset_extract (formatter_asset, error));
|
|
|
|
if (formatter == NULL) {
|
2013-01-22 19:51:25 +00:00
|
|
|
GST_WARNING_OBJECT (project, "Could not create the formatter %p %s: %s",
|
|
|
|
formatter_asset, ges_asset_get_id (formatter_asset),
|
|
|
|
(error && *error) ? (*error)->message : "Unknown Error");
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
ret = FALSE;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
ges_project_add_formatter (project, formatter);
|
|
|
|
ret = ges_formatter_save_to_uri (formatter, timeline, uri, overwrite, error);
|
|
|
|
if (ret && project->priv->uri == NULL)
|
|
|
|
ges_project_set_uri (project, uri);
|
|
|
|
|
|
|
|
out:
|
|
|
|
if (formatter_asset)
|
|
|
|
gst_object_unref (formatter_asset);
|
|
|
|
ges_project_remove_formatter (project, formatter);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_project_new:
|
|
|
|
* @uri: (allow-none): The uri to be set after creating the project.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Returns: A newly created #GESProject
|
|
|
|
*/
|
|
|
|
GESProject *
|
|
|
|
ges_project_new (const gchar * uri)
|
|
|
|
{
|
|
|
|
gchar *id = (gchar *) uri;
|
|
|
|
GESProject *project;
|
|
|
|
|
|
|
|
if (uri == NULL)
|
|
|
|
id = g_strdup_printf ("project-%i", nb_projects++);
|
|
|
|
|
|
|
|
project = GES_PROJECT (ges_asset_request (GES_TYPE_TIMELINE, id, NULL));
|
|
|
|
|
|
|
|
if (project && uri)
|
|
|
|
ges_project_set_uri (project, uri);
|
|
|
|
|
2014-10-26 20:27:17 +00:00
|
|
|
if (uri == NULL)
|
|
|
|
g_free (id);
|
|
|
|
|
2012-09-02 12:14:27 +00:00
|
|
|
return project;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_project_load:
|
|
|
|
* @project: A #GESProject that has an @uri set already
|
|
|
|
* @timeline: A blank timeline to load @project into
|
|
|
|
* @error: (out) (allow-none): An error to be set in case something wrong happens or %NULL
|
|
|
|
*
|
|
|
|
* Loads @project into @timeline
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the project could be loaded %FALSE otherwize.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_project_load (GESProject * project, GESTimeline * timeline, GError ** error)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GES_IS_TIMELINE (timeline), FALSE);
|
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), FALSE);
|
|
|
|
g_return_val_if_fail (ges_project_get_uri (project), FALSE);
|
2014-12-10 09:21:16 +00:00
|
|
|
g_return_val_if_fail (timeline->tracks == NULL, FALSE);
|
2012-09-02 12:14:27 +00:00
|
|
|
|
|
|
|
if (!_load_project (project, timeline, error))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
ges_extractable_set_asset (GES_EXTRACTABLE (timeline), GES_ASSET (project));
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_project_get_uri:
|
|
|
|
* @project: A #GESProject
|
|
|
|
*
|
|
|
|
* Retrieve the uri that is currently set on @project
|
|
|
|
*
|
2016-06-29 00:38:36 +00:00
|
|
|
* Returns: (transfer full) (nullable): a newly allocated string representing uri.
|
2012-09-02 12:14:27 +00:00
|
|
|
*/
|
|
|
|
gchar *
|
|
|
|
ges_project_get_uri (GESProject * project)
|
|
|
|
{
|
|
|
|
GESProjectPrivate *priv;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), FALSE);
|
|
|
|
|
|
|
|
priv = project->priv;
|
|
|
|
if (priv->uri)
|
|
|
|
return g_strdup (priv->uri);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_project_add_encoding_profile:
|
|
|
|
* @project: A #GESProject
|
|
|
|
* @profile: A #GstEncodingProfile to add to the project. If a profile with
|
|
|
|
* the same name already exists, it will be replaced
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if @profile could be added, %FALSE otherwize
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_project_add_encoding_profile (GESProject * project,
|
|
|
|
GstEncodingProfile * profile)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
GESProjectPrivate *priv;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), FALSE);
|
|
|
|
g_return_val_if_fail (GST_IS_ENCODING_PROFILE (profile), FALSE);
|
|
|
|
|
|
|
|
priv = project->priv;
|
|
|
|
for (tmp = priv->encoding_profiles; tmp; tmp = tmp->next) {
|
|
|
|
GstEncodingProfile *tmpprofile = GST_ENCODING_PROFILE (tmp->data);
|
|
|
|
|
|
|
|
if (g_strcmp0 (gst_encoding_profile_get_name (tmpprofile),
|
|
|
|
gst_encoding_profile_get_name (profile)) == 0) {
|
|
|
|
GST_INFO_OBJECT (project, "Already have profile: %s, replacing it",
|
|
|
|
gst_encoding_profile_get_name (profile));
|
|
|
|
|
|
|
|
gst_object_unref (tmp->data);
|
|
|
|
tmp->data = gst_object_ref (profile);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->encoding_profiles = g_list_prepend (priv->encoding_profiles,
|
|
|
|
gst_object_ref (profile));
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_project_list_encoding_profiles:
|
|
|
|
* @project: A #GESProject
|
|
|
|
*
|
|
|
|
* Lists the encoding profile that have been set to @project. The first one
|
|
|
|
* is the latest added.
|
|
|
|
*
|
|
|
|
* Returns: (transfer none) (element-type GstPbutils.EncodingProfile) (allow-none): The
|
|
|
|
* list of #GstEncodingProfile used in @project
|
|
|
|
*/
|
|
|
|
const GList *
|
|
|
|
ges_project_list_encoding_profiles (GESProject * project)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), FALSE);
|
|
|
|
|
|
|
|
return project->priv->encoding_profiles;
|
|
|
|
}
|
2013-01-11 14:49:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_project_get_loading_assets:
|
|
|
|
* @project: A #GESProject
|
|
|
|
*
|
|
|
|
* Get the assets that are being loaded
|
|
|
|
*
|
|
|
|
* Returns: (transfer full) (element-type GES.Asset): 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
|
|
|
|
*/
|
|
|
|
GList *
|
|
|
|
ges_project_get_loading_assets (GESProject * project)
|
|
|
|
{
|
|
|
|
GHashTableIter iter;
|
|
|
|
gpointer key, value;
|
|
|
|
|
|
|
|
GList *ret = NULL;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GES_IS_PROJECT (project), NULL);
|
|
|
|
|
|
|
|
g_hash_table_iter_init (&iter, project->priv->loading_assets);
|
|
|
|
while (g_hash_table_iter_next (&iter, &key, &value))
|
|
|
|
ret = g_list_prepend (ret, gst_object_ref (value));
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|