From 86bdafe86acaf7876d0d430b4274acf1969a8725 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=B1=EC=A2=85=EB=AF=BC/Tizen=20Platform=20Lab=28SR=29/?= =?utf8?q?=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 25 Sep 2023 13:47:08 +0900 Subject: [PATCH] refactor: enhance readability and macro scope --- .../include_internal/esplayer/esplayer.h | 14 ++++---- src/esplusplayer/src/esplayer.cpp | 38 +++++++++++----------- src/esplusplayer/src/esplusplayer_capi.cpp | 4 +-- ut/include/utils/utility.h | 2 +- ut/src/utils/utility.cpp | 2 +- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/esplusplayer/include_internal/esplayer/esplayer.h b/src/esplusplayer/include_internal/esplayer/esplayer.h index 175f67e..97d9d4a 100644 --- a/src/esplusplayer/include_internal/esplayer/esplayer.h +++ b/src/esplusplayer/include_internal/esplayer/esplayer.h @@ -21,7 +21,7 @@ #ifdef USE_MIXER #include "mixer/mixerticket.h" #include "mixer/mixerticket_eventlistener.h" -#endif +#endif // USE_MIXER #include "esplayer/espacket_logger.h" #include "esplayer/message.hpp" #include "esplayer/state_manager.hpp" @@ -69,7 +69,7 @@ class EsPlayer : public EsPlusPlayer { bool SetDisplay(const DisplayType& type, void* obj) override; #ifdef USE_MIXER bool SetDisplay(const DisplayType& type, MixerTicket* handle) override; -#endif +#endif // USE_MIXER bool SetDisplay(const DisplayType& type, void* ecore_wl2_window, const int x, const int y, const int w, const int h) override; bool SetDisplaySubsurface(const DisplayType& type, void* ecore_wl2_subsurface, @@ -217,7 +217,7 @@ class EsPlayer : public EsPlusPlayer { kpi::EsCodecLoggerKeys MakeKpiKeys_(); #ifdef USE_MIXER bool PrepareVideoMixingMode_(std::vector* tracks); -#endif +#endif // USE_MIXER void InitValuesFromIni_(); private: // private types @@ -249,7 +249,7 @@ class EsPlayer : public EsPlusPlayer { #ifdef USE_MIXER void OnMediaPacketVideoRawDecoded( const DecodedVideoRawModePacket& packet) override; -#endif +#endif // USE_MIXER private: void ReadyToPrepare_(const TrackType& type); @@ -279,7 +279,7 @@ class EsPlayer : public EsPlusPlayer { private: EsPlayer* handler_{nullptr}; }; -#endif +#endif // USE_MIXER private: std::vector track_; @@ -321,7 +321,7 @@ class EsPlayer : public EsPlusPlayer { new TrackRendererEventListener(this)}; #ifdef USE_MIXER std::unique_ptr mixer_event_listener_{new MixerListener(this)}; -#endif +#endif // USE_MIXER std::unique_ptr trackrenderer_; std::future preparetask_; PlayerAppInfo app_info_; @@ -342,7 +342,7 @@ class EsPlayer : public EsPlusPlayer { std::mutex audio_focus_m_; bool enable_audio_pipeline_handle_ = true; bool enable_rsc_alloc_handle_ = true; -#endif +#endif // USE_MIXER DecodedVideoFrameBufferType vidoe_frame_buffer_type_ = DecodedVideoFrameBufferType::kNone; // for debugging diff --git a/src/esplusplayer/src/esplayer.cpp b/src/esplusplayer/src/esplayer.cpp index 9f7805d..d097633 100644 --- a/src/esplusplayer/src/esplayer.cpp +++ b/src/esplusplayer/src/esplayer.cpp @@ -378,7 +378,7 @@ bool EsPlayer::Deactivate(const StreamType type) { this, "can't deactivate audio stream, mixer will control audio stream"); return false; } -#endif +#endif // USE_MIXER if (!trackrenderer_->Deactivate(static_cast(type))) { return false; } @@ -416,7 +416,7 @@ bool EsPlayer::Activate(const StreamType type) { "can't activate audio stream, mixer will control audio stream"); return false; } -#endif +#endif // USE_MIXER if (!track_.empty()) { auto has_track = [type](const Track& item) -> bool { return item.type == static_cast(type); @@ -438,16 +438,16 @@ bool EsPlayer::Activate(const StreamType type) { internal::MakeTrustZoneTracks(track_, app_info_.id); } SetTrackRendererAttributes_(); -#ifdef USE_MIXER if (type == StreamType::kVideo) { +#ifdef USE_MIXER if (mixer_ticket_) trackrenderer_->SetVideoFrameBufferType( VideoFrameTypeStrategyPtr(new RawVideoFrameTypeStrategy())); else +#endif // USE_MIXER trackrenderer_->SetVideoFrameBufferType(VideoFrameTypeStrategyPtr( new DefaultVideoFrameTypeStrategy(vidoe_frame_buffer_type_))); } -#endif if (!trackrenderer_->Activate(target->type, *target)) { target->active = false; return false; @@ -472,7 +472,7 @@ bool EsPlayer::DeactivateAudio() { this, "can't deactivate audio stream, mixer will control audio stream"); return false; } -#endif +#endif // USE_MIXER if (!trackrenderer_->DeactivateAudio()) { return false; } @@ -494,7 +494,7 @@ bool EsPlayer::ActivateAudio() { "can't activate audio stream, mixer will control audio stream"); return false; } -#endif +#endif // USE_MIXER if (track_.empty()) { return false; } @@ -534,7 +534,7 @@ bool EsPlayer::Stop() { ResetContextForStop_(); #ifdef USE_MIXER if (mixer_ticket_) mixer_ticket_.reset(); -#endif +#endif // USE_MIXER performance_checker::End(start, "Stop"); return true; }; @@ -649,7 +649,7 @@ bool EsPlayer::PrepareVideoMixingMode_(std::vector* tracks) { } return true; } -#endif +#endif // USE_MIXER // LCOV_EXCL_START bool EsPlayer::Prepare_() { @@ -692,7 +692,7 @@ bool EsPlayer::Prepare_() { } } } -#endif +#endif // USE_MIXER for (const auto& track : active_track) { switch (track.type) { case kTrackTypeAudio: { @@ -938,7 +938,7 @@ bool EsPlayer::SetDisplay(const DisplayType& type, void* obj) { } #ifdef USE_MIXER if (mixer_ticket_) mixer_ticket_.reset(); -#endif +#endif // USE_MIXER return trackrenderer_->SetDisplay(type, obj); } @@ -956,7 +956,7 @@ bool EsPlayer::SetDisplay(const DisplayType& type, MixerTicket* handle) { } return true; } -#endif +#endif // USE_MIXER bool EsPlayer::SetDisplay(const DisplayType& type, void* ecore_wl2_window, const int x, const int y, const int w, const int h) { @@ -967,7 +967,7 @@ bool EsPlayer::SetDisplay(const DisplayType& type, void* ecore_wl2_window, } #ifdef USE_MIXER if (mixer_ticket_) mixer_ticket_.reset(); -#endif +#endif // USE_MIXER return trackrenderer_->SetDisplay(type, ecore_wl2_window, x, y, w, h); } @@ -981,7 +981,7 @@ bool EsPlayer::SetDisplaySubsurface(const DisplayType& type, } #ifdef USE_MIXER if (mixer_ticket_) mixer_ticket_.reset(); -#endif +#endif // USE_MIXER return trackrenderer_->SetDisplaySubsurface(type, ecore_wl2_subsurface, x, y, w, h); } @@ -995,7 +995,7 @@ bool EsPlayer::SetDisplay(const DisplayType& type, unsigned int surface_id, } #ifdef USE_MIXER if (mixer_ticket_) mixer_ticket_.reset(); -#endif +#endif // USE_MIXER return trackrenderer_->SetDisplay(type, surface_id, x, y, w, h); } // LCOV_EXCL_START @@ -1029,7 +1029,7 @@ bool EsPlayer::SetDisplayRoi(const Geometry& roi) { #ifdef USE_MIXER mixerticket_roi_ = roi; if (mixer_ticket_) return true; -#endif +#endif // USE_MIXER return trackrenderer_->SetDisplayRoi(roi); } @@ -1085,7 +1085,7 @@ bool EsPlayer::SetDisplayVisible(bool is_visible) { is_visible_ = is_visible; return true; } -#endif +#endif // USE_MIXER return trackrenderer_->SetDisplayVisible(is_visible); } @@ -2057,7 +2057,7 @@ bool EsPlayer::SetVideoCodecType(const PlayerVideoCodecType& type) { video_decoding_mode_ = internal::kNdecodingMode; return true; } -#endif +#endif // USE_MIXER LOG_INFO_P(this, "PlayerVideoCodecType [%s]", (type == kPlayerVideoCodecTypeHW) ? "hardware" : "software"); video_codec_type_ = type; @@ -2145,7 +2145,7 @@ bool EsPlayer::SetAlternativeVideoResource(unsigned int rsc_type) { LOG_ERROR_P(this, "player can't control resource type, mixer will do it"); return false; } -#endif +#endif // USE_MIXER if (resource_alloc_policy_ > RscAllocPolicy::kRscAllocExclusive) { LOG_ERROR_P(this, "has set resource allocate policy, the alternative " @@ -2688,7 +2688,7 @@ bool EsPlayer::MixerListener::OnUpdateDisplayInfo(const DisplayInfo& cur_info, handler_->is_visible_ ? VisibleStatus::kVisible : VisibleStatus::kHide; return true; } -#endif +#endif // USE_MIXER // LCOV_EXCL_STOP void EsPlayer::TrackRendererEventListener::OnSeekData(const TrackType& type, diff --git a/src/esplusplayer/src/esplusplayer_capi.cpp b/src/esplusplayer/src/esplusplayer_capi.cpp index a5ec155..6e998f2 100644 --- a/src/esplusplayer/src/esplusplayer_capi.cpp +++ b/src/esplusplayer/src/esplusplayer_capi.cpp @@ -20,7 +20,7 @@ using esplusplayer::Geometry; #include "esplusplayer_capi/esplusplayer_internal.h" #if defined(USE_MIXER) && !defined(IS_TOMATO) #include "mixer_capi/mixer_capi.h" -#endif +#endif // defined(USE_MIXER) && !defined(IS_TOMATO) #include "esplusplayer/appinfo.h" #include "esplusplayer/audioeasinginfo.h" #include "esplusplayer/drm.h" @@ -1067,7 +1067,7 @@ int esplusplayer_set_display(esplusplayer_handle handle, return convert_return_type_( cast_(handle)->SetDisplay(static_cast(type), ticket)); } -#endif +#endif // defined(USE_MIXER) && !defined(IS_TOMATO) return convert_return_type_( cast_(handle)->SetDisplay(static_cast(type), window)); } diff --git a/ut/include/utils/utility.h b/ut/include/utils/utility.h index fce1d27..dfa0e93 100644 --- a/ut/include/utils/utility.h +++ b/ut/include/utils/utility.h @@ -110,7 +110,7 @@ class Utility { esplusplayer_handle GetStartedMixESPP(std::string& uri, mixer_handle mixer, esplusplayer::Geometry& roi); -#endif +#endif // USE_MIXER esplusplayer_handle GetOpenedESPP(esplusplayer::Geometry& roi); esplusplayer_handle GetPreparedESPP(std::string& uri, diff --git a/ut/src/utils/utility.cpp b/ut/src/utils/utility.cpp index 6c4db27..8e4ee44 100644 --- a/ut/src/utils/utility.cpp +++ b/ut/src/utils/utility.cpp @@ -119,7 +119,7 @@ esplusplayer_handle Utility::GetStartedMixESPP(std::string& uri, printf("esplusplayer_start failed\n"); return nullptr; } -#endif +#endif // USE_MIXER esplusplayer_handle Utility::GetOpenedESPP(Geometry& roi) { esplusplayer_handle player = esplusplayer_create(); -- 2.7.4