Typedefs | |
| typedef struct bg_fifo_s | bg_fifo_t |
| Opaque fifo handle. | |
Enumerations | |
| enum | bg_fifo_state_t { BG_FIFO_PLAYING, BG_FIFO_STOPPED, BG_FIFO_PAUSED } |
| Operation states a fifo can have. More... | |
Functions | |
| bg_fifo_t * | bg_fifo_create (int num_frames, void *(*create_func)(void *), void *data) |
| Create a fifo. | |
| void | bg_fifo_destroy (bg_fifo_t *f, void(*destroy_func)(void *, void *), void *data) |
| Destroy a fifo. | |
| void * | bg_fifo_lock_read (bg_fifo_t *f, bg_fifo_state_t *state) |
| Lock a fifo for reading. | |
| void * | bg_fifo_try_lock_read (bg_fifo_t *f, bg_fifo_state_t *state) |
| Lock a fifo for reading (nonblocking). | |
| void | bg_fifo_unlock_read (bg_fifo_t *f) |
| Unlock a fifo for reading. | |
| void * | bg_fifo_lock_write (bg_fifo_t *f, bg_fifo_state_t *state) |
| Lock a fifo for writing. | |
| void * | bg_fifo_try_lock_write (bg_fifo_t *f, bg_fifo_state_t *state) |
| Lock a fifo for writing (nonblocking). | |
| void | bg_fifo_unlock_write (bg_fifo_t *f, int eof) |
| Unlock a fifo for writing. | |
| void | bg_fifo_set_state (bg_fifo_t *f, bg_fifo_state_t state) |
| Set the state of a fifo. | |
| void | bg_fifo_clear (bg_fifo_t *f) |
| Clear a fifo. | |
Fifos are used in multithreaded realtime applications to transfer A/V frames from the source to the destination. They have a fixed number of frames.
They also allow save suspension and termination of threads through the state values returned by the bg_fifo_lock_* functions.
| typedef struct bg_fifo_s bg_fifo_t |
Opaque fifo handle.
You don't want to know what's inside
| enum bg_fifo_state_t |
| bg_fifo_t* bg_fifo_create | ( | int | num_frames, | |
| void *(*)(void *) | create_func, | |||
| void * | data | |||
| ) |
Create a fifo.
| num_frames | Number of frames | |
| create_func | Function to be called for each created frame | |
| data | Argument for create_func |
| void bg_fifo_destroy | ( | bg_fifo_t * | f, | |
| void(*)(void *, void *) | destroy_func, | |||
| void * | data | |||
| ) |
Destroy a fifo.
| f | A fifo | |
| destroy_func | Function to be called for each frame to destroy it | |
| data | Argument for destroy_func |
| void* bg_fifo_lock_read | ( | bg_fifo_t * | f, | |
| bg_fifo_state_t * | state | |||
| ) |
Lock a fifo for reading.
| f | A fifo | |
| state | If non NULL, returns the state of the fifo |
| void* bg_fifo_try_lock_read | ( | bg_fifo_t * | f, | |
| bg_fifo_state_t * | state | |||
| ) |
Lock a fifo for reading (nonblocking).
| f | A fifo | |
| state | If non NULL, returns the state of the fifo |
| void bg_fifo_unlock_read | ( | bg_fifo_t * | f | ) |
Unlock a fifo for reading.
| f | A fifo |
| void* bg_fifo_lock_write | ( | bg_fifo_t * | f, | |
| bg_fifo_state_t * | state | |||
| ) |
Lock a fifo for writing.
| f | A fifo | |
| state | If non NULL, returns the state of the fifo |
| void* bg_fifo_try_lock_write | ( | bg_fifo_t * | f, | |
| bg_fifo_state_t * | state | |||
| ) |
Lock a fifo for writing (nonblocking).
| f | A fifo | |
| state | If non NULL, returns the state of the fifo |
| void bg_fifo_unlock_write | ( | bg_fifo_t * | f, | |
| int | eof | |||
| ) |
Unlock a fifo for writing.
| f | A fifo | |
| eof | Set to 1 if EOF (also means, the last frame is invalid) |
| void bg_fifo_set_state | ( | bg_fifo_t * | f, | |
| bg_fifo_state_t | state | |||
| ) |
Set the state of a fifo.
| f | A fifo | |
| state | The new state |
| void bg_fifo_clear | ( | bg_fifo_t * | f | ) |
Clear a fifo.
| f | A fifo |
1.5.6