thanks for response, it helps me a lot. In fact I need audio as well, I'll work around it, at least with one file.<br>Regards, <br><br>Rossana<br><br><br><div class="gmail_quote">2011/10/31 Stefan Sauer <span dir="ltr"><<a href="mailto:ensonic@hora-obscura.de">ensonic@hora-obscura.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><u></u>
<div bgcolor="#ffffff" text="#000000"><div class="im">
On 10/30/2011 02:15 AM, Rossana Guerra wrote:
<blockquote type="cite">Hi Stefan, I saw and run the code. I noticed the
differences, mostly in the "on-pad-added" function.<br>
You create a fakesink where the "flow" doesn't come from video,
then you create a bin from the parent element and got the static
pad from it for linking. I didn't get the meaning of this
technique.<br>
</blockquote>
<br></div>
There where two distinct bugs. The first was to use src1 twice for
the pad-aaded callback if I recall right. The 2nd is that in the
pad-addded callback you get pads for audio and video. You want to
terminate the audio-pads with a fakesink and only connect the
video-pads to videomixer. If you want the adio too, you'll need to
use a similar setup like videomixer, but using adder.<br>
<br>
You will still need to ensure that both video-outputs are in a
compatible format for videomxer. I did not had time to analyze
further. Use the GST_DEBUG_BIN_TO_DOT_FILE to understand whats in
the resulting pipeline and where it goes wrong.<br><font color="#888888">
<br>
Stefan</font><div><div></div><div class="h5"><br>
<br>
<blockquote type="cite">I have an "internal data flow error" message. Here's
the output when I run with debug option as you pointed out.<br>
<br>
Debug information:<br>
<br>
rossana@Studio:~/CodeBlocks/ctrl/bin/Debug$ GST_DEBUG="*:2" ./ctrl
"/home/rossana/video1.avi" "/home/rossana/video2.avi"<br>
Inicio...<br>
Creando...<br>
Creando pipeline...<br>
Creando 1...<br>
Playing...<br>
Dynamic pad created: video/x-raw-rgb<br>
... linking video<br>
Dynamic pad created: audio/x-raw-int<br>
... dropping audio<br>
0:00:00.064628890 4083 0x157f070 <br>
WARN basetransform
gstbasetransform.c:1211:gst_base_transform_setcaps:<alfa1>
transform could not transform video/x-raw-yuv, width=(int)720, <br>
height=(int)528, framerate=(fraction)25/1, format=(fourcc)I420,
interlaced=(boolean)false, pixel-aspect-ratio=(fraction)1/1 in
anything we support<br>
Dynamic pad created: video/x-raw-rgb<br>
... linking video<br>
Dynamic pad created: audio/x-raw-int<br>
... dropping audio<br>
0:00:00.076359290 4083 0x1545b80 <br>
WARN ffmpeg
gstffmpegdec.c:2241:gst_ffmpegdec_frame:<ffdec_mpeg40>
ffdec_mpeg4: decoding error (len: -1, have_data: 0)<br>
<br>
<br>
I am trying to play 2 .avi files, I have no problem to visualize
them with Banshee or any other player, so I think I got the right
codecs in my computer.<br>
Both videos have the same properties values:<br>
<br>
*Video:<br>
<br>
Dimension 720x528<br>
Codec DivX MPEG-4 Version 5<br>
25 fps<br>
bit rate: N/A<br>
<br>
* Sound: <br>
Codec MPEG1 Audio, layer<br>
Channels Stereo<br>
Frec 44100Hz<br>
bit rate 127 kpbs<br>
<br>
I'll keep trying, and thanks for your suggestions. Nice weekend.<br>
<br>
Rossana<br>
<br>
<br>
<br>
<div class="gmail_quote">2011/10/28 Rossana Guerra <span dir="ltr"><<a href="mailto:guerra.rossana@gmail.com" target="_blank">guerra.rossana@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
Hi Stefan, I didn't receive the email, I even looked into the
spam folder, just in case.... <br>
<br>
<div class="gmail_quote">
<div>2011/10/28 Stefan Sauer <span dir="ltr"><<a href="mailto:ensonic@hora-obscura.de" target="_blank">ensonic@hora-obscura.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div bgcolor="#ffffff" text="#000000">
<div> On 10/28/2011 12:40 AM, Rossana Guerra wrote:
<blockquote type="cite">Sorry Stefan, where is the
code to compare with?</blockquote>
</div>
I forwarded the mail to your personal address. Out
mailing list tried to be super smart and stipped
attached *sourcecode*.
<div><br>
<br>
<blockquote type="cite">..I downloaded the doc (pdf)
and the order remains the same.<br>
</blockquote>
</div>
I pushed the fix to the API docs to git. That does not
regenerate the pdf. To be sure which pdf exactly are
you talking about?<br>
</div>
</blockquote>
</div>
<div><br>
<br>
The pdf asociated with the html file, the one that has
this chapter:<br>
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-dparams-parameters.html" target="_blank">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-dparams-parameters.html</a><br>
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/manual.pdf" target="_blank">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/manual.pdf</a>
<br>
<br>
thanks<br>
<br>
<br>
</div>
<div>
<div>
</div>
<div>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div bgcolor="#ffffff" text="#000000"><font color="#888888"> <br>
Stefan</font>
<div>
<div><br>
<br>
<blockquote type="cite">Regards and thanks<br>
<br>
<br>
<div class="gmail_quote">2011/10/27 Stefan
Sauer <span dir="ltr"><<a href="mailto:ensonic@hora-obscura.de" target="_blank">ensonic@hora-obscura.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div bgcolor="#ffffff" text="#000000"> Hi,<br>
On 10/27/2011 01:37 AM, Rossana Guerra
wrote:
<blockquote type="cite">Well the error
type disappeared, it was due where the
place the
gst_controller_set_control_source
(ctrl, "position", GST_CONTROL_SOURCE
(csource)) sentence was.<br>
The first time I did it according the
documentation, at the end of the value
sets of the control source. It seems
it isn't the right place, I changed
the sentences right after creating the
controller, it seems it works. Hope it
helps someone else.<br>
</blockquote>
I fix the wrong order of calls in the
docs.<br>
<br>
<blockquote type="cite"> In this way:<br>
</blockquote>
<br>
I made a few more fixes - compare your
source and mine in a diff viewer (e.g.
meld). You still need to do more stuff
to ensure both sources can be mixed (run
it as GST_DEBUG="*:2" ./ctrl
<file1> <file2> to see the
warnings).<br>
<br>
Stefan<br>
<br>
<blockquote type="cite"><br>
GstInterpolationControlSource *
csource =
gst_interpolation_control_source_new();<br>
<br>
gst_interpolation_control_source_set_interpolation_mode(csource,GST_INTERPOLATE_LINEAR);<br>
gst_controller_set_control_source
(ctrl, "position", GST_CONTROL_SOURCE
(csource));<br>
<br>
(Now the runtime is another! but one
less at least)<br>
<br>
Specially thanks to Stefan!<br>
<br>
<br>
Here is the complete code:<br>
<br>
#include <gst.h><br>
#include
<controller/gstcontroller.h><br>
<br>
#include <iostream><br>
#include <string.h><br>
<br>
using namespace std;<br>
<br>
// Manejador de errores<br>
static gboolean bus_call (GstBus *bus,
GstMessage *msg, gpointer data)<br>
{<br>
GMainLoop *loop = (GMainLoop *)
data;<br>
<br>
switch (GST_MESSAGE_TYPE (msg))<br>
{<br>
case GST_MESSAGE_EOS:<br>
g_print ("Final de stream\n");<br>
g_main_loop_quit (loop);<br>
break;<br>
case GST_MESSAGE_ERROR:<br>
{<br>
gchar *debug;<br>
GError *error;<br>
gst_message_parse_error (msg,
&error, &debug);<br>
g_free (debug);<br>
g_printerr ("Error: %s\n",
error->message);<br>
g_error_free (error);<br>
g_main_loop_quit (loop);<br>
break;<br>
}<br>
default:<br>
break;<br>
}<br>
return TRUE;<br>
}<br>
<br>
static void on_pad_added (GstElement
*element, GstPad *pad, gpointer data)<br>
{<br>
GstPad *sinkpad = NULL;<br>
GstElement * elemento = (GstElement
*) data;<br>
<br>
<br>
/* Ahora linkeo el pad de comp con
sink pad */<br>
g_print ("Dynamic pad created,
linking queue\n");<br>
sinkpad = gst_element_get_static_pad
(elemento, "sink");<br>
<br>
<br>
gst_pad_link (pad, sinkpad);<br>
gst_object_unref(sinkpad);<br>
<br>
}<br>
<br>
int main(int argc, char *argv[])<br>
{<br>
<br>
GMainLoop *loop = NULL;<br>
<br>
GstElement *src1,
*src2,*dec1,*dec2,*alfa1,*color,*smpte,*queue,*sink;<br>
GstBus *bus;<br>
<br>
gdouble duracion = 500.0;<br>
gint transicion = 1;<br>
<br>
cout << "Inicio..." <<
endl;<br>
<br>
/* init GStreamer */<br>
gst_init (&argc, &argv);<br>
bool iniciado = gst_controller_init
(&argc, &argv);<br>
<br>
loop = g_main_loop_new (NULL,
FALSE);<br>
//gint transicion = 1;<br>
<br>
/* make sure we have input */<br>
if (argc != 3) {<br>
g_print ("Usage: %s
<filename1>
<filename2>\n", argv[0]);<br>
return -1;<br>
}<br>
<br>
cout << "Creando..." <<
endl;<br>
src1 =
gst_element_factory_make("filesrc",
"src1");<br>
g_object_set(G_OBJECT(src1),"location",argv[1],
NULL);<br>
<br>
src2 =
gst_element_factory_make("filesrc",
"src2");<br>
g_object_set(G_OBJECT(src1),"location",argv[2],
NULL);<br>
<br>
GstElement *pipeline =
gst_pipeline_new ("video-player");<br>
<br>
dec1 =
gst_element_factory_make("decodebin2","dec1");<br>
<br>
dec2 =
gst_element_factory_make("decodebin2","dec2");<br>
<br>
cout << "Creando pipeline..."
<< endl;<br>
<br>
bus = gst_pipeline_get_bus
(GST_PIPELINE (pipeline));<br>
gst_bus_add_watch (bus, bus_call,
loop);<br>
gst_object_unref (bus);<br>
<br>
alfa1 = gst_element_factory_make
("alpha","alfa1");<br>
smpte = gst_element_factory_make
("smptealpha","smpte");<br>
g_object_set(smpte,"type",
transicion, NULL);<br>
color = gst_element_factory_make
("ffmpegcolorspace", "color");<br>
GstElement * mixer =
gst_element_factory_make("videomixer",
"mixer");<br>
<br>
if ((!alfa1) || (!smpte) || (!color)
|| (!mixer))<br>
{<br>
g_printerr ("Alguno de los
elementos del Bin no pudo ser creado.
Saliendo\n");<br>
return 0;<br>
}<br>
<br>
<br>
cout << "Creando 1..."
<< endl;<br>
<br>
// Agrego Controlador<br>
<br>
GstController * ctrl =
gst_object_control_properties(G_OBJECT(smpte),
"position",NULL);<br>
<br>
if (ctrl == NULL)<br>
{ <br>
GST_WARNING ("No puede
controlar el elemento fuente\n");<br>
return 1;<br>
}<br>
<br>
// Todo valor GValue debe
inicializarse en 0<br>
GValue val_double = { 0, };<br>
g_value_init (&val_double,
G_TYPE_DOUBLE);<br>
<br>
// Creo la fuente al controlador y
la asocio al controlador<br>
// Seteo modo de interpolacion<br>
<br>
GstInterpolationControlSource *
csource =
gst_interpolation_control_source_new();<br>
<br>
gst_interpolation_control_source_set_interpolation_mode(csource,GST_INTERPOLATE_LINEAR);<br>
gst_controller_set_control_source
(ctrl, "position", GST_CONTROL_SOURCE
(csource));<br>
<br>
// Seteo primer valor<br>
g_value_set_double(&val_double,
0.0);<br>
gst_interpolation_control_source_set(csource,(0
* GST_MSECOND),&val_double);<br>
<br>
// Seteo segundo valor<br>
g_value_set_double(&val_double,
1.0);<br>
gst_interpolation_control_source_set(csource,(duracion*GST_MSECOND),&val_double);<br>
<br>
//gst_controller_set_control_source
(ctrl, "position", GST_CONTROL_SOURCE
(csource));<br>
<br>
g_object_unref (csource);<br>
g_value_unset (&val_double);<br>
<br>
g_signal_connect (G_OBJECT (dec1),
"pad-added", G_CALLBACK
(on_pad_added),alfa1);<br>
g_signal_connect (G_OBJECT (dec2),
"pad-added", G_CALLBACK
(on_pad_added),smpte);<br>
<br>
queue =
gst_element_factory_make("queue",
"queue");<br>
sink =
gst_element_factory_make("autovideosink",
"sink");<br>
<br>
gst_bin_add_many (GST_BIN
(pipeline),src1, src2, dec1, dec2,
alfa1, smpte, mixer, queue, color,
sink, NULL);<br>
<br>
gst_element_link (src1,dec1);<br>
gst_element_link (src2,dec2);<br>
gst_element_link (alfa1,mixer);<br>
gst_element_link (smpte,mixer);<br>
gst_element_link (mixer,queue);<br>
gst_element_link (queue,sink);<br>
<br>
<br>
/* now run */<br>
gst_element_set_state (pipeline,
GST_STATE_PLAYING);<br>
cout << "Playing..." <<
endl;<br>
g_main_loop_run (loop);<br>
<br>
/* also clean up */<br>
gst_element_set_state (pipeline,
GST_STATE_NULL);<br>
gst_object_unref (GST_OBJECT
(pipeline));<br>
<br>
return 0;<br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div class="gmail_quote">2011/10/26
Rossana Guerra <span dir="ltr"><<a href="mailto:guerra.rossana@gmail.com" target="_blank">guerra.rossana@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">Sorry,
I had some copy/paste errors.
Here's the code, the runtime error
is:<br>
<br>
CRITICAL **:
gst_interpolation_control_source_set:
assertion `G_VALUE_TYPE (value) ==
self->priv->type' failed.<br>
<br>
I changed the duracion value
variable unit to second (replacing
500 with 5), and I tryed with
GST_SECOND insted, but it didn't
work.<br>
So I wrote it back to GST_MSECOND.<br>
<br>
The code ΅without" typing errors:
<div><br>
<br>
#include <gst.h><br>
#include
<controller/gstcontroller.h><br>
<br>
#include <iostream><br>
</div>
#include <string.h><br>
<br>
<br>
using namespace std;<br>
<br>
// Manejador de errores
<div>
<div><br>
static gboolean bus_call
(GstBus *bus, GstMessage *msg,
gpointer data)<br>
{<br>
GMainLoop *loop =
(GMainLoop *) data;<br>
<br>
switch (GST_MESSAGE_TYPE
(msg))<br>
{<br>
case GST_MESSAGE_EOS:<br>
g_print ("Final de
stream\n");<br>
g_main_loop_quit
(loop);<br>
break;<br>
case GST_MESSAGE_ERROR:<br>
{<br>
gchar *debug;<br>
GError *error;<br>
gst_message_parse_error (msg,
&error, &debug);<br>
g_free (debug);<br>
g_printerr ("Error:
%s\n", error->message);<br>
g_error_free (error);<br>
g_main_loop_quit
(loop);<br>
break;<br>
}<br>
default:<br>
break;<br>
}<br>
return TRUE;<br>
}<br>
<br>
static void on_pad_added
(GstElement *element, GstPad
*pad, gpointer data)<br>
{<br>
GstPad *sinkpad = NULL;<br>
GstElement * elemento =
(GstElement *) data;<br>
<br>
<br>
/* Ahora linkeo el pad de
comp con sink pad */<br>
g_print ("Dynamic pad
created, linking queue\n");<br>
sinkpad =
gst_element_get_static_pad
(elemento, "sink");<br>
<br>
<br>
gst_pad_link (pad, sinkpad);<br>
gst_object_unref(sinkpad);<br>
<br>
}<br>
<br>
<br>
int main(int argc, char
*argv[])<br>
{<br>
<br>
GMainLoop *loop = NULL;<br>
<br>
GstElement *src1,
*src2,*dec1,*dec2,*alfa1,*color,*smpte,*queue,*sink;<br>
GstBus *bus;<br>
<br>
</div>
</div>
guint duracion = 500;<br>
gint transicion = 1;<br>
<br>
cout << "Inicio..."
<< endl;
<div><br>
<br>
/* init GStreamer */<br>
gst_init (&argc,
&argv);<br>
bool iniciado =
gst_controller_init (&argc,
&argv);<br>
<br>
loop = g_main_loop_new (NULL,
FALSE);<br>
<br>
</div>
<div> if (argc != 3) {<br>
g_print ("Usage: %s
<filename1>
<filename2>\n", argv[0]);<br>
return -1;<br>
}<br>
<br>
</div>
cout << "Creando..."
<< endl;
<div> <br>
src1 =
gst_element_factory_make("filesrc",
"src1");<br>
g_object_set(G_OBJECT(src1),"location",argv[1],
NULL);<br>
<br>
src2 =
gst_element_factory_make("filesrc",
"src2");<br>
g_object_set(G_OBJECT(src1),"location",argv[2],
NULL);<br>
<br>
GstElement *pipeline =
gst_pipeline_new
("video-player");<br>
<br>
dec1 =
gst_element_factory_make("decodebin2","dec1");<br>
<br>
dec2 =
gst_element_factory_make("decodebin2","dec2");<br>
<br>
cout << "Creando
pipeline..." << endl;<br>
<br>
bus = gst_pipeline_get_bus
(GST_PIPELINE (pipeline));<br>
gst_bus_add_watch (bus,
bus_call, loop);<br>
gst_object_unref (bus);<br>
<br>
alfa1 =
gst_element_factory_make
("alpha","alfa1");<br>
smpte =
gst_element_factory_make
("smptealpha","smpte");<br>
g_object_set(smpte,"type",
transicion, NULL);<br>
color =
gst_element_factory_make
("ffmpegcolorspace", "color");<br>
GstElement * mixer =
gst_element_factory_make("videomixer",
"mixer");<br>
<br>
if ((!alfa1) || (!smpte) ||
(!color) || (!mixer))<br>
{<br>
g_printerr ("Alguno de los
elementos del Bin no pudo ser
creado. Saliendo\n");<br>
return 0;<br>
}<br>
<br>
<br>
</div>
// Agrego Controlador
<div><br>
<br>
GstController * ctrl =
gst_object_control_properties(G_OBJECT(smpte),
"position",NULL);<br>
<br>
if (ctrl == NULL)<br>
{<br>
GST_WARNING ("No puede
controlar el elemento
fuente\n");<br>
return 1;<br>
}<br>
<br>
// Todo valor GValue debe
inicializarse en 0<br>
</div>
GValue val_int = { 0, };<br>
g_value_init (&val_int,
G_TYPE_INT);
<div><br>
<br>
// Set interpolation mode<br>
<br>
GstInterpolationControlSource
* csource =
gst_interpolation_control_source_new();<br>
<br>
gst_interpolation_control_source_set_interpolation_mode(csource,GST_INTERPOLATE_LINEAR);<br>
<br>
// Seteo primer valor<br>
</div>
g_value_set_int(&val_int,
0);<br>
gst_interpolation_control_source_set(csource,(0
* GST_MSECOND),&val_int);<br>
<br>
// Seteo segundo valor<br>
g_value_set_int (&val_int,
1);<br>
gst_interpolation_control_source_set(csource,(duracion*GST_MSECOND),&val_int);
<div><br>
<br>
gst_controller_set_control_source
(ctrl, "position",
GST_CONTROL_SOURCE (csource));<br>
<br>
g_object_unref (csource);<br>
</div>
g_value_unset (&val_int);
<div><br>
<br>
g_signal_connect (G_OBJECT
(dec1), "pad-added", G_CALLBACK
(on_pad_added),alfa1);<br>
g_signal_connect (G_OBJECT
(dec2), "pad-added", G_CALLBACK
(on_pad_added),smpte);<br>
<br>
queue =
gst_element_factory_make("queue",
"queue");<br>
sink =
gst_element_factory_make("autovideosink",
"sink");<br>
<br>
gst_bin_add_many (GST_BIN
(pipeline),src1, src2, dec1,
dec2, alfa1, smpte, mixer,
queue, color, sink, NULL);<br>
<br>
gst_element_link (src1,dec1);<br>
gst_element_link (src2,dec2);<br>
gst_element_link
(alfa1,mixer);<br>
gst_element_link
(smpte,mixer);<br>
gst_element_link
(mixer,queue);<br>
gst_element_link (queue,sink);<br>
<br>
<br>
/* now run */<br>
gst_element_set_state
(pipeline, GST_STATE_PLAYING);<br>
cout << "Playing..."
<< endl;<br>
g_main_loop_run (loop);<br>
<br>
/* also clean up */<br>
gst_element_set_state
(pipeline, GST_STATE_NULL);<br>
gst_object_unref (GST_OBJECT
(pipeline));<br>
<br>
return 0;<br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
<div>
<div>
<div class="gmail_quote">2011/10/26
Rossana Guerra <span dir="ltr"><<a href="mailto:guerra.rossana@gmail.com" target="_blank">guerra.rossana@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">Where
it says guint duration =
500.0 it should say guint
duration = 500.
Nonetheless, the error
persists.
<div>
<div><br>
<br>
<div class="gmail_quote">2011/10/26
Rossana Guerra <span dir="ltr"><<a href="mailto:guerra.rossana@gmail.com" target="_blank">guerra.rossana@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">HI Stefan,
thanks for your
help, I changed
the variable type
from gdouble to
guint, same error.
<br>
<br>
Here's the whole
code example:<br>
<br>
<br>
#include
<gst.h><br>
#include
<controller/gstcontroller.h><br>
#include
<iostream><br>
<br>
<br>
using namespace
std;<br>
<br>
// Error handler<br>
static gboolean
bus_call (GstBus
*bus, GstMessage
*msg, gpointer
data)<br>
{<br>
GMainLoop
*loop = (GMainLoop
*) data;<br>
<br>
switch
(GST_MESSAGE_TYPE
(msg))<br>
{<br>
case
GST_MESSAGE_EOS:<br>
g_print
("Final de
stream\n");<br>
g_main_loop_quit
(loop);<br>
break;<br>
case
GST_MESSAGE_ERROR:<br>
{<br>
gchar
*debug;<br>
GError
*error;<br>
gst_message_parse_error
(msg, &error,
&debug);<br>
g_free
(debug);<br>
g_printerr
("Error: %s\n",
error->message);<br>
g_error_free
(error);<br>
g_main_loop_quit
(loop);<br>
break;<br>
}<br>
default:<br>
break;<br>
}<br>
return TRUE;<br>
}<br>
<br>
static void
on_pad_added
(GstElement
*element, GstPad
*pad, gpointer
data)<br>
{<br>
GstPad *sinkpad
= NULL;<br>
GstElement *
elemento =
(GstElement *)
data;<br>
<br>
<br>
/* Ahora linkeo
el pad de comp con
sink pad */<br>
g_print
("Dynamic pad
created, linking
queue\n");<br>
sinkpad =
gst_element_get_static_pad
(elemento,
"sink");<br>
<br>
<br>
gst_pad_link
(pad, sinkpad);<br>
gst_object_unref(sinkpad);<br>
<br>
}<br>
<br>
<br>
int main(int argc,
char *argv[])<br>
{<br>
<br>
GMainLoop *loop
= NULL;<br>
<br>
GstElement
*src1,
*src2,*dec1,*dec2,*alfa1,*color,*smpte,*queue,*sink;<br>
GstBus *bus;<br>
<br>
guint duracion =
500.0;<br>
guint transicion
= 1;<br>
<br>
<br>
/* init
GStreamer */<br>
gst_init
(&argc,
&argv);<br>
bool iniciado =
gst_controller_init
(&argc,
&argv);<br>
<br>
<br>
<br>
loop =
g_main_loop_new
(NULL, FALSE); <br>
<br>
/* make sure we
have input */<br>
if (argc != 3) {<br>
g_print
("Usage: %s
<filename1>
<filename2>\n",
argv[0]);<br>
return -1;<br>
}<br>
<br>
src1 =
gst_element_factory_make("filesrc",
"src1");<br>
g_object_set(G_OBJECT(src1),"location",argv[1],
NULL);<br>
<br>
src2 =
gst_element_factory_make("filesrc",
"src2");<br>
g_object_set(G_OBJECT(src1),"location",argv[2],
NULL);<br>
<br>
GstElement
*pipeline =
gst_pipeline_new
("video-player");<br>
<br>
dec1 =
gst_element_factory_make("decodebin2","dec1");<br>
<br>
dec2 =
gst_element_factory_make("decodebin2","dec2");<br>
<br>
cout <<
"Creando
pipeline..."
<< endl;<br>
<br>
bus =
gst_pipeline_get_bus
(GST_PIPELINE
(pipeline));<br>
gst_bus_add_watch
(bus, bus_call,
loop);<br>
gst_object_unref
(bus);<br>
<br>
alfa1 =
gst_element_factory_make
("alpha","alfa1");<br>
smpte =
gst_element_factory_make
("smptealpha","smpte");
<br>
g_object_set(smpte,"type",
transicion, NULL);<br>
color =
gst_element_factory_make
("ffmpegcolorspace",
"color");<br>
GstElement *
mixer =
gst_element_factory_make("videomixer",
"mixer");<br>
<br>
if ((!alfa1) ||
(!smpte) ||
(!color) ||
(!mixer))<br>
{<br>
g_printerr
("Alguno de los
elementos del Bin
no pudo ser
creado.
Saliendo\n");<br>
return 0;<br>
}<br>
<br>
<br>
// Controller
creation
<div><br>
<br>
GstController
* ctrl =
gst_object_control_properties(G_OBJECT(smpte),
"position",NULL);<br>
<br>
if (ctrl ==
NULL)<br>
{<br>
GST_WARNING ("No
puede controlar
el elemento
fuente\n");<br>
return
1;<br>
}<br>
<br>
// Todo valor
GValue debe
inicializarse en
0<br>
GValue
val_double = {
0, };<br>
g_value_init
(&val_double,
G_TYPE_DOUBLE);<br>
<br>
</div>
// Set
interpolation mode
<div> <br>
<br>
GstInterpolationControlSource
* csource =
gst_interpolation_control_source_new();<br>
<br>
gst_interpolation_control_source_set_interpolation_mode(csource,GST_INTERPOLATE_LINEAR);<br>
<br>
// Seteo
primer valor<br>
g_value_set_double(&val_double,
0.0);<br>
gst_interpolation_control_source_set(csource,(0
*
GST_MSECOND),&val_double);<br>
<br>
// Seteo
segundo valor<br>
g_value_set_double
(&val_double,
1.0);<br>
gst_interpolation_control_source_set(csource,(duracion*GST_MSECOND),&val_double);<br>
<br>
gst_controller_set_control_source
(ctrl,
"position",
GST_CONTROL_SOURCE
(csource));<br>
<br>
g_object_unref
(csource);<br>
g_value_unset
(&val_double);<br>
<br>
</div>
g_signal_connect
(G_OBJECT (dec1),
"pad-added",
G_CALLBACK
(on_pad_added),alfa1);<br>
g_signal_connect
(G_OBJECT (dec2),
"pad-added",
G_CALLBACK
(on_pad_added),smpte);<br>
<br>
queue =
gst_element_factory_make("queue",
"queue");<br>
sink =
gst_element_factory_make("autovideosink",
"sink");<br>
<br>
gst_bin_add_many
(GST_BIN
(pipeline),src1,
src2, dec1, dec2,
alfa1, smpte,
mixer, queue,
color, sink,
NULL);<br>
<br>
gst_element_link
(src1,dec1);<br>
gst_element_link
(src2,dec2);<br>
gst_element_link
(alfa1,mixer);<br>
gst_element_link
(smpte,mixer);<br>
gst_element_link
(mixer,queue);<br>
gst_element_link
(queue,sink);<br>
<br>
<br>
/* now run */<br>
gst_element_set_state
(pipeline,
GST_STATE_PLAYING);<br>
cout <<
"Playing..."
<< endl;<br>
g_main_loop_run
(loop);<br>
<br>
/* also clean
up */<br>
gst_element_set_state
(pipeline,
GST_STATE_NULL);<br>
gst_object_unref
(GST_OBJECT
(pipeline));<br>
<br>
return 0;
<div>
<div><br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div class="gmail_quote">2011/10/26
Stefan Sauer <span dir="ltr"><<a href="mailto:ensonic@hora-obscura.de" target="_blank">ensonic@hora-obscura.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div bgcolor="#ffffff" text="#000000">
<div> On
10/26/2011
03:12 AM,
Rossana Guerra
wrote:
<blockquote type="cite">
<pre>Hi I trying to control the position property of a smptealpha element. It
controls the opacity of the alpha channel,</pre>
</blockquote>
</div>
no, position
controls the
transition of
the fade.
0.0:input1,
1.0:input2.
<div><br>
<blockquote type="cite">
<pre> it varies from 0.0 to 1.0.
The duration of this setting is 500ms.
I am working around this problem, it happens at runtime, I can't figure out
what it's wrong.
</pre>
</blockquote>
<br>
</div>
What is not
working? The
code snippet
looks more of
less okay.
Maybe you can
post a full
standalone
example.<br>
<br>
Stefan
<div><br>
<blockquote type="cite">
<pre>Thanks and regards,
Rossana
Here's the code;
_____________
gst_interpolation_control_source_set: assertion `G_VALUE_TYPE (value) ==
self->priv->type' failed
// Agrego Controlador
gdouble duracion = 500;
</pre>
</blockquote>
</div>
guint64
duracion =
500;<br>
<blockquote type="cite">
<div>
<pre> GstController * ctrl = gst_object_control_properties(G_OBJECT(smpte),
"position",NULL);
if (ctrl == NULL)
{
GST_WARNING ("No puede controlar el elemento fuente\n");
return 0;
}
// Todo valor GValue debe inicializarse en 0
GValue val_double = { 0, };
g_value_init (&val_double, G_TYPE_DOUBLE);
// Seteo modo de interpolacion
GstInterpolationControlSource * csource =
gst_interpolation_control_source_new();
gst_interpolation_control_source_set_interpolation_mode(csource,GST_INTERPOLATE_LINEAR);
// Seteo primer valor
g_value_set_double(&val_double, 0.0);
gst_interpolation_control_source_set(csource,(0 *
GST_MSECOND),&val_double);
// Seteo segundo valor
g_value_set_double (&val_double, 1.0);
gst_interpolation_control_source_set(csource,(duracion*GST_MSECOND),&val_double);
gst_controller_set_control_source (ctrl, "position", GST_CONTROL_SOURCE
(csource));
g_object_unref (csource);
g_value_unset (&val_double);
</pre>
</div>
<pre><fieldset></fieldset>
_______________________________________________
gstreamer-devel mailing list
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
<br>
</div>
<br>
_______________________________________________<br>
gstreamer-devel
mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
<pre><fieldset></fieldset>
_______________________________________________
gstreamer-devel mailing list
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
<br>
</div>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br>
</blockquote>
</div>
<br>
<pre><fieldset></fieldset>
_______________________________________________
gstreamer-devel mailing list
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br>
</blockquote>
</div>
</div>
</div>
<br>
</blockquote>
</div>
<br>
<pre><fieldset></fieldset>
_______________________________________________
gstreamer-devel mailing list
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
<br>
</div></div></div>
<br>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br>