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

Playback execution function implementation. More...

#include "player.h"
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "tinyfseq.h"
#include "tinylor.h"
#include "audio.h"
#include "cell.h"
#include "crmap.h"
#include "fseq/seq.h"
#include "pump.h"
#include "putil.h"
#include "queue.h"
#include "serial.h"
#include "sleep.h"
#include "std2/errcode.h"
#include "std2/fc.h"
Include dependency graph for player.c:

Data Structures

struct  player_rtd_s
 Player runtime data structure. More...
 

Functions

static void Player_free (struct player_rtd_s *rtd)
 Frees dynamic allocated structures referenced by the player runtime data. rtd itself is not freed by this function.
 
static int Player_init (struct FC *fc, struct cr_s *cmap, struct player_rtd_s *rtd)
 Populates the player runtime data with dynamically allocated structures before initializing each subsystem.
 
static void Player_log (struct player_rtd_s *rtd)
 Prints a log message summarizing the player's current state.
 
static int Player_writeFrame (struct player_rtd_s *rtd, struct serialdev_s *sdev)
 Increments the current frame index and writes the minified frame data to the serial output. This function drives the core functionality of the player.
 
static int Player_loop (struct player_rtd_s *rtd, struct serialdev_s *sdev)
 Main loop of the player that drives the playback of the sequence. This function will block until the sequence is complete, writing frame data to the serial output and logging the player's current state. A heartbeat message is sent every ~500ms to ensure the connection is maintained.
 
int Player_exec (struct qentry_s *req, struct serialdev_s *sdev)
 Initializes and starts playback of the given playback configuration. Execution will block until the sequence is complete, including audio playback; unless an error occurs. The caller is responsible for freeing the resources provided in the playback request.
 

Detailed Description

Playback execution function implementation.

Function Documentation

◆ Player_exec()

int Player_exec ( struct qentry_s * req,
struct serialdev_s * sdev )

Initializes and starts playback of the given playback configuration. Execution will block until the sequence is complete, including audio playback; unless an error occurs. The caller is responsible for freeing the resources provided in the playback request.

Parameters
reqplay request to execute
sdevserial device to use for playback
Returns
0 on success, a negative error code on failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Player_free()

static void Player_free ( struct player_rtd_s * rtd)
static

Frees dynamic allocated structures referenced by the player runtime data. rtd itself is not freed by this function.

Parameters
rtdplayer runtime data to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Player_init()

static int Player_init ( struct FC * fc,
struct cr_s * cmap,
struct player_rtd_s * rtd )
static

Populates the player runtime data with dynamically allocated structures before initializing each subsystem.

Parameters
fcsequence file controller to read from
cmapchannel map to use for index lookups
rtdplayer runtime data to populate
Returns
0 on success, a negative error code on failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Player_log()

static void Player_log ( struct player_rtd_s * rtd)
static

Prints a log message summarizing the player's current state.

Parameters
rtdplayer runtime data to log
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Player_loop()

static int Player_loop ( struct player_rtd_s * rtd,
struct serialdev_s * sdev )
static

Main loop of the player that drives the playback of the sequence. This function will block until the sequence is complete, writing frame data to the serial output and logging the player's current state. A heartbeat message is sent every ~500ms to ensure the connection is maintained.

Parameters
rtdinitialized player runtime data
sdevserial device to write frame data to
Returns
0 on success, a negative error code on failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Player_writeFrame()

static int Player_writeFrame ( struct player_rtd_s * rtd,
struct serialdev_s * sdev )
static

Increments the current frame index and writes the minified frame data to the serial output. This function drives the core functionality of the player.

Parameters
rtdplayer runtime data to write the next frame from
sdevserial device to write the frame data to
Returns
0 on success, a negative error code on failure
Here is the call graph for this function:
Here is the caller graph for this function: