#endif
};
-struct DecoderBufferTime{
+struct DecoderBufferTime {
uint64_t pts = 0;
uint64_t system_time = 0;
-} ;
+};
/**
* @brief Enumerations for the state of getting decoded packet
* ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_SCALE:
* decoded video frame will be croped and scaled, then sent to
* user by media_packet_video_decoded_cb, only support hw decoder now
-*/
+ */
enum esplusplayer_decoded_video_frame_buffer_type {
ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE,
ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_COPY,
*/
uint64_t pts;
/**
- * @description system time of decoder input or output buffer, in millisecond
+ * @description system time of decoder input or output buffer, in
+ * millisecond
*/
uint64_t system_time;
} esplusplayer_decoder_buffer_time;
#ifndef __ESPLUSPLAYER_ESPLUSPLAYER_CAPI_ESPACKET_H__
#define __ESPLUSPLAYER_ESPLUSPLAYER_CAPI_ESPACKET_H__
-
#include "esplusplayer_capi/matroska_color.h"
#include "esplusplayer_capi/stream.h"
int esplusplayer_set_simple_mix_out_buffer_level(
esplusplayer_handle handle, esplusplayer_simple_mix_out_buffer_level level);
-
#ifdef TIZEN_FEATURE_PUBLIC
/**
* @brief Provided api for enabling video hole.
* @param [in] handle : esplusplayer handle.
* @param [in] value : the value of video hole.
* (@c true = video hole enabled, @c false = video hole disabled)
- * @return @c ESPLUSPLAYER_ERROR_TYPE_NONE on success, otherwise @c one of esplusplayer_error_type
- * values will be returned.
+ * @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
+ * @retval #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation
+ * failed
* @code
* esplusplayer_open(esplayer);
* esplusplayer_enable_video_hole(esplayer, false);
* esplusplayer_close(esplayer);
* @endcode
* @pre The player state must not be #ESPLUSPLAYER_STATE_NONE.
- * @remark To disable video hole, esplusplayer_decoded_video_frame_buffer_type() must
- * not be set to #ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE.
- * To enable video hole, esplusplayer_set_display() must be set to #ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY
+ * @remark To disable video hole,
+ * esplusplayer_decoded_video_frame_buffer_type() must not be set to
+ * #ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE. To enable video hole,
+ * esplusplayer_set_display() must be set to #ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY
* @post None
* @exception None
* @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);
+int esplusplayer_enable_video_hole(esplusplayer_handle handle,
+ const bool value);
#endif
#ifdef __cplusplus
}
if (packet == nullptr || packet->surface_data == nullptr) return;
#else
if (packet == nullptr) return;
- if (packet->private_data) { // hw dec
- gst_buffer_unref((GstBuffer *)packet->private_data);
+ if (packet->private_data) { // hw dec
+ gst_buffer_unref((GstBuffer*)packet->private_data);
packet->private_data = nullptr;
}
if (packet->surface_data == nullptr) return;
// LOG_DEBUG("packet[%p] deleted", packet);
tbm_surface_destroy(static_cast<tbm_surface_h>(packet->surface_data));
packet->surface_data = NULL;
-// LCOV_EXCL_STOP
+ // LCOV_EXCL_STOP
}
} // namespace
public:
explicit DecodedScaledPacketList() { LOG_DEBUG("created"); }
virtual ~DecodedScaledPacketList() { LOG_DEBUG("destroyed"); }
-// LCOV_EXCL_START
+ // LCOV_EXCL_START
virtual void GetFreeTbmSurface(void** ptr, bool is_scale_change) {
std::unique_lock<std::mutex> lk(mtx_);
if (is_scale_change) {
return false;
});
}
-// LCOV_EXCL_STOP
+ // LCOV_EXCL_STOP
virtual void Clear() override {
std::unique_lock<std::mutex> lk(mtx_);
}
protected:
-// LCOV_EXCL_START
+ // LCOV_EXCL_START
virtual bool IsAvailableInternal() override {
if (GetList().size() > kMaxAvailableSize_) return false;
return true;
}
}
}
-// LCOV_EXCL_STOP
+ // LCOV_EXCL_STOP
private:
const std::uint32_t kMaxAvailableSize_ = 5;
#ifdef USE_MIXER
#include "mixer/mixerticket.h"
#include "mixer/mixerticket_eventlistener.h"
-#endif // USE_MIXER
+#endif // USE_MIXER
#include "esplayer/espacket_logger.h"
#include "esplayer/message.hpp"
#include "esplayer/state_manager.hpp"
bool SetDisplay(const DisplayType& type, void* obj) override;
#ifdef USE_MIXER
bool SetDisplay(const DisplayType& type, MixerTicket* handle) override;
-#endif // USE_MIXER
+#endif // USE_MIXER
bool SetDisplay(const DisplayType& type, void* ecore_wl2_window, const int x,
const int y, const int w, const int h) override;
bool SetDisplaySubsurface(const DisplayType& type, void* ecore_wl2_subsurface,
#endif
#ifdef USE_MIXER
bool PrepareVideoMixingMode_(std::vector<Track>* tracks);
-#endif // USE_MIXER
+#endif // USE_MIXER
void InitValuesFromIni_();
private: // private types
#ifdef USE_MIXER
void OnMediaPacketVideoRawDecoded(
const DecodedVideoRawModePacket& packet) override;
-#endif // USE_MIXER
+#endif // USE_MIXER
private:
void ReadyToPrepare_(const TrackType& type);
private:
EsPlayer* handler_{nullptr};
};
-#endif // USE_MIXER
+#endif // USE_MIXER
#ifdef TIZEN_FEATURE_PUBLIC
bool EnableVideoHole(bool value) override;
new TrackRendererEventListener(this)};
#ifdef USE_MIXER
std::unique_ptr<MixerListener> mixer_event_listener_{new MixerListener(this)};
-#endif // USE_MIXER
+#endif // USE_MIXER
std::unique_ptr<TrackRendererAdapter> trackrenderer_;
std::future<void> preparetask_;
PlayerAppInfo app_info_;
std::mutex audio_focus_m_;
bool enable_audio_pipeline_handle_ = true;
bool enable_rsc_alloc_handle_ = true;
-#endif // USE_MIXER
+#endif // USE_MIXER
DecodedVideoFrameBufferType vidoe_frame_buffer_type_ =
DecodedVideoFrameBufferType::kNone;
// for debugging
this, "can't deactivate audio stream, mixer will control audio stream");
return false;
}
-#endif // USE_MIXER
+#endif // USE_MIXER
if (!trackrenderer_->Deactivate(static_cast<TrackType>(type))) {
return false;
}
"can't activate audio stream, mixer will control audio stream");
return false;
}
-#endif // USE_MIXER
+#endif // USE_MIXER
if (!track_.empty()) {
auto has_track = [type](const Track& item) -> bool {
return item.type == static_cast<TrackType>(type);
trackrenderer_->SetVideoFrameBufferType(
VideoFrameTypeStrategyPtr(new RawVideoFrameTypeStrategy()));
else
-#endif // USE_MIXER
+#endif // USE_MIXER
trackrenderer_->SetVideoFrameBufferType(VideoFrameTypeStrategyPtr(
new DefaultVideoFrameTypeStrategy(vidoe_frame_buffer_type_)));
}
this, "can't deactivate audio stream, mixer will control audio stream");
return false;
}
-#endif // USE_MIXER
+#endif // USE_MIXER
if (!trackrenderer_->DeactivateAudio()) {
return false;
}
"can't activate audio stream, mixer will control audio stream");
return false;
}
-#endif // USE_MIXER
+#endif // USE_MIXER
if (track_.empty()) {
return false;
}
ResetContextForStop_();
#ifdef USE_MIXER
if (mixer_ticket_) mixer_ticket_.reset();
-#endif // USE_MIXER
+#endif // USE_MIXER
performance_checker::End(start, "Stop");
return true;
};
}
return true;
}
-#endif // USE_MIXER
+#endif // USE_MIXER
// LCOV_EXCL_START
bool EsPlayer::Prepare_() {
}
}
}
-#endif // USE_MIXER
+#endif // USE_MIXER
for (const auto& track : active_track) {
switch (track.type) {
case kTrackTypeAudio: {
}
#ifdef USE_MIXER
if (mixer_ticket_) mixer_ticket_.reset();
-#endif // USE_MIXER
+#endif // USE_MIXER
return trackrenderer_->SetDisplay(type, obj);
}
}
return true;
}
-#endif // USE_MIXER
+#endif // USE_MIXER
bool EsPlayer::SetDisplay(const DisplayType& type, void* ecore_wl2_window,
const int x, const int y, const int w, const int h) {
}
#ifdef USE_MIXER
if (mixer_ticket_) mixer_ticket_.reset();
-#endif // USE_MIXER
+#endif // USE_MIXER
return trackrenderer_->SetDisplay(type, ecore_wl2_window, x, y, w, h);
}
}
#ifdef USE_MIXER
if (mixer_ticket_) mixer_ticket_.reset();
-#endif // USE_MIXER
+#endif // USE_MIXER
return trackrenderer_->SetDisplaySubsurface(type, ecore_wl2_subsurface, x, y,
w, h);
}
}
#ifdef USE_MIXER
if (mixer_ticket_) mixer_ticket_.reset();
-#endif // USE_MIXER
+#endif // USE_MIXER
return trackrenderer_->SetDisplay(type, surface_id, x, y, w, h);
}
// LCOV_EXCL_START
#ifdef USE_MIXER
mixerticket_roi_ = roi;
if (mixer_ticket_) return true;
-#endif // USE_MIXER
+#endif // USE_MIXER
return trackrenderer_->SetDisplayRoi(roi);
}
is_visible_ = is_visible;
return true;
}
-#endif // USE_MIXER
+#endif // USE_MIXER
return trackrenderer_->SetDisplayVisible(is_visible);
}
video_decoding_mode_ = internal::kNdecodingMode;
return true;
}
-#endif // USE_MIXER
+#endif // USE_MIXER
LOG_INFO_P(this, "PlayerVideoCodecType [%s]",
(type == kPlayerVideoCodecTypeHW) ? "hardware" : "software");
video_codec_type_ = type;
LOG_ERROR_P(this, "player can't control resource type, mixer will do it");
return false;
}
-#endif // USE_MIXER
+#endif // USE_MIXER
if (resource_alloc_policy_ > RscAllocPolicy::kRscAllocExclusive) {
LOG_ERROR_P(this,
"has set resource allocate policy, the alternative "
handler_->is_visible_ ? VisibleStatus::kVisible : VisibleStatus::kHide;
return true;
}
-#endif // USE_MIXER
+#endif // USE_MIXER
// LCOV_EXCL_STOP
void EsPlayer::TrackRendererEventListener::OnSeekData(const TrackType& type,
#include "esplusplayer_capi/esplusplayer_internal.h"
#if defined(USE_MIXER) && !defined(IS_TOMATO)
#include "mixer_capi/mixer_capi.h"
-#endif // defined(USE_MIXER) && !defined(IS_TOMATO)
+#endif // defined(USE_MIXER) && !defined(IS_TOMATO)
#include "esplusplayer/appinfo.h"
#include "esplusplayer/audioeasinginfo.h"
#include "esplusplayer/drm.h"
return convert_return_type_(
cast_(handle)->SetDisplay(static_cast<DisplayType>(type), ticket));
}
-#endif // defined(USE_MIXER) && !defined(IS_TOMATO)
+#endif // defined(USE_MIXER) && !defined(IS_TOMATO)
return convert_return_type_(
cast_(handle)->SetDisplay(static_cast<DisplayType>(type), window));
}
}
#ifdef TIZEN_FEATURE_PUBLIC
-int esplusplayer_enable_video_hole(esplusplayer_handle handle, const bool value) {
+int esplusplayer_enable_video_hole(esplusplayer_handle handle,
+ const bool value) {
LOG_ENTER_P(cast_(handle))
if (is_null_(handle)) return ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER;
#include "gst/gst.h"
// temporary until drmdecrypt platform interfaces are added into rootstrap
-#if !defined(TIZEN_FEATURE_PUBLIC) && !defined(PLUPLAYER_DOWNLOADABLE_APP_TVPLUS)
+#if !defined(TIZEN_FEATURE_PUBLIC) && \
+ !defined(PLUPLAYER_DOWNLOADABLE_APP_TVPLUS)
#include <drmdecrypt/drmdecrypt_api.h>
#endif
}
void ReleaseTZHandle_(GstBuffer* buffer) {
-#if !defined(TIZEN_FEATURE_PUBLIC) && !defined(PLUPLAYER_DOWNLOADABLE_APP_TVPLUS)
+#if !defined(TIZEN_FEATURE_PUBLIC) && \
+ !defined(PLUPLAYER_DOWNLOADABLE_APP_TVPLUS)
GstStructure* tzqdata = GST_STRUCTURE(gst_mini_object_get_qdata(
GST_MINI_OBJECT(buffer),
g_quark_from_static_string("GstTzHandleData")));
namespace esplusplayer {
namespace esplusplayer_cfg {
-
+
const char* GetIniPath() {
const char* path =
- tzplatform_mkpath(TZ_SYS_RO_ETC, "multimedia/esplusplayer.ini");
+ tzplatform_mkpath(TZ_SYS_RO_ETC, "multimedia/esplusplayer.ini");
assert(path);
return path;
}
-} // namespace esplusplayer_cfg
+} // namespace esplusplayer_cfg
-} // namespace esplusplayer
\ No newline at end of file
+} // namespace esplusplayer
\ No newline at end of file
std::unique_ptr<EsStreamReader> reader = nullptr;
bool ready_to_push = false;
- explicit StreamContext(const std::string &path,
+ explicit StreamContext(const std::string& path,
esplusplayer_stream_type type) noexcept {
reader = std::make_unique<EsStreamReader>(path, type);
}
return prepared_.result;
}
- bool SetDisplay(void *window) {
+ bool SetDisplay(void* window) {
return esplusplayer_set_display(handle_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
window) == ESPLUSPLAYER_ERROR_TYPE_NONE;
}
}
public:
- static Context *Create(const std::string &path) {
+ static Context* Create(const std::string& path) {
if (path.empty()) {
return nullptr;
}
}
private:
- explicit Context(const std::string &path) : path_(path) {}
+ explicit Context(const std::string& path) : path_(path) {}
bool Init() {
video_ = std::make_unique<StreamContext>(path_ + "video/",
}
private:
- static void OnError(const esplusplayer_error_type, void *) {
+ static void OnError(const esplusplayer_error_type, void*) {
std::cout << "Error happened" << std::endl;
}
- static void OnResourceConflicted(void *) {
+ static void OnResourceConflicted(void*) {
std::cout << "Resource conflicted" << std::endl;
}
- static void OnPrepared(bool ret, void *userdata) {
+ static void OnPrepared(bool ret, void* userdata) {
std::cout << "Prepared" << std::endl;
- auto *ctx = static_cast<Context *>(userdata);
+ auto* ctx = static_cast<Context*>(userdata);
ctx->StartDataFeedingTask(ESPLUSPLAYER_STREAM_TYPE_VIDEO);
ctx->StartDataFeedingTask(ESPLUSPLAYER_STREAM_TYPE_AUDIO);
ctx->SignalPrepareDone(ret);
}
static void OnReadyToPrepare(const esplusplayer_stream_type type,
- void *userdata) {
+ void* userdata) {
std::cout << "Ready to prepare" << std::endl;
- auto *ctx = static_cast<Context *>(userdata);
+ auto* ctx = static_cast<Context*>(userdata);
ctx->StartDataFeedingTask(type);
}
}
static rm_cb_result OnResourceConflicted(int handle, rm_callback_type event,
- rm_device_request_s *info,
- void *data) {
+ rm_device_request_s* info,
+ void* data) {
return RM_CB_RESULT_OK;
}
}
protected:
- static ::Environment *window_;
+ static ::Environment* window_;
};
-::Environment *RegressionTest::window_ = nullptr;
+::Environment* RegressionTest::window_ = nullptr;
/*
* [[ DF230714-00327 ]]
+#include "ut/include/utils/utility.h"
+
#include <Ecore.h>
#include <Elementary.h>
#include <gtest/gtest.h>
+#include <jconfig.h>
+#include <jpeglib.h>
+#include <math.h>
+#include <poll.h>
+#include <unistd.h>
+
#include <algorithm>
#include <cassert>
#include <chrono>
+#include <fstream>
#include <memory>
-#include <unistd.h>
-#include <poll.h>
-
-#include "ut/include/utils/utility.h"
#include "ut/include/esplusplayer/eseventlistener.hpp"
#include "ut/include/esplusplayer/esreader.hpp"
-
-#include <math.h>
-#include <fstream>
-#include <jconfig.h>
-#include <jpeglib.h>
#ifdef TIZEN_FEATURE_PUBLIC
#include <system_info.h>
#else
#include <capi-system-info/system_info.h>
#include <capi-system-info/system_info_key.h>
#include <system-type/system_type_enum.h>
-#include "ivideocapture.hpp"
+
#include "capi-video-capture.h"
-#include "iaudio-control.hpp"
#include "diagnosis-audio-control.hpp"
+#include "iaudio-control.hpp"
+#include "ivideocapture.hpp"
#endif
using namespace std;
using namespace esplusplayer;
-//using namespace tc;
+// using namespace tc;
using UserData = void*;
namespace utils {
printf("esplusplayer_start failed\n");
return nullptr;
}
-#endif // USE_MIXER
+#endif // USE_MIXER
esplusplayer_handle Utility::GetOpenedESPP(Geometry& roi) {
esplusplayer_handle player = esplusplayer_create();
memset(&pkt, 0, sizeof(esplusplayer_es_packet));
if (!reader->ReadNextPacket(pkt)) break;
esplusplayer_submit_packet(player, &pkt);
- delete []pkt.buffer;
+ delete[] pkt.buffer;
}
};
if (type == ESPLUSPLAYER_STREAM_TYPE_VIDEO) {
#ifndef TIZEN_FEATURE_PUBLIC
void ResizeCopy(unsigned int m_width, unsigned int m_height,
- unsigned int m_rwidth, unsigned int m_rheight,
- char* c_ptr, char* y_ptr, unsigned char* dest,
- unsigned int color_format) {
+ unsigned int m_rwidth, unsigned int m_rheight, char* c_ptr,
+ char* y_ptr, unsigned char* dest, unsigned int color_format) {
unsigned int omit = 1;
unsigned int x = 0;
unsigned int y = 0;
for (y = 0; y < m_height; y++) {
if ((y + 1) % omit || !resize) {
for (x = 0; x < m_width; x += sizeof(unsigned int)) {
-
unsigned int Yplain =
*((unsigned int*)((void*)(y_ptr + y * m_width + x)));
unsigned int Cplain =
break;
}
if ((x + 4) % omit || !resize) {
- dest[inc++] = (Yplain) & 0xFF;
+ dest[inc++] = (Yplain)&0xFF;
dest[inc++] = Cplain & 0xFF;
dest[inc++] = (Cplain >> 8) & 0xFF;
}
if ((x + 3) % omit || !resize) {
dest[inc++] = (Yplain >> 8) & 0xFF;
- dest[inc++] = (Cplain) & 0xFF;
+ dest[inc++] = (Cplain)&0xFF;
dest[inc++] = (Cplain >> 8) & 0xFF;
}
}
}
-int Utility::CaptureYUV(int capture_width, int capture_height,
- char* ybuff, char* cbuff, int ysize,
- int csize, std::string result_file_path) {
+int Utility::CaptureYUV(int capture_width, int capture_height, char* ybuff,
+ char* cbuff, int ysize, int csize,
+ std::string result_file_path) {
// screen capture
IVideoCapture* VCObjptr = IVideoCapture::getInstance();
IVideoCapture::InputParams input_params;
-
+
input_params.capture_w = capture_width;
input_params.capture_h = capture_height;
return 0;
}
-///TODO:: Modify the API to return the pointer instead of writing it as an image file.
+/// TODO:: Modify the API to return the pointer instead of writing it as an
+/// image file.
int Utility::CaptureJPG(const int capture_width, const int capture_height,
char* ybuff, char* cbuff, const int ysize,
const int csize, std::string img_file_path) {
}
int Utility::CheckYUV(int x, int y) {
-
/* screen capture */
IVideoCapture* VCObjptr = IVideoCapture::getInstance();
int CAPTURE_BUF_SIZE = CAPTURE_WIDTH * CAPTURE_HEIGHT;
char ybuff[CAPTURE_BUF_SIZE] = {0};
char cbuff[CAPTURE_BUF_SIZE] = {0};
-
+
IVideoCapture::InputParams input_params;
input_params.capture_w = 640;
input_params.capture_h = 360;
VCObjptr->getVideoPostYUV(input_params, output_params);
- /* check YUV value. As the capture size (640 x 360) is mapped with the full screen (1920 x 1080), the position should be resized. */
+ /* check YUV value. As the capture size (640 x 360) is mapped with the full
+ * screen (1920 x 1080), the position should be resized. */
int new_X = x / 3;
int new_Y = y / 3;
int position = CAPTURE_WIDTH * (new_Y - 1) + new_X;
-
+
LOGE("Y value : %d", (int)ybuff[position]);
return (int)ybuff[position];
}
bool Utility::IsAudioMute() {
long audioMute = 0;
- EXPECT_EQ(audioDiagnoser->Diagnosis_GetBoolean(0, "main out mute", &audioMute), 0);
+ EXPECT_EQ(
+ audioDiagnoser->Diagnosis_GetBoolean(0, "main out mute", &audioMute), 0);
return (audioMute != 0);
}
#endif
}
std::string Utility::getKeyboardInput(int timeoutMsec) {
- struct pollfd pfd = { STDIN_FILENO, POLLIN, 0 };
+ struct pollfd pfd = {STDIN_FILENO, POLLIN, 0};
std::string line = "";
int ret = poll(&pfd, 1, timeoutMsec);
- if(ret == 1) {// there is something to read
+ if (ret == 1) { // there is something to read
std::getline(std::cin, line);
}
return line;
while (getline(ss, line)) {
stringstream liness(line);
string token;
- while(getline(liness, token, delimiter)) {
+ while (getline(liness, token, delimiter)) {
if (!token.empty()) {
result.push_back(token);
}