diff --git a/trunk/configure b/trunk/configure index 504b62f81..60445a4fa 100755 --- a/trunk/configure +++ b/trunk/configure @@ -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[@]}" diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 9f352bf0f..32c0cb9fc 100755 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -42,4 +42,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #define srs_assert(expression) assert(expression) +#include + #endif \ No newline at end of file diff --git a/trunk/src/core/srs_core_amf0.cpp b/trunk/src/core/srs_core_amf0.cpp new file mode 100755 index 000000000..d3218f2e0 --- /dev/null +++ b/trunk/src/core/srs_core_amf0.cpp @@ -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 diff --git a/trunk/src/core/srs_core_amf0.hpp b/trunk/src/core/srs_core_amf0.hpp new file mode 100755 index 000000000..8c3a02f7b --- /dev/null +++ b/trunk/src/core/srs_core_amf0.hpp @@ -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 +*/ + +#include + +#endif \ No newline at end of file diff --git a/trunk/src/core/srs_core_auto_free.hpp b/trunk/src/core/srs_core_auto_free.hpp index 7409af55d..65cafead7 100755 --- a/trunk/src/core/srs_core_auto_free.hpp +++ b/trunk/src/core/srs_core_auto_free.hpp @@ -30,8 +30,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -#include - /** * auto free the instance in the current scope. */ diff --git a/trunk/src/core/srs_core_error.hpp b/trunk/src/core/srs_core_error.hpp index 351c8529b..b2c5d36b5 100755 --- a/trunk/src/core/srs_core_error.hpp +++ b/trunk/src/core/srs_core_error.hpp @@ -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 \ No newline at end of file diff --git a/trunk/src/core/srs_core_stream.cpp b/trunk/src/core/srs_core_stream.cpp new file mode 100755 index 000000000..a2636851a --- /dev/null +++ b/trunk/src/core/srs_core_stream.cpp @@ -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 + +#include +#include + +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; +} + diff --git a/trunk/src/core/srs_core_stream.hpp b/trunk/src/core/srs_core_stream.hpp new file mode 100755 index 000000000..55d5c91b9 --- /dev/null +++ b/trunk/src/core/srs_core_stream.hpp @@ -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 +*/ + +#include + +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 \ No newline at end of file diff --git a/trunk/src/srs/srs.upp b/trunk/src/srs/srs.upp index ba3ed0bec..932051ca7 100755 --- a/trunk/src/srs/srs.upp +++ b/trunk/src/srs/srs.upp @@ -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,