Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (577)
games submitted by our members
Games in WIP (498)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  GstLwjgl - yet another media player  (Read 7699 times)
0 Members and 1 Guest are viewing this topic.
Offline nsigma
« Reply #30 - Posted 2012-08-24 13:03:04 »

Incidentally (may interest you) from my perspective this is not so much about GStreamer vs FFMPEG / libav - it's about some fundamental limitations in using outside processes.  The JogAmp approach seems far less problematic to me (from browsing rather than testing so far).
Then, why don't you try to port "our" stuff to LWJGL?

I think that might be a better approach for what Riven's trying to achieve.  I don't for a number of reasons -

  • I need the added features that GStreamer provides over and alongside FFMPEG / libav.  I also already have working code and know the GStreamer API a lot better.
  • Despite what various naysayers around here say, I believe that it's perfectly possible to ship GStreamer binaries and get stable results on all platforms (and that is demonstrated by lots of other projects out there, Java and non-Java)
  • Ideally, any approach to making video playback easier shouldn't be tied to a particular renderer.  Despite the title of this thread, this approach is extremely easy to decouple from LWJGL.  Praxis itself has both a software and LWJGL renderer (and I haven't ruled out a switch to JOGL in future). I'm currently fixing up an alternative way of handling buffers from GStreamer to ensure that we don't lose anything in performance with this approach (code above has an additional buffer copy, though I've emailed Cero an alternative that doesn't and will post here as long as it seems stable).

Video below shows the (custom) software renderer in Praxis with GStreamer webcam input controlling GStreamer movie (576p) playback rotation - this approach is as easily adapted to Swing, Java2D, or anything else people want to use.

<a href="http://www.youtube.com/v/m-PhKAQdt28?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/m-PhKAQdt28?version=3&amp;hl=en_US&amp;start=</a>

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline Cero
« Reply #31 - Posted 2012-10-19 17:23:55 »

Argh I meant to post it into this thread:

So for linux, I tried to get the libs aswell

I went into /usr/lib and copied everything that seemed useful, and later compared it with our mac and win folders of gstreamer and deleted everything that seemed unrelated... a lot of course
if in /usr/lib there was just a gstreamer folder with everything in there, it wouldnt be a problem, but its kinda like system32 on win
Anyway I'm pretty sure I have a linux32 folder for gstreamer now, which should work and may only contain more unnecessary stuff.
Me personally, I will delete everything but the theora and vorbis decoders later in real usage anyway because of license issues

Haven't had the chance to test it out though yet.
Does anybody know which linux distro has a live-cd version, java installed, but no gstreamer ?
well propably not =D

going to get just some linux distro, deinstall gstreamer and install java...

Offline Cero
« Reply #32 - Posted 2013-01-18 16:00:37 »

Im going to make a video tutorial showcase thingy some day.
Especially showing the high level usage in Libgdx and how easy it really is.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #33 - Posted 2013-01-21 02:35:49 »

so I wrote a little Libgdx Showcase for this.

one thing I have learned: we never set the projection matrix, so I added
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, Gdx.graphics.getWidth(), 0, Gdx.graphics.getHeight());
glTranslatef(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2, 0.0f);

glScalef(1.0f, -1.0f, 1.0f);
glTranslatef(-Gdx.graphics.getWidth()/2, -Gdx.graphics.getHeight()/2, 0.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());


otherwise we have this identity mode with -1f -> 1f instead of pixels
again, not an opengl expert.

which brings me to my next point: using the spritebatch before of after rendering the video doesnt seem to work and you end up seeing nothing
obviously they conflict and it could have various reasons and depends on how the spritebatch works exactly...
people may wanna have a video in the background and draw something on top, so we gotta fix that somehow

So it only works like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
if (videoplayer != null)
{
   if(!videoplayer.isDone())
   {
      videoplayer.updateAndRender(false);
   }
   else
   {
      videoplayer.destroy();
      videoplayer = null;
   }
}
else
{
   spriteBatch.begin();
   
   font.setColor(Color.WHITE);
   font.draw(spriteBatch, "FPS: "+Gdx.graphics.getFramesPerSecond(), 12,  20);
   
   spriteBatch.end();
}


We are rendering a quad for the video and then want to being a spritebatch... so it could have something to do that we have to flush to GPU first before rendering something else
might only need a minor fix, imo

