nle: Port tests to the "commit" action signals

Now that nle_object_commit symbol is hidden, we can't use it
in the tests.
This commit is contained in:
Thibault Saunier 2015-06-25 11:03:12 +02:00
parent 2994650f9e
commit 55f0601211
3 changed files with 39 additions and 22 deletions

View file

@ -891,25 +891,6 @@ nle_composition_class_init (NleCompositionClass * klass)
nleobject_properties[NLEOBJECT_PROP_DURATION] =
g_object_class_find_property (gobject_class, "duration");
/**
* NleComposition::commit
* @comp: a #NleComposition
* @recurse: Whether to commit recursiverly into (NleComposition) children of
* @object. This is used in case we have composition inside
* a nlesource composition, telling it to commit the included
* composition state.
*
* Action signal to commit all the pending changes of the composition and
* its children timing properties
*
* Returns: %TRUE if changes have been commited, %FALSE if nothing had to
* be commited
*/
_signals[COMMIT_SIGNAL] = g_signal_new ("commit", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (NleObjectClass, commit_signal_handler), NULL, NULL, NULL,
G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN);
_signals[COMMITED_SIGNAL] =
g_signal_new ("commited", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 1,

View file

@ -80,6 +80,14 @@ enum
PROP_LAST
};
enum
{
COMMIT_SIGNAL,
LAST_SIGNAL
};
static guint _signals[LAST_SIGNAL] = { 0 };
static GParamSpec *properties[PROP_LAST];
static void nle_object_dispose (GObject * object);
@ -236,6 +244,25 @@ nle_object_class_init (NleObjectClass * klass)
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_EXPANDABLE,
properties[PROP_EXPANDABLE]);
/**
* NleObject::commit
* @object: a #NleObject
* @recurse: Whether to commit recursiverly into (NleComposition) children of
* @object. This is used in case we have composition inside
* a nlesource composition, telling it to commit the included
* composition state.
*
* Action signal to commit all the pending changes of the composition and
* its children timing properties
*
* Returns: %TRUE if changes have been commited, %FALSE if nothing had to
* be commited
*/
_signals[COMMIT_SIGNAL] = g_signal_new ("commit", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (NleObjectClass, commit_signal_handler), NULL, NULL, NULL,
G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN);
}
static void

View file

@ -1,5 +1,4 @@
#include "common.h"
#include "../../../ges/nle/nleobject.h"
void
poll_the_bus (GstBus * bus)
@ -32,6 +31,16 @@ poll_the_bus (GstBus * bus)
}
}
static gboolean
nle_object_commit (GstElement * nlesource, gboolean recurse)
{
gboolean ret;
g_signal_emit_by_name (nlesource, "commit", recurse, &ret);
return ret;
}
GstElement *
gst_element_factory_make_or_warn (const gchar * factoryname, const gchar * name)
{
@ -178,7 +187,7 @@ new_nle_src (const gchar * name, guint64 start, gint64 duration, gint priority)
g_object_set (G_OBJECT (nlesource),
"start", start,
"duration", duration, "inpoint", start, "priority", priority, NULL);
nle_object_commit (NLE_OBJECT (nlesource), FALSE);
nle_object_commit (nlesource, FALSE);
return nlesource;
}
@ -370,7 +379,7 @@ commit_and_wait (GstElement * comp, gboolean * ret)
gulong handler_id =
g_signal_connect (comp, "commited", (GCallback) commited_cb, NULL);
g_mutex_lock (&lock);
*ret = nle_object_commit (NLE_OBJECT (comp), TRUE);
*ret = nle_object_commit (comp, TRUE);
g_cond_wait (&cond, &lock);
g_mutex_unlock (&lock);
g_signal_handler_disconnect (comp, handler_id);