正在显示
7 个修改的文件
包含
117 行增加
和
2 行删除
| @@ -85,7 +85,7 @@ ModuleLibIncs=(${LibSTRoot}) | @@ -85,7 +85,7 @@ ModuleLibIncs=(${LibSTRoot}) | ||
| 85 | MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server" | 85 | MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server" |
| 86 | "srs_core_error" "srs_core_conn" "srs_core_client" | 86 | "srs_core_error" "srs_core_conn" "srs_core_client" |
| 87 | "srs_core_rtmp" "srs_core_socket" "srs_core_buffer" | 87 | "srs_core_rtmp" "srs_core_socket" "srs_core_buffer" |
| 88 | - "srs_core_auto_free") | 88 | + "srs_core_auto_free" "srs_core_protocol") |
| 89 | MODULE_DIR="src/core" . auto/modules.sh | 89 | MODULE_DIR="src/core" . auto/modules.sh |
| 90 | CORE_OBJS="${MODULE_OBJS[@]}" | 90 | CORE_OBJS="${MODULE_OBJS[@]}" |
| 91 | 91 |
| @@ -65,6 +65,13 @@ int SrsClient::do_cycle() | @@ -65,6 +65,13 @@ int SrsClient::do_cycle() | ||
| 65 | } | 65 | } |
| 66 | srs_verbose("rtmp handshake success"); | 66 | srs_verbose("rtmp handshake success"); |
| 67 | 67 | ||
| 68 | + SrsApp* app = NULL; | ||
| 69 | + if ((ret = rtmp->connect_app(&app)) != ERROR_SUCCESS) { | ||
| 70 | + srs_warn("rtmp connect vhost/app failed. ret=%d", ret); | ||
| 71 | + return ret; | ||
| 72 | + } | ||
| 73 | + srs_verbose("rtmp connect vhost/app success"); | ||
| 74 | + | ||
| 68 | return ret; | 75 | return ret; |
| 69 | } | 76 | } |
| 70 | 77 |
trunk/src/core/srs_core_protocol.cpp
0 → 100755
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | + | ||
| 24 | +#include <srs_core_protocol.hpp> | ||
| 25 | + | ||
| 26 | +#include <srs_core_log.hpp> | ||
| 27 | +#include <srs_core_error.hpp> | ||
| 28 | +#include <srs_core_socket.hpp> | ||
| 29 | +#include <srs_core_buffer.hpp> | ||
| 30 | + | ||
| 31 | +SrsProtocol::SrsProtocol(st_netfd_t client_stfd) | ||
| 32 | +{ | ||
| 33 | + stfd = client_stfd; | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +SrsProtocol::~SrsProtocol() | ||
| 37 | +{ | ||
| 38 | +} | ||
| 39 | + |
trunk/src/core/srs_core_protocol.hpp
0 → 100755
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | + | ||
| 24 | +#ifndef SRS_CORE_PROTOCOL_HPP | ||
| 25 | +#define SRS_CORE_PROTOCOL_HPP | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | +#include <srs_core_protocol.hpp> | ||
| 29 | +*/ | ||
| 30 | + | ||
| 31 | +#include <srs_core.hpp> | ||
| 32 | + | ||
| 33 | +#include <st.h> | ||
| 34 | + | ||
| 35 | +class SrsProtocol | ||
| 36 | +{ | ||
| 37 | +private: | ||
| 38 | + st_netfd_t stfd; | ||
| 39 | +public: | ||
| 40 | + SrsProtocol(st_netfd_t client_stfd); | ||
| 41 | + virtual ~SrsProtocol(); | ||
| 42 | +public: | ||
| 43 | +}; | ||
| 44 | + | ||
| 45 | +#endif |
| @@ -25,17 +25,22 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -25,17 +25,22 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | 25 | ||
| 26 | #include <srs_core_log.hpp> | 26 | #include <srs_core_log.hpp> |
| 27 | #include <srs_core_error.hpp> | 27 | #include <srs_core_error.hpp> |
| 28 | -#include <srs_core_buffer.hpp> | ||
| 29 | #include <srs_core_socket.hpp> | 28 | #include <srs_core_socket.hpp> |
| 29 | +#include <srs_core_protocol.hpp> | ||
| 30 | #include <srs_core_auto_free.hpp> | 30 | #include <srs_core_auto_free.hpp> |
| 31 | 31 | ||
| 32 | SrsRtmp::SrsRtmp(st_netfd_t client_stfd) | 32 | SrsRtmp::SrsRtmp(st_netfd_t client_stfd) |
| 33 | { | 33 | { |
| 34 | + protocol = new SrsProtocol(client_stfd); | ||
| 34 | stfd = client_stfd; | 35 | stfd = client_stfd; |
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | SrsRtmp::~SrsRtmp() | 38 | SrsRtmp::~SrsRtmp() |
| 38 | { | 39 | { |
| 40 | + if (protocol) { | ||
| 41 | + delete protocol; | ||
| 42 | + protocol = NULL; | ||
| 43 | + } | ||
| 39 | } | 44 | } |
| 40 | 45 | ||
| 41 | int SrsRtmp::handshake() | 46 | int SrsRtmp::handshake() |
| @@ -83,3 +88,9 @@ int SrsRtmp::handshake() | @@ -83,3 +88,9 @@ int SrsRtmp::handshake() | ||
| 83 | return ret; | 88 | return ret; |
| 84 | } | 89 | } |
| 85 | 90 | ||
| 91 | +int SrsRtmp::connect_app(SrsApp** papp) | ||
| 92 | +{ | ||
| 93 | + int ret = ERROR_SUCCESS; | ||
| 94 | + return ret; | ||
| 95 | +} | ||
| 96 | + |
| @@ -30,17 +30,28 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -30,17 +30,28 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 30 | 30 | ||
| 31 | #include <srs_core.hpp> | 31 | #include <srs_core.hpp> |
| 32 | 32 | ||
| 33 | +#include <string> | ||
| 34 | + | ||
| 33 | #include <st.h> | 35 | #include <st.h> |
| 34 | 36 | ||
| 37 | +struct SrsApp | ||
| 38 | +{ | ||
| 39 | + std::string vhost; | ||
| 40 | + std::string app; | ||
| 41 | +}; | ||
| 42 | + | ||
| 43 | +class SrsProtocol; | ||
| 35 | class SrsRtmp | 44 | class SrsRtmp |
| 36 | { | 45 | { |
| 37 | private: | 46 | private: |
| 47 | + SrsProtocol* protocol; | ||
| 38 | st_netfd_t stfd; | 48 | st_netfd_t stfd; |
| 39 | public: | 49 | public: |
| 40 | SrsRtmp(st_netfd_t client_stfd); | 50 | SrsRtmp(st_netfd_t client_stfd); |
| 41 | virtual ~SrsRtmp(); | 51 | virtual ~SrsRtmp(); |
| 42 | public: | 52 | public: |
| 43 | virtual int handshake(); | 53 | virtual int handshake(); |
| 54 | + virtual int connect_app(SrsApp** papp); | ||
| 44 | }; | 55 | }; |
| 45 | 56 | ||
| 46 | #endif | 57 | #endif |
| @@ -16,6 +16,8 @@ file | @@ -16,6 +16,8 @@ file | ||
| 16 | ..\core\srs_core_client.cpp, | 16 | ..\core\srs_core_client.cpp, |
| 17 | ..\core\srs_core_rtmp.hpp, | 17 | ..\core\srs_core_rtmp.hpp, |
| 18 | ..\core\srs_core_rtmp.cpp, | 18 | ..\core\srs_core_rtmp.cpp, |
| 19 | + ..\core\srs_core_protocol.hpp, | ||
| 20 | + ..\core\srs_core_protocol.cpp, | ||
| 19 | ..\core\srs_core_socket.hpp, | 21 | ..\core\srs_core_socket.hpp, |
| 20 | ..\core\srs_core_socket.cpp, | 22 | ..\core\srs_core_socket.cpp, |
| 21 | ..\core\srs_core_buffer.hpp, | 23 | ..\core\srs_core_buffer.hpp, |
-
请 注册 或 登录 后发表评论