mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-20 15:22:22 +08:00
统一成员变量命名风格
This commit is contained in:
@@ -43,22 +43,22 @@ MediaPlayer::~MediaPlayer() {
|
||||
}
|
||||
void MediaPlayer::play(const char* strUrl) {
|
||||
string strPrefix = FindField(strUrl, NULL, "://");
|
||||
if ((strcasecmp(m_strPrefix.data(),strPrefix.data()) != 0) || strPrefix.empty()) {
|
||||
if ((strcasecmp(_strPrefix.data(),strPrefix.data()) != 0) || strPrefix.empty()) {
|
||||
//协议切换
|
||||
m_strPrefix = strPrefix;
|
||||
m_parser = PlayerBase::createPlayer(strUrl);
|
||||
m_parser->setOnShutdown(m_shutdownCB);
|
||||
_strPrefix = strPrefix;
|
||||
_parser = PlayerBase::createPlayer(strUrl);
|
||||
_parser->setOnShutdown(_shutdownCB);
|
||||
//todo(xzl) 修复此处
|
||||
// m_parser->setOnVideoCB(m_onGetVideoCB);
|
||||
// m_parser->setOnAudioCB(m_onGetAudioCB);
|
||||
// _parser->setOnVideoCB(_onGetVideoCB);
|
||||
// _parser->setOnAudioCB(_onGetAudioCB);
|
||||
}
|
||||
m_parser->setOnPlayResult(m_playResultCB);
|
||||
m_parser->mINI::operator=(*this);
|
||||
m_parser->play(strUrl);
|
||||
_parser->setOnPlayResult(_playResultCB);
|
||||
_parser->mINI::operator=(*this);
|
||||
_parser->play(strUrl);
|
||||
}
|
||||
|
||||
TaskExecutor::Ptr MediaPlayer::getExecutor(){
|
||||
auto parser = dynamic_pointer_cast<SocketHelper>(m_parser);
|
||||
auto parser = dynamic_pointer_cast<SocketHelper>(_parser);
|
||||
if(!parser){
|
||||
return nullptr;
|
||||
}
|
||||
@@ -66,14 +66,14 @@ TaskExecutor::Ptr MediaPlayer::getExecutor(){
|
||||
}
|
||||
|
||||
void MediaPlayer::pause(bool bPause) {
|
||||
if (m_parser) {
|
||||
m_parser->pause(bPause);
|
||||
if (_parser) {
|
||||
_parser->pause(bPause);
|
||||
}
|
||||
}
|
||||
|
||||
void MediaPlayer::teardown() {
|
||||
if (m_parser) {
|
||||
m_parser->teardown();
|
||||
if (_parser) {
|
||||
_parser->teardown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
void teardown() override;
|
||||
TaskExecutor::Ptr getExecutor();
|
||||
private:
|
||||
string m_strPrefix;
|
||||
string _strPrefix;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -101,73 +101,73 @@ public:
|
||||
PlayerImp(){}
|
||||
virtual ~PlayerImp(){}
|
||||
void setOnShutdown(const function<void(const SockException &)> &cb) override {
|
||||
if (m_parser) {
|
||||
m_parser->setOnShutdown(cb);
|
||||
if (_parser) {
|
||||
_parser->setOnShutdown(cb);
|
||||
}
|
||||
m_shutdownCB = cb;
|
||||
_shutdownCB = cb;
|
||||
}
|
||||
void setOnPlayResult(const function<void(const SockException &ex)> &cb) override {
|
||||
if (m_parser) {
|
||||
m_parser->setOnPlayResult(cb);
|
||||
if (_parser) {
|
||||
_parser->setOnPlayResult(cb);
|
||||
}
|
||||
m_playResultCB = cb;
|
||||
_playResultCB = cb;
|
||||
}
|
||||
|
||||
bool isInited() const override{
|
||||
if (m_parser) {
|
||||
return m_parser->isInited();
|
||||
if (_parser) {
|
||||
return _parser->isInited();
|
||||
}
|
||||
return PlayerBase::isInited();
|
||||
}
|
||||
float getDuration() const override {
|
||||
if (m_parser) {
|
||||
return m_parser->getDuration();
|
||||
if (_parser) {
|
||||
return _parser->getDuration();
|
||||
}
|
||||
return PlayerBase::getDuration();
|
||||
}
|
||||
float getProgress() const override{
|
||||
if (m_parser) {
|
||||
return m_parser->getProgress();
|
||||
if (_parser) {
|
||||
return _parser->getProgress();
|
||||
}
|
||||
return PlayerBase::getProgress();
|
||||
}
|
||||
void seekTo(float fProgress) override{
|
||||
if (m_parser) {
|
||||
return m_parser->seekTo(fProgress);
|
||||
if (_parser) {
|
||||
return _parser->seekTo(fProgress);
|
||||
}
|
||||
return PlayerBase::seekTo(fProgress);
|
||||
}
|
||||
|
||||
void setMediaSouce(const MediaSource::Ptr & src) override {
|
||||
if (m_parser) {
|
||||
return m_parser->setMediaSouce(src);
|
||||
if (_parser) {
|
||||
return _parser->setMediaSouce(src);
|
||||
}
|
||||
m_pMediaSrc = src;
|
||||
_pMediaSrc = src;
|
||||
}
|
||||
|
||||
vector<Track::Ptr> getTracks() const override{
|
||||
if (m_parser) {
|
||||
return m_parser->getTracks();
|
||||
if (_parser) {
|
||||
return _parser->getTracks();
|
||||
}
|
||||
return PlayerBase::getTracks();
|
||||
}
|
||||
protected:
|
||||
void onShutdown(const SockException &ex) override {
|
||||
if (m_shutdownCB) {
|
||||
m_shutdownCB(ex);
|
||||
if (_shutdownCB) {
|
||||
_shutdownCB(ex);
|
||||
}
|
||||
}
|
||||
void onPlayResult(const SockException &ex) override {
|
||||
if (m_playResultCB) {
|
||||
m_playResultCB(ex);
|
||||
m_playResultCB = nullptr;
|
||||
if (_playResultCB) {
|
||||
_playResultCB(ex);
|
||||
_playResultCB = nullptr;
|
||||
}
|
||||
}
|
||||
protected:
|
||||
function<void(const SockException &ex)> m_shutdownCB;
|
||||
function<void(const SockException &ex)> m_playResultCB;
|
||||
std::shared_ptr<Parser> m_parser;
|
||||
MediaSource::Ptr m_pMediaSrc;
|
||||
function<void(const SockException &ex)> _shutdownCB;
|
||||
function<void(const SockException &ex)> _playResultCB;
|
||||
std::shared_ptr<Parser> _parser;
|
||||
MediaSource::Ptr _pMediaSrc;
|
||||
};
|
||||
|
||||
} /* namespace Player */
|
||||
|
||||
Reference in New Issue
Block a user