Troubles with gstreamer, pygtk and ubuntu karmic

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

Troubles with gstreamer, pygtk and ubuntu karmic

Nicolas Bertrand-4

Hi,
I use gstreamer and pygtk for webcam acquisition. Since I upgraded to
ubuntu karmic 9.10, I was facing some application freeze/crash.

Most of the time the application freeze and webcam application does
 not start.

For illusrate my problem I use the example from pygst tutorial ( simple
webcam acquisition and display) :
http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html

This program operates normaly on ubuntu dapper drake and ubuntu jaunty
jackalope. I execute the program at least 5 times and webcam
acquisition, is always OK.

If  I execute the same script on ubuntu karmic, sometimes its ok and
sometimes not. Most of the the time the webcam acquisition fails.

What I noticed under karmic  :
    If I use videotestsrc instead of v4l2src, I still having the problem
--> so its seems not due to webcam acquisition.
    When display is not 'forced' to a Drawing area, i.e. the
acquisition starts in another window in place of application window, the
script never crash and webcam acquisition is good. For doin that doin I
don't connect the signal 'sync-message::element'

Do anyone has facing this problem or have an idea for how to
understand/debug this problem.

I post this message on gstreamer and pygtk, because I do not know where
the problem or bad usage come from ?

Thanks in advance for help.

Nico
https://launchpad.net/~nico-inattendu

   





------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Troubles with gstreamer, pygtk and ubuntu karmic

Ron McOuat
I had the same problem. The tutorial version of the code for handling
the assignment of the "prepare-xwindow-id" message is incomplete.
Looking in the example code under gst-python reveals a few more steps. I
changed the tutorial code to look like the following and it worked.

    def on_sync_message(self, bus, message):
        if message.structure is None:
            return
               
        if message.structure.get_name() == "prepare-xwindow-id":          
            # Assign the viewport
            gtk.gdk.threads_enter()
            gtk.gdk.display_get_default().sync()
            imagesink = message.src
            imagesink.set_property("force-aspect-ratio", True)
            imagesink.set_xwindow_id(self.movie_window.window.xid)
            gtk.gdk.threads_leave()

The code form the examples directory in gst-python is not the same as
above but I pulled in the thread sync code to make it work.

Here is the code (commented out) from the examples

            # Example code from
            #
http://cgit.freedesktop.org/gstreamer/gst-python/tree/examples/maemogst.py
            #
            # all this is needed to sync with the X server before giving the
            # x id to the sink
            #gtk.gdk.threads_enter()
            #gtk.gdk.display_get_default().sync()
            #self.video_widget.set_sink(message.src)
            #message.src.set_property("force-aspect-ratio", True)
            #gtk.gdk.threads_leave()



I have also had trouble with the NVidia X server not displaying the
video with the proper colour map. If I move a recorded file off a cam to
another machine it displays the correct colour map but I am sure that is
a separate issue.

Hope that helps,

Ron


Nicolas Bertrand wrote:

> Hi,
> I use gstreamer and pygtk for webcam acquisition. Since I upgraded to
> ubuntu karmic 9.10, I was facing some application freeze/crash.
>
> Most of the time the application freeze and webcam application does
>  not start.
>
> For illusrate my problem I use the example from pygst tutorial ( simple
> webcam acquisition and display) :
> http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html
>
> This program operates normaly on ubuntu dapper drake and ubuntu jaunty
> jackalope. I execute the program at least 5 times and webcam
> acquisition, is always OK.
>
> If  I execute the same script on ubuntu karmic, sometimes its ok and
> sometimes not. Most of the the time the webcam acquisition fails.
>
> What I noticed under karmic  :
>     If I use videotestsrc instead of v4l2src, I still having the problem
> --> so its seems not due to webcam acquisition.
>     When display is not 'forced' to a Drawing area, i.e. the
> acquisition starts in another window in place of application window, the
> script never crash and webcam acquisition is good. For doin that doin I
> don't connect the signal 'sync-message::element'
>
> Do anyone has facing this problem or have an idea for how to
> understand/debug this problem.
>
> I post this message on gstreamer and pygtk, because I do not know where
> the problem or bad usage come from ?
>
> Thanks in advance for help.
>
> Nico
> https://launchpad.net/~nico-inattendu
>
>    
>
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>  

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Troubles with gstreamer, pygtk and ubuntu karmic

Jan Schmidt-6
On Mon, 2009-11-16 at 11:37 -0800, Ron McOuat wrote:

> I had the same problem. The tutorial version of the code for handling
> the assignment of the "prepare-xwindow-id" message is incomplete.
> Looking in the example code under gst-python reveals a few more steps. I
> changed the tutorial code to look like the following and it worked.
>
>     def on_sync_message(self, bus, message):
>         if message.structure is None:
>             return
>                
>         if message.structure.get_name() == "prepare-xwindow-id":          
>             # Assign the viewport
>             gtk.gdk.threads_enter()
>             gtk.gdk.display_get_default().sync()
>             imagesink = message.src
>             imagesink.set_property("force-aspect-ratio", True)
>             imagesink.set_xwindow_id(self.movie_window.window.xid)
>             gtk.gdk.threads_leave()

This is due to GTK+ making a subtle change in the handling of GdkWindow
XIDs, for the Client Side Windows support. You now need to be sure to
take the GDK lock, because they replaced a simple accessor macro with a
function that tries to create a native X server window if one doesn't
yet exist.

See bug https://bugzilla.gnome.org/show_bug.cgi?id=599885

> The code form the examples directory in gst-python is not the same as
> above but I pulled in the thread sync code to make it work.
>
> Here is the code (commented out) from the examples
>
>             # Example code from
>             #
> http://cgit.freedesktop.org/gstreamer/gst-python/tree/examples/maemogst.py
>             #
>             # all this is needed to sync with the X server before giving the
>             # x id to the sink
>             #gtk.gdk.threads_enter()
>             #gtk.gdk.display_get_default().sync()
>             #self.video_widget.set_sink(message.src)
>             #message.src.set_property("force-aspect-ratio", True)
>             #gtk.gdk.threads_leave()
>
>
>
> I have also had trouble with the NVidia X server not displaying the
> video with the proper colour map. If I move a recorded file off a cam to
> another machine it displays the correct colour map but I am sure that is
> a separate issue.

I had this (one time) issue as well. Going into Totem, opening the
Preferences->Display tab, and resetting the Hue slider to the center
fixes it. I think NVidia changed the meaning of the Hue slider values,
making totem's cached value actually cause incorrect hue.

J.
 

>
> Hope that helps,
>
> Ron
>
>
> Nicolas Bertrand wrote:
> > Hi,
> > I use gstreamer and pygtk for webcam acquisition. Since I upgraded to
> > ubuntu karmic 9.10, I was facing some application freeze/crash.
> >
> > Most of the time the application freeze and webcam application does
> >  not start.
> >
> > For illusrate my problem I use the example from pygst tutorial ( simple
> > webcam acquisition and display) :
> > http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html
> >
> > This program operates normaly on ubuntu dapper drake and ubuntu jaunty
> > jackalope. I execute the program at least 5 times and webcam
> > acquisition, is always OK.
> >
> > If  I execute the same script on ubuntu karmic, sometimes its ok and
> > sometimes not. Most of the the time the webcam acquisition fails.
> >
> > What I noticed under karmic  :
> >     If I use videotestsrc instead of v4l2src, I still having the problem
> > --> so its seems not due to webcam acquisition.
> >     When display is not 'forced' to a Drawing area, i.e. the
> > acquisition starts in another window in place of application window, the
> > script never crash and webcam acquisition is good. For doin that doin I
> > don't connect the signal 'sync-message::element'
> >
> > Do anyone has facing this problem or have an idea for how to
> > understand/debug this problem.
> >
> > I post this message on gstreamer and pygtk, because I do not know where
> > the problem or bad usage come from ?
> >
> > Thanks in advance for help.
> >
> > Nico
> > https://launchpad.net/~nico-inattendu
> >
> >    
> >
> >
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> > trial. Simplify your report design, integration and deployment - and focus on
> > what you do best, core application coding. Discover what's new with
> > Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> > _______________________________________________
> > gstreamer-devel mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >
> >  
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>


--
Jan Schmidt <[hidden email]>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Troubles with gstreamer, pygtk and ubuntu karmic

Nicolas Bertrand-4
Jan Schmidt a écrit :

> On Mon, 2009-11-16 at 11:37 -0800, Ron McOuat wrote:
>  
>> I had the same problem. The tutorial version of the code for handling
>> the assignment of the "prepare-xwindow-id" message is incomplete.
>> Looking in the example code under gst-python reveals a few more steps. I
>> changed the tutorial code to look like the following and it worked.
>>
>>     def on_sync_message(self, bus, message):
>>         if message.structure is None:
>>             return
>>                
>>         if message.structure.get_name() == "prepare-xwindow-id":          
>>             # Assign the viewport
>>             gtk.gdk.threads_enter()
>>             gtk.gdk.display_get_default().sync()
>>             imagesink = message.src
>>             imagesink.set_property("force-aspect-ratio", True)
>>             imagesink.set_xwindow_id(self.movie_window.window.xid)
>>             gtk.gdk.threads_leave()
>>    
>
>  
Thanks for the solution,it rocks !
from the example in

http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html

I slightly changed by

        def on_sync_message(self, bus, message):
                if message.structure is None:
                        return
                message_name = message.structure.get_name()
                if message_name == "prepare-xwindow-id":
                        # Assign the viewport
            # all this is needed to sync with the X server before giving the
            # x id to the sink
            gtk.gdk.threads_enter()
            gtk.gdk.display_get_default().sync()
                        imagesink = message.src
                        imagesink.set_property("force-aspect-ratio", True)
                        imagesink.set_xwindow_id(self.videowidget.window.xid)
            gtk.gdk.threads_leave()

as the exmple dos not use a VideoWidget class.



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel