This post was updated on .
Hi all,
I have created a window using gtk and linked the xvimagesink to that window. Able to play the Video but i am facing problem when i am trying to hide that widget. 1. I have constructed the pipeline to play the video. 2. During the construction of the pipeline, i have called a function which creats the container window and a video window (drawing area) but did not show it. Used, gtk_widget_hide(window); 3. I wanted the window widget to be shown only when the play command is issued i.e, only when the pipeline is set to GST_PLAYING. 4. When the bus handler receives the EOS (End of Stream), i gave gtk_widget_hide(window); But the black window is displayed. It is not hidden. Is there anything i am missing. Note: I have not used gtk_main() function. I have just called the gtk_init(NULL,NULL); and then created a window. Requirement: Want to create the window everytime i get a play command and want to hide / destroy that window when received a stop command or it reaches EOS. Need your help. I am new to gstreamer as well as gtk :( Thanks in advance. |
On 08/23/2011 11:14 AM, akaChella wrote:
> Hi all, > > I have created a window using gtk and linked the xvimagesink to that window. > > Able to play the Video but i am facing problem when i am trying to hide that > widget. > > 1. I have constructed the pipeline to play the video. > 2. During construction i have created the container window and a video > window (drawing area) but did not show it. Used, gtk_widget_hide(window); > 3. I wanted the window widget to be shown only when the play command is > issued i.e, only when the pipeline is set to GST_PLAYING. > 4. When the bus handler receives the EOS (End of Stream), i gave > gtk_widget_hide(window); But the black window is displayed. It is not > hidden. > > Is there anything i am missing. > > Note: I have not used gtk_main() function. I have just called the > gtk_init(NULL,NULL); and then created a window. I would suggest you call gtk_main() and build a 'properly' functioning gtk app. gtk_main deals with the event loop, which is somewhat necessary unless you have your own event loop which is likely just complicating things. Considering this is your first app I'd suggest sticking with the norm. > Requirement: Want to create the window everytime i get a play command and > want to hide / destroy that window when received a stop command or it > reaches EOS. > > Need your help. I am new to gstreamer as well as gtk :( > > Thanks in advance. > > > -- > View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Linking-xvimagesink-to-a-gtk-window-tp3763400p3763400.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 |
I found a link to a pretty decent sample program in a discussion at www.gtkforums.com but that forum appears dead when I went to check the link. This may be it at a new home: https://github.com/felipec/gst-player/ you'll also need to understand the code snippets and issues discussed here: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstxoverlay.html |
In reply to this post by Nathanael D. Noblet
But when i include gtk_main(); it does not come out of that, means it is executing gtk_mian() and does not returning to the method where i called this function.
I have two different class, One, which constructs the pipeline (pipeline.c) and the other one which is constructing a window (ui.c). I have a main function in gstreamer class i.e, which is constructing the pipeline. During the construction of the pipeline, i am calling create window function of ui.c class. which has, gtk_init method and a method to construc the window. If i include gtk_main() there, it is not returning to the pipeline.c class. |
On Tue, 2011-08-23 at 23:08 -0700, akaChella wrote:
> But when i include gtk_main(); it does not come out of that, means it > is > executing gtk_mian() and does not returning to the method where i > called > this function. That is the point. Use a idle handler for example to run your code. -- Kaj-Michael Lang <[hidden email]> _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by akaChella
On 08/24/2011 12:08 AM, akaChella wrote:
> But when i include gtk_main(); it does not come out of that, means it is > executing gtk_mian() and does not returning to the method where i called > this function. > > I have two different class, One, which constructs the pipeline (pipeline.c) > and the other one which is constructing a window (ui.c). I have a main > function in gstreamer class i.e, which is constructing the pipeline. > > During the construction of the pipeline, i am calling create window function > of ui.c class. which has, gtk_init method and a method to construc the > window. If i include gtk_main() there, it is not returning to the pipeline.c > class. As stated elsewhere, gtk_main() is how you are *supposed* to write a gtk app. I would suggest you go through a few gtk sample apps to 'get' how it works. Once you understand what is happening, everything will make more sense. For example suppose you have a GUI GTK app and you click a button. How does your app know? Your program would have a function that acts as a 'callback'. gtk_main is running the event loop that sends those callbacks. So yeah, ignore what you are trying to do with gstreamer for a moment, and step back and look at GTK apps for a bit. _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Thanks all for your replies.
Yeah, today i went through few samples of gtk and came to know that gtk_main() acts as an infinite loop and listens to all the events. But, i have an application which constructs the pipeline once and that application then sends - play, pause and stop commands in a random basis. At the end, it destroys the pipeline and deinitializes the gstreamer. But i have a doubt here: 1. If gtk_main() functions listens to all the events, then it is not suppose to show the widget right?? How come it is showing the window and why not it is hiding it? I am able to see the video being played and after it reaches the End of stream, the pipeline is set to GST_STATE_NULL and i am giving gtk_widget_hide(), but the window is not hidden!! 2. If had to call the gtk_main() where in my application should i include the function call ?? Because from wherever i call this function, the control does not returns back. |
Free forum by Nabble | Edit this page |