ocarina/include/core/queue.h

41 lines
1.1 KiB
C

/*
* Copyright 2013 (c) Anna Schumaker.
*
* Queues are lists of tracks that the user has requested to play next.
* Users of queues are expected to implement their own save and load functions,
* and to provide a filled out queue_ops structure during initialization.
*/
#ifndef OCARINA_CORE_QUEUE_H
#define OCARINA_CORE_QUEUE_H
#include <core/file.h>
#include <core/tags/track.h>
struct queue;
struct queue_ops {
/* Called to tell a higher layer that a queue has been initialized. */
void *(*qop_init)(struct queue *, void *);
/* Called to tell a higher layer that a queue is deinitializing. */
void (*qop_deinit)(struct queue *);
};
struct queue {
GQueue q_tracks; /* The queue's list of tracks. */
void *q_private; /* The queue's private data. */
const struct queue_ops *q_ops; /* The queue's operations vector. */
};
/* Called to initialize a queue. */
void queue_init(struct queue *, const struct queue_ops *, void *);
/* Called to deinitialize a queue. */
void queue_deinit(struct queue *);
#endif /* OCARINA_CORE_QUEUE_H */