Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// Copyright 2026 Samsung Electronics Co., Ltd. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_TIZEN_PLUGINS_WRAPPER_VIDEO_PLAYER_VIDEOHOLE_H_
#define FLUTTER_TIZEN_PLUGINS_WRAPPER_VIDEO_PLAYER_VIDEOHOLE_H_

#include <stdbool.h>
#include <stdint.h>

#define MAX_STRING_NAME_LEN 255
#define MMPLAYER_FOUR_CC_LEN 14
#define PLAYER_LANG_NAME_SIZE 10

typedef struct {
char fourCC[MMPLAYER_FOUR_CC_LEN + 1]; /**< codec fourcc */
char name[MAX_STRING_NAME_LEN]; /**< name: video/audio, it maybe not exit in
some track*/
/*dynamic infos in hls,ss,dash streams*/
int width; /**< resolution width */
int height; /**< resolution height */
int bit_rate; /**< bitrate in bps */
} player_video_track_info_v2;

typedef struct {
char fourCC[MMPLAYER_FOUR_CC_LEN + 1]; /**< codec fourcc */
char language[PLAYER_LANG_NAME_SIZE]; /**< language info*/
/*dynamic infos in hls,ss,dash streams*/
int sample_rate; /**< sample rate in this track*/
int channel; /**< channel in this track*/
int bit_rate; /**< bitrate in this track*/
} player_audio_track_info_v2;

typedef struct {
char fourCC[MMPLAYER_FOUR_CC_LEN + 1]; /**< codec fourcc */
char language[PLAYER_LANG_NAME_SIZE]; /**< language info*/
int subtitle_type; /**< text subtitle = 0, picture subtitle = 1 */
} player_subtitle_track_info_v2;

typedef enum {
PLAYER_DRM_TYPE_EME = 14,
} player_drm_type_e;

typedef enum {
PLAYER_ADAPTIVE_INFO_LIVE_DURATION = 3,
PLAYER_ADAPTIVE_INFO_IS_LIVE = 19,
} player_adaptive_Info_e;

typedef enum {
CENC = 0,
KEYIDS = 1,
WEBM = 2,
} drm_init_data_type;

typedef bool (*security_init_complete_cb)(int *drmhandle, unsigned int length,
unsigned char *psshdata,
void *user_data);
typedef int (*set_drm_init_data_cb)(drm_init_data_type init_type, void *data,
int data_length, void *user_data);

typedef enum {
DM_ERROR_NONE = 0,
DM_ERROR_INVALID_SESSION = 21,
} dm_error_e;

typedef struct SetDataParam_s {
void *param1; /**< Parameter 1 */
void *param2; /**< Parameter 2 */
void *param3; /**< Parameter 3 */
void *param4; /**< Parameter 4 */
} SetDataParam_t;

typedef void *DRMSessionHandle_t;

#ifdef __cplusplus
extern "C" {
#endif

// Native libraries remain loaded for the process lifetime (callbacks may
// outlive calls).

int ftpw_video_player_videohole_player_set_ecore_wl_display(
void *player, int type, void *ecore_wl_window, int x, int y, int width,
int height);
int ftpw_video_player_videohole_player_set_drm_handle(
void *player, player_drm_type_e drm_type, int drm_handle);
int ftpw_video_player_videohole_player_set_drm_init_complete_cb(
void *player, security_init_complete_cb callback, void *user_data);
int ftpw_video_player_videohole_player_set_drm_init_data_cb(
void *player, set_drm_init_data_cb callback, void *user_data);
int ftpw_video_player_videohole_player_get_adaptive_streaming_info(
void *player, void *adaptive_info, int adaptive_type);
int ftpw_video_player_videohole_player_get_track_count_v2(void *player,
int type,
int *pcount);
int ftpw_video_player_videohole_player_get_video_track_info_v2(
void *player, int index, player_video_track_info_v2 **track_info);
int ftpw_video_player_videohole_player_get_audio_track_info_v2(
void *player, int index, player_audio_track_info_v2 **track_info);
int ftpw_video_player_videohole_player_get_subtitle_track_info_v2(
void *player, int index, player_subtitle_track_info_v2 **track_info);
bool ftpw_video_player_videohole_device_power_is_standby(void);
int ftpw_video_player_videohole_DMGRSetData(DRMSessionHandle_t drm_session,
const char *data_type,
void *input_data);
int ftpw_video_player_videohole_DMGRGetData(DRMSessionHandle_t drm_session,
const char *data_type,
void *output_data);
void ftpw_video_player_videohole_DMGRSetDRMLocalMode(void);
DRMSessionHandle_t ftpw_video_player_videohole_DMGRCreateDRMSession(
const char *drm_sub_type);
bool ftpw_video_player_videohole_DMGRSecurityInitCompleteCB(
int *drm_handle, unsigned int len, unsigned char *pssh_data,
void *user_data);
int ftpw_video_player_videohole_DMGRReleaseDRMSession(
DRMSessionHandle_t drm_session);

#ifdef __cplusplus
}
#endif

#endif
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions packages/video_player_videohole/tizen/project_def.prop
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ USER_CPP_UNDEFS =
USER_INC_DIRS = inc src
USER_INC_FILES =
USER_CPP_INC_FILES =

USER_LIB_DIRS += lib/${BUILD_ARCH}
USER_LIBS += ftpw_video_player_videohole
40 changes: 0 additions & 40 deletions packages/video_player_videohole/tizen/src/device_proxy.cc

This file was deleted.

27 changes: 0 additions & 27 deletions packages/video_player_videohole/tizen/src/device_proxy.h

This file was deleted.

69 changes: 27 additions & 42 deletions packages/video_player_videohole/tizen/src/drm_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <flutter/standard_method_codec.h>

#include "drm_license_helper.h"
#include "drm_manager_proxy.h"
#include "ftpw_video_player_videohole.h"
#include "log.h"

static std::string GetDrmSubType(int drm_type) {
Expand All @@ -21,20 +21,7 @@ static std::string GetDrmSubType(int drm_type) {
}
}

DrmManager::DrmManager() : drm_type_(DM_TYPE_NONE) {
drm_manager_proxy_ = OpenDrmManagerProxy();
if (drm_manager_proxy_) {
int ret = InitDrmManagerProxy(drm_manager_proxy_);
if (ret != DM_ERROR_NONE) {
LOG_ERROR("[DrmManager] Fail to initialize DRM manager: %s",
get_error_message(ret));
CloseDrmManagerProxy(drm_manager_proxy_);
drm_manager_proxy_ = nullptr;
}
} else {
LOG_ERROR("[DrmManager] Fail to dlopen libdrmmanager.");
}

DrmManager::DrmManager() : drm_type_(DRM_TYPE_NONE) {
// Initialize GMainContext and license request state
main_context_ = std::unique_ptr<GMainContext, GMainContextDeleter>(
g_main_context_ref_thread_default());
Expand All @@ -58,27 +45,18 @@ DrmManager::~DrmManager() {
}

main_context_.reset();

if (drm_manager_proxy_) {
CloseDrmManagerProxy(drm_manager_proxy_);
drm_manager_proxy_ = nullptr;
}
}

bool DrmManager::CreateDrmSession(int drm_type, bool local_mode) {
if (!drm_manager_proxy_) {
LOG_ERROR("[DrmManager] Invalid handle of libdrmmanager.");
return false;
}

if (local_mode) {
DMGRSetDRMLocalMode();
ftpw_video_player_videohole_DMGRSetDRMLocalMode();
}

drm_type_ = drm_type;
std::string sub_type = GetDrmSubType(drm_type);
LOG_INFO("[DrmManager] drm type is %s", sub_type.c_str());
drm_session_ = DMGRCreateDRMSession(DM_TYPE_EME, sub_type.c_str());
drm_session_ = ftpw_video_player_videohole_DMGRCreateDRMSession(
sub_type.c_str());
if (!drm_session_) {
LOG_ERROR("[DrmManager] Fail to create drm session.");
return false;
Expand All @@ -89,7 +67,8 @@ bool DrmManager::CreateDrmSession(int drm_type, bool local_mode) {
SetDataParam_t configure_param = {};
configure_param.param1 = reinterpret_cast<void *>(OnDrmManagerError);
configure_param.param2 = drm_session_;
int ret = DMGRSetData(drm_session_, "error_event_callback", &configure_param);
int ret = ftpw_video_player_videohole_DMGRSetData(
drm_session_, "error_event_callback", &configure_param);
if (ret != DM_ERROR_NONE) {
LOG_ERROR(
"[DrmManager] Fail to set error_event_callback to drm session: %s",
Expand Down Expand Up @@ -125,14 +104,15 @@ void DrmManager::StopDrmSession() {
SetDataParam_t challenge_data_param = {};
challenge_data_param.param1 = nullptr;
challenge_data_param.param2 = nullptr;
int ret = DMGRSetData(drm_session_, "eme_request_key_callback",
&challenge_data_param);
int ret = ftpw_video_player_videohole_DMGRSetData(
drm_session_, "eme_request_key_callback", &challenge_data_param);
if (ret != DM_ERROR_NONE) {
LOG_ERROR("[DrmManager] Fail to unset eme_request_key_callback: %s",
get_error_message(ret));
}

ret = DMGRSetData(drm_session_, "Finalize", nullptr);
ret = ftpw_video_player_videohole_DMGRSetData(drm_session_, "Finalize",
nullptr);

if (ret != DM_ERROR_NONE) {
LOG_ERROR("[DrmManager] Fail to set finalize to drm session: %s",
Expand All @@ -146,7 +126,7 @@ void DrmManager::ReleaseDrmSession() {
return;
}

int ret = DMGRReleaseDRMSession(drm_session_);
int ret = ftpw_video_player_videohole_DMGRReleaseDRMSession(drm_session_);
if (ret != DM_ERROR_NONE) {
LOG_ERROR("[DrmManager] Fail to release drm session: %s",
get_error_message(ret));
Expand All @@ -157,7 +137,8 @@ void DrmManager::ReleaseDrmSession() {
bool DrmManager::GetDrmHandle(int *handle) {
if (drm_session_) {
*handle = 0;
int ret = DMGRGetData(drm_session_, "drm_handle", handle);
int ret = ftpw_video_player_videohole_DMGRGetData(drm_session_,
"drm_handle", handle);
if (ret != DM_ERROR_NONE) {
LOG_ERROR("[DrmManager] Fail to get drm_handle from drm session: %s",
get_error_message(ret));
Expand All @@ -180,7 +161,8 @@ int DrmManager::UpdatePsshData(const void *data, int length) {
SetDataParam_t pssh_data_param = {};
pssh_data_param.param1 = const_cast<void *>(data);
pssh_data_param.param2 = reinterpret_cast<void *>(length);
int ret = DMGRSetData(drm_session_, "update_pssh_data", &pssh_data_param);
int ret = ftpw_video_player_videohole_DMGRSetData(
drm_session_, "update_pssh_data", &pssh_data_param);
if (DM_ERROR_NONE != ret) {
LOG_ERROR("[DrmManager] Fail to set update_pssh_data to drm session: %s",
get_error_message(ret));
Expand All @@ -200,8 +182,8 @@ bool DrmManager::SecurityInitCompleteCB(int *drm_handle, unsigned int len,
}
security_param.param2 = drm_session_;

return DMGRSecurityInitCompleteCB(drm_handle, len, pssh_data,
&security_param);
return ftpw_video_player_videohole_DMGRSecurityInitCompleteCB(
drm_handle, len, pssh_data, &security_param);
}

int DrmManager::SetChallenge(const std::string &media_url) {
Expand All @@ -213,8 +195,8 @@ int DrmManager::SetChallenge(const std::string &media_url) {
SetDataParam_t challenge_data_param = {};
challenge_data_param.param1 = reinterpret_cast<void *>(OnChallengeData);
challenge_data_param.param2 = this;
int ret = DMGRSetData(drm_session_, "eme_request_key_callback",
&challenge_data_param);
int ret = ftpw_video_player_videohole_DMGRSetData(
drm_session_, "eme_request_key_callback", &challenge_data_param);
if (ret != DM_ERROR_NONE) {
LOG_ERROR(
"[DrmManager] Fail to set eme_request_key_callback to drm session: "
Expand All @@ -223,16 +205,18 @@ int DrmManager::SetChallenge(const std::string &media_url) {
return ret;
}

ret = DMGRSetData(drm_session_, "set_playready_manifest",
static_cast<void *>(const_cast<char *>(media_url.c_str())));
ret = ftpw_video_player_videohole_DMGRSetData(
drm_session_, "set_playready_manifest",
static_cast<void *>(const_cast<char *>(media_url.c_str())));
if (ret != DM_ERROR_NONE) {
LOG_ERROR(
"[DrmManager] Fail to set set_playready_manifest to drm session: %s",
get_error_message(ret));
return ret;
}

ret = DMGRSetData(drm_session_, "Initialize", nullptr);
ret = ftpw_video_player_videohole_DMGRSetData(drm_session_, "Initialize",
nullptr);
if (ret != DM_ERROR_NONE) {
LOG_ERROR("[DrmManager] Fail to set initialize to drm session: %s",
get_error_message(ret));
Expand Down Expand Up @@ -299,7 +283,8 @@ void DrmManager::InstallKey(void *session_id, void *response_data,
license_param.param1 = session_id;
license_param.param2 = response_data;
license_param.param3 = response_len;
int ret = DMGRSetData(drm_session_, "install_eme_key", &license_param);
int ret = ftpw_video_player_videohole_DMGRSetData(
drm_session_, "install_eme_key", &license_param);
if (ret != DM_ERROR_NONE) {
LOG_ERROR("[DrmManager] Fail to install eme key: %s",
get_error_message(ret));
Expand Down
3 changes: 0 additions & 3 deletions packages/video_player_videohole/tizen/src/drm_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include <mutex>
#include <queue>

#include "drm_manager_proxy.h"

class DrmManager {
public:
typedef enum {
Expand Down Expand Up @@ -61,7 +59,6 @@ class DrmManager {
request_license_channel_;

void *drm_session_ = nullptr;
void *drm_manager_proxy_ = nullptr;

int drm_type_;
std::string license_server_url_;
Expand Down
Loading
Loading