Playing avi file with jogl newt

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

Playing avi file with jogl newt

Danica
Dear all,

is it possible to play avi with jogl newt. I have a swing project and I have to play avi in swing component. Swing must run on Raspbian Wheezy, Raspberry Pi.

Thank you.

Danica
Reply | Threaded
Open this post in threaded view
|

Re: Playing avi file with jogl newt

gouessej
Administrator
Hi

It should work, you can use GLMediaPlayer, but I have never tested it under Mac OS X and Windows, I can confirm it works under Android and GNU Linux.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Playing avi file with jogl newt

Xerxes Rånby
This post was updated on .
In reply to this post by Danica
Danica wrote
Dear all,

is it possible to play avi with jogl newt.
Hi Danica, and welcome!
Yes, it is possible to use JOGL and NEWT to playback avi files on the raspberry pi, using the GLMediaPlayer class.

In order to get avi playback working then you first need to install ffmpeg/libav decoders that will do the actual video decoding on the pi.
# you basically need libavcodec libavutil and libavformat and you get these by
# installing the libav-tools package on the pi
sudo apt-get install libav-tools

#Then you need gluegen, jogl and optionally joal (audio playback).
# these files are all found inside jogamp-all-platforms archive
# http://jogamp.org/deployment/jogamp-current/archive/jogamp-all-platforms.7z
wget http://jogamp.org/deployment/jogamp-current/jar/gluegen-rt.jar
wget http://jogamp.org/deployment/jogamp-current/jar/gluegen-rt-natives-linux-armv6hf.jar
wget http://jogamp.org/deployment/jogamp-current/jar/jogl-all.jar
wget http://jogamp.org/deployment/jogamp-current/jar/jogl-all-natives-linux-armv6hf.jar
wget http://jogamp.org/deployment/jogamp-current/jar/joal.jar
wget http://jogamp.org/deployment/jogamp-current/jar/joal-natives-linux-armv6hf.jar

#And finally you need to write a media player application
#we have some examples inside the jogl junit tests
# on how to use the GLMediaPlayer class to playback video.
wget http://jogamp.org/deployment/jogamp-current/jar/jogl-test.jar
wget http://jogamp.org/deployment/jogamp-current/jar/junit.jar
# Test movie playback: (the movie cube can also be rotated using the mouse)
# Use -url file://... or -url http://... to load a custom movie.
# http://www.blender.org/features-gallery/movies/
# -url http://download.blender.org/demo/movies/ChairDivXL.avi
java -cp jogl-test.jar:jogl-all.jar:gluegen-rt.jar:joal.jar com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube -width 1980 -height 1080
java -cp jogl-test.jar:jogl-all.jar:gluegen-rt.jar:joal.jar com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple -width 1980 -height 1080 -url http://download.blender.org/demo/movies/ChairDivXL.avi

Danica wrote
I have a swing project and I have to play avi in swing component. Swing must run on Raspbian Wheezy, Raspberry Pi.

Thank you.

Danica
OpenGL ES and AWT/Swing interoperability on the Raspberry Pi is a special case, and this is currently not supported. I will explain the details:

OpenGL ES AWT and Swing interoperability is currently only supported on ARM Linux systems where the system installed libEGL uses a regular X11 "Window" data-structure. This limitation is caused by AWT and Swing itself since these GUI API's is hardwired to only support use of X11 windows. Unfortunately the libEGL (the library you use to initialize OpenGL ES) on the Raspberry Pi is different and only operate on a broadcom specific "EGL_DISPMANX_WINDOW_T" datastructure.

EGL API background:
It is common that libEGL EGLNativeWindowType differ for OpenGL ES implementations across operating systems, for example:
On Windows EGLNativeWindowType is a "HWND" datastructure.
On Linux/Android EGLNativeWindowType is a "ANativeWindow*" datastructure pointer.
On Linux/X11 EGLNativeWindowType is a "Window" datastructure.
and so on...
On The Raspbeery Pi using a Linux/Broadcom Videocore IV EGLNativeWindowType is a "EGL_DISPMANX_WINDOW_T" datastructure.

We have an open bug-report for your use-case:
https://jogamp.org/bugzilla/show_bug.cgi?id=626 - Support X11/EGL-blit on Rasp.Pi allowing use of AWT and Applets (was: NApplet fail using newt bcm.vc.iv driver)

Like stated in the bug-report in order to get AWT and Swing support we first need to render OpenGL ES content into to an off-screen buffer and then "blit" (DMA copy from GPU to CPU memory) in order to place the rendered buffer on a X11 window.
One alternative, and faster, solution is to let the dispmanx opengl es window paint on top of the the X11 displayserver and track the X11 AWT window coordinates, similar to overlay video playback is performed by many video players.
This is a new feature and someone needs to implement it.