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:
parent
edc46f9ced
commit
6e47ec49df
|
@ -27,6 +27,7 @@ class Audio
|
|||
/* Control functions */
|
||||
void play();
|
||||
void pause();
|
||||
void seek();
|
||||
};
|
||||
|
||||
void audio_init(int, char **);
|
||||
|
|
|
@ -16,6 +16,8 @@ class Libsaria
|
|||
/* Control functions */
|
||||
void play();
|
||||
void pause();
|
||||
void stop();
|
||||
void seek();
|
||||
};
|
||||
|
||||
class Libsaria *libsaria_get();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -11,3 +11,14 @@ void Libsaria::pause()
|
|||
{
|
||||
audio.pause();
|
||||
}
|
||||
|
||||
void Libsaria::stop()
|
||||
{
|
||||
pause();
|
||||
seek();
|
||||
}
|
||||
|
||||
void Libsaria::seek()
|
||||
{
|
||||
audio.seek();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue