Media with Gstreamer

Discussions about the internal structures of the game. You can also post here if you'd like to know how things really work (and don't know how to read C code).

Media with Gstreamer

Postby GeoVah » Thu Nov 03, 2005 11:47 am

I've started to use gstreamer for bygfoot media API.
This API contains (now) those functions :

//start to init GStreamer
gint mediaPlayer_init();

//play a sound and return from function when sound is stop
gint mediaPlayer_playSoundToEnd(const gchar *path);


The implementation is on going, the configure.in script has been modified to check for GSTREAMER and add a #define into config.h

BUT nothing is working now :-s
-> compil problem


I've wanted to add three more functions :

//Start to play a sound (needthread :-s
gint mediaPlayer_playSoundAndComeBack(const gchar *path,gint * soundId);

//stop a sound which is playing
gint mediaPlayer_stopSound(gint soundId);

//Play a video. return when video is stop.
gint mediaPlayer_playVideo(const gchar * path);


PS : all this code is on my computer, with a copy/paste from GStream Developer doc.
Geovah - geovah@jabber.sk- (yes i'm french...)
GeoVah
 
Posts: 50
Joined: Sat Dec 18, 2004 10:38 am
Location: Sophia Antipolis - France

Postby gyboth » Thu Nov 03, 2005 11:54 am

what kind of error do you get? i mean, what exactly?

gyözö
Press any key to continue or any other key to quit.
gyboth
Site Admin
 
Posts: 1421
Joined: Sat Dec 18, 2004 8:42 am
Location: Passau, Germany

Postby gyboth » Thu Nov 03, 2005 12:00 pm

i'm not sure config.h is the right file to tinker with (i never edited it).
from the gstreamer docs:
gstreamer docs wrote:Initializing GStreamer

When writing a GStreamer application, you can simply include gst/gst.h to get access to the library functions. Besides that, you will also need to intialize the GStreamer library.


so, you should make files 'sound.c/h' and put
Code: Select all
#include <gst/gst.h>
into the h file. put it also into main.c and call
Code: Select all
gst_init (&argc, &argv);
somewhere in main() (after 'g_init' or so).

put all sound-related funcs into sound.c.

gyözö
Press any key to continue or any other key to quit.
gyboth
Site Admin
 
Posts: 1421
Joined: Sat Dec 18, 2004 8:42 am
Location: Passau, Germany

Postby GeoVah » Thu Nov 03, 2005 1:09 pm

gyboth wrote:i'm not sure config.h is the right file to tinker with (i never edited it).


I've not directly edit config.h but this file is modified to have a #define HAVE_GSTREAMER if gstreamer is detected on the current computer with a ./configure --enable-gstreamer
This is why i have modified the configure.in file

My .c file looks like :
Code: Select all
#ifdef HAVE_GSTREAMER
gint mediaPlayer_int(int argc,char * argv[]) {

}
#else
gint mediaPlayer_init(int argc,char *argv[]) {
  return 0;
}
#endif

So it's the media code who know if it sound is enable or not at COMPIL time :
the one who want to play sound always call mediaPlayer_playSound().


gyboth wrote:put all sound-related funcs into sound.c.
gyözö


My filename are mediaplayer.h and mediaplayer.c since i planned to support video.

in order to simplyfi the code, I started to only support Ogg/Vorbis audio file.
Geovah - geovah@jabber.sk- (yes i'm french...)
GeoVah
 
Posts: 50
Joined: Sat Dec 18, 2004 10:38 am
Location: Sophia Antipolis - France

Postby GeoVah » Thu Nov 03, 2005 1:13 pm

gyboth wrote:what kind of error do you get? i mean, what exactly?

gyözö


I don't have access to my computer because i'm at work but the probleme is a bad header : error in gst/gst.h :( , very strange.

If you want, as soon as the ./configure --enable-gstreamer works totaly and mediaPlayer.c works (a little), I can send U or commit the code to the CVS.
Geovah - geovah@jabber.sk- (yes i'm french...)
GeoVah
 
Posts: 50
Joined: Sat Dec 18, 2004 10:38 am
Location: Sophia Antipolis - France

Postby gyboth » Thu Nov 03, 2005 1:38 pm

GeoVah wrote:I've not directly edit config.h but this file is modified to have a #define HAVE_GSTREAMER if gstreamer is detected on the current computer with a ./configure --enable-gstreamer
This is why i have modified the configure.in file
ok, sounds like you know what you're doing.
the one who want to play sound always call mediaPlayer_playSound().
reasonable. may i ask you to make functions and variables lower-case and underscore-separated? that's the Bygfoot and GTK way of doing them, and it makes the code more consistent if you use it too. like this:
Code: Select all
mediaplayer_play_sound(const gchar *sound_file)
(note that almost all functions start with the filename they're in). and structs are like
Code: Select all
GeovahSoundStruct
ie. w/o underscores but capitalised.
gyboth wrote:put all sound-related funcs into sound.c.
gyözö


My filename are mediaplayer.h and mediaplayer.c since i planned to support video.
even better :-)

in order to simplyfi the code, I started to only support Ogg/Vorbis audio file.
i'd say we use ogg as the default format (the obvious choice for a GPL OSS). but maybe it's possible to create code that recognises the format, so that users can use their own mp3s and wavs, too, if they want.

GeoVah wrote:If you want, as soon as the ./configure --enable-gstreamer works totaly and mediaPlayer.c works (a little), I can send U or commit the code to the CVS.
send it to me first. and thanks for working on it, it's great that i don't have to do it ;-)

gyözö
Press any key to continue or any other key to quit.
gyboth
Site Admin
 
Posts: 1421
Joined: Sat Dec 18, 2004 8:42 am
Location: Passau, Germany

Postby vector » Fri Nov 04, 2005 11:13 pm

I think things are starting to bend towards oog. Im certainly doing my bit on this side of the world to Ogg everything:)
Im not sure exactly what you guys are up to but let me know if you need sound effects or music
"There are two ways to score. Dribble it over the line or smash it into the back of the net."
What type are you?
vector
 
Posts: 449
Joined: Sat Dec 18, 2004 11:26 pm
Location: Australia, Victoria

Postby gyboth » Sat Nov 05, 2005 8:29 pm

vector's really eager to have sounds it seems ;-)

i think we'll definitely be needing sounds (mainly for live game events, i guess), so keep your ears open and collect anything you think can be used.

gyözö
Press any key to continue or any other key to quit.
gyboth
Site Admin
 
Posts: 1421
Joined: Sat Dec 18, 2004 8:42 am
Location: Passau, Germany


Return to Code discussions

Who is online

Users browsing this forum: No registered users and 1 guest