mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
rename SrsBitStream to SrsBitBuffer
This commit is contained in:
parent
0e52fc6d5b
commit
dadfe101b4
5 changed files with 14 additions and 14 deletions
|
@ -252,30 +252,30 @@ void SrsBuffer::write_bytes(char* data, int size)
|
||||||
p += size;
|
p += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsBitStream::SrsBitStream()
|
SrsBitBuffer::SrsBitBuffer()
|
||||||
{
|
{
|
||||||
cb = 0;
|
cb = 0;
|
||||||
cb_left = 0;
|
cb_left = 0;
|
||||||
stream = NULL;
|
stream = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsBitStream::~SrsBitStream()
|
SrsBitBuffer::~SrsBitBuffer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int SrsBitStream::initialize(SrsBuffer* s) {
|
int SrsBitBuffer::initialize(SrsBuffer* s) {
|
||||||
stream = s;
|
stream = s;
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SrsBitStream::empty() {
|
bool SrsBitBuffer::empty() {
|
||||||
if (cb_left) {
|
if (cb_left) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return stream->empty();
|
return stream->empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t SrsBitStream::read_bit() {
|
int8_t SrsBitBuffer::read_bit() {
|
||||||
if (!cb_left) {
|
if (!cb_left) {
|
||||||
srs_assert(!stream->empty());
|
srs_assert(!stream->empty());
|
||||||
cb = stream->read_1bytes();
|
cb = stream->read_1bytes();
|
||||||
|
|
|
@ -159,15 +159,15 @@ public:
|
||||||
/**
|
/**
|
||||||
* the bit stream.
|
* the bit stream.
|
||||||
*/
|
*/
|
||||||
class SrsBitStream
|
class SrsBitBuffer
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int8_t cb;
|
int8_t cb;
|
||||||
u_int8_t cb_left;
|
u_int8_t cb_left;
|
||||||
SrsBuffer* stream;
|
SrsBuffer* stream;
|
||||||
public:
|
public:
|
||||||
SrsBitStream();
|
SrsBitBuffer();
|
||||||
virtual ~SrsBitStream();
|
virtual ~SrsBitBuffer();
|
||||||
public:
|
public:
|
||||||
virtual int initialize(SrsBuffer* s);
|
virtual int initialize(SrsBuffer* s);
|
||||||
virtual bool empty();
|
virtual bool empty();
|
||||||
|
|
|
@ -981,7 +981,7 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsBitStream bs;
|
SrsBitBuffer bs;
|
||||||
if ((ret = bs.initialize(&stream)) != ERROR_SUCCESS) {
|
if ((ret = bs.initialize(&stream)) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ using namespace std;
|
||||||
// @see SRS_SYS_TIME_RESOLUTION_MS_TIMES
|
// @see SRS_SYS_TIME_RESOLUTION_MS_TIMES
|
||||||
#define SYS_TIME_RESOLUTION_US 300*1000
|
#define SYS_TIME_RESOLUTION_US 300*1000
|
||||||
|
|
||||||
int srs_avc_nalu_read_uev(SrsBitStream* stream, int32_t& v)
|
int srs_avc_nalu_read_uev(SrsBitBuffer* stream, int32_t& v)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ int srs_avc_nalu_read_uev(SrsBitStream* stream, int32_t& v)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int srs_avc_nalu_read_bit(SrsBitStream* stream, int8_t& v)
|
int srs_avc_nalu_read_bit(SrsBitBuffer* stream, int8_t& v)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
|
|
@ -34,15 +34,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class SrsBuffer;
|
class SrsBuffer;
|
||||||
class SrsBitStream;
|
class SrsBitBuffer;
|
||||||
|
|
||||||
// compare
|
// compare
|
||||||
#define srs_min(a, b) (((a) < (b))? (a) : (b))
|
#define srs_min(a, b) (((a) < (b))? (a) : (b))
|
||||||
#define srs_max(a, b) (((a) < (b))? (b) : (a))
|
#define srs_max(a, b) (((a) < (b))? (b) : (a))
|
||||||
|
|
||||||
// read nalu uev.
|
// read nalu uev.
|
||||||
extern int srs_avc_nalu_read_uev(SrsBitStream* stream, int32_t& v);
|
extern int srs_avc_nalu_read_uev(SrsBitBuffer* stream, int32_t& v);
|
||||||
extern int srs_avc_nalu_read_bit(SrsBitStream* stream, int8_t& v);
|
extern int srs_avc_nalu_read_bit(SrsBitBuffer* stream, int8_t& v);
|
||||||
|
|
||||||
// get current system time in ms, use cache to avoid performance problem
|
// get current system time in ms, use cache to avoid performance problem
|
||||||
extern int64_t srs_get_system_time_ms();
|
extern int64_t srs_get_system_time_ms();
|
||||||
|
|
Loading…
Reference in a new issue