project: Add a 'asset-loading' signal

This commit is contained in:
Thibault Saunier 2015-11-07 18:21:53 +01:00
parent 320b611ff7
commit 5d82971eef
2 changed files with 22 additions and 5 deletions

View file

@ -82,6 +82,7 @@ enum
ASSET_ADDED_SIGNAL, ASSET_ADDED_SIGNAL,
ASSET_REMOVED_SIGNAL, ASSET_REMOVED_SIGNAL,
MISSING_URI_SIGNAL, MISSING_URI_SIGNAL,
ASSET_LOADING_SIGNAL,
LAST_SIGNAL LAST_SIGNAL
}; };
@ -434,7 +435,7 @@ ges_project_class_init (GESProjectClass * klass)
/** /**
* GESProject::asset-added: * GESProject::asset-added:
* @formatter: the #GESProject * @project: the #GESProject
* @asset: The #GESAsset that has been added to @project * @asset: The #GESAsset that has been added to @project
*/ */
_signals[ASSET_ADDED_SIGNAL] = _signals[ASSET_ADDED_SIGNAL] =
@ -442,9 +443,21 @@ ges_project_class_init (GESProjectClass * klass)
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GESProjectClass, asset_added), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GESProjectClass, asset_added),
NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 1, GES_TYPE_ASSET); NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 1, GES_TYPE_ASSET);
/**
* 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),
NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 1, GES_TYPE_ASSET);
/** /**
* GESProject::asset-removed: * GESProject::asset-removed:
* @formatter: the #GESProject * @project: the #GESProject
* @asset: The #GESAsset that has been removed from @project * @asset: The #GESAsset that has been removed from @project
*/ */
_signals[ASSET_REMOVED_SIGNAL] = _signals[ASSET_REMOVED_SIGNAL] =
@ -657,9 +670,11 @@ ges_project_add_loading_asset (GESProject * project, GType extractable_type,
{ {
GESAsset *asset; GESAsset *asset;
if ((asset = ges_asset_cache_lookup (extractable_type, id))) if ((asset = ges_asset_cache_lookup (extractable_type, id))) {
g_hash_table_insert (project->priv->loading_assets, g_strdup (id), if (g_hash_table_insert (project->priv->loading_assets, g_strdup (id),
gst_object_ref (asset)); gst_object_ref (asset)))
g_signal_emit (project, _signals[ASSET_LOADING_SIGNAL], 0, asset);
}
} }
/************************************** /**************************************

View file

@ -57,6 +57,8 @@ struct _GESProjectClass
/* Signals */ /* Signals */
void (*asset_added) (GESProject * self, void (*asset_added) (GESProject * self,
GESAsset * asset); GESAsset * asset);
void (*asset_loading) (GESProject * self,
GESAsset * asset);
void (*asset_removed) (GESProject * self, void (*asset_removed) (GESProject * self,
GESAsset * asset); GESAsset * asset);
gchar * (*missing_uri) (GESProject * self, gchar * (*missing_uri) (GESProject * self,