fplayer
C99 Falcon Sequence (fseq) file player for Light-O-Rama hardware (like xLights)
|
Frame data loading implementation. More...
#include "pump.h"
#include <assert.h>
#include <pthread.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tinyfseq.h"
#include "fseq/comblock.h"
#include "fseq/fd.h"
#include "std2/errcode.h"
#include "std2/fc.h"
Data Structures | |
struct | frame_pump_s |
Frame pump state controller for loading/tracking frame data. More... | |
Functions | |
int | FP_init (struct FC *fc, const struct tf_header_t *seq, struct frame_pump_s **pump) |
Initializes a frame pump with the provided file controller. The pump will read frames from the file controller and store them in an internal buffer for playback. The pump will also preload the next frame set asynchronously in a separate thread to ensure smooth playback. The caller is responsible for freeing the pump with FP_free . | |
static int | FP_readSeq (struct FC *fc, const struct tf_header_t *seq, const uint32_t frame, struct fd_list_s *list) |
Reads the next frame set from the file controller and stores it in the provided frame data node pointer. This function is used when the sequence is not compressed and read sequentially from the file controller. | |
static int | FP_read (struct frame_pump_s *pump, struct fd_list_s *list) |
Reads the next frame set from the file controller and stores it in the provided frame data node pointer. The pump should have its pos union updated with read request position information before calling this function. | |
static void * | FP_thread (void *pargs) |
int | FP_checkPreload (struct frame_pump_s *pump, const uint32_t frame) |
Checks if the pump's internal buffer is low, and if so, preloads the next frame set from the file controller asynchronously in a separate thread. The preloaded data is stored within the pump, allowing it to be read once the pre-existing primary buffer is empty. | |
int | FP_nextFrame (struct frame_pump_s *pump, uint8_t **fd) |
Copies the next frame of data from the pump to the provided frame data buffer. If the pump's internal buffer is empty, the pump will attempt to read more frames from the file controller provided during initialization. | |
int | FP_framesRemaining (struct frame_pump_s *pump) |
Returns the number of frames remaining in the pump's internal buffer. | |
void | FP_free (struct frame_pump_s *pump) |
Frees the resources associated with the provided frame pump. | |
Frame data loading implementation.
int FP_checkPreload | ( | struct frame_pump_s * | pump, |
uint32_t | frame ) |
Checks if the pump's internal buffer is low, and if so, preloads the next frame set from the file controller asynchronously in a separate thread. The preloaded data is stored within the pump, allowing it to be read once the pre-existing primary buffer is empty.
pump | pump to check |
frame | current frame index for aligning read position |
int FP_framesRemaining | ( | struct frame_pump_s * | pump | ) |
Returns the number of frames remaining in the pump's internal buffer.
pump | pump to check |
void FP_free | ( | struct frame_pump_s * | pump | ) |
Frees the resources associated with the provided frame pump.
pump | pump to free |
int FP_init | ( | struct FC * | fc, |
const struct tf_header_t * | seq, | ||
struct frame_pump_s ** | pump ) |
Initializes a frame pump with the provided file controller. The pump will read frames from the file controller and store them in an internal buffer for playback. The pump will also preload the next frame set asynchronously in a separate thread to ensure smooth playback. The caller is responsible for freeing the pump with FP_free
.
fc | file controller to read frames from |
seq | sequence file for file layout information |
pump | pointer to store the initialized frame pump in |
int FP_nextFrame | ( | struct frame_pump_s * | pump, |
uint8_t ** | fd ) |
Copies the next frame of data from the pump to the provided frame data buffer. If the pump's internal buffer is empty, the pump will attempt to read more frames from the file controller provided during initialization.
pump | pump to copy from |
fd | frame data pointer to return the next frame in |
|
static |
Reads the next frame set from the file controller and stores it in the provided frame data node pointer. The pump should have its pos
union updated with read request position information before calling this function.
pump | frame pump to read from |
list | frame data list pointer to store the next frame set in |
FP_ESEQEND
if the pump has reached the end of the sequence
|
static |
Reads the next frame set from the file controller and stores it in the provided frame data node pointer. This function is used when the sequence is not compressed and read sequentially from the file controller.
fc | file controller to read from |
seq | sequence header for playback configuration |
frame | frame index to read |
list | frame data list pointer to store the next frame set in |
FP_ESEQEND
if the pump has reached the end of the sequence
|
static |