Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
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 9679 times)
0 Members and 1 Guest are viewing this topic.
Offline nsigma
« Posted 2012-08-20 17:46:48 »

You wait for ages, and then two turn up at once ...  Grin

Finally got a few hours today to tidy up the GStreamer code I mentioned in Riven's YUNPM thread.  Unlike Cero's earlier post, this has no Slick dependencies, and I've tidied up the way the preloader for native libs works, and added in a method to parse the video size before constructing the output window.  As Cero had carefully tested this on lots of other systems, I hope I haven't broken anything!   Wink

You may ask, why post / write an alternative to YUNPM?  Well, mainly because 95% of this code already existed!   Wink  I also believe that GStreamer is a better option because it works 'in-process', handles all issues of sync itself (and better IMO), gives far more control and input possibilities if needed, and the actual code required to make this work is minimal in comparison.

GstLwjgl ships with embedded GStreamer libs for Win32 and Win64, meaning no system install of GStreamer is required.  It's possible to do this for OSX too, but I need someone willing to test.  It depends on the system libs on Linux, because I think this is the best approach, but embedding libs is also a possibility there.

The library pre-loading code is adapted from Processing, and it uses the native libs from their repo.  Despite the license notice on their repo, these include some GPL plugins.  It is possible to delete these plugins (as Cero has done) without recompiling anything, unlike the FFMPEG binary currently in YUNPM which is GPL and must be recompiled.  I'm also going to look at getting it working with binaries from GStreamer.com which are all LGPL.
 
The lib is provided as a Zip file, with the same example movie as YUNPM for comparison.  It responds to the same basic pause / resume / mute commands.  It's a bit higher on CPU usage at the moment, as I haven't ported over any of the texture upload optimisations, and there are also some optimisations possible in the way the video buffers are handled.  These can and will be improved over the next few weeks - I need them if nothing else!  Smiley

For want of a better place to put this for now, it's up on Google Drive - https://docs.google.com/open?id=0B_q5nI7hdd_3NHk0TVBBcHBmSW8




Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #1 - Posted 2012-08-20 18:12:33 »

get the following and nothing happens when trying the gst-lwjgl.sh script
bt_audio_service_open: connect() failed: Connection refused (111)

I have no idea what that means. I am on slackware 64 and everything here works pretty well (youtube, mplayer etc) and sound seems to work with everything else.

I have no special talents. I am only passionately curious.--Albert Einstein
Offline nsigma
« Reply #2 - Posted 2012-08-20 19:40:01 »

@delt0r - this was mainly put together to demonstrate library bundling works fine on Windows, which is where most people have had issues. It could be done on Linux with little effort, but at the moment if you don't have a working system GStreamer then no it won't play. This works fine on Ubuntu / Mint ootb.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #3 - Posted 2012-08-20 20:10:44 »

Why would you assume there is something wrong with my gstreamer instillation? It works fine from the command line.

Quote
Quote
Quote from: delt0r on 2 hours ago
As for "another solution". Yes it is. But dammit, a simple to play to texture or something is just not out there.
Er, that's exactly what that code is, as is Riven's FFMPEG code and as I believe Cero has for VLCJ too (though that's reliant on a GPL library). There's not been a shortage of code flying around this forum over the last few months that does this.  It's just been a little hidden away!

As i said before... Code that works. Gstreamer in my experience is always like this. One thing works.. another doesn't something else crashs. Works on machine A, but machine B has not sound...etc

I have no special talents. I am only passionately curious.--Albert Einstein
Offline nsigma
« Reply #4 - Posted 2012-08-20 21:46:18 »

@delt0r - because your default audio device seems to be misconfigured. Or it could be a missing codec throwing it I suppose. It's an argument in favour of lib bundling on Linux too (as Cero proposes). I've never had issues on Linux in years of use and a variety of distros / hardware - maybe just lucky! Smiley

Windows on the other hand has been problematic, hence doing lib bundling. The idea of tidying this code up a bit was to demonstrate that it's a valid Windows solution. Issues there I'd be more bothered about.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline Cero
« Reply #5 - Posted 2012-08-20 22:07:26 »

Why would you assume there is something wrong with my gstreamer instillation? It works fine from the command line.
Aha ! Definitely need to ship working linux libs...

@delt0r - because your default audio device seems to be misconfigured. Or it could be a missing codec throwing it I suppose. It's an argument in favour of lib bundling on Linux too (as Cero proposes)
Yea, you basically have to do everything to maximize your chances.

As i said before... Code that works. Gstreamer in my experience is always like this. One thing works.. another doesn't something else crashs. Works on machine A, but machine B has not sound...etc
Just makes no sense, no matter what process is using it, it should behave the same.
And it will.


@GstLwjgl in general: Mainly because you have to build FFMPEG yourself without those codecs, for now I will definitely be more interested in GST. Would be a damn shame to ship a game and get a lawsuit.

Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #6 - Posted 2012-08-20 22:11:12 »

from the command line i can play music files fine from gstreamer. So my sound is configured fine.

I have no special talents. I am only passionately curious.--Albert Einstein
Offline Cero
« Reply #7 - Posted 2012-08-20 22:17:16 »

from the command line i can play music files fine from gstreamer. So my sound is configured fine.

then thats wasnt the problem
the codec thing of course could still be... just "music" doesnt say much
a normal installation of gst should include all

but yeah this is really a part where we would sacrifice control and it would be out of our hands - so bundling mac and linux libs will come

Offline nsigma
« Reply #8 - Posted 2012-08-21 09:37:41 »

from the command line i can play music files fine from gstreamer. So my sound is configured fine.

That's not really a good argument to say that it's all set up correctly!  For a start does this actually work for you (using whatever your normal gst-launch command is)?

1  
gst-launch-0.10 -v playbin2 uri=file:///path/to/sample_h264.mp4 


It could easily be a codec issue - h264 could very well not be installed, and it's a terrible choice here really for many reasons, including it brings in GPL code.  Maybe try a different type of video. 

The error message you gave suggests your default GStreamer audio sink is set to a bluetooth device? (maybe check with gstreamer-properties)  My current code is using the system default GStreamer audio sink.  It would be simple enough to specify an alternative on failure, or even bring in the audio and play through OpenAL, JavaSound or whatever. 

@Cero - If you're using theora I don't think it's possible to have GStreamer without it (it's in the base), therefore lack of ability to play h264 isn't necessarily a reason to bundle on Linux.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline Cero
« Reply #9 - Posted 2012-08-21 10:45:41 »

@Cero - If you're using theora I don't think it's possible to have GStreamer without it (it's in the base), therefore lack of ability to play h264 isn't necessarily a reason to bundle on Linux.
My point is, if you rely on it being installed and properly - thats a risk.
And well if you sell something on Linux that uses gst, I really would want to include it.

or even bring in the audio and play through OpenAL
OpenAL is cool of course; but if this MAY cause sync issues than something like that should be avoided

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 835
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #10 - Posted 2012-08-21 11:02:12 »

Please do not disregard the opensource license I put in YUNPM.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 835
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #11 - Posted 2012-08-21 12:58:14 »

You copied large sections of my code, removed my license, replaced it with yours and claimed copyright.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline nsigma
« Reply #12 - Posted 2012-08-21 14:58:53 »

You copied large sections of my code, removed my license, replaced it with yours and claimed copyright.

