Commit 18bf6ec2 by xiongziliang

tcp客户端支持指定网卡

parent 3b73e777
Subproject commit f5c26c234dfee07b9c3406fb359a3052ce19cf1f Subproject commit 61a84362acbd196355dcf0053d2e8f7f4d12e3dd
...@@ -37,6 +37,7 @@ using namespace ZL::Rtsp; ...@@ -37,6 +37,7 @@ using namespace ZL::Rtsp;
namespace ZL { namespace ZL {
namespace Player { namespace Player {
const char PlayerBase::kNetAdapter[] = "net_adapter";
PlayerBase::Ptr PlayerBase::createPlayer(const char* strUrl) { PlayerBase::Ptr PlayerBase::createPlayer(const char* strUrl) {
string prefix = FindField(strUrl, NULL, "://"); string prefix = FindField(strUrl, NULL, "://");
......
...@@ -51,7 +51,8 @@ public: ...@@ -51,7 +51,8 @@ public:
RTP_MULTICAST = 2, RTP_MULTICAST = 2,
} eRtpType; } eRtpType;
static Ptr createPlayer(const char* strUrl); static Ptr createPlayer(const char* strUrl);
static const char kNetAdapter[];
PlayerBase(){}; PlayerBase(){};
virtual ~PlayerBase(){}; virtual ~PlayerBase(){};
virtual void play(const char* strUrl) {}; virtual void play(const char* strUrl) {};
...@@ -79,8 +80,6 @@ public: ...@@ -79,8 +80,6 @@ public:
virtual float getDuration() const { return 0;}; virtual float getDuration() const { return 0;};
virtual float getProgress() const { return 0;}; virtual float getProgress() const { return 0;};
virtual void seekTo(float fProgress) {}; virtual void seekTo(float fProgress) {};
protected: protected:
virtual void onShutdown(const SockException &ex) {}; virtual void onShutdown(const SockException &ex) {};
virtual void onPlayResult(const SockException &ex) {}; virtual void onPlayResult(const SockException &ex) {};
......
...@@ -75,7 +75,6 @@ void RtmpPlayer::teardown() { ...@@ -75,7 +75,6 @@ void RtmpPlayer::teardown() {
shutdown(); shutdown();
} }
} }
void RtmpPlayer::play(const char* strUrl) { void RtmpPlayer::play(const char* strUrl) {
teardown(); teardown();
string strHost = FindField(strUrl, "://", "/"); string strHost = FindField(strUrl, "://", "/");
...@@ -97,6 +96,9 @@ void RtmpPlayer::play(const char* strUrl) { ...@@ -97,6 +96,9 @@ void RtmpPlayer::play(const char* strUrl) {
//服务器域名 //服务器域名
strHost = FindField(strHost.c_str(), NULL, ":"); strHost = FindField(strHost.c_str(), NULL, ":");
} }
if(!(*this)[PlayerBase::kNetAdapter].empty()){
setNetAdapter((*this)[PlayerBase::kNetAdapter]);
}
startConnect(strHost, iPort); startConnect(strHost, iPort);
} }
void RtmpPlayer::onErr(const SockException &ex){ void RtmpPlayer::onErr(const SockException &ex){
......
...@@ -147,6 +147,9 @@ void RtspPlayer::play(const char* strUrl, const char *strUser, const char *strPw ...@@ -147,6 +147,9 @@ void RtspPlayer::play(const char* strUrl, const char *strUser, const char *strPw
} }
m_strUrl = strUrl; m_strUrl = strUrl;
if(!(*this)[PlayerBase::kNetAdapter].empty()){
setNetAdapter((*this)[PlayerBase::kNetAdapter]);
}
startConnect(ip.data(), port); startConnect(ip.data(), port);
} }
void RtspPlayer::onConnect(const SockException &err){ void RtspPlayer::onConnect(const SockException &err){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论