GP2X Mplayer Library


nickspoon

vultum stultum habes
Joined
Nov 4, 2005
Messages
4,234
Age
31
Location
Essex, UK
Website
Visit site
libgpvid is a library based on the recently-released GPH MPlayer sourcecode. It can be included in any app compiled for the GP2X with the official SDK. It's currently very basic - you can play a video at default volume, no seeking or pausing. So, without further adieu, an example:

Code:
#include <stdio.h>
#include <gvlib_export.h>

int main(int argc, char* argv[]) {
	gp_play_video("test.avi");
	return 0;
}

This piece of code will simply play the video "test.avi" and then exit. Very simple, no? Doesn't get easier than this. Something to note, however, is that gp_play_video uses its own SDL_Init (won't work otherwise). So it's advisable to quit SDL if you're using it, then restart it again afterwards, like so:

Code:
...
SDL_Quit();
gp_play_video("test.avi");
SDL_Init(SDL_INIT_VIDEO etc...);

To link, you need quite a complex chain of libraries:
Code:
-lgpvid -lmpcodecs -lmpdemux -lgpvid -laf -lao2 -losdep -lfaad2  -lfbdisp -lSDL_image -lmad -lvorbisidec -lnsl -lSDL -lpthread  -ldl -lm  -lpng -lz -ljpeg -lunicodefont -lSDL_inifile

The above will link the code perfectly well - and yes, there are two -lgpvids, this solves a dependency problem.

Download libgpvid.zip

Unzip the above into your arm-gp2x-linux folder in your SDK.

I *request* that people using this library give proper credit and, if it is used commercially, I *request* a free copy. It's under GPL, so if you want source, request it.

Enjoy!
 
I'm surprised it uses SDL - I would have guessed they would render directly since they're already piping stuff around to the decoder with the 940 (I think?)

Edit: Maybe SDL is just for sound / buttons...
 
nickspoon posted on Jul 13 2006 at 10:12 PM said:
Here I'm going to go with a Squidge license - give proper credit and a free copy to me if you use this.
No, the library is under the GPL. You can request that those conditions are met but you can't require them :) Using this library will also bring any code linked to it under the GPL too (which is exactly why I don't like the GPL - I think their ideas about linking are completely wrong).
 
Last edited by a moderator:
Is there an option for not using SDL? As in, we give it a buffer to render into? That is also a huge list of libraries to link to. How big is the simplest application?
 
Orkie posted on Jul 14 2006 at 11:09 AM said:
nickspoon posted on Jul 13 2006 at 10:12 PM said:
Here I'm going to go with a Squidge license - give proper credit and a free copy to me if you use this.
No, the library is under the GPL. You can request that those conditions are met but you can't require them :) Using this library will also bring any code linked to it under the GPL too (which is exactly why I don't like the GPL - I think their ideas about linking are completely wrong).
I've not read the GPL, so I'm unfamiliar with its terms. I'm assuming if I distribute it as a shared library, programs using it are not required to release source? I'll do a shared lib later today, so you nice people don't have to give away your source.

I *request* that people using this library give proper credit and, if it is used commercially, I *request* a free copy.

Bloody GPL.

slygamer posted on Jul 14 2006 at 11:25 AM said:
Is there an option for not using SDL? As in, we give it a buffer to render into? That is also a huge list of libraries to link to. How big is the simplest application?
The libraries are for audio output and decoding, mainly. SDL is required for some reason I can't figure out, but in order for it to work it has to SDL_Init within the library. You don't have to use SDL in your app, as long as you link with it it'll work fine. It takes over the framebuffer whilst it's running, and releases it when it's done - so it's pretty much stand-alone.
 
Last edited by a moderator:
Orkie posted on Jul 14 2006 at 01:09 PM said:
nickspoon posted on Jul 13 2006 at 10:12 PM said:
Here I'm going to go with a Squidge license - give proper credit and a free copy to me if you use this.
No, the library is under the GPL. You can request that those conditions are met but you can't require them :) Using this library will also bring any code linked to it under the GPL too (which is exactly why I don't like the GPL - I think their ideas about linking are completely wrong).
I do want to start yet-another-gpl-flamewar, but this is only wrong if you don't get that it's done purposely. People putting code under the GPL really want to force you to put yours under the same license if you use it (or else they don't understand what they do). Or else, why the people behind the GPL would have created the LGPL.

nickspoon posted on Jul 14 2006 at 02:12 PM said:
I've not read the GPL, so I'm unfamiliar with its terms. I'm assuming if I distribute it as a shared library, programs using it are not required to release source? I'll do a shared lib later today, so you nice people don't have to give away your source.
Nop, you can't. From http://www.gnu.org/licenses/lgpl.html :
When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
 
Last edited by a moderator:
mongolito404 posted on Jul 14 2006 at 01:35 PM said:
nickspoon posted on Jul 14 2006 at 02:12 PM said:
I've not read the GPL, so I'm unfamiliar with its terms. I'm assuming if I distribute it as a shared library, programs using it are not required to release source? I'll do a shared lib later today, so you nice people don't have to give away your source.
Nop, you can't. From http://www.gnu.org/licenses/lgpl.html :
When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
Well fine then. Using this, you'll have to give out source to your app on request, but you have to do that anyway if you're using SDL.

I won't bother with the shared library then ;)

This is turning out to be more hassle than I thought it would. Bloody GPL.
 
Last edited by a moderator:
mongolito404 posted on Jul 14 2006 at 02:26 PM said:
nickspoon posted on Jul 14 2006 at 04:03 PM said:
Well fine then. Using this, you'll have to give out source to your app on request, but you have to do that anyway if you're using SDL.
Again, no. SDL is licensed under the LGPL. See the SDL licensing FAQ.
Oh yay. More licensing. Happy, happy, happy.

Right. Fine. I will make this clear. Anything released using this library is under the GPL.

*waits for somebody to find a problem with that, too*
 
Last edited by a moderator:
I'm thinking if all this allows is video playback in a standalone mode, wouldn't a separate executable be a better way to go? Seems kinda silly to have it linked in the main program if it can't really be used at the same time as other stuff anyway.
 
BradN posted on Jul 14 2006 at 07:19 PM said:
I'm thinking if all this allows is video playback in a standalone mode, wouldn't a separate executable be a better way to go? Seems kinda silly to have it linked in the main program if it can't really be used at the same time as other stuff anyway.

Sounds reasonable, adding command line support to the existing player may be better, and comes with the added advantages in that the additional memory is only used whilst the video is playing, and the licensing model becomes a "don't care".

This way does allow a single executable however, which may help tidyness; but then again, you'll be needing your movie files seperate anyway, so I don't see the problem with having an additional executable.
 
Last edited by a moderator:
Back
Top