Offline nsigma
« Reply #34 - Posted 2013-01-21 12:04:55 »

There's not an issue in the original code, but in how you've (not completely!) translated it to work with libGDX.  I'm pretty sure the projection matrix is set correctly in LwjglRenderer, as it borrows the code for basic setup from YUNPM.  You need to rewrite the GStreamerPlayer.updateAndRender() method to update a libGDX Texture instead, and then you can draw that the same as any other texture in your game.

Remember this was written as a proof-of-concept that can be adapted for other uses.  GStreamerPlayer is not reusable as-is - it needs rewriting to suit whatever context you want to use the movie in.  To make this more generic, that updateAndRender() method should be stripped out, and instead responsibility for rendering needs to be in the renderer and the GStreamerPlayer class should just call back into the renderer with the updated texture buffer.

Perhaps
GStreamerPlayer.update(Renderer renderer);
which updates the buffer as required and calls back into renderer -
Renderer.updateMovie(Buffer buffer, boolean isNewFrame, int width, int height);
?  That's a quick and untried thought - not to be considered the definitive way to do it!  Wink

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline Cero
« Reply #35 - Posted 2013-01-21 14:27:19 »

to update a libGDX Texture instead, and then you can draw that the same as any other texture in your game.

Of course I know that. That would be the absolute best way.
I just haven't tried it yet because I'm quite sure that because of my lacking knowledge I would do something that would slow everything down tremendously in the process.
There are pixmap and TextureData in libgdx, but I'm not really sure how to do this effectively Tongue

Even if there was something like new Texture(buffer) which I dont think there is, I would still doubt performance

Offline nsigma
« Reply #36 - Posted 2013-01-21 15:01:57 »

There are pixmap and TextureData in libgdx, but I'm not really sure how to do this effectively Tongue

Even if there was something like new Texture(buffer) which I dont think there is, I would still doubt performance

You should be able to create an empty Texture (constructor with width, height, format?) and then update the texture using GLCommon.glTexSubImage() in the same / similar way.  I'm doing something similar in the Praxis OpenGL pipeline, though I'd forgotten how much that code has now diverged from what's in libGDX.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline Cero
« Reply #37 - Posted 2013-02-17 01:44:58 »

Actually I was just one line missing - texture binding, it now works fine with libgdx. Not as a libgdx texture but everything someone needs to play cutscenes. With the ability to render something above it.
Almost finished a nice showcase.

Here is another thought:
I have actually never used the 64bit libs. Reason is, although my machine is 64bit I use a 32bit JRE. I also package a 32bit private jre with my games because it works on both architectures.
Meaning I personally would never need those 64bit libs.

Offline Cero
« Reply #38 - Posted 2013-02-17 18:37:55 »

because I dont have a mac I could never test the Mac, but I'm kinda optimistic there, should work as expected

Now, I tested Linux yesterday. So first of all yes, most distributions and especially all the popular modern distributions come with GStreamer. Linux Mint and Ubuntu being prime targets.
So if its installed it works flawlessly.
I seem to have gathered all the libs for Linux32 and 64 - but it just didn't seem to work. I removed gstreamer from my distro and tried to load from my libs.
But I kept getting strange errors with "cannot load gstbasevideo" for example; "cannot find file" although it shows me a path which is absolutely valid and the file does exist

Maybe it can be fixed, but the bottom line is Linux distros usually have it, a linux port of a game mine would usually anyway have a disclaimer like "works on linux, but no official support, ubuntu and mint distros recommended" so I would just add "gstreamer needs to be installed", of course if I create on of these actual .deb packages you can actually define dependencies like gstreamer of course.

Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (18 views)
2014-04-15 18:08:23

BurntPizza (15 views)
2014-04-15 03:46:01

UprightPath (28 views)
2014-04-14 17:39:50

UprightPath (13 views)
2014-04-14 17:35:47

Porlus (29 views)
2014-04-14 15:48:38

tom_mai78101 (54 views)
2014-04-10 04:04:31

BurntPizza (111 views)
2014-04-08 23:06:04

tom_mai78101 (212 views)
2014-04-05 13:34:39

trollwarrior1 (181 views)
2014-04-04 12:06:45

CJLetsGame (187 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!