diff --git a/ges/ges-asset.c b/ges/ges-asset.c index e5d2d9564f..0419b9bcd6 100644 --- a/ges/ges-asset.c +++ b/ges/ges-asset.c @@ -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 diff --git a/ges/ges-asset.h b/ges/ges-asset.h index 89cc0c6fae..d636c98fd5 100644 --- a/ges/ges-asset.h +++ b/ges/ges-asset.h @@ -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);