typedef void* esplusplayer_handle;
/**
- * @brief Enumerations for the Adaptive info type
- */
-enum esplusplayer_adaptive_info_type {
- 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,
-};
-
-/**
* @brief Enumerations for low latency mode
* @version 3.2
*/
ESPLUSPLAYER_ADVANCED_PICTURE_QUALITY_USB_CAMERA
};
-/**
- * @brief ESPlusplayer easing target volume, duration, type information
- * @version 3.0
- */
-typedef struct {
- /**
- * @description audio easing target volume (0 ~ 100)
- */
- unsigned int volume;
- /**
- * @description audio easing duration, in millisecond
- */
- unsigned int duration;
- /**
- * @description audio easing function type
- */
- esplusplayer_audio_easing_type type;
-} esplusplayer_target_audio_easing_info;
-
-/**
- * @brief ESPlusplayer app id, version, type information
- */
-typedef struct {
- /**
- * @description App id for controlling resource.
- */
- char* id;
- /**
- * @description When there is playback market issue, KPI logger will
- * send the version.
- */
- char* version;
- /**
- * @description RunningApps.InformationTicker will use this type to show
- * stream information. ex) "MSE", "HTML5", etc..
- */
- char* type;
-} esplusplayer_app_info;
-
typedef struct {
/**
* @description the minimum frame number in case of mid latency
int esplusplayer_seek(esplusplayer_handle handle, uint64_t time_ms);
/**
- * @brief Set App id to esplayer to control resource confliction.
- * @param [in] handle : esplusplayer handle.
- * @param [in] app_info : application id, version, type.
- * @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_app_info appinfo;
- * appinfo.id = "youtube";
- * appinfo.version = "3.0";
- * appinfo.type = "MSE";
- * esplusplayer_handle esplayer = esplusplayer_create();
- * esplusplayer_open(esplayer);
- * esplusplayer_set_app_info(esplayer,&appinfo);
- * // ... your codes ...
- * esplusplayer_close(esplayer);
- * @endcode
- * @pre The player state must be #ESPLUSPLAYER_STATE_IDLE.
- * @post None
- * @exception None
- * @see esplusplayer_open()
- */
-int esplusplayer_set_app_info(esplusplayer_handle handle,
- const esplusplayer_app_info* app_info);
-
-/**
* @brief Set the video display.
* @param [in] handle : esplusplayer handle.
* @param [in] type : display type.
*/
int esplusplayer_set_display(esplusplayer_handle handle,
esplusplayer_display_type type, void* window);
+
+#ifdef TIZEN_FEATURE_TV
+/**
+ * @brief Set the video display.
+ * @param [in] handle : esplusplayer handle.
+ * @param [in] type : display type.
+ * @param [in] subsurface : the ecore wayland subsurface handle.
+ * @param [in] x : the x coordinate of subsurface.
+ * @param [in] y : the y coordinate of subsurface.
+ * @param [in] width : the width of subsurface.
+ * @param [in] height : the height of subsurface.
+ * @return @c one of esplusplayer_error_type values will be returned.
+ * @pre The player state must be #ESPLUSPLAYER_STATE_IDLE.
+ * @post None
+ * @exception None
+ * @version 3.1
+ * @see esplusplayer_set_display_mode() \n
+ * esplusplayer_set_display_roi() \n
+ * esplusplayer_set_display_visible()
+ */
+int esplusplayer_set_display_ecore_subsurface(esplusplayer_handle handle,
+ esplusplayer_display_type type,
+ void* subsurface, int x, int y,
+ int width, int height);
+#endif
+
/**
* @brief Set the video display mode.
* @param [in] handle : esplusplayer handle.
esplusplayer_submit_status esplusplayer_submit_packet(
esplusplayer_handle handle, esplusplayer_es_packet* packet);
+#ifdef TIZEN_FEATURE_TV
/**
* @brief Submit encrypted es packet to decode and decrypt audio or video.
* @param [in] handle : esplusplayer handle.
esplusplayer_submit_status esplusplayer_submit_encrypted_packet(
esplusplayer_handle handle, esplusplayer_es_packet* packet,
esplusplayer_drm_info* drm_info);
+#endif
/**
* @brief Generate EOS(End Of Stream) packet explicitly and submit it to the
* @see esplusplayer_prepare_async()
*/
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
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.
*/
int esplusplayer_set_low_latency_mode(esplusplayer_handle handle,
esplusplayer_low_latency_mode mode);
-
-/**
- * @brief Provided api for enabling video frame peek mode
- * @param [in] handle : esplusplayer handle.
- * @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_video_frame_peek_mode(esplayer);
- * // ... your codes ...
- * esplusplayer_close(esplayer);
- * @endcode
- * @pre The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
- * @post None
- * @exception None
- * @see esplusplayer_open() \n
- * esplusplayer_render_video_frame().
- */
-int esplusplayer_set_video_frame_peek_mode(esplusplayer_handle handle);
-
-/**
- * @brief Provided api for rendering a video frame which is holded by video
- * frame peek mode.
- * @param [in] handle : esplusplayer handle.
- * @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 ...
- * esplusplayer_render_video_frame(esplayer);
- * // ... your codes ...
- * esplusplayer_stop(esplayer);
- * @endcode
- * @pre In order to use this api,
- * The player state must be one of #ESPLUSPLAYER_STATE_READY or
- * #ESPLUSPLAYER_STATE_PAUSED after esplusplayer_seek_done_cb or
- * esplusplayer_prepare_async_done_cb is called \n
- * @post None
- * @exception None
- * @see esplusplayer_set_video_frame_peek_mode() \n
- * esplusplayer_prepare_async()
- */
-int esplusplayer_render_video_frame(esplusplayer_handle handle);
+#endif
/**
* @brief Provided api for setting unlimited max buffer mode, the player
* esplusplayer_submit_encrypted_packet()
*/
int esplusplayer_set_unlimited_max_buffer_mode(esplusplayer_handle handle);
-/**
- * @brief Provided api for enabling film maker mode.
- * @param [in] handle : esplusplayer handle.
- * @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_fmm_mode(esplayer);
- * // ... your codes ...
- * esplusplayer_close(esplayer);
- * @endcode
- * @pre The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
- * @post None
- * @exception None
- * @see esplusplayer_open()
- */
-int esplusplayer_set_fmm_mode(esplusplayer_handle handle);
+
/**
* @brief Provided api for setting audio codec type for playback.
* @param [in] handle : esplusplayer handle.
+++ /dev/null
-/**
- * @file attribute.h
- * @interfacetype module
- * @privlevel None-privilege
- * @privilege None
- * @product TV, AV, B2B
- * @version 1.0
- * @SDK_Support N
- *
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-#ifndef __PLUSPLAYER_APPINFO_H__
-#define __PLUSPLAYER_APPINFO_H__
-
-#include <string>
-
-namespace plusplayer {
-
-/**
-* @brief Player app information.
-*/
-struct PlayerAppInfo {
- std::string id; /**< App id */
- std::string version; /**< App version */
- std::string type; /**< App type. ex)"MSE", "HTML5", etc.. */
-};
-
-} // namespace plusplayer
-
-#endif // __PLUSPLAYER_PLAYER_APPINFO_H__
\ No newline at end of file
#include <utility>
#include <vector>
-#include "plusplayer/appinfo.h"
#include "plusplayer/drm.h"
#include "plusplayer/elementary_stream.h"
#include "plusplayer/es_eventlistener.h"
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 Resume() { return false; }
/**
- * @brief SetAppId
- * @remarks Set app_id to resource manager. Resource manager check the
- * priority to control resource.
- * @param [in] app_info : application id, version, type
- * @pre The player state must be set to #EsState::kIdle
- * @return None
- */
- virtual void SetAppInfo(const PlayerAppInfo& app_info) { return; }
- /**
* @brief SetPlaybackRate.
* @remarks Set playback rate from 0.0 to 2.0.
* @param [in] rate : The playback rate from 0.0 to 2.0. EsPlayer isn't
*/
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)
}
/**
- * @brief Provided api for enabling video frame peek mode
- * @pre The player state must be set to #EsState::kIdle.
- * @return @c True on success, otherwise @c False
- * @see RenderVideoFrame().
- */
- virtual bool SetVideoFramePeekMode() { return false; }
-
- /**
- * @brief Provided api for rendering a video frame which is holded by
- * video frame peek mode.
- * @pre In order to use this api, The player state must be one of
- * #EsState::kReady or #EsState::kPaused after EsEventListener::OnSeekDone()
- * or EsEventListener::OnPrepareDone() is called \n
- * @see SetVideoFramePeekMode().
- */
- virtual bool RenderVideoFrame() { return false; }
- /**
* @brief Provided api for setting unlimited max buffer mode
* @remarks The player does not limit es packet transmission although in
* buffer overrun status.
*/
virtual bool SetUnlimitedMaxBufferMode() { return false; }
/**
- * @brief Provided api for enabling fmm mode
- * @pre The player state must be set to #EsState::kIdle.
- * @return @c True on success, otherwise @c False
- */
- virtual bool SetFmmMode() { return false; }
- /**
* @brief Provided api for setting audio codec type
* @pre The player state must be set to #EsState::kIdle.
* @return @c True on success, otherwise @c False
bool Pause() override;
bool Resume() override;
bool Seek(const uint64_t time_millisecond) override;
- void SetAppInfo(const PlayerAppInfo& app_info) override;
bool SetPlaybackRate(const double rate, const bool audio_mute) override;
bool SetDisplay(const DisplayType& type, void* obj) override;
bool SetDisplay(const DisplayType& type, void* ecore_wl2_window, const int x,
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;
void SetBufferSize(const BufferOption& option, uint64_t size) override;
bool SetLowLatencyMode(const PlayerLowLatencyMode& mode) override;
- bool SetVideoFramePeekMode() override;
- bool RenderVideoFrame() override;
bool SetUnlimitedMaxBufferMode() override;
- bool SetFmmMode() override;
bool SetAudioCodecType(const PlayerAudioCodecType& type) override;
bool SetVideoCodecType(const PlayerVideoCodecType& type) override;
SubmitDataType submit_data_type_ = SubmitDataType::kCleanData;
drm::Property drm_property_;
std::uint32_t low_latency_mode_ = 0;
- std::uint32_t video_frame_peek_mode_ = 0;
std::uint32_t unlimited_max_buffer_mode_ = 0;
std::uint32_t accurate_seek_mode_ = 1;
std::uint32_t video_pre_display_mode_ = 1;
- std::uint32_t fmm_mode_ = 0;
PlayerAudioCodecType audio_codec_type_ = kPlayerAudioCodecTypeHW;
PlayerVideoCodecType video_codec_type_ = kPlayerVideoCodecTypeHW;
bool force_audio_swdecoder_use_ = false;
new TrackRendererEventListener(this)};
std::unique_ptr<TrackRendererAdapter> trackrenderer_;
std::future<void> preparetask_;
- PlayerAppInfo app_info_;
double current_playback_rate_ = 1.0;
bool current_audio_mute_ = false;
bool is_resource_conflicted_ = false;
#include "esplayer/esplayer.h"
+#include <inttypes.h>
#include <boost/scope_exit.hpp>
#include <cassert>
#include <chrono>
inline bool IsPcmMimeType(const std::string& mimetype) {
return (mimetype.find("audio/x-raw") != std::string::npos);
}
-inline bool IsForcedUnsetTz(const Track& track, const std::string& id) {
- if ((track.type == kTrackTypeAudio) && strstr(id.c_str(), "netflix")) {
- return true;
- }
- return false;
-}
inline bool IsAacCodec(const Track& track) {
return (track.mimetype.find("audio/mpeg") != std::string::npos &&
track.version == 2);
return eos_status;
}
-void MakeTrustZoneTracks(std::vector<Track>& tracks,
- const std::string& app_id) {
- for (auto& track : tracks) {
- const bool is_already_tz_type =
- (track.mimetype.find("_tz", track.mimetype.length() - 3) !=
- std::string::npos);
- if (is_already_tz_type) {
- continue;
- }
- track.streamtype = track.mimetype;
- if (track.use_swdecoder || IsPcmMimeType(track.mimetype) ||
- IsForcedUnsetTz(track, app_id))
- continue;
- else
- track.mimetype = track.mimetype + "_tz";
- }
-}
-
void UpdateCodecTypeTracks(std::vector<Track>& tracks,
const PlayerAudioCodecType& audio_codec_type,
const PlayerVideoCodecType& video_codec_type,
low_latency_mode_);
#endif
trackrenderer_->SetAttribute(
- TrackRendererAdapter::Attribute::kVideoFramePeekMode,
- video_frame_peek_mode_);
- trackrenderer_->SetAttribute(
TrackRendererAdapter::Attribute::kUnlimitedMaxBufferMode,
unlimited_max_buffer_mode_);
trackrenderer_->SetAttribute(
resume_time_.time);
resume_time_.is_set = false;
}
- trackrenderer_->SetAttribute(TrackRendererAdapter::Attribute::kFmmMode,
- fmm_mode_);
#if 0
trackrenderer_->SetAttribute(
TrackRendererAdapter::Attribute::kAlternativeVideoResource,
internal::UpdateCodecTypeTracks(track_, audio_codec_type_,
video_codec_type_,
force_audio_swdecoder_use_);
- if (drm_property_.external_decryption) {
- internal::MakeTrustZoneTracks(track_, app_info_.id);
- }
std::vector<Track> active_track;
if (!track_util::GetActiveTrackList(track_, active_track)) {
return false;
LOG_ERROR_P(this, "Invalid State , during preparing");
return false;
}
- LOG_ERROR_P(this, "resume time [%llu ms]", time_millisecond);
+ LOG_ERROR("[%p] > resume time [%" PRIu64 " ms]", this, time_millisecond);
resume_time_.is_set = true;
resume_time_.time = time_millisecond;
return true;
}
- LOG_DEBUG_P(this, "[ENTER] seek time [%llu ms]", time_millisecond);
+ LOG_DEBUG("[%p] > [ENTER] seek time [%" PRIu64 " ms]", this, time_millisecond);
for (const auto& track : track_) {
eos_status_ = internal::ResetEosStatus(track.type, eos_status_);
es_packet_logger_.PrintStoredPacketInfo(
return state_manager_.ProcessEvent(event);
}
-void EsPlayer::SetAppInfo(const PlayerAppInfo& app_info) {
- LOG_ENTER_P(this);
- if (state_manager_.GetState() != EsState::kIdle) {
- LOG_ERROR_P(this, "Invalid State , current %d",
- state_manager_.GetStateEnum());
- return;
- }
- app_info_ = app_info;
- trackrenderer_->SetAppInfo(app_info);
- LOG_INFO("Appid [%s]", app_info.id.c_str());
-}
-
bool EsPlayer::SetPlaybackRate(const double rate, const bool audio_mute) {
LOG_ENTER_P(this);
submit_data_type_ = SubmitDataType::kCleanData;
low_latency_mode_ = 0;
resume_time_.is_set = false;
- video_frame_peek_mode_ = 0;
unlimited_max_buffer_mode_ = 0;
- fmm_mode_ = 0;
audio_codec_type_ = kPlayerAudioCodecTypeHW;
video_codec_type_ = kPlayerVideoCodecTypeHW;
is_resource_conflicted_ = false;
- app_info_ = PlayerAppInfo();
src_queue_size_ = SrcQueueSize();
is_msg_task_stop_ = false;
}
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);
- 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);
return true;
}
-bool EsPlayer::SetVideoFramePeekMode() {
- if (state_manager_.GetState() != EsState::kIdle) {
- LOG_ERROR_P(this, "Invalid State , current %d",
- state_manager_.GetStateEnum());
- return false;
- }
- constexpr std::uint32_t peek_mode_on = 1;
- video_frame_peek_mode_ = peek_mode_on;
- return true;
-}
-
-bool EsPlayer::RenderVideoFrame() {
- if (!video_frame_peek_mode_) return false;
- if (state_manager_.GetState() == EsState::kReady ||
- state_manager_.GetState() == EsState::kPaused) {
- trackrenderer_->RenderVideoFrame();
- return true;
- }
- LOG_ERROR_P(this, "Invalid State , current %d",
- state_manager_.GetStateEnum());
- return false;
-}
-
bool EsPlayer::SetUnlimitedMaxBufferMode() {
if (state_manager_.GetState() != EsState::kIdle) {
LOG_ERROR_P(this, "Invalid State , current %d",
return true;
}
-bool EsPlayer::SetFmmMode() {
- if (state_manager_.GetState() != EsState::kIdle) {
- LOG_ERROR_P(this, "Invalid State , current %d",
- state_manager_.GetStateEnum());
- return false;
- }
- constexpr std::uint32_t fmm_mode_on = 1;
- fmm_mode_ = fmm_mode_on;
- return true;
-}
-
bool EsPlayer::SetAudioCodecType(const PlayerAudioCodecType& type) {
Track activated_track;
bool is_existed =
void EsPlayer::TrackRendererEventListener::ReadyToSeek_(const TrackType& type) {
uint64_t offset = handler_->need_data_[type].seek_offset;
- LOG_INFO_P(handler_, "OnReadyToSeek [%s] offset [%llu]ms",
+ LOG_INFO("[%p] > OnReadyToSeek [%s] offset [%" PRIu64 "]ms", handler_,
(type == kTrackTypeAudio) ? "audio" : "video", offset);
handler_->need_data_[type].mask &= ~kNeedDataMaskBySeek;
#include "core/utils/plusplayer_log.h"
#include "esplayer/decoded_pkt_list.h"
#include "esplusplayer_capi/esplusplayer_internal.h"
-#include "plusplayer/appinfo.h"
#include "plusplayer/drm.h"
#include "plusplayer/elementary_stream.h"
#include "plusplayer/espacket.h"
using plusplayer::EsPacketPtr;
using plusplayer::EsState;
using plusplayer::MatroskaColor;
-using plusplayer::PlayerAdaptiveInfo;
-using plusplayer::PlayerAppInfo;
using plusplayer::PlayerLowLatencyMode;
using plusplayer::StreamType;
using plusplayer::SubmitDataType;
std::unique_lock<std::mutex> lock(this->multi_seek_control.lock);
if (this->multi_seek_control.is_offset_valid == false ||
this->multi_seek_control.offset != offset) {
- LOG_ERROR("Invalid offset:%llu", this->multi_seek_control.offset);
+ LOG_ERROR("Invalid offset:%" PRIu64, this->multi_seek_control.offset);
return;
}
if (this->ready_to_seek_cb_)
return convert_return_type_(cast_(handle)->Seek(time_ms));
}
-int esplusplayer_set_app_info(esplusplayer_handle handle,
- const esplusplayer_app_info* app_info) {
- LOG_ENTER_P(cast_(handle))
- if (is_null_(handle)) return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
- if (app_info == nullptr) return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
-
- LOG_INFO_P(cast_(handle), "app id : %s ", app_info->id);
- LOG_INFO_P(cast_(handle), "app version : %s ", app_info->version);
- LOG_INFO_P(cast_(handle), "app type : %s", app_info->type);
-
- PlayerAppInfo info;
- info.id = app_info->id;
- info.version = app_info->version;
- info.type = app_info->type;
- cast_(handle)->SetAppInfo(info);
- return convert_return_type_(true);
-}
-
int esplusplayer_set_display(esplusplayer_handle handle,
esplusplayer_display_type type, void* window) {
LOG_ENTER_P(cast_(handle))
return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
auto ret = cast_(handle)->GetPlayingTime(ms);
- // LOG_INFO_P(cast_(handle), "playing time : %llu", *ms);
+ // LOG_INFO("[%p] > playing time : %" PRIu64, cast_(handle), *ms);
return convert_return_type_(ret);
}
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;
uint64_t size) {
LOG_ENTER_P(cast_(handle))
if (is_null_(handle)) return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
- LOG_INFO_P(cast_(handle), "option: %d, size: %lld", static_cast<int>(option),
- size);
+ LOG_INFO("[%p] > option: %d, size: %" PRId64, cast_(handle),
+ static_cast<int>(option), size);
cast_(handle)->SetBufferSize(static_cast<plusplayer::BufferOption>(option),
size);
return convert_return_type_(true);
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))
cast_(handle)->SetLowLatencyMode(static_cast<PlayerLowLatencyMode>(mode));
return convert_return_type_(ret);
}
-
-int esplusplayer_set_video_frame_peek_mode(esplusplayer_handle handle) {
- LOG_ENTER_P(cast_(handle))
- if (is_null_(handle)) return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
- auto ret = cast_(handle)->SetVideoFramePeekMode();
- return convert_return_type_(ret);
-}
-
-int esplusplayer_render_video_frame(esplusplayer_handle handle) {
- LOG_ENTER_P(cast_(handle))
- if (is_null_(handle)) return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
- auto ret = cast_(handle)->RenderVideoFrame();
- return convert_return_type_(ret);
-}
+#endif
int esplusplayer_set_unlimited_max_buffer_mode(esplusplayer_handle handle) {
LOG_ENTER_P(cast_(handle))
return convert_return_type_(ret);
}
-int esplusplayer_set_fmm_mode(esplusplayer_handle handle) {
- LOG_ENTER_P(cast_(handle))
- if (is_null_(handle)) return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
- auto ret = cast_(handle)->SetFmmMode();
- return convert_return_type_(ret);
-}
-
int esplusplayer_set_audio_codec_type(esplusplayer_handle handle,
esplusplayer_audio_codec_type type) {
LOG_ENTER_P(cast_(handle))
#include <vector>
#include "core/decoderinputbuffer.h"
-#include "plusplayer/appinfo.h"
#include "plusplayer/drm.h"
#include "plusplayer/track.h"
#include "plusplayer/types/buffer.h"
kAccurateSeekMode, // std::uint32_t
kLowLatencyMode, // std::uint32_t
- kVideoFramePeekMode, // std::uint32_t
kUnlimitedMaxBufferMode, // std::uint32_t
kVideoPreDisplayMode, // std::uint32_t
kStartRenderingTime, // std::uint64_t
- kFmmMode, // std::uint32_t
#if 0
kAlternativeVideoResource, // std::uint32_t
kVideoDecodingMode, // std::uint32_t
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 Deactivate(TrackType type);
bool Activate(TrackType type, const Track& track);
bool SubmitPacket(const DecoderInputBufferPtr& data);
bool SetDisplayVisible(bool is_visible);
void GetDisplay(DisplayType* type, Geometry* area);
void GetDisplayMode(DisplayMode* mode);
- void SetAppId(const std::string& app_id);
- void SetAppInfo(const PlayerAppInfo& app_info);
bool SetAudioMute(bool is_mute);
bool SetVolume(const int& volume);
bool GetVolume(int* volume);
bool Flush(const StreamType& type);
bool Flush(const TrackType& type);
void GetAttribute(const Attribute& attr, boost::any* value);
- bool RenderVideoFrame();
private:
TrackRendererAdapter();
#include <cassert>
-#include "plusplayer/appinfo.h"
#include "plusplayer/drm.h"
#include "plusplayer/track.h"
#include "plusplayer/types/buffer.h"
void MakeTrackRendererCropArea(TrackRendererCropArea* crop,
const CropArea& area);
void MakeTrackRendererTrack(TrackRendererTrack* track, const Track& trackinfo);
-void MakeTrackRendererAppInfo(TrackRendererAppInfo* app_attr,
- const PlayerAppInfo& app_info);
DisplayMode ConvertToDisplayMode(TrackRendererDisplayMode typevalue);
DisplayType ConvertToDisplayType(const TrackRendererDisplayType typevalue);
#include <string.h>
#undef LOG_TAG
-#define LOG_TAG "PLUSPLAYER"
+#define LOG_TAG "ESPP"
#ifndef __MODULE__
#define __MODULE__ \
return true;
}
-bool TrackRendererAdapter::GetDroppedFrames(void* counts) {
- if (trackrenderer_get_dropped_frames(handle_, counts) == kFailed) {
- return false;
- }
- return true;
-}
-
bool TrackRendererAdapter::Deactivate(TrackType type) {
if (trackrenderer_deactivate(
handle_, adapter_utils::ConvertToTrackRendererTrackType(type)) ==
return true;
}
-void TrackRendererAdapter::SetAppId(const std::string& app_id) {
- trackrenderer_set_app_id(handle_, app_id.c_str());
-}
-
-void TrackRendererAdapter::SetAppInfo(const PlayerAppInfo& app_info) {
- TrackRendererAppInfo info;
- adapter_utils::MakeTrackRendererAppInfo(&info, app_info);
- trackrenderer_set_app_info(handle_, &info);
-}
-
void TrackRendererAdapter::SetVideoStillMode(const StillMode& type) {
trackrenderer_set_video_still_mode(
handle_, adapter_utils::ConvertToTrackRendererStillMode(type));
{ValueType::kUInt32, "accurate-seek-mode"}},
{TrackRendererAdapter::Attribute::kLowLatencyMode,
{ValueType::kUInt32, "low-latency-mode"}},
- {TrackRendererAdapter::Attribute::kVideoFramePeekMode,
- {ValueType::kUInt32, "video-frame-peek-mode"}},
{TrackRendererAdapter::Attribute::kUnlimitedMaxBufferMode,
{ValueType::kUInt32, "unlimited-max-buffer-mode"}},
{TrackRendererAdapter::Attribute::kVideoPreDisplayMode,
{ValueType::kUInt32, "video-pre-display-mode"}},
{TrackRendererAdapter::Attribute::kStartRenderingTime,
{ValueType::kUInt64, "start-rendering-time"}},
- {TrackRendererAdapter::Attribute::kFmmMode,
- {ValueType::kUInt32, "fmm-mode"}},
#if 0
{TrackRendererAdapter::Attribute::kAlternativeVideoResource,
{ValueType::kUInt32, "alternative-video-resource"}},
handle_, adapter_utils::ConvertToVideoFrameBufferType(type));
}
-bool TrackRendererAdapter::RenderVideoFrame() {
- if (trackrenderer_render_video_frame(handle_) == kFailed) {
- return false;
- }
- return true;
-}
-
/////////////////////////////////////////////
/////////////// Callbacks ///////////////////
/////////////////////////////////////////////
track->protection_system = trackinfo.protection_system.c_str();
}
-void MakeTrackRendererAppInfo(TrackRendererAppInfo* app_attr,
- const PlayerAppInfo& app_info) {
- app_attr->id = const_cast<char*>(app_info.id.c_str());
- app_attr->version = const_cast<char*>(app_info.version.c_str());
- app_attr->type = const_cast<char*>(app_info.type.c_str());
-}
-
DisplayMode ConvertToDisplayMode(TrackRendererDisplayMode typevalue) {
switch (typevalue) {
case kTrackRendererDisplayModeLetterBox: {
ASSERT_EQ(esplusplayer_destroy(esplayer), ESPLUSPLAYER_ERROR_TYPE_NONE);
}
-#ifdef PRODUCT_TEST
+#ifdef TIZEN_FEATURE_TV
TEST_F(EsTest, vdapi_basic_esplusplayer_submit_encrypted_packet_p_1) {
esplusplayer_handle esplayer = NULL;
ASSERT_EQ(esplusplayer_submit_encrypted_packet(esplayer, NULL, NULL),
ASSERT_EQ(esplusplayer_destroy(esplayer), ESPLUSPLAYER_ERROR_TYPE_NONE);
}
-#ifdef PRODUCT_TEST
-TEST_F(EsTest, vdapi_basic_esplusplayer_set_low_latency_mode_p_1) {
- esplusplayer_handle esplayer = esplusplayer_create();
- ASSERT_NE(nullptr, esplayer);
- ASSERT_EQ(esplusplayer_open(esplayer), ESPLUSPLAYER_ERROR_TYPE_NONE);
- esplusplayer_set_low_latency_mode(esplayer,
- ESPLUSPLAYER_LOW_LATENCY_MODE_NONE);
- ASSERT_EQ(esplusplayer_close(esplayer), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(esplusplayer_destroy(esplayer), ESPLUSPLAYER_ERROR_TYPE_NONE);
-}
-
-TEST_F(EsTest,
- vdapi_basic_esplusplayer_esplusplayer_set_video_frame_peek_mode_p_1) {
- esplusplayer_handle esplayer = esplusplayer_create();
- ASSERT_NE(nullptr, esplayer);
- ASSERT_EQ(esplusplayer_open(esplayer), ESPLUSPLAYER_ERROR_TYPE_NONE);
- esplusplayer_set_video_frame_peek_mode(esplayer);
- ASSERT_EQ(esplusplayer_close(esplayer), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(esplusplayer_destroy(esplayer), ESPLUSPLAYER_ERROR_TYPE_NONE);
-}
-#endif
-
TEST_P(EsBasicTest, vdapi_basic_esplusplayer_set_audio_mute_p_1) {
ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
ASSERT_EQ(
std::this_thread::sleep_for(std::chrono::seconds(10));
}
-#ifdef PRODUCT_TEST
-TEST_F(EsTest, vdapi_basic_esplusplayer_set_app_info_p_1) {
- esplusplayer_handle esplayer = esplusplayer_create();
- ASSERT_NE(nullptr, esplayer);
- ASSERT_EQ(esplusplayer_open(esplayer), ESPLUSPLAYER_ERROR_TYPE_NONE);
- char a[20], appid[] = "youtube";
- char v[20], version[] = "3.0";
- char t[20], type[] = "MSE";
- esplusplayer_app_info appinfo;
- strncpy(a, appid, sizeof(a)-1);
- a[sizeof(a)-1] = 0x00;
- strncpy(v, version, sizeof(v)-1);
- v[sizeof(v)-1] = 0x00;
- strncpy(t, type, sizeof(t)-1);
- t[sizeof(t)-1] = 0x00;
- appinfo.id = a;
- appinfo.version = v;
- appinfo.type = t;
- ASSERT_EQ(esplusplayer_set_app_info(esplayer, &appinfo),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(esplusplayer_close(esplayer), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(esplusplayer_destroy(esplayer), ESPLUSPLAYER_ERROR_TYPE_NONE);
-}
-#endif
-
TEST_P(EsBasicTest, vdapi_basic_esplusplayer_close_p_2) {
ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
std::cout << "BasicTest, Play, END" << std::endl;
}
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_get_adaptive_info_p_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_TRUE(video_reader_->SetStreamInfo(esplayer_));
- ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
- ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- callback_->WaitForPrepareDone();
- ASSERT_EQ(esplusplayer_start(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- std::this_thread::sleep_for(std::chrono::seconds(3));
- uint64_t count = 0;
- ASSERT_EQ(esplusplayer_get_adaptive_info(
- esplayer_, static_cast<void*>(&count),
- ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_FRAMES),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- std::cout << "count = " << count << std::endl;
-}
-
TEST_P(EsBasicTest, vdapi_basic_esplusplayer_set_submit_data_type_p_1) {
ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
std::this_thread::sleep_for(std::chrono::seconds(3));
}
-#ifdef PRODUCT_TEST
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_render_video_frame_p_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(esplusplayer_set_video_frame_peek_mode(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_TRUE(video_reader_->SetStreamInfo(esplayer_));
- ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
- ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- callback_->WaitForPrepareDone();
- ASSERT_EQ(esplusplayer_start(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- std::this_thread::sleep_for(std::chrono::seconds(3));
- ASSERT_EQ(esplusplayer_pause(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(esplusplayer_seek(esplayer_, 0), ESPLUSPLAYER_ERROR_TYPE_NONE);
- std::this_thread::sleep_for(std::chrono::seconds(5));
- ASSERT_EQ(esplusplayer_render_video_frame(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- std::this_thread::sleep_for(std::chrono::seconds(2));
- ASSERT_EQ(esplusplayer_resume(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- std::this_thread::sleep_for(std::chrono::seconds(5));
- std::cout << "BasicTest, Play, END" << std::endl;
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_set_render_time_offset_p_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_TRUE(video_reader_->SetStreamInfo(esplayer_));
- ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
- ASSERT_EQ(esplusplayer_set_low_latency_mode(
- esplayer_, ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- callback_->WaitForPrepareDone();
- ASSERT_EQ(esplusplayer_start(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- int64_t set_offset = 10;
- ASSERT_EQ(esplusplayer_set_render_time_offset(
- esplayer_, ESPLUSPLAYER_STREAM_TYPE_VIDEO, set_offset),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- int64_t get_offset = 0;
- ASSERT_EQ(esplusplayer_get_render_time_offset(
- esplayer_, ESPLUSPLAYER_STREAM_TYPE_VIDEO, &get_offset),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(set_offset, get_offset);
- std::cout << "BasicTest, Play, END" << std::endl;
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_set_render_time_offset_p_2) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_TRUE(video_reader_->SetStreamInfo(esplayer_));
- ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
- ASSERT_EQ(esplusplayer_set_low_latency_mode(
- esplayer_, ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- callback_->WaitForPrepareDone();
- ASSERT_EQ(esplusplayer_start(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- int64_t set_offset = 10;
- ASSERT_EQ(esplusplayer_set_render_time_offset(
- esplayer_, ESPLUSPLAYER_STREAM_TYPE_AUDIO, set_offset),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- int64_t get_offset = 0;
- ASSERT_EQ(esplusplayer_get_render_time_offset(
- esplayer_, ESPLUSPLAYER_STREAM_TYPE_AUDIO, &get_offset),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(set_offset, get_offset);
- std::cout << "BasicTest, Play, END" << std::endl;
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_set_render_time_offset_n_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_TRUE(video_reader_->SetStreamInfo(esplayer_));
- ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
- ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- callback_->WaitForPrepareDone();
- ASSERT_EQ(esplusplayer_start(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- int64_t set_offset = 10;
- ASSERT_EQ(esplusplayer_set_render_time_offset(
- esplayer_, ESPLUSPLAYER_STREAM_TYPE_VIDEO, set_offset),
- ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
- int64_t get_offset = 0;
- ASSERT_EQ(esplusplayer_get_render_time_offset(
- esplayer_, ESPLUSPLAYER_STREAM_TYPE_VIDEO, &get_offset),
- ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
- std::cout << "BasicTest, Play, END" << std::endl;
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_set_render_time_offset_n_2) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_TRUE(video_reader_->SetStreamInfo(esplayer_));
- ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
- ASSERT_EQ(esplusplayer_set_low_latency_mode(
- esplayer_, ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_SYNC),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- int64_t set_offset = 10;
- ASSERT_EQ(esplusplayer_set_render_time_offset(
- esplayer_, ESPLUSPLAYER_STREAM_TYPE_VIDEO, set_offset),
- ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
- int64_t get_offset = 0;
- ASSERT_EQ(esplusplayer_get_render_time_offset(
- esplayer_, ESPLUSPLAYER_STREAM_TYPE_VIDEO, &get_offset),
- ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
- std::cout << "BasicTest, Play, END" << std::endl;
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_switch_audio_stream_onthefly_p_1) {
- if (uri_.find("aac") == std::string::npos) return;
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_TRUE(video_reader_->SetStreamInfo(esplayer_));
- ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
- ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- callback_->WaitForPrepareDone();
- esplusplayer_audio_stream_info audio_stream;
- memset(&audio_stream, 0, sizeof(esplusplayer_audio_stream_info));
- audio_stream.mime_type = ESPLUSPLAYER_AUDIO_MIME_TYPE_AC3;
- audio_stream.sample_rate = 48000;
- audio_stream.channels = 2;
- ASSERT_EQ(esplusplayer_switch_audio_stream_onthefly(esplayer_, &audio_stream),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- std::cout << "set audio stream info after flush" << std::endl;
- std::cout << "BasicTest, Play, END" << std::endl;
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_switch_audio_stream_onthefly_n_1) {
- if (uri_.find("aac") == std::string::npos) return;
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_TRUE(video_reader_->SetStreamInfo(esplayer_));
- ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
- ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- callback_->WaitForPrepareDone();
-
- esplusplayer_audio_stream_info audio_stream;
- memset(&audio_stream, 0, sizeof(esplusplayer_audio_stream_info));
- audio_stream.mime_type = ESPLUSPLAYER_AUDIO_MIME_TYPE_OPUS;
- audio_stream.sample_rate = 48000;
- audio_stream.channels = 2;
- ASSERT_EQ(esplusplayer_switch_audio_stream_onthefly(esplayer_, &audio_stream),
- ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
- std::cout << "BasicTest, Play, END" << std::endl;
-}
-
TEST_P(EsBasicTest, vdapi_basic_esplusplayer_set_video_codec_type_p_1) {
ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
std::cout << "BasicTest, Play, END" << std::endl;
}
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_get_virtual_rsc_id_p_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_TRUE(video_reader_->SetStreamInfo(esplayer_));
- ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
- ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- callback_->WaitForPrepareDone();
-
- int virtual_id = -1;
- ASSERT_EQ(esplusplayer_get_virtual_rsc_id(
- esplayer_, ESPLUSPLAYER_RSC_TYPE_VIDEO_RENDERER, &virtual_id),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_TRUE(virtual_id != -1);
- std::cout << "BasicTest, Play, END" << std::endl;
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_init_audio_easing_info_p_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- const esplusplayer_target_audio_easing_info init_info = {
- 0, 1000, ESPLUSPLAYER_AUDIO_EASING_LINEAR};
- ASSERT_EQ(esplusplayer_init_audio_easing_info(esplayer_, 100, 0, &init_info),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_init_audio_easing_info_n_1) {
- const esplusplayer_target_audio_easing_info init_info = {
- 0, 1000, ESPLUSPLAYER_AUDIO_EASING_LINEAR};
- ASSERT_EQ(esplusplayer_init_audio_easing_info(esplayer_, 100, 0, &init_info),
- ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_update_audio_easing_info_p_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- const esplusplayer_target_audio_easing_info init_info = {
- 0, 1000, ESPLUSPLAYER_AUDIO_EASING_LINEAR};
- ASSERT_EQ(esplusplayer_init_audio_easing_info(esplayer_, 100, 0, &init_info),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- const esplusplayer_target_audio_easing_info update_info = {
- 100, 1000, ESPLUSPLAYER_AUDIO_EASING_LINEAR};
- ASSERT_EQ(esplusplayer_update_audio_easing_info(esplayer_, &update_info),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_update_audio_easing_info_n_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- const esplusplayer_target_audio_easing_info update_info = {
- 100, 1000, ESPLUSPLAYER_AUDIO_EASING_LINEAR};
- ASSERT_EQ(esplusplayer_update_audio_easing_info(esplayer_, &update_info),
- ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_get_audio_easing_info_p_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- uint32_t init_volume = 100;
- uint32_t init_elapsed_time = 50;
- const esplusplayer_target_audio_easing_info info = {
- 50, 1000, ESPLUSPLAYER_AUDIO_EASING_LINEAR};
- ASSERT_EQ(esplusplayer_init_audio_easing_info(esplayer_, init_volume,
- init_elapsed_time, &info),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- uint32_t cur_volume = 0;
- uint32_t elapsed_time = 0;
- esplusplayer_target_audio_easing_info get_info;
- ASSERT_EQ(esplusplayer_get_audio_easing_info(esplayer_, &cur_volume,
- &elapsed_time, &get_info),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- EXPECT_EQ(init_volume, cur_volume);
- EXPECT_EQ(init_elapsed_time, elapsed_time);
- EXPECT_EQ(info.volume, get_info.volume);
- EXPECT_EQ(info.duration, get_info.duration);
- EXPECT_EQ(info.type, get_info.type);
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_get_audio_easing_info_n_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- uint32_t cur_volume = 0;
- uint32_t elapsed_time = 0;
- esplusplayer_target_audio_easing_info get_info;
- ASSERT_EQ(esplusplayer_get_audio_easing_info(esplayer_, &cur_volume,
- &elapsed_time, &get_info),
- ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_start_audio_easing_p_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
- ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- callback_->WaitForPrepareDone();
-
- const esplusplayer_target_audio_easing_info info = {
- 50, 1000, ESPLUSPLAYER_AUDIO_EASING_LINEAR};
- ASSERT_EQ(esplusplayer_init_audio_easing_info(esplayer_, 100, 0, &info),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(esplusplayer_start_audio_easing(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(esplusplayer_start(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_start_audio_easing_n_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- ASSERT_EQ(esplusplayer_start_audio_easing(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_stop_audio_easing_p_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
- ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- callback_->WaitForPrepareDone();
-
- const esplusplayer_target_audio_easing_info info = {
- 50, 1000, ESPLUSPLAYER_AUDIO_EASING_LINEAR};
- ASSERT_EQ(esplusplayer_init_audio_easing_info(esplayer_, 100, 0, &info),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(esplusplayer_start_audio_easing(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(esplusplayer_start(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- std::this_thread::sleep_for(std::chrono::seconds(1));
- ASSERT_EQ(esplusplayer_stop_audio_easing(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-}
-
-TEST_P(EsBasicTest, vdapi_basic_esplusplayer_stop_audio_easing_n_1) {
- ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
- ASSERT_EQ(
- esplusplayer_set_display(esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- window_->Window()),
- ESPLUSPLAYER_ERROR_TYPE_NONE);
-
- ASSERT_EQ(esplusplayer_stop_audio_easing(esplayer_),
- ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
-}
-#endif
-
INSTANTIATE_TEST_CASE_P(ESPlusplayer, EsBasicTest,
::testing::ValuesIn(es_tc::tc_list));
submit_stopped_ = true;
}
-TEST_F(EsPlayerTest, Get_Adaptive_Info) {
- using ::testing::_;
- using ::testing::AtLeast;
-
- SetVideoStream();
- SetAudioStream();
-
- EXPECT_CALL(*mock_eventlistener_, OnReadyToPrepare(_, _)).Times(AtLeast(1));
- EXPECT_CALL(*mock_eventlistener_, OnPrepareDone(true, _));
-
- ASSERT_TRUE(player_->PrepareAsync());
-
- std::this_thread::sleep_for(std::chrono::seconds(5));
-
- uint64_t *pvalue = new uint64_t;
- ASSERT_TRUE(player_->GetAdaptiveInfo(
- (void *)pvalue, pp::PlayerAdaptiveInfo::kVideoDroppedFrames));
- std::cout << "Dropped frames: " << *pvalue << std::endl;
-
- ASSERT_TRUE(player_->Stop());
- submit_stopped_ = true;
-}
-
TEST_F(EsPlayerTest, SetGetVolume) {
using ::testing::_;
using ::testing::AtLeast;
tracksource->Stop();
}
-TEST_F(EsPlayerTest2, VideoPeekSeek) {
+TEST_F(EsPlayerTest2, VideoSeek) {
using ::testing::_;
using ::testing::AtLeast;
esplayer->SetDisplay(plusplayer::DisplayType::kOverlay, obj);
esplayer->SetStream(GetVideoStream());
esplayer->SetStream(GetAudioStream());
- esplayer->SetVideoFramePeekMode();
esplayer->PrepareAsync();
fake_eventlistener->WaitAllStreamData();
auto seek_feeding_task = std::thread(feeding_task_fn);
std::this_thread::sleep_for(std::chrono::seconds(5));
std::cout <<" Render Video and wait 5 sec ~"<< std::endl;
- esplayer->RenderVideoFrame();
- std::this_thread::sleep_for(std::chrono::seconds(5));
std::cout <<" Resume ~"<< std::endl;
esplayer->Resume();
std::this_thread::sleep_for(std::chrono::seconds(5));