audio: Add callbacks for changing pause status
When the count is changed or pausing finishes, I trigger this callback to notify the UI. I also added in a line to enable pausing any time the count is incremented. Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
c346a5860a
commit
1c99042efd
|
@ -13,6 +13,7 @@ struct Callbacks {
|
|||
void (*on_play)();
|
||||
void (*on_pause)();
|
||||
void (*on_track_loaded)(library :: Song &);
|
||||
void (*on_pause_count_changed)(bool, unsigned int);
|
||||
|
||||
/* Library callbacks */
|
||||
void (*on_library_add)(unsigned int, library :: Library *);
|
||||
|
|
|
@ -40,6 +40,7 @@ static void handle_pause_count()
|
|||
o_pause_enabled = false;
|
||||
} else
|
||||
o_pause_count--;
|
||||
get_callbacks()->on_pause_count_changed(o_pause_enabled, o_pause_count);
|
||||
}
|
||||
|
||||
static gboolean on_message(GstBus *bus, GstMessage *message, gpointer data)
|
||||
|
@ -224,8 +225,12 @@ long audio :: duration()
|
|||
|
||||
void audio :: pause_after(bool enabled, unsigned int n)
|
||||
{
|
||||
if (n > o_pause_count)
|
||||
enabled = true;
|
||||
|
||||
o_pause_enabled = enabled;
|
||||
o_pause_count = n;
|
||||
get_callbacks()->on_pause_count_changed(enabled, n);
|
||||
}
|
||||
|
||||
bool audio :: pause_enabled()
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
static void no_op() {}
|
||||
static void no_op(unsigned int) {}
|
||||
static void no_op(bool, unsigned int) {}
|
||||
static void no_op(unsigned int id, library :: Library *path) {}
|
||||
static void no_op(Playqueue *, unsigned int) {}
|
||||
static void no_op(library :: Song &) {}
|
||||
|
@ -15,6 +16,7 @@ static struct Callbacks callbacks = {
|
|||
.on_play = no_op,
|
||||
.on_pause = no_op,
|
||||
.on_track_loaded = no_op,
|
||||
.on_pause_count_changed = no_op,
|
||||
|
||||
.on_library_add = no_op,
|
||||
.on_library_update = no_op,
|
||||
|
|
Loading…
Reference in New Issue