Remove unused code 19/314219/2
authorGilbok Lee <gilbok.lee@samsung.com>
Tue, 9 Jul 2024 03:36:16 +0000 (12:36 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Tue, 9 Jul 2024 03:38:56 +0000 (12:38 +0900)
[Version] 0.0.56
[Issue Type] Refactoring

Change-Id: I559ff3503dc28549a9c697c63f5b3353b6a5da8a

packaging/libtrackrenderer.spec
src/CMakeLists.txt
src/display.cpp
src/gstcaps_builder.cpp
src/include_internal/trackrenderer/core/pipeline.hpp
src/pipeline.cpp [deleted file]
src/trackrenderer.cpp
src/trackrenderer_capi.cpp

index 58dfaccdf8732f383c469a5c98adfdbc8a5209f9..d87f3fafc8bb6b0dec2c73a839f90de1c4246d3b 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libtrackrenderer
 Summary:    new multimedia streaming player trackrenderer
-Version:    0.0.55
+Version:    0.0.56
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 8db72275bf2edfcd4f79611b2967a3a37881d32a..85bd4b832df1deb1b252a3cab1dbb77daa829a7a 100644 (file)
@@ -54,7 +54,6 @@ SET(CC_SRCS
   ${PROJECT_SOURCE_DIR}/trackrenderer_capi_utils.cpp
   ${PROJECT_SOURCE_DIR}/trackrenderer_debug.cpp
   ${PROJECT_SOURCE_DIR}/gstcaps_builder.cpp
-  ${PROJECT_SOURCE_DIR}/pipeline.cpp
   ${PROJECT_SOURCE_DIR}/decoderinputbuffer.cpp
   ${PROJECT_SOURCE_DIR}/gst_utils.cpp
   ${PROJECT_SOURCE_DIR}/gstobject_guard.cpp
index 0f67bce4eef6f98a8622f2fe3bf3dd9da417767c..d482cd0e86ae5f7f5cb572110faf4b1964432ea0 100644 (file)
@@ -324,7 +324,7 @@ bool Display::SetDisplay_(const DisplayType& type,
     return false;
   }
 
-  // TODO(euna7.ko) what is mean??
+  // TODO what is mean??
   // wl_window is based on app window(param display).
   // App window already move, so do not need to move wl_window
   // x = 0;
@@ -337,7 +337,7 @@ bool Display::SetDisplay_(const DisplayType& type,
 bool Display::SetDisplay(const DisplayType& type, const uint32_t surface_id,
                          const int x, const int y, const int w, const int h) {
   TRACKRENDERER_ENTER;
-  // TODO(euna7.ko) State should not be idle.
+  // TODO State should not be idle.
   // unsigned int pre_surface_id = surface_id_;   // for backup previouse info.
   std::lock_guard<std::mutex> lock(settings_mutex_);
   TRACKRENDERER_INFO("type: %d, surface_id: %d, x(%d) y(%d) w(%d) h(%d)",
@@ -360,7 +360,7 @@ bool Display::SetDisplay(const DisplayType& type, const uint32_t surface_id,
     window_.w = w;
     window_.h = h;
   } else {
-    // TODO(euna7.ko)
+    // TODO
     // changing surface case
     // ret = mm_player_change_videosink(handle->mm_handle, mmType, set_handle);
     // if( ret != true) {
@@ -370,7 +370,7 @@ bool Display::SetDisplay(const DisplayType& type, const uint32_t surface_id,
     // }
   }
 
-  // TODO(euna7.ko) if We need to change window, how can we update it??
+  // TODO if We need to change window, how can we update it??
   // display_->Update(pipeline_->video_sink);
 
   TRACKRENDERER_LEAVE;
index 4be0340f648e210f6a2c63f82e014451f5740639..41b298429607ef0f2eb40da8b2756a1d1f158004 100644 (file)
@@ -52,12 +52,8 @@ static GstBuffer* MakeGstBufferWithCodecData(const std::shared_ptr<char>& data,
 }
 
 static const std::string GetMediaType(const Track& track) {
-  std::string media_type =
-      track.streamtype.empty() ? track.mimetype : track.streamtype;
-  if (media_type.find("_tz") != std::string::npos) {
-    media_type = media_type.substr(0, media_type.size() - 3);
-  }
-  return media_type;
+  return track.streamtype.empty() ?
+    track.mimetype : track.streamtype;
 }
 
 static const std::string GetCapsName(const std::string media_type,
@@ -183,11 +179,6 @@ static void FillCodecData(const GstCapsWrapper& caps, const Track& track) {
   gst_buffer_unref(codec_data);
 }
 
-static void FillSecureField(const GstCapsWrapper& caps, const Track& track) {
-  if (track.mimetype.find("_tz") == std::string::npos) return;
-  caps.SetValue("secure", G_TYPE_BOOLEAN, TRUE);
-}
-
 static void FillChannelMaskField(const GstCapsWrapper& caps,
                                  const Track& track) {
   GstAudioChannelPosition position[64];
@@ -269,7 +260,6 @@ GstCapsWrapper GstCapsBuilder::Build(const Track& track, bool is_drm) {
   internal::FillCodecData(caps, track);
   internal::FillStreamFormat(caps, track);
   internal::FillDrmInfo(caps, track);
-  internal::FillSecureField(caps, track);
   internal::FillChannelMaskField(caps, track);
 
   caps.PrintCapsString();
@@ -292,10 +282,7 @@ GstCapsWrapper GstCapsBuilder::BuildOrgMediaType(const Track& track, bool is_drm
   FillDefaultValue_(caps, track);
   internal::FillStreamType(caps, track);
   internal::FillCodecData(caps, track);
-
   internal::FillStreamFormat(caps, track);
-
-  internal::FillSecureField(caps, track);
   internal::FillChannelMaskField(caps, track);
 
   caps.PrintCapsString();
index 28140de0ffcf3df99d11acdeb07a4952ec612d62..78bd51ed9f92cdbc7eb935c4c4a555ad3aafd256 100644 (file)
@@ -44,13 +44,6 @@ namespace plusplayer {
 
 namespace trackrenderer {
 
-namespace trustzone {
-
-bool InitTzAppsrc();
-bool GstAppsrcPushBuffer(GstElement* appsrc, GstBuffer* buffer);
-
-}  // namespace trustzone
-
 namespace pipeline_internal {
 
 inline GstElement* GetLastObj(GstElement* bin) {
@@ -114,11 +107,6 @@ class Pipeline : private boost::noncopyable {
     }
     GstElement* obj = gst_element_factory_make(name, nickname);
 
-    if (strstr(name, "tzappsrc")) {
-      is_trustzone_element_[static_cast<int>(element)] = true;
-      if (!InitTzAppsrc_()) return false;
-    }
-
     if (!obj) {
       TRACKRENDERER_ERROR("Fail to create element [%s]", name);
       return false;
@@ -474,11 +462,7 @@ class Pipeline : private boost::noncopyable {
     int index = static_cast<int>(type);
     GstElement* obj = mainbin_[index];
     if (!obj) return false;
-    if (is_trustzone_element_[index]) {
-      trustzone::GstAppsrcPushBuffer(obj, buffer);
-    } else {
-      gst_app_src_push_buffer(GST_APP_SRC(obj), buffer);
-    }
+    gst_app_src_push_buffer(GST_APP_SRC(obj), buffer);
 
     return true;
   }
@@ -688,8 +672,6 @@ class Pipeline : private boost::noncopyable {
     return true;
   }
 
-  bool InitTzAppsrc_() { return trustzone::InitTzAppsrc(); }
-
  private:
   using PadProbeMap =
       std::unordered_map<std::string, std::pair<gulong, GstPad*>>;
diff --git a/src/pipeline.cpp b/src/pipeline.cpp
deleted file mode 100644 (file)
index aaefad8..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "trackrenderer/core/pipeline.hpp"
-
-#include <dlfcn.h>
-
-#include <cassert>
-
-namespace plusplayer {
-
-namespace trackrenderer {
-
-namespace trustzone {
-
-#define GSTREAMER_PLUGIN_LIB(NAME) "/usr/lib/gstreamer-1.0/" #NAME
-
-static std::once_flag lib_loaded;
-static void* tzappsrc_lib = nullptr;
-using TzAppsrcPushBuffer = int(*)(void* appsrc, void* buffer);
-static TzAppsrcPushBuffer tz_appsrc_push_buffer;
-
-bool InitTzAppsrc() {
-  bool retval = true;
-  auto loadlib = [](bool& ret) {
-    tzappsrc_lib = dlopen(GSTREAMER_PLUGIN_LIB(libgsttzappsrc.so), RTLD_LAZY);
-    if (!tzappsrc_lib) {
-      TRACKRENDERER_ERROR("libgsttzappsrc.so open failed: %s", dlerror());
-      assert(0);
-      ret = false;
-      return;
-    }
-    tz_appsrc_push_buffer =
-        (TzAppsrcPushBuffer)dlsym(tzappsrc_lib, "gst_tz_app_src_push_buffer");
-    if (!tz_appsrc_push_buffer) {
-      TRACKRENDERER_ERROR("Failed to import gst_tz_app_src_push_buffer");
-      assert(0);
-      ret = false;
-      return;
-    }
-  };
-  std::call_once(lib_loaded, loadlib, retval);
-  return retval;
-}
-
-bool GstAppsrcPushBuffer(GstElement* appsrc, GstBuffer* buffer) {
-  if(tz_appsrc_push_buffer(appsrc,buffer) != GST_FLOW_OK) {
-    return false;
-  }
-  return true;
-}
-
-} // namespace trustzone
-
-}  // namespace trackrenderer
-
-}  // namespace plusplayer
index 8fb453809862d0cc2de24e00bb2332b9061bd468..809a8f92d52fb22313a356f26ffc5f3c9bb63f00 100644 (file)
@@ -59,27 +59,6 @@ const char kFakeSinkName[] = "fakesink";
 const char kVideoSinkName[] = "tizenwlsink";
 const char kAudioSinkName[] = "pulsesink";
 
-// Hw clock
-#ifndef PR_TASK_PERF_USER_TRACE
-#define PR_TASK_PERF_USER_TRACE 666
-#endif
-
-constexpr int kBufSize = 256;
-inline void PerfUsrTrace(const char* arg = nullptr) {
-  char buf[kBufSize]{
-      0,
-  };
-  const char* prefix_str = "[PERF][MMPLAYER]";
-  bool use_arg{false};
-  if (arg) {
-    if (strlen(arg) < (kBufSize - strlen(prefix_str))) {
-      use_arg = true;
-    }
-  }
-  snprintf(buf, kBufSize, "%s %s", prefix_str, (use_arg ? arg : ""));
-  prctl(PR_TASK_PERF_USER_TRACE, buf, strlen(buf));
-}
-
 }  // namespace
 
 namespace plusplayer {
@@ -124,58 +103,22 @@ TrackEncryptionUnit GetTrackEncryptionUnit(drm::Type type) {
   return TrackEncryptionUnit::kNone;
 }
 
-inline bool IsFhdOrLowerResolution(int width, int height, int max_w,
-                                   int max_h) {
-  int w = max_w ? max_w : width;
-  int h = max_h ? max_h : height;
-  if ((w <= kMaxFhdWidth && h <= kMaxFhdHeight) ||
-      (w <= kMaxFhdHeight && h <= kMaxFhdWidth))
-    return true;
-  TRACKRENDERER_ERROR("w:%d, h:%d, mw:%d, mh:%d!", width, height, max_w, max_h);
-  return false;
-}
-
-inline bool IsUhdResolution(int w, int h) {
-  return ((w > kMaxFhdWidth || h > kMaxFhdHeight) &&
-          (w <= kMaxUhdWidth && h <= kMaxUhdHeight));
-}
-
-inline bool IsUhd8kResolution(int w, int h) {
-  return (w > kMaxUhdWidth || h > kMaxUhdHeight);
-}
-
-inline bool IsTzMimeType(const std::string& mimetype) {  // useful when external
-                                                         // audio is present in
-  // verimatrix case as trustzone is not used in this case
-  return (mimetype.find("_tz") != std::string::npos);
-}
-
 inline bool IsExternalDecryptionCase(const drm::Property& property) {
   return property.external_decryption;
 }
 
-inline bool IsTzAppSrcElementNecessary(const drm::Property& property,
-                                       const std::string& mimetype) {
-  return IsTzMimeType(mimetype);
-}
-
 inline bool IsDrmEmeElementNecessary(const drm::Property& property,
                                      const std::string& mimetype) {
   // Some Apps call setDrm even for plain content (mostly trailers),
   // but main contents are Drm protected. So we need to check drm_type
   // as well as mime_type for plain/drm content. (Example app: Stan/Chili)
-  return (GetTrackEncryptionUnit(property.type) == TrackEncryptionUnit::kEs &&
-          IsTzMimeType(mimetype));
+  return (GetTrackEncryptionUnit(property.type) == TrackEncryptionUnit::kEs);
 }
 
 inline bool IsDecryptorElementNecessary(const drm::Property& property) {
   return (property.type == drm::Type::kClearkey);
 
 }
-inline bool IsTzDecoderElementNecessary(const drm::Property& property,
-                                        const std::string& mimetype) {
-  return IsTzMimeType(mimetype);
-}
 
 inline bool IsDecoderElementNecessary(const std::string& mimetype) {
   return !IsPcmMimeType(mimetype);
@@ -475,11 +418,7 @@ bool TrackRenderer::Start() {
   if (!pipeline_) {
     return false;
   }
-  /*
-    if(still_mode_type_ == StillMode::kOff) {
-      pipeline_->SetProperty(Elements::kSinkVideo, "still-mode", FALSE);
-    }
-  */
+
   if (state_ < State::kWorking) return false;
   target_substate_ = SubState::kPlaying;
   pipeline_->SetState(Elements::kPipeline, GST_STATE_PLAYING);
@@ -507,11 +446,7 @@ bool TrackRenderer::Stop() {
     TRACKRENDERER_LEAVE;
     return true;
   }
-  /*
-    if(still_mode_type_ == StillMode::kOn) {
-      pipeline_->SetProperty(Elements::kSinkVideo, "still-mode", TRUE);
-    }
-  */
+
   TRACKRENDERER_INFO("Set pipeline state to GST_STATE_NULL.");
   pipeline_->SetState(Elements::kPipeline, GST_STATE_NULL);
   ReleaseResource_();
@@ -660,19 +595,14 @@ bool TrackRenderer::Seek(uint64_t time,
   if (!pipeline_) {
     return false;
   }
-  // mute off/on values are defined in mmaudiosink element
-  static const int mute_off = 2;
-  static const int mute_on = 3;
 
   // get user setting
   bool is_mute = false;
   pipeline_->GetProperty(Elements::kSinkAudio, "mute", &is_mute);
 
-  int mute_flag = is_mute ? mute_on : mute_off;
-
   gboolean async = TRUE;
   if (playback_rate != kDefaultPlaybackRate) {
-    mute_flag = mute_on;
+    is_mute = true;
     async = FALSE;
   }
 
@@ -680,10 +610,10 @@ bool TrackRenderer::Seek(uint64_t time,
   auto is_audio_track = [](const Track& item) noexcept -> bool {
     return item.mimetype.find("audio") != std::string::npos;
   };
+
   auto target = find_if(trackinfo_.begin(), trackinfo_.end(), is_audio_track);
   if (target != trackinfo_.end()) {
-    pipeline_->SetProperty(Elements::kSinkAudio, "mute", mute_flag % 2,
-                           "async", async);
+    pipeline_->SetProperty(Elements::kSinkAudio, "mute", is_mute, "async", async);
   }
 
   gint64 start = time_converter_->timeToNs_(time), stop = GST_CLOCK_TIME_NONE;
@@ -912,24 +842,6 @@ TrackType TrackRenderer::GetTrackType_(GstElement* element) {
   return type;
 }
 
-bool TrackRenderer::SetMatroskaColorInfo(const std::string& color_info) {
-  TRACKRENDERER_ENTER;
-  std::unique_lock<std::mutex> lock(resource_m_);
-  if (state_ == State::kStopped) return false;
-  if (pipeline_ == nullptr) return false;
-  GstCaps* old_caps = nullptr;
-  pipeline_->GetProperty(Elements::kAppSrcVideo, "caps", &old_caps);
-  if (old_caps == nullptr) return false;
-  auto old_caps_guard = gstguard::make_guard(old_caps);
-  auto new_caps_guard = gstguard::make_guard(gst_caps_copy(old_caps));
-  gst_caps_set_simple(new_caps_guard.get(), "matroska_color_info",
-                      G_TYPE_STRING, color_info.c_str(), nullptr);
-  pipeline_->SetProperty(Elements::kSinkVideo, "video-color-info",
-                         new_caps_guard.get());
-  pipeline_->SetProperty(Elements::kAppSrcVideo, "caps", new_caps_guard.get());
-  return true;
-}
-
 void TrackRenderer::CreateAppSrc_(TrackType type, const GstCaps* caps) {
   TRACKRENDERER_ENTER;
 
@@ -2566,7 +2478,7 @@ void TrackRenderer::SetVolume_() {
     return;
   }
   if (strstr(sink_name, kAudioSinkName)) {
-    pipeline_->SetProperty(Elements::kSinkAudio, "volume", (volume_/100.0));
+    pipeline_->SetProperty(Elements::kSinkAudio, "volume", (volume_ / 100.0));
   } else {
     TRACKRENDERER_WARN("unknown audio sink name: %s", sink_name);
   }
@@ -2934,9 +2846,6 @@ bool TrackRenderer::DeactivateAudio_() {
   pipeline_->BinRemove(Elements::kBinAudio, Elements::kDecAudio,
                        Elements::kSinkAudio);
   std::string sink_name = kFakeSinkName;
-  if (internal::IsTzMimeType(track.mimetype)) {
-    sink_name = "tzfakesink";
-  }
 
   pipeline_->FactoryMake(Elements::kFakeSinkAudio, sink_name.c_str(), NULL);
   pipeline_->SetProperty(Elements::kFakeSinkAudio, "async", TRUE, NULL);
index 47ced09134e8784f38cbe17f143fa932ac901f74..e530a168282ebcb96afced647117adf08111a9dc 100644 (file)
@@ -1099,11 +1099,7 @@ void trackrenderer_get_attribute(TrackRendererHandle handle,
 
 int trackrenderer_set_matroska_color_info(TrackRendererHandle handle,
                                           const char* color_info) {
-  auto priv = static_cast<TrackRendererPrivPtr>(handle);
-  if (!priv) return kFailed;
-  if (!priv->renderer->SetMatroskaColorInfo(color_info)) {
-    return kFailed;
-  }
+  TRACKRENDERER_WARN("Not supported on Public");
   return kSuccess;
 }