Commit 18bf6ec2 by xiongziliang

tcp客户端支持指定网卡

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