2015-12-17 10:32:01 -05:00
|
|
|
/*
|
2013-12-24 20:17:44 -05:00
|
|
|
* Copyright 2013 (c) Anna Schumaker.
|
2015-12-24 13:05:20 -05:00
|
|
|
*
|
|
|
|
* The gst_init() function parses command line options passed to Ocarina
|
|
|
|
* through argv. Use the command `gst-inspect-1.0 --help-gst` to find
|
|
|
|
* what options are supported.
|
2013-12-24 20:17:44 -05:00
|
|
|
*/
|
2014-06-21 09:37:47 -04:00
|
|
|
#ifndef OCARINA_CORE_AUDIO_H
|
|
|
|
#define OCARINA_CORE_AUDIO_H
|
2014-12-02 08:16:22 -05:00
|
|
|
#include <core/tags/track.h>
|
2015-12-15 08:16:06 -05:00
|
|
|
#include <gst/gst.h>
|
2014-01-22 22:31:42 -05:00
|
|
|
|
2014-12-20 15:47:10 -05:00
|
|
|
|
2015-12-15 10:23:15 -05:00
|
|
|
struct audio_ops {
|
|
|
|
/* Called when a track is loaded. */
|
2015-12-18 08:09:34 -05:00
|
|
|
void (*on_load)(struct track *);
|
|
|
|
|
|
|
|
/* Called when playback state changes. */
|
|
|
|
void (*on_state_change)(GstState);
|
2015-12-16 12:50:14 -05:00
|
|
|
|
|
|
|
/* Called when the automatic pause state changes. */
|
|
|
|
void (*on_config_pause)(int);
|
2015-12-15 10:23:15 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-12-15 08:16:06 -05:00
|
|
|
/* Called to initialize the audio manager. */
|
2015-12-15 10:23:15 -05:00
|
|
|
void audio_init(int *, char ***, struct audio_ops *);
|
2015-12-15 08:16:06 -05:00
|
|
|
|
2015-12-15 10:46:48 -05:00
|
|
|
/* Called to deinitialize the audio manager. */
|
|
|
|
void audio_deinit();
|
|
|
|
|
2016-08-12 16:16:02 -04:00
|
|
|
/* Called to force-save the current track. */
|
|
|
|
void audio_save();
|
|
|
|
|
2015-12-15 08:16:06 -05:00
|
|
|
|
2015-12-15 10:23:15 -05:00
|
|
|
/* Called to load a track for playback. */
|
|
|
|
bool audio_load(struct track *);
|
|
|
|
|
2015-12-16 08:26:49 -05:00
|
|
|
/* Called to get the current track. */
|
|
|
|
struct track *audio_cur_track();
|
|
|
|
|
2015-12-16 09:18:01 -05:00
|
|
|
/* Called to get the current playback state. */
|
|
|
|
GstState audio_cur_state();
|
|
|
|
|
2015-12-16 08:26:49 -05:00
|
|
|
|
2016-08-18 09:18:13 -04:00
|
|
|
/* Called to set the playback volume. */
|
|
|
|
void audio_set_volume(unsigned int);
|
|
|
|
|
|
|
|
/* Called to get the playback volume. */
|
|
|
|
unsigned int audio_get_volume();
|
|
|
|
|
|
|
|
|
2015-12-15 14:17:17 -05:00
|
|
|
/* Called to begin playback. */
|
|
|
|
bool audio_play();
|
|
|
|
|
2015-12-15 14:34:13 -05:00
|
|
|
/* Called to pause playback. */
|
|
|
|
bool audio_pause();
|
|
|
|
|
2015-12-15 15:50:02 -05:00
|
|
|
/* Called to seek playback to a specific offset, in nanoseconds. */
|
|
|
|
bool audio_seek(gint64);
|
|
|
|
|
2015-12-15 16:42:49 -05:00
|
|
|
/* Called to find the current playback position, in nanoseconds. */
|
|
|
|
gint64 audio_position();
|
|
|
|
|
2015-12-16 08:00:19 -05:00
|
|
|
/* Called to find the duration of the current track. */
|
|
|
|
gint64 audio_duration();
|
|
|
|
|
2015-12-16 11:23:18 -05:00
|
|
|
|
|
|
|
/* Called to load the next track. */
|
|
|
|
struct track *audio_next();
|
|
|
|
|
2015-12-16 12:21:59 -05:00
|
|
|
/* Called to load the previous track. */
|
|
|
|
struct track *audio_prev();
|
|
|
|
|
2015-12-16 15:27:23 -05:00
|
|
|
/* Called when playback has reached the end-of-stream position. */
|
|
|
|
struct track *audio_eos();
|
|
|
|
|
2015-12-17 09:17:25 -05:00
|
|
|
/* Called when gstreamer has received an error. */
|
|
|
|
void audio_error(GstMessage *);
|
|
|
|
|
2015-12-16 12:50:14 -05:00
|
|
|
/* Called to configure automatic pausing. */
|
|
|
|
void audio_pause_after(int);
|
|
|
|
|
2015-12-18 07:52:48 -05:00
|
|
|
#ifdef CONFIG_TESTING
|
|
|
|
GstElement *test_audio_player();
|
|
|
|
#endif /* CONFIG_TESTING */
|
2014-06-21 09:37:47 -04:00
|
|
|
#endif /* OCARINA_CORE_AUDIO_H */
|