mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
move the annexb decode utility to protocol.
This commit is contained in:
parent
bd25626f0e
commit
72ad6894ca
8 changed files with 128 additions and 69 deletions
|
@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <srs_kernel_stream.hpp>
|
||||
#include <srs_protocol_amf0.hpp>
|
||||
#include <srs_app_utility.hpp>
|
||||
#include <srs_protocol_utility.hpp>
|
||||
|
||||
SrsCodecSampleUnit::SrsCodecSampleUnit()
|
||||
{
|
||||
|
|
|
@ -107,35 +107,6 @@ int srs_get_log_level(string level)
|
|||
}
|
||||
}
|
||||
|
||||
bool srs_avc_startswith_annexb(SrsStream* stream, int* pnb_start_code)
|
||||
{
|
||||
char* bytes = stream->data() + stream->pos();
|
||||
char* p = bytes;
|
||||
|
||||
for (;;) {
|
||||
if (!stream->require(p - bytes + 3)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// not match
|
||||
if (p[0] != 0x00 || p[1] != 0x00) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// match N[00] 00 00 01, where N>=0
|
||||
if (p[2] == 0x01) {
|
||||
if (pnb_start_code) {
|
||||
*pnb_start_code = (int)(p - bytes) + 3;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static SrsRusage _srs_system_rusage;
|
||||
|
||||
SrsRusage::SrsRusage()
|
||||
|
|
|
@ -50,15 +50,6 @@ extern int srs_socket_connect(std::string server, int port, int64_t timeout, st_
|
|||
*/
|
||||
extern int srs_get_log_level(std::string level);
|
||||
|
||||
/**
|
||||
* whether stream starts with the avc NALU in "AnnexB"
|
||||
* from H.264-AVC-ISO_IEC_14496-10.pdf, page 211.
|
||||
* start code must be "N[00] 00 00 01" where N>=0
|
||||
* @param pnb_start_code output the size of start code, must >=3.
|
||||
* NULL to ignore.
|
||||
*/
|
||||
extern bool srs_avc_startswith_annexb(SrsStream* stream, int* pnb_start_code = NULL);
|
||||
|
||||
// current process resouce usage.
|
||||
// @see: man getrusage
|
||||
class SrsRusage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue