mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
update librtmp, add amf0 parse functions
This commit is contained in:
parent
efc9f53512
commit
f37faf7236
6 changed files with 200 additions and 112 deletions
|
@ -36,6 +36,8 @@ using namespace std;
|
|||
#include <srs_core_autofree.hpp>
|
||||
#include <srs_protocol_rtmp_stack.hpp>
|
||||
#include <srs_kernel_utility.hpp>
|
||||
#include <srs_kernel_stream.hpp>
|
||||
#include <srs_protocol_amf0.hpp>
|
||||
|
||||
// if user want to define log, define the folowing macro.
|
||||
#ifndef SRS_RTMP_USER_DEFINED_LOG
|
||||
|
@ -406,6 +408,33 @@ int64_t srs_get_time_ms()
|
|||
return srs_get_system_time_ms();
|
||||
}
|
||||
|
||||
srs_amf0_t srs_amf0_parse(char* data, int size)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
srs_amf0_t amf0 = NULL;
|
||||
|
||||
SrsStream stream;
|
||||
if ((ret = stream.initialize(data, size)) != ERROR_SUCCESS) {
|
||||
return amf0;
|
||||
}
|
||||
|
||||
SrsAmf0Any* any = NULL;
|
||||
if ((ret = SrsAmf0Any::discovery(&stream, &any)) != ERROR_SUCCESS) {
|
||||
return amf0;
|
||||
}
|
||||
|
||||
stream.reset();
|
||||
if ((ret = any->read(&stream)) != ERROR_SUCCESS) {
|
||||
srs_freep(any);
|
||||
return amf0;
|
||||
}
|
||||
|
||||
amf0 = (srs_amf0_t)any;
|
||||
|
||||
return amf0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue