Using OpenGL video output with glimagesink

1,061 views
Skip to first unread message

dvrslype

unread,
Mar 25, 2010, 10:46:34 AM3/25/10
to gstreamer-java
Hello,

I installed the gstreamer OpenGL plugin on my Ubuntu system
(http://packages.ubuntu.com/dapper/i386/gstreamer0.10-gl/download)

This offers the glimagesink output module, but I can't seem to use it
with gstreamer-java:

Exception in thread "AWT-EventQueue-0"
java.lang.IllegalArgumentException: Element does not implement
interface
at org.gstreamer.interfaces.GstInterface.<init>(GstInterface.java:43)
at org.gstreamer.interfaces.XOverlay.<init>(XOverlay.java:55)
at org.gstreamer.interfaces.XOverlay.wrap(XOverlay.java:46)
at videotest.Main$1.run(Main.java:50)

What do I need to do to get this to work? Are there some bindings that
need to be added to gstreamer-java?

dvrslype

Farkas Levente

unread,
Mar 25, 2010, 11:09:48 AM3/25/10
to gstream...@googlegroups.com
why do you think so?
overlay currently support swing, awt and swing.
we haven't use opengl yet:-(
but patches are welcome:-)

> --
> You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
> To post to this group, send email to gstream...@googlegroups.com.
> To unsubscribe from this group, send email to gstreamer-jav...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/gstreamer-java?hl=en.
>
>

--
Levente "Si vis pacem para bellum!"

Tal Shalif

unread,
Mar 25, 2010, 4:47:25 PM3/25/10
to gstream...@googlegroups.com
The plugin webpage claims that: "GstGLImageSink implements GstImplementsInterface and GstXOverlay" and indeed I was able to modify OverlayPlayer.main to use 'glimagesink' instead of 'xvimagesink' on Linux. I am using gstreamer GIT HEAD for my tests:

====================== very slightly modified OverlayPlayer.main() ===================
    public static void main(String[] args) {
        //System.setProperty("sun.java2d.opengl", "True");
       
        args = Gst.init("Swing Player", args);

        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
               
                JFrame frame = new JFrame("Overlay Test");
                final Canvas canvas = new Canvas();
                canvas.setPreferredSize(new Dimension(640, 480));
                frame.add(canvas, BorderLayout.CENTER);               
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.pack();
                frame.setVisible(true);
               
                Pipeline player = Pipeline.launch("videtestsrc ! glimagesink name=gl");

                bus = player.getBus();
               
                bus.connect(new Bus.ERROR() {
                    public void errorMessage(GstObject source, int code, String message) {
                        System.out.println("Error: code=" + code + " message=" + message);
                    }
                });
                final Element videoSink = player.getElementByName("gl");
                //
                // Setting the overlay window ID is supposed to be done from a sync handler
                // but that doesn't work on windows
                //
                if (!Platform.isWindows()) {
                    bus.setSyncHandler(new BusSyncHandler() {

                        public BusSyncReply syncMessage(Message msg) {
                            Structure s = msg.getStructure();
                            if (s == null || !s.hasName("prepare-xwindow-id")) {
                                return BusSyncReply.PASS;
                            }
                            XOverlay.wrap(videoSink).setWindowID(canvas);
                            return BusSyncReply.DROP;
                        }
                    });
                } else {
                    XOverlay.wrap(videoSink).setWindowID(canvas);
                }
                player.play();      
            } 
        });
    }
================================================================

Farkas Levente

unread,
Mar 29, 2010, 10:56:05 AM3/29/10
to gstream...@googlegroups.com
hi,
do this "!Platform.isWindows()" really needs?
do you test it with gstreamer-java head?

> <mailto:gstream...@googlegroups.com>.


> > To unsubscribe from this group, send email to
> gstreamer-jav...@googlegroups.com

> <mailto:gstreamer-java%2Bunsu...@googlegroups.com>.


> > For more options, visit this group at
> http://groups.google.com/group/gstreamer-java?hl=en.
> >
> >
>
>
>
> --
> Levente "Si vis pacem para bellum!"
>
> --
> You received this message because you are subscribed to the Google
> Groups "gstreamer-java" group.
> To post to this group, send email to gstream...@googlegroups.com

> <mailto:gstream...@googlegroups.com>.


> To unsubscribe from this group, send email to
> gstreamer-jav...@googlegroups.com

> <mailto:gstreamer-java%2Bunsu...@googlegroups.com>.

Tal Shalif

unread,
Mar 29, 2010, 4:23:15 PM3/29/10
to gstream...@googlegroups.com
Do you mean for setting the XOverlay inside bus.setSyncHandle()? On Linux with X11 I could run the code without the synch handle (i.e. exactly like the code for Windows), providing: a. The JFrame and Canvas instance have had time to show-up on screen and b. the pipeline is not playing yet. Using setSyncHandle() takes care of b. (otherwise an independent xvimagesink window will show-up if XOverlay.warp() has not been called by this point). Maybe the program can be written without setSyncHandle(), but why fix if its not broken..

