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

FSEQ compression block loading implementation. More...

#include "comblock.h"
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <zstd.h>
#include "tinyfseq.h"
#include "fseq/fd.h"
#include "std2/errcode.h"
#include "std2/fc.h"
Include dependency graph for comblock.c:

Macros

#define COMBLOCK_SIZE   8
 Size of a FSEQ file format compression block entry in bytes.
 

Functions

static int ComBlock_findAbsoluteAddr (struct FC *fc, const struct tf_header_t *seq, const int index, uint32_t *const cbAddr, uint32_t *const cbSize)
 Calculates the absolute address of the given compression block index and its encoded size.
 
static int ComBlock_readZstd (struct FC *fc, const struct tf_header_t *seq, const int index, struct fd_list_s *list)
 Reads the given compression block (by index) from the given file controller and decompresses it using zstd.
 
int ComBlock_read (struct FC *fc, const struct tf_header_t *seq, const int index, struct fd_list_s *list)
 Reads the given compression block (by index) from the given file controller and decompresses it (if supported).
 
int ComBlock_count (struct FC *fc, const struct tf_header_t *seq)
 Determines the number of compression blocks available within the given sequence file. The FSEQ file header already contains a field, compressionBlockCount, that specifies the number of compression blocks, but other encoding programs are known to write additional zero-sized compression blocks to align write operations. This results in a discrepancy between the header field and the actual number of playable blocks in the sequence file.
 

Detailed Description

FSEQ compression block loading implementation.

Macro Definition Documentation

◆ COMBLOCK_SIZE

#define COMBLOCK_SIZE   8

Size of a FSEQ file format compression block entry in bytes.

Function Documentation

◆ ComBlock_count()

int ComBlock_count ( struct FC * fc,
const struct tf_header_t * seq )

Determines the number of compression blocks available within the given sequence file. The FSEQ file header already contains a field, compressionBlockCount, that specifies the number of compression blocks, but other encoding programs are known to write additional zero-sized compression blocks to align write operations. This results in a discrepancy between the header field and the actual number of playable blocks in the sequence file.

Parameters
fctarget file controller instance
seqsequence file for file layout information
Returns
the number of compression blocks on success or a negative error code on failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComBlock_findAbsoluteAddr()

static int ComBlock_findAbsoluteAddr ( struct FC * fc,
const struct tf_header_t * seq,
const int index,
uint32_t *const cbAddr,
uint32_t *const cbSize )
static

Calculates the absolute address of the given compression block index and its encoded size.

Parameters
fctarget file controller instance
seqsequence file for file layout information
indexindex of the compression block to look up
cbAddrout pointer to the absolute address of the compression block
cbSizeout pointer to the size of the compression block
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:

◆ ComBlock_read()

int ComBlock_read ( struct FC * fc,
const struct tf_header_t * seq,
int index,
struct fd_list_s * list )

Reads the given compression block (by index) from the given file controller and decompresses it (if supported).

Parameters
fctarget file controller instance
seqsequence file for file layout information
indexindex of the compression block to read
listpointer to the list for storing the decompressed frame data
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:

◆ ComBlock_readZstd()

static int ComBlock_readZstd ( struct FC * fc,
const struct tf_header_t * seq,
const int index,
struct fd_list_s * list )
static

Reads the given compression block (by index) from the given file controller and decompresses it using zstd.

Parameters
fctarget file controller instance
seqsequence file for file layout information
indexindex of the compression block to read
listout pointer to the decompressed block data (array of frames) or NULL on failure
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: