mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-20 07:12:21 +08:00
新增获取推流推流代理列表和ffmpeg源列表接口 (#3992)
This commit is contained in:
@@ -139,6 +139,10 @@ public:
|
||||
// Using this only makes sense after a successful connection to the server
|
||||
TranslationInfo getTranslationInfo();
|
||||
|
||||
const std::string& getUrl() const { return _pull_url; }
|
||||
const MediaTuple& getMediaTuple() const { return _tuple; }
|
||||
const ProtocolOption& getOption() const { return _option; }
|
||||
|
||||
private:
|
||||
// MediaSourceEvent override
|
||||
bool close(MediaSource &sender) override;
|
||||
|
||||
@@ -46,6 +46,7 @@ void MediaPusher::publish(const string &url) {
|
||||
_delegate->setOnPublished(_on_publish);
|
||||
_delegate->mINI::operator=(*this);
|
||||
_delegate->publish(url);
|
||||
_url = url;
|
||||
}
|
||||
|
||||
EventPoller::Ptr MediaPusher::getPoller(){
|
||||
|
||||
@@ -33,11 +33,13 @@ public:
|
||||
void publish(const std::string &url) override;
|
||||
toolkit::EventPoller::Ptr getPoller();
|
||||
void setOnCreateSocket(toolkit::Socket::onCreateSocket cb);
|
||||
|
||||
std::shared_ptr<MediaSource> getSrc() { return _src.lock(); }
|
||||
const std::string& getUrl() const { return _url; }
|
||||
private:
|
||||
std::weak_ptr<MediaSource> _src;
|
||||
toolkit::EventPoller::Ptr _poller;
|
||||
toolkit::Socket::onCreateSocket _on_create_socket;
|
||||
std::string _url;
|
||||
};
|
||||
|
||||
} /* namespace mediakit */
|
||||
|
||||
@@ -19,7 +19,6 @@ PusherProxy::PusherProxy(const MediaSource::Ptr &src, int retry_count, const Eve
|
||||
: MediaPusher(src, poller) {
|
||||
_retry_count = retry_count;
|
||||
_on_close = [](const SockException &) {};
|
||||
_weak_src = src;
|
||||
_live_secs = 0;
|
||||
_live_status = 1;
|
||||
_republish_count = 0;
|
||||
@@ -52,7 +51,7 @@ void PusherProxy::publish(const string &dst_url) {
|
||||
strong_self->_on_publish = nullptr;
|
||||
}
|
||||
|
||||
auto src = strong_self->_weak_src.lock();
|
||||
auto src = strong_self->getSrc();
|
||||
if (!err) {
|
||||
// 推流成功 [AUTO-TRANSLATED:28ce6e56]
|
||||
// Stream successfully pushed
|
||||
@@ -87,7 +86,7 @@ void PusherProxy::publish(const string &dst_url) {
|
||||
TraceL << " live secs " << strong_self->_live_secs;
|
||||
}
|
||||
|
||||
auto src = strong_self->_weak_src.lock();
|
||||
auto src = strong_self->getSrc();
|
||||
// 推流异常中断,延时重试播放 [AUTO-TRANSLATED:e69e5a05]
|
||||
// Stream abnormally interrupted, retry playing with delay
|
||||
if (src && (*failed_cnt < strong_self->_retry_count || strong_self->_retry_count < 0)) {
|
||||
|
||||
@@ -77,7 +77,6 @@ private:
|
||||
std::atomic<int> _live_status;
|
||||
std::atomic<uint64_t> _live_secs;
|
||||
std::atomic<uint64_t> _republish_count;
|
||||
std::weak_ptr<MediaSource> _weak_src;
|
||||
std::function<void(const toolkit::SockException &ex)> _on_close;
|
||||
std::function<void(const toolkit::SockException &ex)> _on_publish;
|
||||
};
|
||||
|
||||
@@ -295,5 +295,15 @@ void RtpServer::updateSSRC(uint32_t ssrc) {
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t RtpServer::getSSRC() const {
|
||||
if (_ssrc) {
|
||||
return *_ssrc;
|
||||
}
|
||||
if (_tcp_server) {
|
||||
return (*_tcp_server)[RtpSession::kSSRC];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}//namespace mediakit
|
||||
#endif//defined(ENABLE_RTPPROXY)
|
||||
|
||||
@@ -97,6 +97,9 @@ public:
|
||||
*/
|
||||
void updateSSRC(uint32_t ssrc);
|
||||
|
||||
uint32_t getSSRC() const;
|
||||
int getOnlyTrack() const { return _only_track; }
|
||||
TcpMode getTcpMode() const { return _tcp_mode; }
|
||||
private:
|
||||
// tcp主动模式连接服务器成功回调 [AUTO-TRANSLATED:0775844e]
|
||||
// tcp active mode connection server success callback
|
||||
|
||||
Reference in New Issue
Block a user