Sorry, my bad, that wasn't intentional - the LwjglRenderer class should have Riven's name / licence on it too.  As a quick proof of concept I wanted to make sure that it was using the same LWJGL setup as you (you did suggest I write a GStreamer backend originally, but unfortunately your API isn't particularly built for that).  It's not exactly the important part of the code here though, and is fairly standard LWJGL setup, no?  The actual movie player and pre-loader code doesn't include anything from YUNPM - that all pre-existed. My standard LGPL header was added at the last minute to make sure everyone knows the code ported from Processing is licensed that way.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 835
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #13 - Posted 2012-08-21 15:08:25 »

My code is in GStreamerPlayer.java and LwjglRenderer.java

Whether you think it's trivial doesn't matter, you copied and altered it, which means it's a derivative work.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline nsigma
« Reply #14 - Posted 2012-08-21 15:23:33 »

My code is in GStreamerPlayer.java and LwjglRenderer.java

There is nothing in GStreamerPlayer that is copied from YUNPM.

Whether you think it's trivial doesn't matter, you copied and altered it, which means it's attributed work.

I'm well aware of that and apologized for it.  I'll put another source bundle up with the correct attributions when I get a chance.  As I said, it was meant as a proof-of-concept and addition to the debate, nothing more nothing less.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline Cero
« Reply #15 - Posted 2012-08-21 15:25:46 »

My code is in GStreamerPlayer.java and LwjglRenderer.java

There is nothing in GStreamerPlayer that is copied from YUNPM.

I was looking for it too.

The only differences in the player I wrote and the new one are
1  
synchronized (lock)
and the dirty boolean

Offline nsigma
« Reply #16 - Posted 2012-08-21 15:42:53 »

The only differences in the player I wrote and the new one ...

Yes, your name needs to be on there - another omission I'm aware of.  Never do anything in a rush! Wink

The other new code is around the preroll() and dimensions methods, to fix the issue you'd asked me about.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline davedes
« Reply #17 - Posted 2012-08-21 15:56:27 »

How would a Mac user go about setting this up? Do I need to build gstreamer from source? Clueless

Offline nsigma
« Reply #18 - Posted 2012-08-21 16:09:03 »

How would a Mac user go about setting this up? Do I need to build gstreamer from source? Clueless

No.  From the Processing repo at http://code.google.com/p/processing or I can send you them.  The library preloader code will need tweaking slightly to work with them though - hopefully just a case of taking out the check for Windows and pointing it at the right directory.

You could also try a system install of GStreamer from here - http://docs.gstreamer.com/display/GstSDK/Installing+on+Mac+OS+X - but then you miss the benefits of bundling.  Be interested to know if it actually works, mind!  Wink

I do plan on extracting the binaries from GStreamer.com and making whatever changes are needed to get the preloader to work with them.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline Cero
« Reply #19 - Posted 2012-08-21 17:19:50 »

The library preloader code will need tweaking slightly to work with them though - hopefully just a case of taking out the check for Windows and pointing it at the right directory.

Yeah and it should work the same with linux gst binaries, same unix structure and all

Does the linux version of processing bundle the gst binaries ? Cant find them with a quick look.
(As a matter of fact, there is QTJava in "processing-1.5.1\modes\java\libraries\video\" the old quicktime thingy)

My idea would be to just burn a distro, which definitely doesnt have gst, boot from it and then try...

Offline Cero
« Reply #20 - Posted 2012-08-21 17:28:32 »

hm even the windows version has no gstreamer stuff here

Offline Cero
« Reply #21 - Posted 2012-08-21 17:33:29 »

ah my bad, sorta, the processing 2 pre releases have it; and lol the windows version also includes mac

EDIT: well, it seems ALL version have mac and windows but none linux, depending on system install I guess
anyway mac should be easy

http://code.google.com/p/processing/downloads/list
"processing-2.0a8\modes\java\libraries\video\library\"

Offline nsigma
« Reply #22 - Posted 2012-08-21 17:38:09 »

ah my bad, sorta, the processing 2 pre releases have it; and lol the windows version also includes mac

I just spent 10 minutes trying to find that out for you!  Tongue

For anyone else, just download any of the pre-releases and the natives should be in /modes/java/libraries/video/library/ or do as I did and do an svn checkout on the libraries section of the repo.

and lol the windows version also includes mac

So that you can export a Processing app that works on all systems.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline Cero
« Reply #23 - Posted 2012-08-21 18:44:25 »

and lol the windows version also includes mac

So that you can export a Processing app that works on all systems.

Ah yes I forgot

Offline Cero
« Reply #24 - Posted 2012-08-21 23:30:43 »

So these changes should make macosx possible: https://dl.dropbox.com/u/52666052/GStreamerLibrary.java

Get the macosx gst libs:
https://docs.google.com/file/d/0B9Nkz0-YWCIDcHRHMVQxTVhKMEU/edit
Just File -> Download to download the whole zip (using google drive for the first time :D)
and put the 2 folders where the windows libs are of course

Offline nsigma
« Reply #25 - Posted 2012-08-22 08:57:26 »

So these changes should make macosx possible: https://dl.dropbox.com/u/52666052/GStreamerLibrary.java

Not quite!  You'll want to change

1  
2  
3  
4  
if (!Platform.isWindows()) {
            Gst.init("GStreamer core video", new String[]{});
            return;
}


to

1  
2  
3  
4  
if (!Platform.isWindows() && !Platform.isMac()) {
            Gst.init("GStreamer core video", new String[]{});
            return;
}


or it'll never get to the code you've added.  That's there to ensure the system GStreamer is inited on Linux - can be removed if we bundle Linux libs too.

No need to add the isWindows(), etc. methods in to this file - system checking is already available through the static methods in Platform.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline gouessej
« Reply #26 - Posted 2012-08-22 20:31:59 »

Whether you think it's trivial doesn't matter, you copied and altered it, which means it's a derivative work.
When someone did something similar with my source code several years ago, some people replied here that the code snippet was trivial and that I should not complain, etc...

Offline Cero
« Reply #27 - Posted 2012-08-22 21:37:11 »

So these changes should make macosx possible: https://dl.dropbox.com/u/52666052/GStreamerLibrary.java

Not quite!  You'll want to change

1  
2  
3  
4  
if (!Platform.isWindows()) {
            Gst.init("GStreamer core video", new String[]{});
            return;
}


to

1  
2  
3  
4  
if (!Platform.isWindows() && !Platform.isMac()) {
            Gst.init("GStreamer core video", new String[]{});
            return;
}


or it'll never get to the code you've added.  That's there to ensure the system GStreamer is inited on Linux - can be removed if we bundle Linux libs too.

No need to add the isWindows(), etc. methods in to this file - system checking is already available through the static methods in Platform.


ah yes. with that I'm positive mac will work without problems.
now about linux... how do we get those binaries... ?

Offline nsigma
« Reply #28 - Posted 2012-08-23 11:45:08 »

Whether you think it's trivial doesn't matter, you copied and altered it, which means it's a derivative work.
When someone did something similar with my source code several years ago, some people replied here that the code snippet was trivial and that I should not complain, etc...

I never claimed it was trivial, and the source has been updated with the relevant notices and I've already apologised for the error.  It was an honest mistake not to include Riven's name - the LWJGL setup code was deliberately copied for point of comparison (Riven had originally suggested writing a comparison GStreamer backend for YUNPM, but that was not really practical given the differences between the stream-based and callback-based libs underneath).

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).

I've had lots of code appropriated too, a couple of times on here - I understand it's not a nice thing!  I can't comment in your specific case, not knowing what was used, but if others thought it was trivial it may have come under de minimis. (not suggesting this in regards to the above!)

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline gouessej
« Reply #29 - Posted 2012-08-23 19:47:03 »

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've had lots of code appropriated too, a couple of times on here - I understand it's not a nice thing!  I can't comment in your specific case, not knowing what was used, but if others thought it was trivial it may have come under de minimis. (not suggesting this in regards to the above!)
It was really extremely trivial but I didn't understand why a newbie was so afraid to have to use the GPL...

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.

trollwarrior1 (29 views)
2014-11-22 12:13:56

xFryIx (71 views)
2014-11-13 12:34:49

digdugdiggy (50 views)
2014-11-12 21:11:50

digdugdiggy (44 views)
2014-11-12 21:10:15

digdugdiggy (38 views)
2014-11-12 21:09:33

kovacsa (62 views)
2014-11-07 19:57:14

TehJavaDev (67 views)
2014-11-03 22:04:50

BurntPizza (64 views)
2014-11-03 18:54:52

moogie (80 views)
2014-11-03 06:22:04

CopyableCougar4 (80 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!