fplayer
C99 Falcon Sequence (fseq) file player for Light-O-Rama hardware (like xLights)
Loading...
Searching...
No Matches
queue.c File Reference

Playback queue implementation. More...

#include "queue.h"
#include <assert.h>
#include <stdlib.h>
#include "std2/errcode.h"
Include dependency graph for queue.c:

Data Structures

struct  q_s
 Queue structure for managing playback requests. More...
 

Functions

int Q_init (struct q_s **q)
 Allocates and initializes a new queue instance.
 
int Q_append (struct q_s *q, struct qentry_s ent)
 Appends a new entry to the end of the queue.
 
int Q_next (struct q_s *q, struct qentry_s *ent)
 Gets the next entry from the queue and removes it from the queue.
 
void Q_free (struct q_s *q)
 Frees the memory allocated for the queue instance and all of its remaining entries.
 

Detailed Description

Playback queue implementation.

Function Documentation

◆ Q_append()

int Q_append ( struct q_s * q,
struct qentry_s ent )

Appends a new entry to the end of the queue.

Parameters
qqueue instance to add the entry to
ententry to add to the queue, string pointers are copied but not the strings themselves, the caller is responsible for managing the memory of the strings to ensure they are valid for the lifetime of the queue
Returns
0 on success, a negative error code on failure
Here is the caller graph for this function:

◆ Q_free()

void Q_free ( struct q_s * q)

Frees the memory allocated for the queue instance and all of its remaining entries.

Here is the caller graph for this function:

◆ Q_init()

int Q_init ( struct q_s ** q)

Allocates and initializes a new queue instance.

Parameters
qreturn pointer to the new queue instance
Returns
0 on success, a negative error code on failure
Here is the caller graph for this function:

◆ Q_next()

int Q_next ( struct q_s * q,
struct qentry_s * ent )

Gets the next entry from the queue and removes it from the queue.

Parameters
qqueue instance to get the next entry from
entreturn pointer to the next entry
Returns
1 on success, 0 if the queue is empty
Here is the caller graph for this function: