Merge pull request #88 from review-bot/reform/tizen-vault-esplusplayer-python-pep8...
author박현진/S/W Platform Lab(VD)/삼성전자 <hyunjin45.park@samsung.com>
Wed, 4 Oct 2023 05:09:12 +0000 (14:09 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 4 Oct 2023 05:09:12 +0000 (14:09 +0900)
Coding style for "Change to USE_MIXER macro" PR

src/esplusplayer/include_internal/esplayer/esplayer.h
src/esplusplayer/src/esplayer.cpp
src/esplusplayer/src/esplusplayer_capi.cpp
ut/include/utils/utility.h
ut/src/utils/utility.cpp

index 97d9d4a..3a4d077 100644 (file)
@@ -21,7 +21,7 @@
 #ifdef USE_MIXER
 #include "mixer/mixerticket.h"
 #include "mixer/mixerticket_eventlistener.h"
-#endif // USE_MIXER
+#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 // USE_MIXER
+#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<Track>* tracks);
-#endif // USE_MIXER
+#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 // USE_MIXER
+#endif  // USE_MIXER
 
    private:
     void ReadyToPrepare_(const TrackType& type);
@@ -279,7 +279,7 @@ class EsPlayer : public EsPlusPlayer {
    private:
     EsPlayer* handler_{nullptr};
   };
-#endif // USE_MIXER
+#endif  // USE_MIXER
 
  private:
   std::vector<Track> track_;
@@ -321,7 +321,7 @@ class EsPlayer : public EsPlusPlayer {
       new TrackRendererEventListener(this)};
 #ifdef USE_MIXER
   std::unique_ptr<MixerListener> mixer_event_listener_{new MixerListener(this)};
-#endif // USE_MIXER
+#endif  // USE_MIXER
   std::unique_ptr<TrackRendererAdapter> trackrenderer_;
   std::future<void> 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 // USE_MIXER
+#endif  // USE_MIXER
   DecodedVideoFrameBufferType vidoe_frame_buffer_type_ =
       DecodedVideoFrameBufferType::kNone;
   // for debugging
index d097633..cd82546 100644 (file)
@@ -378,7 +378,7 @@ bool EsPlayer::Deactivate(const StreamType type) {
         this, "can't deactivate audio stream, mixer will control audio stream");
     return false;
   }
-#endif // USE_MIXER
+#endif  // USE_MIXER
   if (!trackrenderer_->Deactivate(static_cast<TrackType>(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 // USE_MIXER
+#endif  // USE_MIXER
   if (!track_.empty()) {
     auto has_track = [type](const Track& item) -> bool {
       return item.type == static_cast<TrackType>(type);
@@ -444,7 +444,7 @@ bool EsPlayer::Activate(const StreamType type) {
         trackrenderer_->SetVideoFrameBufferType(
             VideoFrameTypeStrategyPtr(new RawVideoFrameTypeStrategy()));
       else
-#endif // USE_MIXER
+#endif  // USE_MIXER
         trackrenderer_->SetVideoFrameBufferType(VideoFrameTypeStrategyPtr(
             new DefaultVideoFrameTypeStrategy(vidoe_frame_buffer_type_)));
     }
@@ -472,7 +472,7 @@ bool EsPlayer::DeactivateAudio() {
         this, "can't deactivate audio stream, mixer will control audio stream");
     return false;
   }
-#endif // USE_MIXER
+#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 // USE_MIXER
+#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 // USE_MIXER
+#endif  // USE_MIXER
     performance_checker::End(start, "Stop");
     return true;
   };
@@ -649,7 +649,7 @@ bool EsPlayer::PrepareVideoMixingMode_(std::vector<Track>* tracks) {
   }
   return true;
 }
-#endif // USE_MIXER
+#endif  // USE_MIXER
 // LCOV_EXCL_START
 
 bool EsPlayer::Prepare_() {
@@ -692,7 +692,7 @@ bool EsPlayer::Prepare_() {
         }
       }
     }
-#endif // USE_MIXER
+#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 // USE_MIXER
+#endif  // USE_MIXER
   return trackrenderer_->SetDisplay(type, obj);
 }
 
@@ -956,7 +956,7 @@ bool EsPlayer::SetDisplay(const DisplayType& type, MixerTicket* handle) {
   }
   return true;
 }
-#endif // USE_MIXER
+#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 // USE_MIXER
+#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 // USE_MIXER
+#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 // USE_MIXER
+#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 // USE_MIXER
+#endif  // USE_MIXER
   return trackrenderer_->SetDisplayRoi(roi);
 }
 
@@ -1085,7 +1085,7 @@ bool EsPlayer::SetDisplayVisible(bool is_visible) {
     is_visible_ = is_visible;
     return true;
   }
-#endif // USE_MIXER
+#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 // USE_MIXER
+#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 // USE_MIXER
+#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 // USE_MIXER
+#endif  // USE_MIXER
 // LCOV_EXCL_STOP
 
 void EsPlayer::TrackRendererEventListener::OnSeekData(const TrackType& type,
index 6e998f2..209385e 100644 (file)
@@ -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 // defined(USE_MIXER) && !defined(IS_TOMATO)
+#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<DisplayType>(type), ticket));
   }
-#endif // defined(USE_MIXER) && !defined(IS_TOMATO)
+#endif  // defined(USE_MIXER) && !defined(IS_TOMATO)
   return convert_return_type_(
       cast_(handle)->SetDisplay(static_cast<DisplayType>(type), window));
 }
index dfa0e93..a34106b 100644 (file)
@@ -6,24 +6,22 @@
 
 #include <Ecore_Evas.h>
 
-#include "gmock/gmock.h"
-
-#include "core/utils/plusplayer_log.h"
-#include "esplusplayer_capi/esplusplayer_capi.h"
-#include "mixer_capi/mixer_capi.h"
-#include "esplusplayer/types/display.h"
-#include "ut/include/appwindow.h"
-
 #include <condition_variable>
 #include <functional>
 #include <future>
-
 #include <memory>
 #include <mutex>
 #include <string>
 #include <thread>
 #include <vector>
 
+#include "core/utils/plusplayer_log.h"
+#include "esplusplayer/types/display.h"
+#include "esplusplayer_capi/esplusplayer_capi.h"
+#include "gmock/gmock.h"
+#include "mixer_capi/mixer_capi.h"
+#include "ut/include/appwindow.h"
+
 #define DEFAULT_TIMEOUT_FOR_PREPARING (95 * 1000)
 #define DEFAULT_TIMEOUT_FOR_SEEKING (25 * 1000)
 #define EOS_WAIT_TIME 10000
@@ -35,11 +33,7 @@ namespace utils {
 class Utility;
 using evas_h = Evas_Object*;
 
-enum EsType {
-  kAudio = 0x01,
-  kVideo = 0x02,
-  kBoth = (kAudio | kVideo)
-};
+enum EsType { kAudio = 0x01, kVideo = 0x02, kBoth = (kAudio | kVideo) };
 
 class Utility {
  public:
@@ -52,7 +46,7 @@ class Utility {
   static std::vector<std::string> Split(std::string in, char delimiter);
   static bool IsChipset(const char* name);
   static esplusplayer_video_mime_type ConvertToMimeType(
-      const std::string &mimetype) {
+      const std::stringmimetype) {
     static std::unordered_map<std::string, esplusplayer_video_mime_type>
         kMimeTypeMap = {
             {"video/x-h264", ESPLUSPLAYER_VIDEO_MIME_TYPE_H264},
@@ -65,7 +59,7 @@ class Utility {
   }
 
   static esplusplayer_audio_mime_type ConvertToMimeType(
-      const std::string &mimetype, const std::string &format) {
+      const std::string& mimetype, const std::string& format) {
     if (mimetype.compare("audio/x-raw") == 0) {
       static std::unordered_map<std::string, esplusplayer_audio_mime_type>
           kPcmFormatMap = {
@@ -110,13 +104,14 @@ class Utility {
 
   esplusplayer_handle GetStartedMixESPP(std::string& uri, mixer_handle mixer,
                                         esplusplayer::Geometry& roi);
-#endif // USE_MIXER
+#endif  // USE_MIXER
   esplusplayer_handle GetOpenedESPP(esplusplayer::Geometry& roi);
 
   esplusplayer_handle GetPreparedESPP(std::string& uri,
                                       esplusplayer::Geometry& roi);
 
-  esplusplayer_handle GetStartedESPP(std::string& uri, esplusplayer::Geometry& roi);
+  esplusplayer_handle GetStartedESPP(std::string& uri,
+                                     esplusplayer::Geometry& roi);
 
   bool PrepareESPP(esplusplayer_handle player, std::string& uri,
                    EsType type = EsType::kBoth);
@@ -132,16 +127,16 @@ class Utility {
   int CaptureYUV(int capture_width, int capture_height, char* ybuff,
                  char* cbuff, int ysize, int csize,
                  std::string result_file_path);
-  
+
   int CaptureJPG(const int capture_width, const int capture_height, char* ybuff,
                  char* cbuff, const int ysize, const int csize,
                  std::string img_file_path);
-  
+
   int CheckYUV(int x, int y);
   bool IsAudioDisconnected();
-  bool IsAudioConnected() {return !IsAudioDisconnected();}
+  bool IsAudioConnected() { return !IsAudioDisconnected(); }
   bool IsAudioMute();
-  bool IsAudioUnmute() {return !IsAudioMute();}
+  bool IsAudioUnmute() { return !IsAudioMute(); }
   int GetPlayingTimeForManualTestInMsec();
 
   Utility(const Utility& rhs) = delete;
@@ -156,16 +151,9 @@ class Utility {
   DiagnosisAudioControl* audioDiagnoser = nullptr;
 };
 
-enum class WatcherStatus {
-  kSuccess,
-  kFail
-};
+enum class WatcherStatus { kSuccess, kFail };
 
-enum PrepareStatus {
-  kReady,
-  kSuccess,
-  kFail
-};
+enum PrepareStatus { kReady, kSuccess, kFail };
 
 static const int TIMEOUT_10_SEC = 10 * 1000;
 
index 8e4ee44..65ba9c3 100644 (file)
@@ -1,33 +1,33 @@
+#include "ut/include/utils/utility.h"
+
 #include <Ecore.h>
 #include <Elementary.h>
+#include <capi-system-info/system_info.h>
+#include <capi-system-info/system_info_key.h>
 #include <gtest/gtest.h>
+#include <jconfig.h>
+#include <jpeglib.h>
+#include <math.h>
+#include <poll.h>
+#include <system-type/system_type_enum.h>
+#include <unistd.h>
+
 #include <algorithm>
 #include <cassert>
 #include <chrono>
+#include <fstream>
 #include <memory>
 
-#include <unistd.h>
-#include <poll.h>
-
-#include "ut/include/utils/utility.h"
-#include "ut/include/esplusplayer/eseventlistener.hpp"
-#include "ut/include/esplusplayer/esreader.hpp"
-
-#include <math.h>
-#include <fstream>
-#include <jconfig.h>
-#include <jpeglib.h>
-#include <capi-system-info/system_info.h>
-#include <capi-system-info/system_info_key.h>
-#include <system-type/system_type_enum.h>
-#include "ivideocapture.hpp"
 #include "capi-video-capture.h"
-#include "iaudio-control.hpp"
 #include "diagnosis-audio-control.hpp"
+#include "iaudio-control.hpp"
+#include "ivideocapture.hpp"
+#include "ut/include/esplusplayer/eseventlistener.hpp"
+#include "ut/include/esplusplayer/esreader.hpp"
 
 using namespace std;
 using namespace esplusplayer;
-//using namespace tc;
+// using namespace tc;
 using UserData = void*;
 
 namespace utils {
@@ -119,7 +119,7 @@ esplusplayer_handle Utility::GetStartedMixESPP(std::string& uri,
     printf("esplusplayer_start failed\n");
   return nullptr;
 }
-#endif // USE_MIXER
+#endif  // USE_MIXER
 
 esplusplayer_handle Utility::GetOpenedESPP(Geometry& roi) {
   esplusplayer_handle player = esplusplayer_create();
@@ -196,7 +196,7 @@ void Utility::FeedingEsPacket(esplusplayer_handle player,
       memset(&pkt, 0, sizeof(esplusplayer_es_packet));
       if (!reader->ReadNextPacket(pkt)) break;
       esplusplayer_submit_packet(player, &pkt);
-      delete []pkt.buffer;
+      delete[] pkt.buffer;
     }
   };
   if (type == ESPLUSPLAYER_STREAM_TYPE_VIDEO) {
@@ -267,9 +267,8 @@ unsigned int Gcd(unsigned int u, unsigned int v) {
 }
 
 void ResizeCopy(unsigned int m_width, unsigned int m_height,
-                unsigned int m_rwidth, unsigned int m_rheight,
-                char* c_ptr, char* y_ptr, unsigned char* dest,
-                unsigned int color_format) {
+                unsigned int m_rwidth, unsigned int m_rheight, char* c_ptr,
+                char* y_ptr, unsigned char* dest, unsigned int color_format) {
   unsigned int omit = 1;
   unsigned int x = 0;
   unsigned int y = 0;
@@ -289,7 +288,6 @@ void ResizeCopy(unsigned int m_width, unsigned int m_height,
   for (y = 0; y < m_height; y++) {
     if ((y + 1) % omit || !resize) {
       for (x = 0; x < m_width; x += sizeof(unsigned int)) {
-
         unsigned int Yplain =
             *((unsigned int*)((void*)(y_ptr + y * m_width + x)));
         unsigned int Cplain =
@@ -308,13 +306,13 @@ void ResizeCopy(unsigned int m_width, unsigned int m_height,
             break;
         }
         if ((x + 4) % omit || !resize) {
-          dest[inc++] = (Yplain) & 0xFF;
+          dest[inc++] = (Yplain)&0xFF;
           dest[inc++] = Cplain & 0xFF;
           dest[inc++] = (Cplain >> 8) & 0xFF;
         }
         if ((x + 3) % omit || !resize) {
           dest[inc++] = (Yplain >> 8) & 0xFF;
-          dest[inc++] = (Cplain) & 0xFF;
+          dest[inc++] = (Cplain)&0xFF;
           dest[inc++] = (Cplain >> 8) & 0xFF;
         }
 
@@ -334,14 +332,14 @@ void ResizeCopy(unsigned int m_width, unsigned int m_height,
   }
 }
 
-int Utility::CaptureYUV(int capture_width, int capture_height,
-                        char* ybuff, char* cbuff, int ysize,
-                        int csize, std::string result_file_path) {
+int Utility::CaptureYUV(int capture_width, int capture_height, char* ybuff,
+                        char* cbuff, int ysize, int csize,
+                        std::string result_file_path) {
   // screen capture
   IVideoCapture* VCObjptr = IVideoCapture::getInstance();
 
   IVideoCapture::InputParams input_params;
-  
+
   input_params.capture_w = capture_width;
   input_params.capture_h = capture_height;
 
@@ -372,7 +370,8 @@ int Utility::CaptureYUV(int capture_width, int capture_height,
 
   return 0;
 }
-///TODO:: Modify the API to return the pointer instead of writing it as an image file.
+/// TODO:: Modify the API to return the pointer instead of writing it as an
+/// image file.
 int Utility::CaptureJPG(const int capture_width, const int capture_height,
                         char* ybuff, char* cbuff, const int ysize,
                         const int csize, std::string img_file_path) {
@@ -450,7 +449,6 @@ int Utility::CaptureJPG(const int capture_width, const int capture_height,
 }
 
 int Utility::CheckYUV(int x, int y) {
-
   /* screen capture */
   IVideoCapture* VCObjptr = IVideoCapture::getInstance();
 
@@ -459,7 +457,7 @@ int Utility::CheckYUV(int x, int y) {
   int CAPTURE_BUF_SIZE = CAPTURE_WIDTH * CAPTURE_HEIGHT;
   char ybuff[CAPTURE_BUF_SIZE] = {0};
   char cbuff[CAPTURE_BUF_SIZE] = {0};
-  
+
   IVideoCapture::InputParams input_params;
   input_params.capture_w = 640;
   input_params.capture_h = 360;
@@ -474,11 +472,12 @@ int Utility::CheckYUV(int x, int y) {
 
   VCObjptr->getVideoPostYUV(input_params, output_params);
 
-  /* check YUV value. As the capture size (640 x 360) is mapped with the full screen (1920 x 1080), the position should be resized. */
+  /* check YUV value. As the capture size (640 x 360) is mapped with the full
+   * screen (1920 x 1080), the position should be resized. */
   int new_X = x / 3;
   int new_Y = y / 3;
   int position = CAPTURE_WIDTH * (new_Y - 1) + new_X;
-  
+
   LOGE("Y value : %d", (int)ybuff[position]);
   return (int)ybuff[position];
 }
@@ -491,7 +490,8 @@ bool Utility::IsAudioDisconnected() {
 
 bool Utility::IsAudioMute() {
   long audioMute = 0;
-  EXPECT_EQ(audioDiagnoser->Diagnosis_GetBoolean(0, "main out mute", &audioMute), 0);
+  EXPECT_EQ(
+      audioDiagnoser->Diagnosis_GetBoolean(0, "main out mute", &audioMute), 0);
   return (audioMute != 0);
 }
 
@@ -522,10 +522,10 @@ bool Utility::IsChipset(const char* name) {
 }
 
 std::string Utility::getKeyboardInput(int timeoutMsec) {
-  struct pollfd pfd = { STDIN_FILENO, POLLIN, 0 };
+  struct pollfd pfd = {STDIN_FILENO, POLLIN, 0};
   std::string line = "";
   int ret = poll(&pfd, 1, timeoutMsec);
-  if(ret == 1) {// there is something to read
+  if (ret == 1) {  // there is something to read
     std::getline(std::cin, line);
   }
   return line;
@@ -549,7 +549,7 @@ vector<string> Utility::Split(string in, char delimiter) {
   while (getline(ss, line)) {
     stringstream liness(line);
     string token;
-    while(getline(liness, token, delimiter)) {
+    while (getline(liness, token, delimiter)) {
       if (!token.empty()) {
         result.push_back(token);
       }