int cVideoBufferSimple::ReadBlock(uint8_t **buf, unsigned int size, time_t &endTime, time_t &wrapTime) { int readBytes; if (m_BytesConsumed) { m_Buffer->Del(m_BytesConsumed); } m_BytesConsumed = 0; *buf = m_Buffer->Get(readBytes); if (!(*buf) || readBytes < TS_SIZE) { usleep(100); return 0; } /* Make sure we are looking at a TS packet */ while (readBytes > TS_SIZE) { if ((*buf)[0] == TS_SYNC_BYTE && (*buf)[TS_SIZE] == TS_SYNC_BYTE) break; m_BytesConsumed++; (*buf)++; readBytes--; } if ((*buf)[0] != TS_SYNC_BYTE) { m_Buffer->Del(m_BytesConsumed); m_BytesConsumed = 0; return 0; } m_BytesConsumed += TS_SIZE; endTime = 0; wrapTime = 0; return TS_SIZE; }
void cVideoBufferSimple::Put(uint8_t *buf, unsigned int size) { m_Buffer->Put(buf, size); }
void cVideoBufferSimple::Put(const uint8_t *buf, unsigned int size) { m_Buffer.Put(buf, size); }