mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
extractable: Make extractable_set_asset return a boolean
WARNING: This is a minor API breakage, it should be harmless and allows us to let users know whether changing setting the asset worked or no.
This commit is contained in:
parent
0cdec2c2d0
commit
bc7a465fcd
3 changed files with 24 additions and 6 deletions
|
@ -71,6 +71,7 @@ ges_extractable_default_init (GESExtractableInterface * iface)
|
|||
ges_extractable_get_real_extractable_type_default;
|
||||
iface->get_parameters_from_id = extractable_get_parameters_from_id;
|
||||
iface->set_asset = NULL;
|
||||
iface->set_asset_full = NULL;
|
||||
iface->get_id = extractable_get_id;
|
||||
iface->register_metas = NULL;
|
||||
iface->can_update_asset = FALSE;
|
||||
|
@ -98,13 +99,15 @@ ges_extractable_get_asset (GESExtractable * self)
|
|||
* @asset: (transfer none): The #GESAsset to set
|
||||
*
|
||||
* Method to set the asset which instantiated the specified object
|
||||
*
|
||||
* Return: %TRUE if @asset could be set %FALSE otherwize
|
||||
*/
|
||||
void
|
||||
gboolean
|
||||
ges_extractable_set_asset (GESExtractable * self, GESAsset * asset)
|
||||
{
|
||||
GESExtractableInterface *iface;
|
||||
|
||||
g_return_if_fail (GES_IS_EXTRACTABLE (self));
|
||||
g_return_val_if_fail (GES_IS_EXTRACTABLE (self), FALSE);
|
||||
|
||||
iface = GES_EXTRACTABLE_GET_INTERFACE (self);
|
||||
GST_DEBUG_OBJECT (self, "Setting asset to %" GST_PTR_FORMAT, asset);
|
||||
|
@ -113,15 +116,20 @@ ges_extractable_set_asset (GESExtractable * self, GESAsset * asset)
|
|||
g_object_get_qdata (G_OBJECT (self), ges_asset_key)) {
|
||||
GST_WARNING_OBJECT (self, "Can not reset asset on object");
|
||||
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_object_set_qdata_full (G_OBJECT (self), ges_asset_key,
|
||||
gst_object_ref (asset), gst_object_unref);
|
||||
|
||||
/* Let classes that implement the interface know that a asset has been set */
|
||||
if (iface->set_asset_full)
|
||||
return iface->set_asset_full (self, asset);
|
||||
|
||||
if (iface->set_asset)
|
||||
iface->set_asset (self, asset);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,6 +63,9 @@ struct _GESExtractableInterface
|
|||
void (*set_asset) (GESExtractable *self,
|
||||
GESAsset *asset);
|
||||
|
||||
gboolean (*set_asset_full) (GESExtractable *self,
|
||||
GESAsset *asset);
|
||||
|
||||
GParameter *(*get_parameters_from_id) (const gchar *id,
|
||||
guint *n_params);
|
||||
|
||||
|
@ -79,7 +82,7 @@ struct _GESExtractableInterface
|
|||
};
|
||||
|
||||
GESAsset* ges_extractable_get_asset (GESExtractable *self);
|
||||
void ges_extractable_set_asset (GESExtractable *self,
|
||||
gboolean ges_extractable_set_asset (GESExtractable *self,
|
||||
GESAsset *asset);
|
||||
|
||||
gchar * ges_extractable_get_id (GESExtractable *self);
|
||||
|
|
|
@ -148,7 +148,7 @@ extractable_get_id (GESExtractable * self)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
extractable_set_asset (GESExtractable * self, GESAsset * asset)
|
||||
{
|
||||
GEnumClass *enum_class;
|
||||
|
@ -156,6 +156,11 @@ extractable_set_asset (GESExtractable * self, GESAsset * asset)
|
|||
GESTransitionClip *trans = GES_TRANSITION_CLIP (self);
|
||||
const gchar *vtype = ges_asset_get_id (asset);
|
||||
|
||||
if (!(ges_clip_get_supported_formats (GES_CLIP (self)) &
|
||||
GES_TRACK_TYPE_VIDEO)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Update the transition type if we actually changed it */
|
||||
if (g_strcmp0 (vtype, trans->priv->vtype_name)) {
|
||||
guint index;
|
||||
|
@ -172,6 +177,8 @@ extractable_set_asset (GESExtractable * self, GESAsset * asset)
|
|||
}
|
||||
ges_transition_clip_update_vtype_internal (GES_CLIP (self), value, FALSE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -181,7 +188,7 @@ ges_extractable_interface_init (GESExtractableInterface * iface)
|
|||
iface->get_id = extractable_get_id;
|
||||
iface->get_parameters_from_id = extractable_get_parameters_from_id;
|
||||
iface->can_update_asset = TRUE;
|
||||
iface->set_asset = extractable_set_asset;
|
||||
iface->set_asset_full = extractable_set_asset;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GESTransitionClip,
|
||||
|
|
Loading…
Reference in a new issue