Valkka
1.6.1
OpenSource Video Management
|
SharedMemRingBuffer for AVRGBFrame. More...
#include <sharedmem.h>
Public Member Functions | |
SharedMemRingBufferRGB (const char *name, int n_cells, int width, int height, int mstimeout=0, bool is_server=false) | |
Default ctor. | |
virtual | ~SharedMemRingBufferRGB () |
Default destructor. | |
void | serverPushAVRGBFrame (AVRGBFrame *f) |
PyObject * | clientPullPy () |
Returns a python tuple of metadata (index, width, height, slot, timestamp) | |
bool | clientPull (int &index_out, int &size_out) |
Legacy support. | |
bool | clientPullFrame (int &index_out, RGB24Meta &meta) |
Pulls payload and extended metadata. | |
bool | clientPullFrameThread (int &index_out, RGB24Meta &meta) |
For multithreading (instead of multiprocessing) applications: releases python GIL. | |
bool | serverPushPyRGB (PyObject *po, SlotNumber slot, long int mstimestamp) |
Public Member Functions inherited from SharedMemRingBufferBase | |
SharedMemRingBufferBase (const char *name, int n_cells, std::size_t n_bytes, int mstimeout=0, bool is_server=false) | |
Default constructor. More... | |
virtual | ~SharedMemRingBufferBase () |
Default destructor. | |
int | getValue () |
Returns the current index (next to be read) of the shmem buffer. | |
bool | getClientState () |
Are the shmem segments available for client? | |
void | serverPush (std::vector< uint8_t > &inp_payload, void *meta) |
Copies payload to ring buffer. More... | |
void | serverUseFd (EventFd &event_fd) |
Activate the file descriptor api for usage with select and poll. | |
bool | clientPull (int &index_out, void *meta) |
Returns the index of SharedMemoryRingBuffer::shmems that was just written. More... | |
bool | clientPullThread (int &index_out, void *meta) |
multithreading version: releases GIL | |
PyObject * | getBufferListPy () |
void | clientUseFd (EventFd &event_fd) |
Activate the file descriptor api for usage with select and poll. | |
Protected Attributes | |
int | width |
int | height |
Protected Attributes inherited from SharedMemRingBufferBase | |
std::string | name |
int | n_cells |
int | n_bytes |
Parameters defining the shmem ring buffer (number, size) | |
int | mstimeout |
Semaphore timeout in milliseconds. | |
bool | is_server |
Are we on the server side or not? | |
sem_t * | sema |
sem_t * | flagsema |
Posix semaphore objects (semaphore counter, semaphore for the overflow flag) | |
std::string | sema_name |
Name to identify the posix semaphore counter. | |
std::string | flagsema_name |
Name to identify the posix semaphore used for the overflow flag. | |
int | index |
The index of cell that has just been written. Remember: server and client see their own copies of this. | |
struct timespec | ts |
Timespec for semaphore timeouts. | |
int | fd |
A file descriptor for poll and select. | |
Additional Inherited Members | |
Public Attributes inherited from SharedMemRingBufferBase | |
std::vector< SharedMemSegment * > | shmems |
Shared memory segments - can be exposed as numpy arrays. | |
uint8_t ** | cache |
One can expose a cache instead as numpy arrays - but this requires an additional copy step - enable with flag USE_SHMEM_CACHE. | |
Protected Member Functions inherited from SharedMemRingBufferBase | |
void | setFlag () |
Server: call this to indicate a ring-buffer overflow. | |
bool | flagIsSet () |
Client: call this to see if there has been a ring-buffer overflow. | |
void | clearFlag () |
Client: call this after handling the ring-buffer overflow. | |
int | getFlagValue () |
Used by SharedMemoryRingBuffer::flagIsSet() | |
void | zero () |
Force reset. Semaphore value is set to 0. | |
void | setEventFd () |
Set event file descriptor. | |
void | clearEventFd () |
Clear event file descriptor. | |