Hello,<br>My code are always messy, and maybe you need to do some g_object_unref to clean(see the last line in comment), but this code works.<br><br>A new pad callback function:<br>static void<br>cb_new_pad (GstElement *element,
<br>&nbsp;&nbsp;&nbsp; &nbsp;GstPad&nbsp;&nbsp;&nbsp;&nbsp; *pad,<br>&nbsp;&nbsp;&nbsp; &nbsp;gpointer&nbsp;&nbsp;&nbsp; data)<br>{<br>&nbsp; GstPad *sinkpad;<br>&nbsp; GstCaps *caps;<br>&nbsp; GstStructure *str;<br>&nbsp; gint i, max;<br><br>&nbsp;&nbsp;&nbsp; caps = gst_pad_get_caps (pad);<br><br>&nbsp;&nbsp;&nbsp; str = gst_caps_get_structure (caps, 0);
<br>&nbsp; /* We can now link this pad with the audio or video&nbsp; decoder */<br>&nbsp; g_print (&quot;\n Dynamic pad created, linking parser/decoder \n&quot;);<br>&nbsp;&nbsp;&nbsp; if (g_strrstr (gst_structure_get_name (str), &quot;video&quot;))<br>
&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_print(&quot;Video link\n&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; max = gst_structure_n_fields (str); // Récupère le nombre de field dans la structure<br>&nbsp;&nbsp;&nbsp; <br>&nbsp; &nbsp;&nbsp;&nbsp; for(i=0;i&lt;max; i++){<br>&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_print(&quot;\n Nom de la structure %s \n&quot;, gst_structure_nth_field_name (str, i)); // Recupère le nom de la structure.
<br>&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_print(gst_caps_to_string(caps));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Add now the video thread in the main pipeline<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_bin_add(GST_BIN(pipeline), pipeVideo);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Put the pipeline video on state ready (It can bug if it is not init to ready)
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_element_set_state (pipeVideo, GST_STATE_READY);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Retrieves the sink pad of the pipevideo(the ghost pad) <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sinkpad = gst_element_get_pad (pipeVideo, &quot;sink&quot;);&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //If the pileline is already link, stop here
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (GST_PAD_IS_LINKED (sinkpad)) return;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //You can add here a notify caps:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //g_signal_connect(sinkpad,&nbsp;&nbsp;&nbsp; &quot;notify::caps&quot;,G_CALLBACK(cb_notify_caps), NULL);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Link the main pipeline pad with the pipeline video pad
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (gst_pad_link(pad, sinkpad)!= GST_PAD_LINK_OK)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_error(&quot;Cannot link video\n&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Put the state at pause, it can be crash if not init
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_element_set_state (pipeVideo, GST_STATE_PAUSED);<br><br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp; if ( g_strrstr (gst_structure_get_name (str), &quot;audio&quot;))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_print(&quot;Audio link\n&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_bin_add(GST_BIN(pipeline), pipeAudio);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_element_set_state (pipeAudio, GST_STATE_READY);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sinkpad = gst_element_get_pad (pipeAudio, &quot;sink&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (GST_PAD_IS_LINKED (sinkpad)){
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_print(&quot;Already link&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (gst_pad_link(pad, sinkpad) != GST_PAD_LINK_OK)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_error(&quot;Cannot link audio\n&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return;
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //g_print(&quot;Audio paused\n&quot;);<br>
&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; gst_element_set_state (pipeAudio, GST_STATE_PAUSED);<br>
&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; g_print(&quot;Audio playing\n&quot;);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //gst_element_set_state (pipeAudio, GST_STATE_PLAYING);<br>
&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; g_print(&quot;Video playing\n&quot;);<br>
&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; gst_element_set_state (pipeVideo, GST_STATE_PLAYING);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //g_print(&quot;pipe playing2\n&quot;) &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; if(!haveTypeAudio){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_print(&quot;Type de l&#39;audio pas encore trouvé %d \n&quot;, video_frames);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; };<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_element_set_state (pipeline, GST_STATE_PLAYING);<br>&nbsp; &nbsp;&nbsp;&nbsp; //gst_object_unref (sinkpad);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp; }<br>}<br><br><div><span class="gmail_quote">2007/5/6, fabien &lt;<a href="mailto:fabien.castan@free.fr">
fabien.castan@free.fr</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello,<br><br>It&#39;s me again. I tried and I tried by I still can&#39;t read a video file.
<br>So I tried to write the smallest and simplest code possible, based on<br>the example that was sent to the mailing list.<br>The only thing missing is the connection of the &quot;pad&quot; in the<br>&quot;cb_new_pad()&quot; function and without this connection nothing can really
<br>happen..<br>I added the video pipeline to the global pipeline, but there must be<br>something missing and I don&#39;t know what?<br>I&#39;ve attached the file to this e-mail.<br><br>Thanks for your patience<br><br>-------------------------------------------------------------------------
<br>This SF.net email is sponsored by DB2 Express<br>Download DB2 Express C - the FREE version of DB2 express and take<br>control of your XML. No limits. Just data. Click to get it now.<br><a href="http://sourceforge.net/powerbar/db2/">
http://sourceforge.net/powerbar/db2/</a><br>_______________________________________________<br>gstreamer-devel mailing list<br><a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a>
<br><a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br><br><br></blockquote></div><br>