mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
enhanced avc decode, parse the sps get width+height. 2.0.156.
This commit is contained in:
parent
7e1749e029
commit
70c59da1bf
9 changed files with 351 additions and 8 deletions
|
@ -252,4 +252,38 @@ void SrsStream::write_bytes(char* data, int size)
|
|||
p += size;
|
||||
}
|
||||
|
||||
SrsBitStream::SrsBitStream()
|
||||
{
|
||||
cb = 0;
|
||||
cb_left = 0;
|
||||
stream = NULL;
|
||||
}
|
||||
|
||||
SrsBitStream::~SrsBitStream()
|
||||
{
|
||||
}
|
||||
|
||||
int SrsBitStream::initialize(SrsStream* s) {
|
||||
stream = s;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool SrsBitStream::empty() {
|
||||
if (cb_left) {
|
||||
return false;
|
||||
}
|
||||
return stream->empty();
|
||||
}
|
||||
|
||||
int8_t SrsBitStream::read_bit() {
|
||||
if (!cb_left) {
|
||||
srs_assert(!stream->empty());
|
||||
cb = stream->read_1bytes();
|
||||
cb_left = 8;
|
||||
}
|
||||
|
||||
int8_t v = (cb >> (cb_left - 1)) & 0x01;
|
||||
cb_left--;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue