Add API to set low latency mode and render time offset 40/291540/4
authorEunhye Choi <eunhae1.choi@samsung.com>
Tue, 18 Apr 2023 06:16:41 +0000 (15:16 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Tue, 18 Apr 2023 10:50:37 +0000 (19:50 +0900)
[Version] 0.0.12

- Add API to set low latency mode
  public supports _DISABLE_PREROLL mode only.
- Add API to set render time offset

Change-Id: Iba73374342a171e6472f1183363017ccb7a7b433

include/esplusplayer_capi/esplusplayer_capi.h
include/plusplayer/esplusplayer.h
packaging/esplusplayer.spec
src/esplusplayer/include_internal/esplayer/esplayer.h
src/esplusplayer/src/esplayer.cpp
src/esplusplayer/src/esplusplayer_capi.cpp
src/plusplayer-core/include_internal/core/trackrendereradapter.h
src/plusplayer-core/src/trackrendereradapter.cpp
test/esplusplayer_test.c

index 428d9c2..bae8697 100644 (file)
@@ -74,7 +74,7 @@ typedef void* esplusplayer_handle;
 
 /**
  * @brief   Enumerations for low latency mode
- * @version 3.2
+ * @remark  Public supports #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL only.
  */
 typedef enum {
   ESPLUSPLAYER_LOW_LATENCY_MODE_NONE = 0x0000,
@@ -85,6 +85,7 @@ typedef enum {
   /**
    * @description   to support video fast decoding/rendering
    *                Video stream should be composed only of P and I frames.
+   *                The mode support seamless resolution change since tizen 6.5
    */
   ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO = 0x0010,
   /**
@@ -100,11 +101,6 @@ typedef enum {
   ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO_DISTORTION_CONCEALMENT =
       ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO | 0x0020,
   /**
-   * @description   to support video fast decoding/rendering and video
-   *                with seamless resolution change.
-   */
-  ESPLUSPLAYER_LOW_LATENCY_MODE_SEAMLESS_RESOLUTION_CHANGE = 0x0040,
-  /**
    * @description   to disable clock sync and a/v sync when rendering. it
    *                includes #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL.
    */
@@ -115,21 +111,44 @@ typedef enum {
    *                #ESPLUSPLAYER_STATE_READY from #ESPLUSPLAYER_STATE_IDLE.
    *                It changes the state immediately.
    *                It's usually used for sparse stream. (e.g. video packet
-   *                arrives but audio packet doesn't yet.)
+   *                arrives but audio packet does't yet.)
    */
   ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL = 0x0200,
   /**
+   * @deprecated    Deprecated since tizen 6.5
    * @description   to set lower video quality
+   *                If set this value, it can use original game_mode.
+   *                This value will be deprecated from 2022TV.
+   *                Please use ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE.
    */
   ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY = 0x1000,
   /**
-   * @description   to set game mode
-   *                It must be used exclusively with ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY.
-   *                It must use this value with ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO.
-   *                If use this value, It can expect better latency performance than ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY.
-   *                It can use enhanced game_mode.
+   * @description   to set game mode for minimum latency
+   *                Video stream should be composed only of P and I frames.
+   *                It must not be used together with
+   *                #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY.
+   *                If use this value, It can expect better latency performance
+   *                than #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY.
+   *                The mode support seamless resolution change.
+   *                The mode use lower video quality.
    */
-  ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE = 0x2000
+  ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE =
+      ESPLUSPLAYER_LOW_LATENCY_MODE_AUDIO |
+      ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO | 0x2000,
+  /**
+   * @description   to set game mode for latency
+   *                Video stream should be composed only of P and I frames.
+   *                Video stream must use fixed resolution.
+   *                It must not be used together with
+   *                #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY.
+   *                If use this value, It can expect better latency
+   *                performance than
+   *                #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY and
+   *                #ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE
+   *                The mode use lower video quality.
+   */
+  ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE_WITH_FIXED_RESOLUTION =
+      ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE | 0x4000,
 } esplusplayer_low_latency_mode;
 
 /**
@@ -1702,7 +1721,6 @@ int esplusplayer_set_event_cb(esplusplayer_handle handle,
 int esplusplayer_decoded_buffer_destroy(
     esplusplayer_handle handle, esplusplayer_decoded_video_packet* packet);
 
-#ifdef TIZEN_FEATURE_TV
 /**
  * @brief     Provided api for setting low latency mode, multiple modes can be
  *            set to duplicate.
@@ -1715,28 +1733,20 @@ int esplusplayer_decoded_buffer_destroy(
  * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
  * @code
  *            esplusplayer_open(esplayer);
- *            esplusplayer_set_low_latency_mode(esplayer,ESPLUSPLAYER_LOW_LATENCY_MODE_NONE);
+ *            esplusplayer_set_low_latency_mode(esplayer, ESPLUSPLAYER_LOW_LATENCY_MODE_NONE);
  *            // ... your codes ...
  *            esplusplayer_close(esplayer);
  * @endcode
  * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
  * @post      None
  * @exception None
- * @remark    esplusplayer_set_low_latency_mode().
- *            if set ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_SYNC:
- *            1, esplusplayer_buffer_status_cb/
- *            esplusplayer_buffer_byte_status_cb/
- *            esplusplayer_buffer_time_status_cb/
- *            esplusplayer_ready_to_prepare_cb/
- *            esplusplayer_ready_to_seek_cb/esplusplayer_seek_done_cb
- *            callbacks are not invoked
- *            2, If es packets are sent after esplusplayer_start() is called,
- *            it will be played immediately.
+ * @remark    Public supports #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL only.
+ *            No operation is performed and #ESPLUSPLAYER_ERROR_TYPE_NONE will be returned,
+ *            if @a mode is not #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL to make compatilbe with TV API.
  * @see       esplusplayer_open()
  */
 int esplusplayer_set_low_latency_mode(esplusplayer_handle handle,
                                       esplusplayer_low_latency_mode mode);
-#endif
 
 /**
  * @brief     Provided api for setting unlimited max buffer mode, the player
@@ -1828,6 +1838,65 @@ int esplusplayer_set_audio_codec_type(esplusplayer_handle handle,
 int esplusplayer_set_video_codec_type(esplusplayer_handle handle,
                                       esplusplayer_video_codec_type type);
 /**
+ * @brief     Provided api for setting render time offset
+ * @param     [in] handle : esplusplayer handle ptr.
+ * @param     [in] type : stream type
+ * @param     [in] offset : offset (in milliseconds).
+ *                          G_MININT64 <= offset * 1000000 <= G_MAXINT64
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_low_latency_mode(esplayer,ESPLUSPLAYER_LOW_LATENCY_MODE_NONE);
+ *            prepare esplayer
+ *            // ... your codes ...
+ *            int64_t set_offset = 10;
+ *            esplusplayer_set_render_time_offset(esplayer,ESPLUSPLAYER_STREAM_TYPE_VIDEO,
+ *                                                set_offset);
+ *            int64_t get_offset = 0;
+ *            esplusplayer_get_render_time_offset(esplayer_,ESPLUSPLAYER_STREAM_TYPE_VIDEO,
+ *                                                &get_offset);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_READY,
+ *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
+ *            It have to be set to low latency mode. (all mode except
+ *            # ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_SYNC)
+ * @remark    esplusplayer_set_low_latency_mode().
+ * @post      None
+ * @exception None
+ * @see       esplusplayer_open()
+ *            esplusplayer_get_render_time_offset()
+ */
+int esplusplayer_set_render_time_offset(esplusplayer_handle handle,
+                                        esplusplayer_stream_type type,
+                                        int64_t offset);
+/**
+ * @brief     Provided api for getting render time offset
+ * @param     [in] handle : esplusplayer handle ptr.
+ * @param     [in] type : stream type
+ * @param     [in] offset : offset ptr (in milliseconds).
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_READY,
+ *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
+ *            It have to be set to low latency mode.
+ * @remark    esplusplayer_set_low_latency_mode().
+ * @post      None
+ * @exception None
+ * see        esplusplayer_set_render_time_offset()
+ */
+int esplusplayer_get_render_time_offset(esplusplayer_handle handle,
+                                        esplusplayer_stream_type type,
+                                        int64_t* offset);
+/**
  * @brief     Provided api for enabling video hole.
  * @param     [in] handle : esplusplayer handle.
  * @param     [in] value : the value of video hole.
@@ -1849,8 +1918,8 @@ int esplusplayer_set_video_codec_type(esplusplayer_handle handle,
  *            not be set to #ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE.
  * @post      None
  * @exception None
- * @see       esplusplayer_set_video_frame_buffer_type
- *            esplusplayer_set_media_packet_video_decoded_cb
+ * @see       esplusplayer_set_video_frame_buffer_type()
+ *            esplusplayer_set_media_packet_video_decoded_cb()
  */
 int esplusplayer_enable_video_hole(esplusplayer_handle handle, const bool value);
 
index aa3bb27..02438b1 100644 (file)
@@ -676,6 +676,32 @@ class EsPlusPlayer : private boost::noncopyable {
     return false;
   }
   /**
+   * @brief     Provided api for setting render time offset
+   * @param     [in] type : stream type
+   * @param     [in] offset : offset (milisecond).
+   * @pre       The player state must be set to #EsState::kReady,
+   *            #EsState::kPaused or #EsState::kPlaying.
+   *            It have to be set to low latency mode.
+   * @see       EsPlusPlayer::SetLowLatencyMode()
+   * @return    @c True on success, otherwise @c False
+   */
+  virtual bool SetRenderTimeOffset(const StreamType type, int64_t offset) {
+    return false;
+  }
+  /**
+   * @brief     Provided api for getting render time offset
+   * @param     [in] type : stream type
+   * @param     [out] offset : offset ptr (milisecond).
+   * @pre       The player state must be set to #EsState::kReady,
+   *            #EsState::kPaused or #EsState::kPlaying.
+   *            It have to be set to low latency mode.
+   * @see       EsPlusPlayer::SetLowLatencyMode()
+   * @return    @c True on success, otherwise @c False
+   */
+  virtual bool GetRenderTimeOffset(const StreamType type, int64_t* offset) {
+    return false;
+  }
+  /**
    * @brief     Provided api for enabling video hole
    * @return    @c True on success, otherwise @c False
    */
index e850597..6676bca 100644 (file)
@@ -2,7 +2,7 @@
 %bcond_without ESPLUSPLAYER_UT
 Name:       esplusplayer
 Summary:    new multimedia streaming player
-Version:    0.0.11
+Version:    0.0.12
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
@@ -23,8 +23,6 @@ BuildRequires:  pkgconfig(wayland-client)
 BuildRequires:  pkgconfig(tizen-extension-client)
 BuildRequires:  pkgconfig(libtzplatform-config)
 BuildRequires:  pkgconfig(jsoncpp)
-BuildRequires:  pkgconfig(icu-i18n)
-BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(capi-system-info)
 BuildRequires:  pkgconfig(gio-2.0)
 BuildRequires:  pkgconfig(libtbm)
index 737ee50..fd22fd2 100644 (file)
@@ -93,6 +93,8 @@ class EsPlayer : public EsPlusPlayer {
   bool SetUnlimitedMaxBufferMode() override;
   bool SetAudioCodecType(const PlayerAudioCodecType& type) override;
   bool SetVideoCodecType(const PlayerVideoCodecType& type) override;
+  bool SetRenderTimeOffset(const StreamType type, int64_t offset) override;
+  bool GetRenderTimeOffset(const StreamType type, int64_t* offset) override;
   bool EnableVideoHole(bool value) override;
 
  private:
index 3ded2ae..d4ae619 100644 (file)
@@ -406,22 +406,8 @@ void EsPlayer::SetTrackRendererAttributes_() {
   trackrenderer_->SetAttribute(
       TrackRendererAdapter::Attribute::kAudioQueueMaxBuffer,
       src_queue_size_.kMaxBufferOfAudioSrcQueue);
-#if 0
-  trackrenderer_->SetAttribute(
-      TrackRendererAdapter::Attribute::kVideoQueueMaxTime,
-      util::ConvertMsToNs(src_queue_size_.kMaxTimeOfVideoSrcQueue));
-  trackrenderer_->SetAttribute(
-      TrackRendererAdapter::Attribute::kAudioQueueMaxTime,
-      util::ConvertMsToNs(src_queue_size_.kMaxTimeOfAudioSrcQueue));
-  trackrenderer_->SetAttribute(
-      TrackRendererAdapter::Attribute::kVideoMinTimeThreshold,
-      src_queue_size_.kMinTimeThresholdOfVideoSrcQueue);
-  trackrenderer_->SetAttribute(
-      TrackRendererAdapter::Attribute::kAudioMinTimeThreshold,
-      src_queue_size_.kMinTimeThresholdOfAudioSrcQueue);
   trackrenderer_->SetAttribute(TrackRendererAdapter::Attribute::kLowLatencyMode,
                                low_latency_mode_);
-#endif
   trackrenderer_->SetAttribute(
       TrackRendererAdapter::Attribute::kUnlimitedMaxBufferMode,
       unlimited_max_buffer_mode_);
@@ -436,15 +422,6 @@ void EsPlayer::SetTrackRendererAttributes_() {
         resume_time_.time);
     resume_time_.is_set = false;
   }
-#if 0
-  trackrenderer_->SetAttribute(
-      TrackRendererAdapter::Attribute::kAlternativeVideoResource,
-      alternative_video_resource_);
-  trackrenderer_->SetAttribute(
-      TrackRendererAdapter::Attribute::kVideoDecodingMode,
-      video_decoding_mode_);
-#endif
-
 }
 
 bool EsPlayer::Prepare_() {
@@ -617,6 +594,20 @@ bool EsPlayer::Seek(const uint64_t time_millisecond) {
 
   bool ret = state_manager_.ProcessEvent(event);
   is_seek_done_need_drop = false;
+
+  if (eventlistener_) {
+    if (internal::IsLowLatencyModeDisableAVSync(low_latency_mode_) ||
+        internal::IsLowLatencyModeDisablePreroll(low_latency_mode_)) {
+      auto listener = std::bind(&plusplayer::EsEventListener::OnSeekDone,
+                                eventlistener_, std::placeholders::_1);
+      auto msg = es_msg::Simple::Make(listener, eventlistener_userdata_);
+      std::unique_lock<std::mutex> msg_mutex(msg_task_mutex_);
+      msg_queue_.push(std::move(msg));
+      msg_mutex.unlock();
+      msg_task_cv_.notify_one();
+    }
+  }
+
   LOG_DEBUG("%p, [LEAVE] seek end ", this);
 
   return ret;
@@ -1361,6 +1352,61 @@ bool EsPlayer::SetVideoCodecType(const PlayerVideoCodecType& type) {
   return true;
 }
 
+
+bool EsPlayer::SetRenderTimeOffset(const StreamType type, int64_t offset) {
+  if (state_manager_.GetState() < EsState::kReady) {
+    LOG_ERROR_P(this, "Invalid State , current %d",
+                state_manager_.GetStateEnum());
+    return false;
+  }
+  if (!internal::IsSupportedTsOffset(low_latency_mode_)) {
+    LOG_ERROR_P(this,
+                "low latency mode have to be set except disable_sync mode");
+    return false;
+  }
+  /* FIME: time unit api will be added to support both ms and us */
+  if ((offset * 1000000 > G_MAXINT64) || (offset * 1000000 < G_MININT64)) {
+    LOG_ERROR("%p, wrong value : G_MAXINT64 < offset[%" PRId64
+              "] * 1000000 < G_MAXINT64",
+        this, offset);
+    return false;
+  }
+  if (type == StreamType::kMax) return false;
+  if (type == StreamType::kAudio)
+    trackrenderer_->SetAttribute(
+        TrackRendererAdapter::Attribute::kAudioRenderTimeOffset,
+        util::ConvertMsToNs(offset));
+  else if (type == StreamType::kVideo)
+    trackrenderer_->SetAttribute(
+        TrackRendererAdapter::Attribute::kVideoRenderTimeOffset,
+        util::ConvertMsToNs(offset));
+  return true;
+}
+
+bool EsPlayer::GetRenderTimeOffset(const StreamType type, int64_t* offset) {
+  if (state_manager_.GetState() < EsState::kReady) {
+    LOG_ERROR_P(this, "Invalid State , current %d",
+                state_manager_.GetStateEnum());
+    return false;
+  }
+  if (!internal::IsSupportedTsOffset(low_latency_mode_)) {
+    LOG_ERROR_P(this, "low latency mode have to be set");
+    return false;
+  }
+  if (type == StreamType::kMax) return false;
+  boost::any off_set;
+  if (type == StreamType::kAudio)
+    trackrenderer_->GetAttribute(
+        TrackRendererAdapter::Attribute::kAudioRenderTimeOffset, &off_set);
+  else if (type == StreamType::kVideo)
+    trackrenderer_->GetAttribute(
+        TrackRendererAdapter::Attribute::kVideoRenderTimeOffset, &off_set);
+
+  *offset = util::ConvertNsToMs(boost::any_cast<int64_t>(off_set));
+
+  return true;
+}
+
 void EsPlayer::Init_() {
   track_.clear();
   is_stopped_ = false;
index 6563509..cb057de 100644 (file)
@@ -1335,16 +1335,19 @@ int esplusplayer_decoded_buffer_destroy(
   return convert_return_type_(true);
 }
 
-#ifdef TIZEN_FEATURE_TV
 int esplusplayer_set_low_latency_mode(esplusplayer_handle handle,
                                       esplusplayer_low_latency_mode mode) {
   LOG_ENTER_P(cast_(handle))
   if (is_null_(handle)) return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
+  if (mode != ESPLUSPLAYER_LOW_LATENCY_MODE_NONE &&
+      mode != ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL) {
+    LOG_WARN("Not supported latency mode 0x%x", static_cast<std::uint32_t>(mode));
+    return ESPLUSPLAYER_ERROR_TYPE_NONE;
+  }
   auto ret =
       cast_(handle)->SetLowLatencyMode(static_cast<PlayerLowLatencyMode>(mode));
   return convert_return_type_(ret);
 }
-#endif
 
 int esplusplayer_set_unlimited_max_buffer_mode(esplusplayer_handle handle) {
   LOG_ENTER_P(cast_(handle))
@@ -1374,3 +1377,24 @@ int esplusplayer_set_video_codec_type(esplusplayer_handle handle,
       cast_(handle)->SetVideoCodecType(static_cast<PlayerVideoCodecType>(type));
   return convert_return_type_(ret);
 }
+
+int esplusplayer_set_render_time_offset(esplusplayer_handle handle,
+                                        esplusplayer_stream_type type,
+                                        int64_t offset) {
+  LOG_ENTER_P(cast_(handle))
+  if (is_null_(handle)) return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
+  auto ret =
+      cast_(handle)->SetRenderTimeOffset(static_cast<StreamType>(type), offset);
+  return convert_return_type_(ret);
+}
+
+int esplusplayer_get_render_time_offset(esplusplayer_handle handle,
+                                        esplusplayer_stream_type type,
+                                        int64_t* offset) {
+  LOG_ENTER_P(cast_(handle))
+  if (is_null_(handle) || is_null_(offset))
+    return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
+  auto ret =
+      cast_(handle)->GetRenderTimeOffset(static_cast<StreamType>(type), offset);
+  return convert_return_type_(ret);
+}
index 9a0d3c3..c8e8be1 100644 (file)
@@ -45,30 +45,15 @@ class TrackRendererAdapter {
     kAudioMinByteThreshold,       // std::uint32_t
     kVideoQueueMaxBuffer,         // std::uint64_t
     kAudioQueueMaxBuffer,         // std::uint64_t
-#if 0
-    kVideoQueueMaxTime,           // std::uint64_t
-    kAudioQueueMaxTime,           // std::uint64_t
-    kVideoQueueCurrentLevelTime,  // std::uint64_t
-    kAudioQueueCurrentLevelTime,  // std::uint64_t
-    kVideoMinTimeThreshold,       // std::uint32_t
-    kAudioMinTimeThreshold,       // std::uint32_t
-    kVideoSupportRotation,        // std::unit32_t
     kVideoRenderTimeOffset,       // std::int64_t
     kAudioRenderTimeOffset,       // std::int64_t
-#endif
 
     /*attributes for trackrenderer configures*/
-
     kAccurateSeekMode,          // std::uint32_t
     kLowLatencyMode,            // std::uint32_t
     kUnlimitedMaxBufferMode,    // std::uint32_t
     kVideoPreDisplayMode,       // std::uint32_t
     kStartRenderingTime,        // std::uint64_t
-#if 0
-    kAlternativeVideoResource,  // std::uint32_t
-    kVideoDecodingMode,         // std::uint32_t
-    kLateVideoFrameDropMode,    // std::uint32_t
-#endif
   };
 
   // TODO(js4716.chun):CHECK POINTS
index 20032de..dbd5430 100644 (file)
@@ -460,26 +460,10 @@ static const std::map<TrackRendererAdapter::Attribute, AttrInfo>
          {ValueType::kUInt64, "video-queue-max-buffer"}},
         {TrackRendererAdapter::Attribute::kAudioQueueMaxBuffer,
          {ValueType::kUInt64, "audio-queue-max-buffer"}},
-#if 0
-        {TrackRendererAdapter::Attribute::kVideoQueueMaxTime,
-         {ValueType::kUInt64, "video-queue-max-time"}},
-        {TrackRendererAdapter::Attribute::kAudioQueueMaxTime,
-         {ValueType::kUInt64, "audio-queue-max-time"}},
-        {TrackRendererAdapter::Attribute::kVideoQueueCurrentLevelTime,
-         {ValueType::kUInt64, "video-current-level-time"}},
-        {TrackRendererAdapter::Attribute::kAudioQueueCurrentLevelTime,
-         {ValueType::kUInt64, "audio-current-level-time"}},
-        {TrackRendererAdapter::Attribute::kVideoMinTimeThreshold,
-         {ValueType::kUInt32, "video-min-time-percent"}},
-        {TrackRendererAdapter::Attribute::kAudioMinTimeThreshold,
-         {ValueType::kUInt32, "audio-min-time-percent"}},
-        {TrackRendererAdapter::Attribute::kVideoSupportRotation,
-         {ValueType::kUInt32, "support-rotation"}},
         {TrackRendererAdapter::Attribute::kVideoRenderTimeOffset,
          {ValueType::kInt64, "video-render-time-offset"}},
         {TrackRendererAdapter::Attribute::kAudioRenderTimeOffset,
          {ValueType::kInt64, "audio-render-time-offset"}}
-#endif
         };
 
 static const std::map<TrackRendererAdapter::Attribute, AttrInfo>
@@ -494,14 +478,6 @@ static const std::map<TrackRendererAdapter::Attribute, AttrInfo>
          {ValueType::kUInt32, "video-pre-display-mode"}},
         {TrackRendererAdapter::Attribute::kStartRenderingTime,
          {ValueType::kUInt64, "start-rendering-time"}},
-#if 0
-        {TrackRendererAdapter::Attribute::kAlternativeVideoResource,
-         {ValueType::kUInt32, "alternative-video-resource"}},
-        {TrackRendererAdapter::Attribute::kVideoDecodingMode,
-         {ValueType::kUInt32, "video-decoding-mode"}},
-        {TrackRendererAdapter::Attribute::kLateVideoFrameDropMode,
-         {ValueType::kUInt32, "late-video-frame-drop-mode"}}
-#endif
         };
 }  // namespace adapter_utils
 
index da2ace3..0c82e28 100644 (file)
@@ -57,6 +57,7 @@ enum {
        CURRENT_STATUS_SET_VIDEO_ROI,
        CURRENT_STATUS_SELECT_TRACK,
        CURRENT_STATUS_ENABLE_VIDEO_HOLE,
+       CURRENT_STATUS_SET_RENDER_TIME_OFFSET,
 };
 
 /* for video display */
@@ -1242,6 +1243,20 @@ static void __test_set_display_rotation(int mode)
                g_print("                       => esplusplayer_set_display_rotation(%d) success\n", mode);
 }
 
+static void __test_set_render_time_offset(int type, int64_t time_ms)
+{
+       if (!g_test_h) {
+               g_print("test handle is NULL\n");
+               return;
+       }
+
+       int ret = esplusplayer_set_render_time_offset(g_test_h->espp_h, (esplusplayer_stream_type)type, time_ms);
+       if (ret != ESPLUSPLAYER_ERROR_TYPE_NONE)
+               g_print("                       => failed to esplusplayer_set_render_time_offset(%d, %" PRId64 ")\n", type, time_ms);
+       else
+               g_print("                       => esplusplayer_set_render_time_offset(%d, %" PRId64 ")\n", type, time_ms);
+}
+
 static void __test_enable_video_hole(bool value)
 {
        if (!g_test_h) {
@@ -1356,6 +1371,8 @@ static void __interpret_main_menu(char *cmd)
                        g_menu_state = CURRENT_STATUS_SET_DISPLAY_VISIBLE;
                } else if (strncmp(cmd, "ev", 2) == 0) {
                        g_menu_state = CURRENT_STATUS_ENABLE_VIDEO_HOLE;
+               } else if (strncmp(cmd, "sr", 2) == 0) {
+                       g_menu_state = CURRENT_STATUS_SET_RENDER_TIME_OFFSET;
                } else {
                        g_print("unknown menu \n");
                }
@@ -1404,7 +1421,9 @@ static void __display_sub_basic()
        g_print("[State] S.Get state\n");
        g_print("[volume] f.Set Volume\t");
        g_print("g.Get Volume\t");
-       g_print("h.Set Mute\n\n");
+       g_print("h.Set Mute\n");
+       g_print("[etc]\n");
+       g_print("sr.Set render time offset\n\n");
 
        g_print("-- << mediademuxer cmd >> ---------------------------------------------------------------\n");
        g_print("prd.prepare demuxer\n\n");
@@ -1454,6 +1473,8 @@ static void __displaymenu()
                g_print("*** Input select track id(video_id, audio_id <unselect -1>)\n");
        } else if (g_menu_state == CURRENT_STATUS_ENABLE_VIDEO_HOLE) {
                g_print("*** Set videohole (1:enable, 0:disable)\n");
+       } else if (g_menu_state == CURRENT_STATUS_SET_RENDER_TIME_OFFSET) {
+               g_print("*** Input stream type and time offset\n");
        } else {
                g_print("*** Unknown status.\n");
                quit_program();
@@ -1482,7 +1503,8 @@ static void interpret(char *cmd)
 {
        int value = 0;
        float value_f = 0.0;
-       uint64_t value_uin64 = 0;
+       uint64_t value_uint64 = 0;
+       int64_t value_int64 = 0;
 
        switch (g_menu_state) {
        case CURRENT_STATUS_MAINMENU:
@@ -1512,8 +1534,8 @@ static void interpret(char *cmd)
        }
        case CURRENT_STATUS_SEEK:
        {
-               value_uin64 = (uint64_t)strtoul(cmd, NULL, 10);
-               __test_seek(value_uin64);
+               value_uint64 = (uint64_t)strtoul(cmd, NULL, 10);
+               __test_seek(value_uint64);
                reset_menu_state();
                break;
        }
@@ -1703,6 +1725,28 @@ static void interpret(char *cmd)
                reset_menu_state();
                break;
        }
+       case CURRENT_STATUS_SET_RENDER_TIME_OFFSET:
+       {
+               static int type = 0;
+               static int cnt = 0;
+               switch (cnt) {
+               case 0:
+                       value = atoi(cmd);
+                       type = value;
+                       cnt++;
+                       break;
+               case 1:
+                       cnt = 0;
+                       value_int64 = (int64_t)strtoul(cmd, NULL, 10);
+                       __test_set_render_time_offset(type, value_int64);
+                       type = 0;
+                       reset_menu_state();
+                       break;
+               default:
+                       break;
+               }
+               break;
+       }
        default:
                break;
        }