trackobject: Add API guards all around

This commit is contained in:
Thibault Saunier 2012-04-23 19:20:18 -04:00
parent 6735e877b3
commit 5cae3f844f

View file

@ -377,6 +377,8 @@ ges_track_object_set_start_internal (GESTrackObject * object, guint64 start)
void void
ges_track_object_set_start (GESTrackObject * object, guint64 start) ges_track_object_set_start (GESTrackObject * object, guint64 start)
{ {
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
if (ges_track_object_set_start_internal (object, start)) if (ges_track_object_set_start_internal (object, start))
#if GLIB_CHECK_VERSION(2,26,0) #if GLIB_CHECK_VERSION(2,26,0)
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_START]); g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_START]);
@ -413,6 +415,8 @@ ges_track_object_set_inpoint_internal (GESTrackObject * object, guint64 inpoint)
void void
ges_track_object_set_inpoint (GESTrackObject * object, guint64 inpoint) ges_track_object_set_inpoint (GESTrackObject * object, guint64 inpoint)
{ {
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
if (ges_track_object_set_inpoint_internal (object, inpoint)) if (ges_track_object_set_inpoint_internal (object, inpoint))
#if GLIB_CHECK_VERSION(2,26,0) #if GLIB_CHECK_VERSION(2,26,0)
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_INPOINT]); g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_INPOINT]);
@ -450,6 +454,8 @@ ges_track_object_set_duration_internal (GESTrackObject * object,
void void
ges_track_object_set_duration (GESTrackObject * object, guint64 duration) ges_track_object_set_duration (GESTrackObject * object, guint64 duration)
{ {
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
if (ges_track_object_set_duration_internal (object, duration)) if (ges_track_object_set_duration_internal (object, duration))
#if GLIB_CHECK_VERSION(2,26,0) #if GLIB_CHECK_VERSION(2,26,0)
g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_DURATION]); g_object_notify_by_pspec (G_OBJECT (object), properties[PROP_DURATION]);
@ -512,6 +518,8 @@ ges_track_object_set_priority (GESTrackObject * object, guint32 priority)
gboolean gboolean
ges_track_object_set_active (GESTrackObject * object, gboolean active) ges_track_object_set_active (GESTrackObject * object, gboolean active)
{ {
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE);
GST_DEBUG ("object:%p, active:%d", object, active); GST_DEBUG ("object:%p, active:%d", object, active);
if (object->priv->gnlobject != NULL) { if (object->priv->gnlobject != NULL) {
@ -632,7 +640,7 @@ gnlobject_duration_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED,
g_object_get (gnlobject, "duration", &duration, NULL); g_object_get (gnlobject, "duration", &duration, NULL);
GST_DEBUG ("gnlobject duration : %" GST_TIME_FORMAT " current : %" GST_DEBUG_OBJECT (gnlobject, "duration : %" GST_TIME_FORMAT " current : %"
GST_TIME_FORMAT, GST_TIME_ARGS (duration), GST_TIME_ARGS (obj->duration)); GST_TIME_FORMAT, GST_TIME_ARGS (duration), GST_TIME_ARGS (obj->duration));
if (duration != obj->duration) { if (duration != obj->duration) {
@ -982,6 +990,8 @@ ges_track_object_set_locked (GESTrackObject * object, gboolean locked)
gboolean gboolean
ges_track_object_is_locked (GESTrackObject * object) ges_track_object_is_locked (GESTrackObject * object)
{ {
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE);
return object->priv->locked; return object->priv->locked;
} }
@ -991,13 +1001,16 @@ ges_track_object_is_locked (GESTrackObject * object)
* *
* Get the position of the object in the container #GESTrack. * Get the position of the object in the container #GESTrack.
* *
* Returns: the start position (in #GstClockTime) * Returns: the start position (in #GstClockTime) or #GST_CLOCK_TIME_NONE
* if something went wrong.
* *
* Since: 0.10.2 * Since: 0.10.2
*/ */
guint64 guint64
ges_track_object_get_start (GESTrackObject * object) ges_track_object_get_start (GESTrackObject * object)
{ {
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), GST_CLOCK_TIME_NONE);
if (G_UNLIKELY (object->priv->gnlobject == NULL)) if (G_UNLIKELY (object->priv->gnlobject == NULL))
return object->priv->pending_start; return object->priv->pending_start;
else else
@ -1010,13 +1023,16 @@ ges_track_object_get_start (GESTrackObject * object)
* *
* Get the offset within the contents of this #GESTrackObject * Get the offset within the contents of this #GESTrackObject
* *
* Returns: the in-point (in #GstClockTime) * Returns: the in-point (in #GstClockTime) or #GST_CLOCK_TIME_NONE
* if something went wrong.
* *
* Since: 0.10.2 * Since: 0.10.2
*/ */
guint64 guint64
ges_track_object_get_inpoint (GESTrackObject * object) ges_track_object_get_inpoint (GESTrackObject * object)
{ {
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), GST_CLOCK_TIME_NONE);
if (G_UNLIKELY (object->priv->gnlobject == NULL)) if (G_UNLIKELY (object->priv->gnlobject == NULL))
return object->priv->pending_inpoint; return object->priv->pending_inpoint;
else else
@ -1030,13 +1046,16 @@ ges_track_object_get_inpoint (GESTrackObject * object)
* Get the duration which will be used in the container #GESTrack * Get the duration which will be used in the container #GESTrack
* starting from the 'in-point' * starting from the 'in-point'
* *
* Returns: the duration (in #GstClockTime) * Returns: the duration (in #GstClockTime) or #GST_CLOCK_TIME_NONE
* if something went wrong.
* *
* Since: 0.10.2 * Since: 0.10.2
*/ */
guint64 guint64
ges_track_object_get_duration (GESTrackObject * object) ges_track_object_get_duration (GESTrackObject * object)
{ {
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), GST_CLOCK_TIME_NONE);
if (G_UNLIKELY (object->priv->gnlobject == NULL)) if (G_UNLIKELY (object->priv->gnlobject == NULL))
return object->priv->pending_duration; return object->priv->pending_duration;
else else
@ -1049,13 +1068,15 @@ ges_track_object_get_duration (GESTrackObject * object)
* *
* Get the priority of the object withing the containing #GESTrack. * Get the priority of the object withing the containing #GESTrack.
* *
* Returns: the priority of @object * Returns: the priority of @object or -1 if something went wrong
* *
* Since: 0.10.2 * Since: 0.10.2
*/ */
guint32 guint32
ges_track_object_get_priority (GESTrackObject * object) ges_track_object_get_priority (GESTrackObject * object)
{ {
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), -1);
if (G_UNLIKELY (object->priv->gnlobject == NULL)) if (G_UNLIKELY (object->priv->gnlobject == NULL))
return object->priv->pending_priority; return object->priv->pending_priority;
else else
@ -1076,6 +1097,8 @@ ges_track_object_get_priority (GESTrackObject * object)
gboolean gboolean
ges_track_object_is_active (GESTrackObject * object) ges_track_object_is_active (GESTrackObject * object)
{ {
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE);
if (G_UNLIKELY (object->priv->gnlobject == NULL)) if (G_UNLIKELY (object->priv->gnlobject == NULL))
return object->priv->pending_active; return object->priv->pending_active;
else else
@ -1113,7 +1136,11 @@ ges_track_object_lookup_child (GESTrackObject * object, const gchar * prop_name,
gpointer key, value; gpointer key, value;
gchar **names, *name, *classename; gchar **names, *name, *classename;
gboolean res; gboolean res;
GESTrackObjectPrivate *priv = object->priv; GESTrackObjectPrivate *priv;
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE);
priv = object->priv;
classename = NULL; classename = NULL;
res = FALSE; res = FALSE;
@ -1160,8 +1187,11 @@ ges_track_object_set_child_property_by_pspec (GESTrackObject * object,
GParamSpec * pspec, GValue * value) GParamSpec * pspec, GValue * value)
{ {
GstElement *element; GstElement *element;
GESTrackObjectPrivate *priv;
GESTrackObjectPrivate *priv = object->priv; g_return_if_fail (GES_IS_TRACK_OBJECT (object));
priv = object->priv;
if (!priv->properties_hashtable) if (!priv->properties_hashtable)
goto prop_hash_not_set; goto prop_hash_not_set;
@ -1211,7 +1241,7 @@ ges_track_object_set_child_property_valist (GESTrackObject * object,
gchar *error = NULL; gchar *error = NULL;
GValue value = { 0, }; GValue value = { 0, };
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (GES_IS_TRACK_OBJECT (object));
name = first_property_name; name = first_property_name;
@ -1277,6 +1307,8 @@ ges_track_object_set_child_property (GESTrackObject * object,
{ {
va_list var_args; va_list var_args;
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
va_start (var_args, first_property_name); va_start (var_args, first_property_name);
ges_track_object_set_child_property_valist (object, first_property_name, ges_track_object_set_child_property_valist (object, first_property_name,
var_args); var_args);
@ -1385,6 +1417,8 @@ ges_track_object_get_child_property (GESTrackObject * object,
{ {
va_list var_args; va_list var_args;
g_return_if_fail (GES_IS_TRACK_OBJECT (object));
va_start (var_args, first_property_name); va_start (var_args, first_property_name);
ges_track_object_get_child_property_valist (object, first_property_name, ges_track_object_get_child_property_valist (object, first_property_name,
var_args); var_args);
@ -1406,8 +1440,11 @@ ges_track_object_get_child_property_by_pspec (GESTrackObject * object,
GParamSpec * pspec, GValue * value) GParamSpec * pspec, GValue * value)
{ {
GstElement *element; GstElement *element;
GESTrackObjectPrivate *priv;
GESTrackObjectPrivate *priv = object->priv; g_return_if_fail (GES_IS_TRACK_OBJECT (object));
priv = object->priv;
if (!priv->properties_hashtable) if (!priv->properties_hashtable)
goto prop_hash_not_set; goto prop_hash_not_set;
@ -1587,6 +1624,8 @@ ges_track_object_edit (GESTrackObject * object,
GESTrack *track = ges_track_object_get_track (object); GESTrack *track = ges_track_object_get_track (object);
GESTimeline *timeline; GESTimeline *timeline;
g_return_val_if_fail (GES_IS_TRACK_OBJECT (object), FALSE);
if (G_UNLIKELY (!track)) { if (G_UNLIKELY (!track)) {
GST_WARNING_OBJECT (object, "Trying to edit in %d mode but not in" GST_WARNING_OBJECT (object, "Trying to edit in %d mode but not in"
"any Track yet.", mode); "any Track yet.", mode);