asset: Add a function to stop proxying an asset

And remove any reference as it beeing a proxy.
This commit is contained in:
Thibault Saunier 2017-07-31 12:54:25 -04:00
parent eae6b70523
commit 9a76617fc7
2 changed files with 33 additions and 1 deletions

View file

@ -121,7 +121,7 @@ struct _GESAssetPrivate
GESAssetState state;
GType extractable_type;
/* When an asset is proxied, instanciating it will
/* When an asset is proxied, instantiating it will
* return the asset it points to */
char *proxied_asset_id;
@ -779,6 +779,37 @@ ges_asset_set_proxy (GESAsset * asset, GESAsset * proxy)
return TRUE;
}
/**
* ges_asset_unproxy:
* @asset: The #GESAsset to stop proxying with @proxy
* @proxy: The #GESAsset to stop considering as a proxy for @asset
*
* Removes @proxy from the list of known proxies for @asset.
* If @proxy was the current proxy for @asset, stop using it.
*
* Returns: %TRUE if @proxy was a known proxy for @asset, %FALSE otherwise.
*/
gboolean
ges_asset_unproxy (GESAsset * asset, GESAsset * proxy)
{
g_return_val_if_fail (GES_IS_ASSET (asset), FALSE);
g_return_val_if_fail (GES_IS_ASSET (proxy), FALSE);
g_return_val_if_fail (asset != proxy, FALSE);
if (!g_list_find (asset->priv->proxies, proxy)) {
GST_INFO_OBJECT (asset, "%s is not a proxy.", proxy->priv->id);
return FALSE;
}
if (asset->priv->proxies->data == proxy)
ges_asset_set_proxy (asset, NULL);
asset->priv->proxies = g_list_remove (asset->priv->proxies, proxy);
return TRUE;
}
/**
* ges_asset_list_proxies:
* @asset: The #GESAsset to get proxies from

View file

@ -107,6 +107,7 @@ GList * ges_list_assets (GType filter);
gboolean ges_asset_set_proxy (GESAsset *asset, GESAsset *proxy);
gboolean ges_asset_unproxy (GESAsset *asset, GESAsset * proxy);
GList * ges_asset_list_proxies (GESAsset *asset);
GESAsset * ges_asset_get_proxy_target(GESAsset *proxy);
GESAsset * ges_asset_get_proxy (GESAsset *asset);