how to change element when pipe is running!!!!!!!!!!!!!

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

how to change element when pipe is running!!!!!!!!!!!!!

DBOYaoao
hi everyone:
           I am a new gst developer,I have a trouble with change elemnt while pipeline is running.
           my project is like this:A->B->C,B can change the pixel-aspect-ratio,I use d to change b that can change the pixel-aspect-ratio,but i don't know why can't change it.
         my method is this: I use videoscale ! capsfilter ! xvimagsink to change aspect-ratio
         capsfilterB aspect-ratio is 1:1      capsfilterD aspect-ratio is 16:9
        first I block the videoscale srcpad,and the movie stop,then I unlink B with A and c,then connect D with A and C use gst_bin_link_many(),finally I unblock the videoscale srcpad.but the movie not continue.
       However When I set capsfilterD's aspect-ratio as 1:1 , it work.
       
block code like this:

             GstPad *videoscalesrcpad = gst_element_get_static_pad(videoscale,"src");
                                                gst_pad_set_blocked_async(videoscalesrcpad,TRUE,padBlockcb,videoscalesrcpad);
                                        while(!gst_pad_is_blocking(videoscalesrcpad))
                                        {
                                                g_print("wait for the srcpad blocking\n");
                                        }
                                        gst_element_set_state(capsfilter_1,GST_STATE_NULL);
                                        g_print(".....................src pad blocked..........\n");
                                        GstPad *caps1sinkpad = gst_element_get_static_pad(capsfilter_1,"sink");

                                        if(!gst_pad_is_linked(caps1sinkpad))
                                        {
                                                g_print("caps sink not link\n");
                                        }
                                        if(!gst_pad_unlink(videoscalesrcpad,caps1sinkpad))
                                        {
                                                g_print("unlinlk failed \n");
                                                return ;
                                        }
                                        GstPad *outsinkpad = gst_element_get_static_pad(outsink,"sink");
                                        GstPad *caps1srcpad = gst_element_get_static_pad(capsfilter_1,"src");

                                        gst_pad_unlink(caps1srcpad,outsinkpad);
unblock code like this:
                   GstCaps *filtercaps = NULL;
                                        filtercaps = gst_caps_from_string("video/x-raw-yuv,pixel-aspect-ratio=\(fraction\)1/1");
                                        g_object_set(G_OBJECT(capsfilter_2),"caps",filtercaps,NULL);
                                        gst_caps_unref(filtercaps);

                                        gst_bin_add(videobin,capsfilter_2);
                                        gst_element_link_many(videoscale,capsfilter_2,outsink,NULL);
                                        gst_element_set_state(capsfilter_2,GST_STATE_PLAYING);

#endif
                                        GstPad *videoscalesrcpad = gst_element_get_static_pad(videoscale,"src");
                                        gst_pad_set_blocked_async(videoscalesrcpad,FALSE,padBlockcb,NULL);

Thanks for anybody help!!!!!!
Reply | Threaded
Open this post in threaded view
|

Re: how to change element when pipe is running!!!!!!!!!!!!!

DBOYaoao
why nobody answer me!
Reply | Threaded
Open this post in threaded view
|

Re: how to change element when pipe is running!!!!!!!!!!!!!

Lawrence Anthony-2
Lookup dynamic pipelines in version 1.0

----- Original Message -----
From: "DBOYaoao" <[hidden email]>
To: [hidden email]
Sent: Tuesday, September 11, 2012 6:21:44 PM
Subject: Re: how to change element when pipe is running!!!!!!!!!!!!!

why nobody answer me!



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/how-to-change-element-when-pipe-is-running-tp4656253p4656265.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to change element when pipe is running!!!!!!!!!!!!!

Tim-Philipp Müller-2
In reply to this post by DBOYaoao
On Tue, 2012-09-11 at 18:21 -0700, DBOYaoao wrote:

> why nobody answer me!

Possibly because people stopped reading your post after the second
paragraph, because it is not very concise, not very nicely formatted (as
a mail anyway), and contains way too many exclamation marks ;)

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to change element when pipe is running!!!!!!!!!!!!!

enthusiastic geek
Usually I would pause my pipeline momentarily -> change my property or unlink bin. Then replace the new bin or change property as appropriate. Then sync_state_with_parent() before moving from ready() -> play(). I had answered a similar question, albeit syntax is in java http://stackoverflow.com/questions/7040191/realtime-changing-the-ip-source-into-a-gstreamer-pipeline/7758401#7758401