|
Paraslash Audio Streaming |
About News Download Documentation Development |
Macros | |
#define | FEC_HEADER_SIZE 32 |
#define | FEC_MAGIC 0xFECC0DEC |
Functions | |
int | fec_new (int k, int n, struct fec_parms **parms) |
void | fec_free (struct fec_parms *p) |
void | fec_encode (struct fec_parms *parms, const unsigned char *const *src, unsigned char *dst, int idx, int sz) |
int | fec_decode (struct fec_parms *parms, unsigned char **data, int *idx, int sz) |
#define FEC_HEADER_SIZE 32 |
Each FEC slice contains a FEC header of this size.
#define FEC_MAGIC 0xFECC0DEC |
The FEC header starts with this magic value.
int fec_new | ( | int | k, |
int | n, | ||
struct fec_parms ** | result | ||
) |
Create a new encoder and return an opaque descriptor to it.
k | Number of input slices. |
n | Number of output slices. |
result | On success the Fec descriptor is returned here. |
This creates the k*n encoding matrix. It is computed starting with a Vandermonde matrix, and then transformed into a systematic matrix.
void fec_free | ( | struct fec_parms * | p | ) |
Deallocate a fec params structure.
p | The structure to free. |
void fec_encode | ( | struct fec_parms * | parms, |
const unsigned char *const * | src, | ||
unsigned char * | dst, | ||
int | idx, | ||
int | sz | ||
) |
Compute one encoded slice of the given input.
parms | The fec parameters returned earlier by fec_new(). |
src | The k data slices to encode. |
dst | Result pointer. |
idx | The index of the slice to compute. |
sz | The size of the input data packets. |
Encode the k slices of size sz given by src and store the output slice number idx in dst.
int fec_decode | ( | struct fec_parms * | parms, |
unsigned char ** | data, | ||
int * | idx, | ||
int | sz | ||
) |
Decode one slice from the group of received slices.
parms | Pointer to fec params structure. |
data | Pointers to received packets. |
idx | Pointer to packet indices (gets modified). |
sz | Size of each packet. |
The data vector of received slices and the indices of slices are used to produce the correct output slice. The data slices are modified in-place.