<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
I think your problem is this: <br><br>The queues should be between the demuxer and the decoder. I see that you put them between the decoder and the audioconvert(for the audio stream). The pipeline linkage should look like src->demuxer->queuea->decodera->convert->resample->sinka<br>src->demuxer->queuev->decoderv->sinkv<br><br>> Date: Thu, 23 Apr 2009 08:31:41 -0700<br>> From: alavariega@dextratech.com<br>> To: gstreamer-devel@lists.sourceforge.net<br>> Subject: Re: [gst-devel] play audio and video simultaneously<br>> <br>> <br>> The "mad" element doesn't have dynamic pads, so it doesn't emit a "pad-added"<br>> signal. You can connect it directly to "audioconvert".<br>> <br>> Also I see that you declare "queueV" as a "GstElement**" and not as a<br>> "GstElement*".<br>> <br>> <br>> Hi Sledge, thanks for your reply!<br>> <br>> I have already made the corresponding changes and still not activated the<br>> signal that link the video decoder with the respective queue. when i execute<br>> the application this is the result:<br>> <br>> ** (testvideop:6043): DEBUG: Signal: pad-added<br>> on_pad_added: audio/mpeg<br>> ** (testvideop:6043): DEBUG: Linking audio pad to decodera<br>> The audio pad src was linked<br>> ** (testvideop:6043): DEBUG: Signal: pad-added<br>> on_pad_added: video/mpeg<br>> ** (testvideop:6043): DEBUG: Linking video pad to decoderv<br>> The video pad src was linked<br>> <br>> There are no more errors, but they are not playing the video and audio<br>> streams simultaneously<br>> <br>> Thanks in advance for the help,<br>> <br>> Best Regards,<br>> <br>> Alberto.<br>> <br>> <br>> <br>> #include<gst/gst.h><br>> <br>> static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer <br>> data);<br>> static void on_pad_added (GstElement *element, GstPad *pad);<br>> static void on_decpad_added(GstElement *element, GstPad *pad );<br>> <br>> GstElement *pipeline, *src, *demux, *decoderv, *sinkv, *decodera, *convert,<br>> *resample, *sinka;<br>> GstElement *queueA, *queueV;<br>> <br>> int main(int argc, char *argv[])<br>> {<br>> GstStateChangeReturn ret;<br>> GMainLoop *loop;<br>> GstBus *bus;<br>> /*initialization*/<br>> gst_init(&argc,&argv);<br>> loop = g_main_loop_new(NULL, FALSE);<br>> <br>> if(argc != 2)<br>> {<br>> g_print("Usage: %s <mpg/mpeg video file>", argv[0]);<br>> return -1;<br>> }<br>> <br>> pipeline = gst_pipeline_new("VIDEO PLAYER");<br>> bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));<br>> gst_bus_add_watch(bus, bus_call, loop);<br>> <br>> src = gst_element_factory_make("filesrc", "filesource");<br>> demux = gst_element_factory_make("dvddemux", "mpg-demux");<br>> <br>> /*Gstreamer video elements*/<br>> decoderv = gst_element_factory_make("mpeg2dec", "mpeg-decoder");<br>> sinkv = gst_element_factory_make("xvimagesink", "video-out");<br>> if(!decoderv || !sinkv)<br>> {<br>> g_print("\nthe video could not playback\n");<br>> return -1;<br>> }<br>> <br>> /*Gstreamer audio elements*/<br>> <br>> decodera = gst_element_factory_make("mad", "decoder-audio");<br>> convert = gst_element_factory_make("audioconvert", "a-convert");<br>> resample = gst_element_factory_make("audioresample", "a-resample");<br>> sinka = gst_element_factory_make("osssink", "play audio");<br>> if(!decodera || !convert || !resample || !sinka)<br>> {<br>> g_print("\nthe audio could not playback\n");<br>> return -1;<br>> }<br>> <br>> queueA = gst_element_factory_make("queue", "queue-audio");<br>> queueV = gst_element_factory_make("queue", "queue-video");<br>> <br>> g_object_set (G_OBJECT (src), "location", argv[1], NULL);<br>> gst_bin_add_many(GST_BIN(pipeline), src, demux, decoderv,<br>> queueV,sinkv,decodera,convert, resample, sinka, NULL);<br>> <br>> gst_element_link (src, demux);<br>> gst_element_link (queueV, sinkv);<br>> // gst_element_link (queueA, convert);<br>> gst_element_link (decodera, convert);<br>> gst_element_link (convert, resample);<br>> gst_element_link (resample, sinka);<br>> <br>> g_signal_connect (demux, "pad-added",G_CALLBACK (on_pad_added), NULL);<br>> //g_signal_connect (decodera,<br>> "pad-added",G_CALLBACK(on_decpad_added),decodera);<br>> g_signal_connect (decoderv,<br>> "pad-added",G_CALLBACK(on_decpad_added),decoderv);<br>> <br>> /* run */<br>> ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);<br>> <br>> if (ret == GST_STATE_CHANGE_FAILURE) <br>> {<br>> GstMessage *msg;<br>> <br>> g_print ("Failed to start up pipeline!\n");<br>> <br>> /* check if there is an error message with details on the bus */<br>> msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);<br>> if (msg) {<br>> GError *err = NULL;<br>> g_print("\nDISPLAY ERROR:\n");<br>> gst_message_parse_error (msg, &err, NULL);<br>> g_print ("ERROR: %s\n", err->message);<br>> g_error_free (err);<br>> gst_message_unref (msg);<br>> }<br>> return -1;<br>> }<br>> <br>> g_main_loop_run (loop);<br>> <br>> /* clean up */<br>> gst_element_set_state (pipeline, GST_STATE_NULL);<br>> gst_object_unref (pipeline);<br>> <br>> return 0;<br>> <br>> }<br>> <br>> <br>> static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer <br>> data)<br>> {<br>> GMainLoop *loop = data;<br>> <br>> switch (GST_MESSAGE_TYPE (msg)) {<br>> case GST_MESSAGE_EOS:<br>> g_print ("End-of-stream\n");<br>> g_main_loop_quit (loop);<br>> break;<br>> case GST_MESSAGE_ERROR: {<br>> gchar *debug = NULL;<br>> GError *err = NULL;<br>> <br>> gst_message_parse_error (msg, &err, &debug);<br>> <br>> g_print ("Error: %s\n", err->message);<br>> g_error_free (err);<br>> <br>> if (debug) {<br>> g_print ("Debug details: %s\n", debug);<br>> g_free (debug);<br>> }<br>> <br>> g_main_loop_quit (loop);<br>> break;<br>> }<br>> default:<br>> break;<br>> }<br>> <br>> return TRUE;<br>> }<br>> <br>> <br>> static void on_decpad_added(GstElement *element, GstPad *pad )<br>> {<br>> g_debug ("Signal: decoder pad-added");<br>> GstCaps *caps;<br>> GstStructure *str;<br>> GstPad *targetsink;<br>> caps = gst_pad_get_caps (pad);<br>> g_assert (caps != NULL);<br>> str = gst_caps_get_structure (caps, 0);<br>> g_assert (str != NULL);<br>> <br>>         g_debug ("Linking decoder to QUEUE pad ");<br>>         // Link it actually<br>> //element = (element == decodera ? queueA : queueV);<br>>         targetsink = gst_element_get_pad ( queueV, "sink");<br>>         g_assert (targetsink != NULL);<br>>         gst_pad_link (pad, targetsink); <br>> if (gst_pad_is_linked(pad))<br>> g_print("The decoder pad src was linked\n");<br>> else<br>> g_print("The stream:%s pad src was<br>> linked\n",gst_pad_get_name(pad));<br>>         gst_object_unref (targetsink);<br>> gst_caps_unref (caps);<br>> }<br>> <br>> static void on_pad_added (GstElement *element, GstPad *pad)<br>> {<br>> g_debug ("Signal: pad-added");<br>> GstCaps *caps;<br>> GstStructure *str;<br>> <br>> caps = gst_pad_get_caps (pad);<br>> g_assert (caps != NULL);<br>> str = gst_caps_get_structure (caps, 0);<br>> g_assert (str != NULL);<br>> <br>> const gchar *c = gst_structure_get_name(str);<br>> g_print("on_pad_added: %s\n",c);<br>> if (g_strrstr (c, "video") || g_strrstr (c, "image")) {<br>> g_debug ("Linking video pad to decoderv");<br>> // Link it actually<br>> GstPad *targetsink = gst_element_get_pad (decoderv, "sink"); <br>> g_assert (targetsink != NULL);<br>> //g_print("\nVIDEO--pad source: %s\n",<br>> gst_pad_get_name(pad));<br>> //g_print("\nVIDEO--pad sink: %s\n",<br>> gst_pad_get_name(targetsink));<br>> gst_pad_link (pad, targetsink);<br>> if (gst_pad_is_linked(pad))<br>> g_print("The video pad src was linked\n");<br>> gst_object_unref (targetsink);<br>> }<br>> <br>> if (g_strrstr (c, "audio")) {<br>> g_debug ("Linking audio pad to decodera");<br>> // Link it actually<br>> GstPad *targetsink = gst_element_get_pad (decodera, "sink");<br>> g_assert (targetsink != NULL);<br>> //g_print("\nAUDIO--pad source: %s\n",<br>> gst_pad_get_name(pad));<br>> //g_print("\nAUDIO--pad sink: %s\n",<br>> gst_pad_get_name(targetsink));<br>> gst_pad_link (pad, targetsink);<br>> if (gst_pad_is_linked(pad))<br>> g_print("The audio pad src was linked\n");<br>> gst_object_unref (targetsink);<br>> }<br>> <br>> gst_caps_unref (caps);<br>> }<br>> <br>> <br>> <br>> <br>> -- <br>> View this message in context: http://www.nabble.com/play-audio-and-video-simultaneously-tp23175849p23197413.html<br>> Sent from the GStreamer-devel mailing list archive at Nabble.com.<br>> <br>> <br>> ------------------------------------------------------------------------------<br>> Stay on top of everything new and different, both inside and <br>> around Java (TM) technology - register by April 22, and save<br>> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.<br>> 300 plus technical and hands-on sessions. Register today. <br>> Use priority code J9JMT32. http://p.sf.net/sfu/p<br>> _______________________________________________<br>> gstreamer-devel mailing list<br>> gstreamer-devel@lists.sourceforge.net<br>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel<br><br /><hr />Σύρετε φωτογραφίες στο παράθυρο του Messenger. Δείτε πώς. <a href='http://download.live.com/messenger ' target='_new'>Κάντε κλικ εδώ!</a></body>
</html>