增加获取媒体流播放器列表功能

This commit is contained in:
custompal
2022-08-30 21:05:19 +08:00
parent 679c79802f
commit 04aa3ef41f
12 changed files with 70 additions and 47 deletions

View File

@@ -65,6 +65,11 @@ public:
return _ring;
}
void getPlayerList(const std::function<void(const std::list<std::shared_ptr<void>> &info_list)> &cb,
const std::function<std::shared_ptr<void>(std::shared_ptr<void> &&info)> &on_change) override {
_ring->getInfoList(cb, on_change);
}
/**
* 获取播放器个数
*/

View File

@@ -836,6 +836,9 @@ void RtspSession::handleReq_Play(const Parser &parser) {
if (!_play_reader && _rtp_type != Rtsp::RTP_MULTICAST) {
weak_ptr<RtspSession> weakSelf = dynamic_pointer_cast<RtspSession>(shared_from_this());
_play_reader = play_src->getRing()->attach(getPoller(), useGOP);
_play_reader->setGetInfoCB([weakSelf]() { return weakSelf.lock(); });
_play_reader->setDetachCB([weakSelf]() {
auto strongSelf = weakSelf.lock();
if (!strongSelf) {