mirror of
https://github.com/ossrs/srs.git
synced 2025-02-14 12:21:55 +00:00
add amf0 decode framework.
This commit is contained in:
parent
f5672998fd
commit
496c5ecfde
9 changed files with 178 additions and 3 deletions
3
trunk/configure
vendored
3
trunk/configure
vendored
|
@ -85,7 +85,8 @@ ModuleLibIncs=(${LibSTRoot})
|
|||
MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server"
|
||||
"srs_core_error" "srs_core_conn" "srs_core_client"
|
||||
"srs_core_rtmp" "srs_core_socket" "srs_core_buffer"
|
||||
"srs_core_auto_free" "srs_core_protocol")
|
||||
"srs_core_auto_free" "srs_core_protocol" "srs_core_amf0"
|
||||
"srs_core_stream")
|
||||
MODULE_DIR="src/core" . auto/modules.sh
|
||||
CORE_OBJS="${MODULE_OBJS[@]}"
|
||||
|
||||
|
|
|
@ -42,4 +42,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <assert.h>
|
||||
#define srs_assert(expression) assert(expression)
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#endif
|
24
trunk/src/core/srs_core_amf0.cpp
Executable file
24
trunk/src/core/srs_core_amf0.cpp
Executable file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 winlin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <srs_core_amf0.hpp>
|
33
trunk/src/core/srs_core_amf0.hpp
Executable file
33
trunk/src/core/srs_core_amf0.hpp
Executable file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 winlin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SRS_CORE_AMF0_HPP
|
||||
#define SRS_CORE_AMF0_HPP
|
||||
|
||||
/*
|
||||
#include <srs_core_amf0.hpp>
|
||||
*/
|
||||
|
||||
#include <srs_core.hpp>
|
||||
|
||||
#endif
|
|
@ -30,8 +30,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <srs_core.hpp>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* auto free the instance in the current scope.
|
||||
*/
|
||||
|
|
|
@ -53,4 +53,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define ERROR_RTMP_CHUNK_START 301
|
||||
#define ERROR_RTMP_MSG_INVLIAD_SIZE 302
|
||||
|
||||
#define ERROR_SYSTEM_STREAM_INIT 400
|
||||
|
||||
#endif
|
60
trunk/src/core/srs_core_stream.cpp
Executable file
60
trunk/src/core/srs_core_stream.cpp
Executable file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 winlin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <srs_core_stream.hpp>
|
||||
|
||||
#include <srs_core_log.hpp>
|
||||
#include <srs_core_error.hpp>
|
||||
|
||||
SrsStream::SrsStream()
|
||||
{
|
||||
bytes = NULL;
|
||||
size = 0;
|
||||
}
|
||||
|
||||
SrsStream::~SrsStream()
|
||||
{
|
||||
}
|
||||
|
||||
int SrsStream::initialize(char* _bytes, int _size)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if (!_bytes) {
|
||||
ret = ERROR_SYSTEM_STREAM_INIT;
|
||||
srs_error("stream param bytes must not be NULL. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (_size <= 0) {
|
||||
ret = ERROR_SYSTEM_STREAM_INIT;
|
||||
srs_error("stream param size must be positive. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
size = _size;
|
||||
bytes = _bytes;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
51
trunk/src/core/srs_core_stream.hpp
Executable file
51
trunk/src/core/srs_core_stream.hpp
Executable file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 winlin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SRS_CORE_STREAM_HPP
|
||||
#define SRS_CORE_STREAM_HPP
|
||||
|
||||
/*
|
||||
#include <srs_core_stream.hpp>
|
||||
*/
|
||||
|
||||
#include <srs_core.hpp>
|
||||
|
||||
class SrsStream
|
||||
{
|
||||
protected:
|
||||
char* bytes;
|
||||
int size;
|
||||
public:
|
||||
SrsStream();
|
||||
virtual ~SrsStream();
|
||||
public:
|
||||
/**
|
||||
* initialize the stream from bytes.
|
||||
* @_bytes, must not be NULL, or return error.
|
||||
* @_size, must be positive, or return error.
|
||||
* @remark, stream never free the _bytes, user must free it.
|
||||
*/
|
||||
virtual int initialize(char* _bytes, int _size);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -18,6 +18,10 @@ file
|
|||
..\core\srs_core_rtmp.cpp,
|
||||
..\core\srs_core_protocol.hpp,
|
||||
..\core\srs_core_protocol.cpp,
|
||||
..\core\srs_core_amf0.hpp,
|
||||
..\core\srs_core_amf0.cpp,
|
||||
..\core\srs_core_stream.hpp,
|
||||
..\core\srs_core_stream.cpp,
|
||||
..\core\srs_core_socket.hpp,
|
||||
..\core\srs_core_socket.cpp,
|
||||
..\core\srs_core_buffer.hpp,
|
||||
|
|
Loading…
Reference in a new issue