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> GstPad *pad,<br> gpointer data)<br>{<br> GstPad *sinkpad;<br> GstCaps *caps;<br> GstStructure *str;<br> gint i, max;<br><br> caps = gst_pad_get_caps (pad);<br><br> str = gst_caps_get_structure (caps, 0);
<br> /* We can now link this pad with the audio or video decoder */<br> g_print ("\n Dynamic pad created, linking parser/decoder \n");<br> if (g_strrstr (gst_structure_get_name (str), "video"))<br>
{<br> g_print("Video link\n");<br> <br> max = gst_structure_n_fields (str); // Récupère le nombre de field dans la structure<br> <br> for(i=0;i<max; i++){<br> g_print("\n Nom de la structure %s \n", gst_structure_nth_field_name (str, i)); // Recupère le nom de la structure.
<br> }<br> g_print(gst_caps_to_string(caps));<br> //Add now the video thread in the main pipeline<br> gst_bin_add(GST_BIN(pipeline), pipeVideo);<br> //Put the pipeline video on state ready (It can bug if it is not init to ready)
<br> gst_element_set_state (pipeVideo, GST_STATE_READY);<br> //Retrieves the sink pad of the pipevideo(the ghost pad) <br> sinkpad = gst_element_get_pad (pipeVideo, "sink"); <br> <br> //If the pileline is already link, stop here
<br> if (GST_PAD_IS_LINKED (sinkpad)) return;<br><br> //You can add here a notify caps:<br> //g_signal_connect(sinkpad, "notify::caps",G_CALLBACK(cb_notify_caps), NULL);<br><br> //Link the main pipeline pad with the pipeline video pad
<br> if (gst_pad_link(pad, sinkpad)!= GST_PAD_LINK_OK)<br> {<br> g_error("Cannot link video\n");<br> return;<br> }<br> //Put the state at pause, it can be crash if not init
<br> gst_element_set_state (pipeVideo, GST_STATE_PAUSED);<br><br> }<br><br> if ( g_strrstr (gst_structure_get_name (str), "audio"))<br> {<br> g_print("Audio link\n");<br> <br>
gst_bin_add(GST_BIN(pipeline), pipeAudio);<br> gst_element_set_state (pipeAudio, GST_STATE_READY);<br> sinkpad = gst_element_get_pad (pipeAudio, "sink");<br> if (GST_PAD_IS_LINKED (sinkpad)){
<br> g_print("Already link");<br> } <br> <br> if (gst_pad_link(pad, sinkpad) != GST_PAD_LINK_OK)<br> {<br> g_error("Cannot link audio\n");<br> return;
<br> }<br>
//g_print("Audio paused\n");<br>
// gst_element_set_state (pipeAudio, GST_STATE_PAUSED);<br>
// g_print("Audio playing\n");<br>
//gst_element_set_state (pipeAudio, GST_STATE_PLAYING);<br>
// g_print("Video playing\n");<br>
// gst_element_set_state (pipeVideo, GST_STATE_PLAYING);<br>
//g_print("pipe playing2\n") <br> if(!haveTypeAudio){<br> g_print("Type de l'audio pas encore trouvé %d \n", video_frames);<br> return;<br> };<br>
<br> gst_element_set_state (pipeline, GST_STATE_PLAYING);<br> //gst_object_unref (sinkpad); <br> }<br>}<br><br><div><span class="gmail_quote">2007/5/6, fabien <<a href="mailto:fabien.castan@free.fr">
fabien.castan@free.fr</a>>:</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's me again. I tried and I tried by I still can'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 "pad" in the<br>"cb_new_pad()" 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't know what?<br>I'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>