controller: port api changes

This commit is contained in:
Stefan Sauer 2011-11-10 23:15:30 +02:00
parent 9ce6c731c3
commit 3a1acca583
2 changed files with 7 additions and 10 deletions

View file

@ -63,7 +63,6 @@ main (gint argc, gchar ** argv)
{ {
GstElement *pipeline; GstElement *pipeline;
GstElement *shapewipe; GstElement *shapewipe;
GstController *ctrl;
GstLFOControlSource *csource; GstLFOControlSource *csource;
GValue val = { 0, }; GValue val = { 0, };
GMainLoop *loop; GMainLoop *loop;
@ -97,14 +96,14 @@ main (gint argc, gchar ** argv)
shapewipe = gst_bin_get_by_name (GST_BIN (pipeline), "shape"); shapewipe = gst_bin_get_by_name (GST_BIN (pipeline), "shape");
if (!(ctrl = gst_controller_new (GST_OBJECT (shapewipe), "position", NULL))) { if (!gst_object_control_properties (GST_OBJECT (shapewipe), "position", NULL)) {
g_print ("can't control shapewipe element\n"); g_print ("can't control shapewipe element\n");
return -3; return -3;
} }
csource = gst_lfo_control_source_new (); csource = gst_lfo_control_source_new ();
gst_controller_set_control_source (ctrl, "position", gst_object_set_control_source (GST_OBJECT (shapewipe), "position",
GST_CONTROL_SOURCE (csource)); GST_CONTROL_SOURCE (csource));
g_value_init (&val, G_TYPE_FLOAT); g_value_init (&val, G_TYPE_FLOAT);
@ -138,7 +137,6 @@ main (gint argc, gchar ** argv)
g_main_loop_unref (loop); g_main_loop_unref (loop);
g_object_unref (G_OBJECT (ctrl));
gst_object_unref (G_OBJECT (pipeline)); gst_object_unref (G_OBJECT (pipeline));
return 0; return 0;

View file

@ -68,7 +68,7 @@ event_loop (GstElement * bin)
} }
static void static void
set_program (GstController * ctrl, GstStructure * prog) set_program (GstObject * elem, GstStructure * prog)
{ {
const GstStructure *s; const GstStructure *s;
GstInterpolationControlSource *cs; GstInterpolationControlSource *cs;
@ -99,7 +99,7 @@ set_program (GstController * ctrl, GstStructure * prog)
cs = g_hash_table_lookup (css, name); cs = g_hash_table_lookup (css, name);
if (!cs) { if (!cs) {
cs = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
gst_controller_set_control_source (ctrl, name, GST_CONTROL_SOURCE (cs)); gst_object_set_control_source (elem, name, GST_CONTROL_SOURCE (cs));
gst_interpolation_control_source_set_interpolation_mode (cs, gst_interpolation_control_source_set_interpolation_mode (cs,
GST_INTERPOLATE_NONE); GST_INTERPOLATE_NONE);
g_hash_table_insert (css, (gpointer) name, cs); g_hash_table_insert (css, (gpointer) name, cs);
@ -124,7 +124,6 @@ main (gint argc, gchar ** argv)
GstElement *bin; GstElement *bin;
GstElement *src, *fmt, *enc, *sink; GstElement *src, *fmt, *enc, *sink;
GstCaps *caps; GstCaps *caps;
GstController *ctrl;
GstStructure *prog; GstStructure *prog;
/* init gstreamer */ /* init gstreamer */
@ -170,8 +169,8 @@ main (gint argc, gchar ** argv)
} }
/* get the controller */ /* get the controller */
if (!(ctrl = gst_controller_new (GST_OBJECT (src), "brightness", "contrast", if (!gst_object_control_properties (GST_OBJECT (src), "brightness",
"saturation", NULL))) { "contrast", "saturation", NULL)) {
GST_WARNING ("can't control source element"); GST_WARNING ("can't control source element");
return -1; return -1;
} }
@ -192,7 +191,7 @@ main (gint argc, gchar ** argv)
", image03=(structure)\"image\\,brightness\\=0\\,contrast\\=15\\;\";", ", image03=(structure)\"image\\,brightness\\=0\\,contrast\\=15\\;\";",
NULL); NULL);
#endif #endif
set_program (ctrl, prog); set_program (GST_OBJECT (src), prog);
g_object_set (src, "num-buffers", gst_structure_n_fields (prog), NULL); g_object_set (src, "num-buffers", gst_structure_n_fields (prog), NULL);
/* prepare playback */ /* prepare playback */