libsaria: Add progress file

This will include code for seeking and getting the current position in
the song.  Right now I just have a function for resetting the position
to the beginning of the song.
This commit is contained in:
Bryan Schumaker 2011-09-03 21:55:42 -04:00
parent 937fbc1111
commit 4b3b1babbc
5 changed files with 39 additions and 18 deletions

View File

@ -0,0 +1,3 @@
void libsaria_seek();

View File

@ -24,16 +24,3 @@ bool Audio::pause()
{
return change_state(GST_STATE_PAUSED);
}
/*
* Right now I just seek to the beginning of the song.
* Eventually I should allow the user to seek anywhere.
*/
void Audio::seek()
{
gst_element_seek_simple(GST_ELEMENT(player),
GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH,
// Convert seconds to nano-seconds
0 * GST_SECOND);
}

View File

@ -0,0 +1,15 @@
#include <libsaria/audio.h>
/*
* Right now I just seek to the beginning of the song.
* Eventually I should allow the user to seek anywhere.
*/
void Audio::seek()
{
gst_element_seek_simple(GST_ELEMENT(player),
GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH,
// Convert seconds to nano-seconds
0 * GST_SECOND);
}

View File

@ -24,11 +24,6 @@ void Libsaria::stop()
seek();
}
void Libsaria::seek()
{
audio.seek();
}
/*
* Convenience functions for accessing libsaria class functions
*/

21
libsaria/progress.cpp Normal file
View File

@ -0,0 +1,21 @@
#include <libsaria/libsaria.h>
/*
* Implementations of functions defined in the libsaria class
*/
void Libsaria::seek()
{
audio.seek();
}
/*
* Convenience functions for accessing libsaria class functions
*/
void libsaria_seek()
{
libsaria_get()->seek();
}