libsaria: Added a stop function

I stop playback, and seek to the beginning.  I do this as to different
function calls in the Libsaria class so callbacks will still trigger
(once they have been implemented).
This commit is contained in:
Bryan Schumaker 2011-08-22 08:27:34 -04:00
parent edc46f9ced
commit 6e47ec49df
4 changed files with 27 additions and 0 deletions

View File

@ -27,6 +27,7 @@ class Audio
/* Control functions */
void play();
void pause();
void seek();
};
void audio_init(int, char **);

View File

@ -16,6 +16,8 @@ class Libsaria
/* Control functions */
void play();
void pause();
void stop();
void seek();
};
class Libsaria *libsaria_get();

View File

@ -15,3 +15,16 @@ void Audio::pause()
{
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

@ -11,3 +11,14 @@ void Libsaria::pause()
{
audio.pause();
}
void Libsaria::stop()
{
pause();
seek();
}
void Libsaria::seek()
{
audio.seek();
}