I am using SVN HEAD.

dvrslype

unread,
Apr 29, 2010, 4:11:12 PM4/29/10
to gstreamer-java
> I am using SVN HEAD.

got it working with the GIT HEAD of gstreamer and gst-plugins-gl,
didn't work with the ubuntu packages.

Farkas Levente

unread,
Apr 30, 2010, 7:37:21 AM4/30/10
to gstream...@googlegroups.com
On 04/29/2010 10:11 PM, dvrslype wrote:
>> I am using SVN HEAD.
>
> got it working with the GIT HEAD of gstreamer and gst-plugins-gl,
> didn't work with the ubuntu packages.

does it means not a gstreamer-java bug?

--
Levente "Si vis pacem para bellum!"

dvrslype

unread,
May 10, 2010, 7:44:42 AM5/10/10
to gstreamer-java


On 30 apr, 13:37, Farkas Levente <lfar...@lfarkas.org> wrote:
> does it means not a gstreamer-java bug?

I believe so, yes!
Thanks for your support.

dvrslype

Farkas Levente

unread,
May 13, 2010, 6:17:56 PM5/13/10
to gstream...@googlegroups.com
do you know why setSyncHandle not working on windows? i assume it
should have to be working on all platforms...

Farkas Levente

unread,
May 18, 2010, 10:17:11 AM5/18/10
to gstream...@googlegroups.com, Tal Shalif
i'm still try to understand you code:-(
in the comment and bellow you wrote setSyncHandle have to use on
windwos, but in the code use:
if (!Platform.isWindows())
so what's the current situation?

On 03/29/2010 10:23 PM, Tal Shalif wrote:
> Do you mean for setting the XOverlay inside bus.setSyncHandle()? On
> Linux with X11 I could run the code without the synch handle (i.e.
> exactly like the code for Windows), providing: a. The JFrame and Canvas
> instance have had time to show-up on screen and b. the pipeline is not
> playing yet. Using setSyncHandle() takes care of b. (otherwise an
> independent xvimagesink window will show-up if XOverlay.warp() has not
> been called by this point). Maybe the program can be written without
> setSyncHandle(), but why fix if its not broken..
>
> I am using SVN HEAD.
>
> On 29 March 2010 17:56, Farkas Levente <lfa...@lfarkas.org

Tal Shalif

unread,
May 18, 2010, 3:18:01 PM5/18/10
to gstream...@googlegroups.com
Actually the other way around: when the platform is not windows (i.e. Linux or Mac), using XOverlay.wrap() is historically done in response to an asynch bus message containing an "prepare-xwindow-id" attribute. I never investigated why this is apparently not necessary on windows.

Farkas Levente

unread,
May 18, 2010, 4:29:49 PM5/18/10
to gstream...@googlegroups.com, Tal Shalif
on linux we don't use asynch bus message, but simple wrap in the
constructor. and it's working....
that's why i don't understand it.
tomorrow i'll test it in windows...

On 05/18/2010 09:18 PM, Tal Shalif wrote:
> Actually the other way around: when the platform is not windows (i.e.
> Linux or Mac), using XOverlay.wrap() is historically done in response to
> an asynch bus message containing an "prepare-xwindow-id" attribute. I
> never investigated why this is apparently not necessary on windows.
>
> On 18 May 2010 17:17, Farkas Levente <lfa...@lfarkas.org
> <mailto:lfa...@lfarkas.org>> wrote:
>
> i'm still try to understand you code:-(
> in the comment and bellow you wrote setSyncHandle have to use on
> windwos, but in the code use:
> if (!Platform.isWindows())
> so what's the current situation?
>
>
> On 03/29/2010 10:23 PM, Tal Shalif wrote:
>
> Do you mean for setting the XOverlay inside bus.setSyncHandle()? On
> Linux with X11 I could run the code without the synch handle (i.e.
> exactly like the code for Windows), providing: a. The JFrame and
> Canvas
> instance have had time to show-up on screen and b. the pipeline
> is not
> playing yet. Using setSyncHandle() takes care of b. (otherwise an
> independent xvimagesink window will show-up if XOverlay.warp()
> has not
> been called by this point). Maybe the program can be written without
> setSyncHandle(), but why fix if its not broken..
>
> I am using SVN HEAD.
>
> On 29 March 2010 17:56, Farkas Levente <lfa...@lfarkas.org
> <mailto:lfa...@lfarkas.org>
> <mailto:gstream...@googlegroups.com>.
> To unsubscribe from this group, send email to
> gstreamer-jav...@googlegroups.com
> <mailto:gstreamer-java%2Bunsu...@googlegroups.com>.
Reply all
Reply to author
Forward
0 new messages