mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
tcp客户端支持指定网卡
This commit is contained in:
parent
3b73e77710
commit
18bf6ec201
@ -1 +1 @@
|
|||||||
Subproject commit f5c26c234dfee07b9c3406fb359a3052ce19cf1f
|
Subproject commit 61a84362acbd196355dcf0053d2e8f7f4d12e3dd
|
@ -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,6 +51,7 @@ 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(){};
|
||||||
@ -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() {
|
|||||||
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) {
|
|||||||
//服务器域名
|
//服务器域名
|
||||||
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
|
|||||||
}
|
}
|
||||||
|
|
||||||
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){
|
||||||
|
Loading…
Reference in New Issue
Block a user