typedef void* esplusplayer_handle;
/**
+ * @brief Enumerations for the Adaptive info type
+ */
+typedef enum {
+ ESPLUSPLAYER_ADAPT_INFO_TYPE_NONE,
+ ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_FRAMES,
+ ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_VIDEO_FRAMES_FOR_CATCHUP,
+ ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_AUDIO_FRAMES_FOR_CATCHUP,
+} esplusplayer_adaptive_info_type;
+
+/**
* @brief Enumerations for low latency mode
* @remark Public supports #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL only.
*/
int esplusplayer_get_playing_time(esplusplayer_handle handle, uint64_t* ms);
/**
+ * @brief Get dropped frame counts in videosink.
+ * @param [in] handle : esplusplayer handle.
+ * @param [out] padaptive_info : dropped frame counts.
+ * @param [in] adaptive_type : type of adaptive info which APP want to get.
+ * @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
+ * prepare esplayer done
+ * // ... your codes ...
+ * uint64_t count = 0;
+ * esplusplayer_get_adaptive_info(esplayer,
+ * static_cast<void*>(&count),ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_FRAMES);
+ * // ... your codes ...
+ * esplusplayer_stop(esplayer);
+ * @endcode
+ * @pre The player must be one of #ESPLUSPLAYER_STATE_READY,
+ * #ESPLUSPLAYER_STATE_PAUSE or #ESPLUSPLAYER_STATE_PLAYING.
+ * @post None
+ * @exception None
+ * @see esplusplayer_prepare_async()
+ */
+int esplusplayer_get_adaptive_info(
+ esplusplayer_handle handle, void* padaptive_info,
+ esplusplayer_adaptive_info_type adaptive_type);
+
+/**
* @brief Set volume to player
* @param [in] handle : esplusplayer handle.
* @param [in] volume : volume level(0 ~ 100).
kFull, // buffer already full
kSuccess // submit succeeded
};
-
+/**
+ * @brief Enumerations for adaptive info type.
+ */
+enum class PlayerAdaptiveInfo {
+ kMinType,
+ kVideoDroppedFrames,
+ kDroppedVideoFramesForCatchup,
+ kDroppedAudioFramesForCatchup,
+ kMaxType,
+};
/**
* @brief Enumerations for low latency mode
*/
*/
virtual bool GetPlayingTime(uint64_t* time_in_milliseconds) { return false; }
/**
+ * @brief Get the adaptive info from the plugins
+ * @param [in] adaptive_type : App wanted get info type
+ * @param [out] padaptive_info : return value of requested(such as dropped
+ * frames)
+ * @pre The player must be one of #EsState::kPlaying or
+ * #EsState::kPaused or #EsState::kReady
+ * @return @c True on success, otherwise @c False
+ */
+ virtual bool GetAdaptiveInfo(void* padaptive_info,
+ const PlayerAdaptiveInfo& adaptive_type) {
+ return false;
+ }
+ /**
* @brief Set on mute of the audio sound
* @param [in] is_mute : On mute of the sound
* (@c true = mute, @c false = non-mute)
bool SetVideoFrameBufferType(DecodedVideoFrameBufferType type) override;
void RegisterListener(EsEventListener* listener,
EsEventListener::UserData userdata) override;
+ bool GetAdaptiveInfo(void* padaptive_info,
+ const PlayerAdaptiveInfo& adaptive_type) override;
bool SetVolume(const int& volume) override;
bool GetVolume(int* volume) override;
bool Flush(const StreamType& type) override;
eventlistener_userdata_ = userdata;
}
+bool EsPlayer::GetAdaptiveInfo(void* padaptive_info,
+ const PlayerAdaptiveInfo& adaptive_type) {
+ if (!padaptive_info || adaptive_type <= PlayerAdaptiveInfo::kMinType ||
+ adaptive_type >= PlayerAdaptiveInfo::kMaxType)
+ return false;
+ switch (adaptive_type) {
+ case PlayerAdaptiveInfo::kVideoDroppedFrames:
+ if (state_manager_.GetState() < EsState::kReady) {
+ LOG_ERROR_P(this, "Wrong state, we aren't started yet");
+ return false;
+ }
+ return trackrenderer_->GetDroppedFrames(padaptive_info);
+ case PlayerAdaptiveInfo::kDroppedVideoFramesForCatchup:
+ if (state_manager_.GetState() < EsState::kReady) {
+ LOG_ERROR_P(this, "Wrong state, we aren't started yet");
+ return false;
+ }
+ return trackrenderer_->GetDroppedFramesForCatchup(kTrackTypeVideo,
+ padaptive_info);
+ case PlayerAdaptiveInfo::kDroppedAudioFramesForCatchup:
+ if (state_manager_.GetState() < EsState::kReady) {
+ LOG_ERROR_P(this, "Wrong state, we aren't started yet");
+ return false;
+ }
+ return trackrenderer_->GetDroppedFramesForCatchup(kTrackTypeAudio,
+ padaptive_info);
+ default:
+ break;
+ }
+ return false;
+}
+
bool EsPlayer::SetVolume(const int& volume) {
if (volume < internal::kVolumeMin || volume > internal::kVolumeMax) {
LOG_ERROR_P(this, "Invalid volume level %d", volume);
using plusplayer::EsPacketPtr;
using plusplayer::EsState;
using plusplayer::MatroskaColor;
+using plusplayer::PlayerAdaptiveInfo;
using plusplayer::PlayerLowLatencyMode;
using plusplayer::StreamType;
using plusplayer::SubmitDataType;
return convert_return_type_(ret);
}
+int esplusplayer_get_adaptive_info(
+ esplusplayer_handle handle, void* padaptive_info,
+ esplusplayer_adaptive_info_type adaptive_type) {
+ // LOG_ENTER_P(cast_(handle))
+ if (is_null_(handle) || is_null_(padaptive_info))
+ return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
+
+ auto ret = cast_(handle)->GetAdaptiveInfo(
+ padaptive_info, static_cast<PlayerAdaptiveInfo>(adaptive_type));
+ return convert_return_type_(ret);
+}
+
int esplusplayer_set_volume(esplusplayer_handle handle, const int volume) {
LOG_ENTER_P(cast_(handle))
if (is_null_(handle)) return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
bool Seek(uint64_t time_millisecond, double playback_rate, bool audio_mute);
bool SetPlaybackRate(double playback_rate, bool audio_mute);
bool GetPlayingTime(uint64_t* curtime_in_msec);
+ bool GetDroppedFrames(void* counts);
+ bool GetDroppedFramesForCatchup(TrackType type, void* counts);
bool Deactivate(TrackType type);
bool Activate(TrackType type, const Track& track);
bool SubmitPacket(const DecoderInputBufferPtr& data);
return true;
}
+bool TrackRendererAdapter::GetDroppedFrames(void* counts) {
+ if (trackrenderer_get_dropped_frames(handle_, counts) == kFailed) {
+ return false;
+ }
+ return true;
+}
+
+bool TrackRendererAdapter::GetDroppedFramesForCatchup(TrackType type,
+ void* counts) {
+ if (trackrenderer_get_dropped_frames_for_catchup(
+ handle_, adapter_utils::ConvertToTrackRendererTrackType(type),
+ counts) == kFailed) {
+ return false;
+ }
+ return true;
+}
+
bool TrackRendererAdapter::Deactivate(TrackType type) {
if (trackrenderer_deactivate(
handle_, adapter_utils::ConvertToTrackRendererTrackType(type)) ==