From: Haesu Gwon Date: Thu, 29 May 2025 08:36:19 +0000 (+0900) Subject: [HALACR-50] Remove HDCP API X-Git-Tag: accepted/tizen/unified/20250610.081807^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;p=platform%2Fhal%2Fapi%2Fdrm.git [HALACR-50] Remove HDCP API - Remove HDCP API which is moved to HDCP git [Version] 1.0.0 [Issue Type] Remove Change-Id: If1fc2a1aa9eaad64a12589b8a6c1143bb2782d11 --- diff --git a/doc/hal_drm_doc.h b/doc/hal_drm_doc.h index 33317fb..ad7d9e4 100644 --- a/doc/hal_drm_doc.h +++ b/doc/hal_drm_doc.h @@ -39,7 +39,6 @@ * - managing drm sessions. * - device provisioning. * - decrypt DRM content. - * - hdcp * * @subsection HALAPI_HAL_DRM_MODULE_STATE_DIAGRAM State Diagram * @image html hal_drm_state_diagram.png @@ -64,18 +63,6 @@ * NONE * SYNC * - * - * hal_drm_hdcp_open() - * INITIALIZED - * HDCP_OPENED - * SYNC - * - * - * hal_drm_hdcp_close() - * HDCP_OPENED - * INITIALIZED - * SYNC - * * * * For more information on the DRM features and the macros, see HAL DRM programming guides and tutorials. diff --git a/doc/images/hal_drm_state_diagram.png b/doc/images/hal_drm_state_diagram.png index 3f08724..7126269 100644 Binary files a/doc/images/hal_drm_state_diagram.png and b/doc/images/hal_drm_state_diagram.png differ diff --git a/include/hal-drm-interface-1.h b/include/hal-drm-interface-1.h index f4634fe..3ef0b22 100644 --- a/include/hal-drm-interface-1.h +++ b/include/hal-drm-interface-1.h @@ -59,7 +59,6 @@ typedef enum hal_drm_error { typedef enum hal_drm_state { HAL_DRM_STATE_NONE, /**< None state */ HAL_DRM_STATE_INITIALIZED, /**< Initialized state for DRM device */ - HAL_DRM_STATE_HDCP_OPENED, /**< Opened state for DRM device */ } hal_drm_state_e; /** @@ -143,30 +142,6 @@ typedef struct hal_drm_message { */ typedef hal_drm_error_e (*hal_drm_message_cb)(hal_drm_message_s *message, void *user_data); -/* HDCP */ - -/** - * @brief HDCP device type - * @since HAL_MODULE_DRM 1.0 - */ -typedef enum -{ - HAL_DRM_HDCP_DEVICE_RECEIVER, /**< Receiver */ - HAL_DRM_HDCP_DEVICE_TRANSMIT, /**< Transmitter */ - HAL_DRM_HDCP_DEVICE_TRANSMIT_MULTISINK, /**< Transmitter with multi sink */ - } hal_drm_hdcp_device_type_e; - -/** - * @brief HDCP protocol version - * @since HAL_MODULE_DRM 1.0 - */ -typedef enum -{ - HAL_DRM_HDCP_VERSION_2_0 = 20, /**< HDCP version 2.0 */ - HAL_DRM_HDCP_VERSION_2_1 = 21, /**< HDCP version 2.1 */ - HAL_DRM_HDCP_VERSION_2_2 = 22, /**< HDCP version 2.2 */ -} hal_drm_hdcp_protocol_version_e; - /** * @brief The structure type of the DRM HAL functions. * @since HAL_MODULE_DRM 1.0 @@ -182,26 +157,6 @@ typedef struct _hal_backend_drm_funcs { int (*get_command)(void *drm_handle, hal_drm_command_e command, void **value); /** Sets a set of commands */ int (*set_batch_command)(void *drm_handle, hal_drm_batch_command_control_s *batch_command, hal_drm_command_e *error_command); - /** Opens HDCP */ - int (*hdcp_open)(void *drm_handle, hal_drm_hdcp_device_type_e type, hal_drm_hdcp_protocol_version_e version); - /** Closes HDCP */ - int (*hdcp_close)(void *drm_handle); - /** Starts HDCP receiver */ - int (*hdcp_start_receiver)(void *drm_handle, uint32_t socket_port, uint32_t *hdcp_id); - /** Stops HDCP receiver */ - int (*hdcp_stop_receiver)(void *drm_handle, uint32_t hdcp_id); - /** Starts HDCP transmitter */ - int (*hdcp_start_transmitter)(void *drm_handle, const char *socket_ip, uint32_t socket_port, uint32_t *hdcp_id); - /** Stops HDCP transmitter */ - int (*hdcp_stop_transmitter)(void *drm_handle, uint32_t hdcp_id); - /** Allocates hdcp output buffer */ - int (*hdcp_allocate_output_buffer)(void *drm_handle, uint32_t size, bool is_secure, hal_drm_buffer_s *buffer); - /** Releases hdcp output buffer */ - int (*hdcp_release_output_buffer)(void *drm_handle, hal_drm_buffer_s *buffer); - /** Decrypts HDCP data */ - int (*hdcp_decrypt)(void *drm_handle, hal_drm_buffer_s *input, void *decrypt_info, hal_drm_buffer_s *output); - /** Encrypts HDCP data */ - int (*hdcp_encrypt)(void *drm_handle, hal_drm_buffer_s *input, uint32_t hdcp_id, void *encrypt_info, hal_drm_buffer_s *output); } hal_backend_drm_funcs; /** diff --git a/include/hal-drm.h b/include/hal-drm.h index 7988556..70de023 100644 --- a/include/hal-drm.h +++ b/include/hal-drm.h @@ -1,5 +1,5 @@ /* - * HAL(Hardware Abstract Layer) API for DRM(Digital Rights Management) including HDCP(High-bandwidth Digital Content Protection) + * HAL(Hardware Abstract Layer) API for DRM(Digital Rights Management) * * Copyright (c) 2025 Samsung Electronics Co., Ltd. * @@ -129,166 +129,6 @@ int hal_drm_get_command(void *drm_handle, hal_drm_command_e command, void **valu */ int hal_drm_set_batch_command(void *drm_handle, hal_drm_batch_command_control_s *batch_command, hal_drm_command_e *error_command); -/** - * @brief Opens HDCP. - * @since HAL_MODULE_DRM 1.0 - * @param[in] drm_handle The handle to the DRM HAL - * @param[in] type The type of HDCP - * @param[in] version The version of HDCP - * @return @c 0 on success, otherwise a negative error value - * @retval #HAL_DRM_ERROR_NONE Successful - * @retval #HAL_DRM_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAL_DRM_ERROR_NOT_IMPLEMENTED The feature is not implemented - * @pre The DRM state must be set to #HAL_DRM_STATE_INITIALIZED. - * @post If it succeeds, the DRM state will be #HAL_DRM_STATE_HDCP_OPENED. - * @see hal_drm_hdcp_close() - */ -int hal_drm_hdcp_open(void *drm_handle, hal_drm_hdcp_device_type_e type, hal_drm_hdcp_protocol_version_e version); - -/** - * @brief Closes HDCP. - * @since HAL_MODULE_DRM 1.0 - * @param[in] drm_handle The handle to the DRM HAL - * @return @c 0 on success, otherwise a negative error value - * @retval #HAL_DRM_ERROR_NONE Successful - * @retval #HAL_DRM_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAL_DRM_ERROR_NOT_IMPLEMENTED The feature is not implemented - * @pre The DRM state must be set to #HAL_DRM_STATE_HDCP_OPENED. - * @post If it succeeds, the DRM state will be #HAL_DRM_STATE_INITIALIZED. - * @see hal_drm_hdcp_open() - */ -int hal_drm_hdcp_close(void *drm_handle); - -/** - * @brief Starts HDCP receiver. - * @since HAL_MODULE_DRM 1.0 - * @param[in] drm_handle The handle to the DRM HAL - * @param[in] socket_port The socket port number - * @param[out] hdcp_id The hdcp id - * @return @c 0 on success, otherwise a negative error value - * @retval #HAL_DRM_ERROR_NONE Successful - * @retval #HAL_DRM_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAL_DRM_ERROR_NOT_IMPLEMENTED The feature is not implemented - * @pre The DRM state must be set to #HAL_DRM_STATE_HDCP_OPENED. - * @see hal_drm_hdcp_stop_receiver() - */ -int hal_drm_hdcp_start_receiver(void *drm_handle, uint32_t socket_port, uint32_t *hdcp_id); - -/** - * @brief Stops HDCP receiver. - * @since HAL_MODULE_DRM 1.0 - * @param[in] drm_handle The handle to the DRM HAL - * @param[in] hdcp_id The hdcp id - * @return @c 0 on success, otherwise a negative error value - * @retval #HAL_DRM_ERROR_NONE Successful - * @retval #HAL_DRM_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAL_DRM_ERROR_NOT_IMPLEMENTED The feature is not implemented - * @pre The DRM state must be set to #HAL_DRM_STATE_HDCP_OPENED. - * @see hal_drm_hdcp_start_receiver() - */ -int hal_drm_hdcp_stop_receiver(void *drm_handle, uint32_t hdcp_id); - -/** - * @brief Starts HDCP transmitter. - * @since HAL_MODULE_DRM 1.0 - * @param[in] drm_handle The handle to the DRM HAL - * @param[in] socket_ip The socket ip address - * @param[in] socket_port The socket port number - * @param[out] hdcp_id The hdcp id - * @return @c 0 on success, otherwise a negative error value - * @retval #HAL_DRM_ERROR_NONE Successful - * @retval #HAL_DRM_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAL_DRM_ERROR_NOT_IMPLEMENTED The feature is not implemented - * @pre The DRM state must be set to #HAL_DRM_STATE_HDCP_OPENED. - * @see hal_drm_hdcp_stop_transmitter() - */ -int hal_drm_hdcp_start_transmitter(void *drm_handle, const char *socket_ip, uint32_t socket_port, uint32_t *hdcp_id); - -/** - * @brief Stops HDCP transmitter. - * @since HAL_MODULE_DRM 1.0 - * @param[in] drm_handle The handle to the DRM HAL - * @param[in] hdcp_id The hdcp id - * @return @c 0 on success, otherwise a negative error value - * @retval #HAL_DRM_ERROR_NONE Successful - * @retval #HAL_DRM_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAL_DRM_ERROR_NOT_IMPLEMENTED The feature is not implemented - * @pre The DRM state must be set to #HAL_DRM_STATE_HDCP_OPENED. - * @see hal_drm_hdcp_start_transmitter() - */ -int hal_drm_hdcp_stop_transmitter(void *drm_handle, uint32_t hdcp_id); - -/** - * @brief Allocates HDCP output buffer. - * @since HAL_MODULE_DRM 1.0 - * @param[in] drm_handle The handle to the DRM HAL - * @param[in] size The size of output buffer - * @param[in] is_secure The flag which indicates the real data is managed in secure world or not - * @param[out] output The HDCP output buffer - * @return @c 0 on success, otherwise a negative error value - * @retval #HAL_DRM_ERROR_NONE Successful - * @retval #HAL_DRM_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAL_DRM_ERROR_INTERNAL Internal error - * @retval #HAL_DRM_ERROR_NOT_IMPLEMENTED The feature is not implemented - * @pre The DRM state must be set to #HAL_DRM_STATE_HDCP_OPENED. - * @see hal_drm_hdcp_release_output_buffer() - * @see hal_drm_hdcp_decrypt() - */ -int hal_drm_hdcp_allocate_output_buffer(void *drm_handle, uint32_t size, bool is_secure, hal_drm_buffer_s *buffer); - -/** - * @brief Releases HDCP output buffer. - * @since HAL_MODULE_DRM 1.0 - * @remarks The output buffer should be released with this function after use it. - * @param[in] drm_handle The handle to the DRM HAL - * @param[in] output The HDCP output buffer to release - * @return @c 0 on success, otherwise a negative error value - * @retval #HAL_DRM_ERROR_NONE Successful - * @retval #HAL_DRM_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAL_DRM_ERROR_NOT_IMPLEMENTED The feature is not implemented - * @pre The DRM state must be set to #HAL_DRM_STATE_HDCP_OPENED. - * @see hal_drm_hdcp_allocate_output_buffer() - * @see hal_drm_hdcp_decrypt() - */ -int hal_drm_hdcp_release_output_buffer(void *drm_handle, hal_drm_buffer_s *buffer); - -/** - * @brief Decrypts HDCP data. - * @since HAL_MODULE_DRM 1.0 - * @param[in] drm_handle The handle to the DRM HAL - * @param[in] input The input buffer to decrypt - * @param[in] decrypt_info The decryption information - * @param[out] output The decrypted output buffer - * @return @c 0 on success, otherwise a negative error value - * @retval #HAL_DRM_ERROR_NONE Successful - * @retval #HAL_DRM_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAL_DRM_ERROR_INTERNAL Internal error - * @retval #HAL_DRM_ERROR_NOT_IMPLEMENTED The feature is not implemented - * @pre The DRM state must be set to #HAL_DRM_STATE_HDCP_OPENED. - * @see hal_drm_hdcp_allocate_output_buffer() - * @see hal_drm_hdcp_release_output_buffer() - */ -int hal_drm_hdcp_decrypt(void *drm_handle, hal_drm_buffer_s *input, void *decrypt_info, hal_drm_buffer_s *output); - -/** - * @brief Encrypts HDCP data to send. - * @since HAL_MODULE_DRM 1.0 - * @param[in] drm_handle The handle to the DRM HAL - * @param[in] input The input buffer to encrypt - * @param[in] hdcp_id The hdcp id - * @param[in] encrypt_info The encryption information - * @param[out] output The encrypted output buffer - * @return @c 0 on success, otherwise a negative error value - * @retval #HAL_DRM_ERROR_NONE Successful - * @retval #HAL_DRM_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAL_DRM_ERROR_INTERNAL Internal error - * @retval #HAL_DRM_ERROR_NOT_IMPLEMENTED The feature is not implemented - * @pre The DRM state must be set to #HAL_DRM_STATE_HDCP_OPENED. - * @see hal_drm_hdcp_allocate_output_buffer() - * @see hal_drm_hdcp_release_output_buffer() - */ -int hal_drm_hdcp_encrypt(void *drm_handle, hal_drm_buffer_s *input, uint32_t hdcp_id, void *encrypt_info, hal_drm_buffer_s *output); - /** * @} */ diff --git a/packaging/hal-api-drm.spec b/packaging/hal-api-drm.spec index bcaa8d9..f2e51dd 100644 --- a/packaging/hal-api-drm.spec +++ b/packaging/hal-api-drm.spec @@ -3,7 +3,7 @@ ### main package ######### Name: %{name} Summary: %{name} interface -Version: 1.0.1 +Version: 1.0.0 Release: 0 Group: Development/Libraries License: Apache-2.0 diff --git a/src/hal-api-drm.c b/src/hal-api-drm.c index 3ca89ed..53f92b0 100644 --- a/src/hal-api-drm.c +++ b/src/hal-api-drm.c @@ -253,179 +253,3 @@ int hal_drm_set_batch_command(void *drm_handle, hal_drm_batch_command_control_s return handle->funcs->set_batch_command(handle->backend, batch_command, error_command); } - -int hal_drm_hdcp_open(void *drm_handle, hal_drm_hdcp_device_type_e type, hal_drm_hdcp_protocol_version_e version) -{ - int ret = 0; - hal_drm_s *handle = (hal_drm_s *)drm_handle; - - HAL_DRM_RETURN_IF_NULL(handle, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs->hdcp_open, HAL_DRM_ERROR_NOT_IMPLEMENTED); - - if (type < HAL_DRM_HDCP_DEVICE_RECEIVER || type > HAL_DRM_HDCP_DEVICE_TRANSMIT_MULTISINK) - return HAL_DRM_ERROR_INVALID_PARAMETER; - - if (version < HAL_DRM_HDCP_VERSION_2_0 || version > HAL_DRM_HDCP_VERSION_2_2) - return HAL_DRM_ERROR_INVALID_PARAMETER; - - AUTOCLEAN_LOCKER(&handle->lock); - - HAL_DRM_CHECK_STATE(handle->state, HAL_DRM_STATE_INITIALIZED); - - ret = handle->funcs->hdcp_open(handle->backend, type, version); - if (ret == HAL_DRM_ERROR_NONE) - __hal_drm_set_state(handle, HAL_DRM_STATE_HDCP_OPENED); - - return ret; -} - -int hal_drm_hdcp_close(void *drm_handle) -{ - int ret = 0; - hal_drm_s *handle = (hal_drm_s *)drm_handle; - - HAL_DRM_RETURN_IF_NULL(handle, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs->hdcp_close, HAL_DRM_ERROR_NOT_IMPLEMENTED); - - AUTOCLEAN_LOCKER(&handle->lock); - - HAL_DRM_CHECK_STATE(handle->state, HAL_DRM_STATE_HDCP_OPENED); - - ret = handle->funcs->hdcp_close(handle->backend); - if (ret == HAL_DRM_ERROR_NONE) - __hal_drm_set_state(handle, HAL_DRM_STATE_INITIALIZED); - - return ret; -} - -int hal_drm_hdcp_start_receiver(void *drm_handle, uint32_t socket_port, uint32_t *hdcp_id) -{ - hal_drm_s *handle = (hal_drm_s *)drm_handle; - - HAL_DRM_RETURN_IF_NULL(handle, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs->hdcp_start_receiver, HAL_DRM_ERROR_NOT_IMPLEMENTED); - HAL_DRM_RETURN_IF_NULL(hdcp_id, HAL_DRM_ERROR_INVALID_PARAMETER); - - AUTOCLEAN_LOCKER(&handle->lock); - - HAL_DRM_CHECK_STATE(handle->state, HAL_DRM_STATE_HDCP_OPENED); - - return handle->funcs->hdcp_start_receiver(handle->backend, socket_port, hdcp_id); -} - -int hal_drm_hdcp_stop_receiver(void *drm_handle, uint32_t hdcp_id) -{ - hal_drm_s *handle = (hal_drm_s *)drm_handle; - - HAL_DRM_RETURN_IF_NULL(handle, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs->hdcp_stop_receiver, HAL_DRM_ERROR_NOT_IMPLEMENTED); - - AUTOCLEAN_LOCKER(&handle->lock); - - HAL_DRM_CHECK_STATE(handle->state, HAL_DRM_STATE_HDCP_OPENED); - - return handle->funcs->hdcp_stop_receiver(handle->backend, hdcp_id); -} - -int hal_drm_hdcp_start_transmitter(void *drm_handle, const char *socket_ip, uint32_t socket_port, uint32_t *hdcp_id) -{ - hal_drm_s *handle = (hal_drm_s *)drm_handle; - - HAL_DRM_RETURN_IF_NULL(handle, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs->hdcp_start_transmitter, HAL_DRM_ERROR_NOT_IMPLEMENTED); - HAL_DRM_RETURN_IF_NULL(socket_ip, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(hdcp_id, HAL_DRM_ERROR_INVALID_PARAMETER); - - AUTOCLEAN_LOCKER(&handle->lock); - - HAL_DRM_CHECK_STATE(handle->state, HAL_DRM_STATE_HDCP_OPENED); - - return handle->funcs->hdcp_start_transmitter(handle->backend, socket_ip, socket_port, hdcp_id); -} - -int hal_drm_hdcp_stop_transmitter(void *drm_handle, uint32_t hdcp_id) -{ - hal_drm_s *handle = (hal_drm_s *)drm_handle; - - HAL_DRM_RETURN_IF_NULL(handle, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs->hdcp_stop_transmitter, HAL_DRM_ERROR_NOT_IMPLEMENTED); - - AUTOCLEAN_LOCKER(&handle->lock); - - HAL_DRM_CHECK_STATE(handle->state, HAL_DRM_STATE_HDCP_OPENED); - - return handle->funcs->hdcp_stop_transmitter(handle->backend, hdcp_id); -} - -int hal_drm_hdcp_allocate_output_buffer(void *drm_handle, uint32_t size, bool is_secure, hal_drm_buffer_s *buffer) -{ - hal_drm_s *handle = (hal_drm_s *)drm_handle; - - HAL_DRM_RETURN_IF_NULL(handle, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs->hdcp_stop_transmitter, HAL_DRM_ERROR_NOT_IMPLEMENTED); - HAL_DRM_RETURN_IF_NULL(buffer, HAL_DRM_ERROR_INVALID_PARAMETER); - - AUTOCLEAN_LOCKER(&handle->lock); - - HAL_DRM_CHECK_STATE(handle->state, HAL_DRM_STATE_HDCP_OPENED); - - return handle->funcs->hdcp_allocate_output_buffer(handle->backend, size, is_secure, buffer); -} - -int hal_drm_hdcp_release_output_buffer(void *drm_handle, hal_drm_buffer_s *buffer) -{ - hal_drm_s *handle = (hal_drm_s *)drm_handle; - - HAL_DRM_RETURN_IF_NULL(handle, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs->hdcp_stop_transmitter, HAL_DRM_ERROR_NOT_IMPLEMENTED); - HAL_DRM_RETURN_IF_NULL(buffer, HAL_DRM_ERROR_INVALID_PARAMETER); - - AUTOCLEAN_LOCKER(&handle->lock); - - HAL_DRM_CHECK_STATE(handle->state, HAL_DRM_STATE_HDCP_OPENED); - - return handle->funcs->hdcp_release_output_buffer(handle->backend, buffer); -} - -int hal_drm_hdcp_decrypt(void *drm_handle, hal_drm_buffer_s *input, void *decrypt_info, hal_drm_buffer_s *output) -{ - hal_drm_s *handle = (hal_drm_s *)drm_handle; - - HAL_DRM_RETURN_IF_NULL(handle, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs->hdcp_decrypt, HAL_DRM_ERROR_NOT_IMPLEMENTED); - HAL_DRM_RETURN_IF_NULL(input, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(output, HAL_DRM_ERROR_INVALID_PARAMETER); - - AUTOCLEAN_LOCKER(&handle->lock); - - HAL_DRM_CHECK_STATE(handle->state, HAL_DRM_STATE_HDCP_OPENED); - - return handle->funcs->hdcp_decrypt(handle->backend, input, decrypt_info, output); -} - -int hal_drm_hdcp_encrypt(void *drm_handle, hal_drm_buffer_s *input, uint32_t hdcp_id, void *encrypt_info, hal_drm_buffer_s *output) -{ - hal_drm_s *handle = (hal_drm_s *)drm_handle; - - HAL_DRM_RETURN_IF_NULL(handle, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(handle->funcs->hdcp_encrypt, HAL_DRM_ERROR_NOT_IMPLEMENTED); - HAL_DRM_RETURN_IF_NULL(input, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(encrypt_info, HAL_DRM_ERROR_INVALID_PARAMETER); - HAL_DRM_RETURN_IF_NULL(output, HAL_DRM_ERROR_INVALID_PARAMETER); - - AUTOCLEAN_LOCKER(&handle->lock); - - HAL_DRM_CHECK_STATE(handle->state, HAL_DRM_STATE_HDCP_OPENED); - - return handle->funcs->hdcp_encrypt(handle->backend, input, hdcp_id, encrypt_info, output); -} diff --git a/tests/drm_hal_test.cpp b/tests/drm_hal_test.cpp index 3148f9c..0cc1f0a 100644 --- a/tests/drm_hal_test.cpp +++ b/tests/drm_hal_test.cpp @@ -26,8 +26,6 @@ static int gRet; static void *gHalHandle; -static const char *gSocketIp = "192.168.0.1"; -static int gPortIp = 100; /* * main class @@ -161,14 +159,8 @@ TEST_F(DrmHalTest, DrmSetBatchCommandP) batch_command.custom.name = "custom_command_name"; batch_command.custom.value = (void*)10; - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - gRet = hal_drm_set_batch_command(gHalHandle, &batch_command, nullptr); ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); } /** @@ -191,717 +183,11 @@ TEST_F(DrmHalTest, DrmSetBatchCommandN) batch_command.custom.name = "custom_command_name"; batch_command.custom.value = (void*)10; - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - gRet = hal_drm_set_batch_command(nullptr, &batch_command, nullptr); ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); gRet = hal_drm_set_batch_command(gHalHandle, nullptr, nullptr); ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpOpenP - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Positive, Open HDCP - * @apicovered hal_drm_hdcp_open - * @passcase when hal_drm_hdcp_open returns HAL_DRM_ERROR_NONE - * @failcase when hal_drm_hdcp_open does not return HAL_DRM_ERROR_NONE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpOpenP) -{ - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpCloseP - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Positive, Close HDCP - * @apicovered hal_drm_hdcp_close - * @passcase when hal_drm_hdcp_close returns HAL_DRM_ERROR_NONE - * @failcase when hal_drm_hdcp_close does not return HAL_DRM_ERROR_NONE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpCloseP) -{ - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpCloseN - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Close HDCP - * @apicovered hal_drm_hdcp_close - * @passcase when hal_drm_hdcp_open is not called and hal_drm_hdcp_close returns HAL_DRM_ERROR_INVALID_STATE - * @failcase when hal_drm_hdcp_close does not return HAL_DRM_ERROR_INVALID_STATE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpCloseN1) -{ - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_STATE); -} - -/** - * @testcase HdcpCloseN - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Close HDCP - * @apicovered hal_drm_hdcp_close - * @passcase when hal_drm_hdcp_close returns HAL_DRM_ERROR_INVALID_PARAMETER - * @failcase when hal_drm_hdcp_close does not return HAL_DRM_ERROR_INVALID_PARAMETER - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpCloseN2) -{ - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(nullptr); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); -} - -/** - * @testcase HdcpStartReceiverP - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Positive, Start HDCP receiver - * @apicovered hal_drm_hdcp_start_receiver - * @passcase when hal_drm_hdcp_start_receiver returns HAL_DRM_ERROR_NONE - * @failcase when hal_drm_hdcp_start_receiver does not return HAL_DRM_ERROR_NONE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpStartReceiverP) -{ - uint32_t hdcp_id = 0; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_receiver(gHalHandle, 100, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpStartReceiverN - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Start HDCP receiver - * @apicovered hal_drm_hdcp_start_receiver - * @passcase when hal_drm_hdcp_start_receiver returns HAL_DRM_ERROR_INVALID_STATE - * @failcase when hal_drm_hdcp_start_receiver does not return HAL_DRM_ERROR_INVALID_STATE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpStartReceiverN1) -{ - uint32_t hdcp_id = 0; - - gRet = hal_drm_hdcp_start_receiver(gHalHandle, 100, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_STATE); -} - -/** - * @testcase HdcpStartReceiverN2 - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Start HDCP receiver - * @apicovered hal_drm_hdcp_start_receiver - * @passcase when hal_drm_hdcp_start_receiver returns HAL_DRM_ERROR_INVALID_PARAMETER - * @failcase when hal_drm_hdcp_start_receiver does not return HAL_DRM_ERROR_INVALID_PARAMETER - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpStartReceiverN2) -{ - uint32_t hdcp_id = 0; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_receiver(nullptr, 100, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_start_receiver(gHalHandle, 100, nullptr); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpStopReceiverP - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Positive, Stop HDCP receiver - * @apicovered hal_drm_hdcp_stop_receiver - * @passcase when hal_drm_hdcp_stop_receiver returns HAL_DRM_ERROR_NONE - * @failcase when hal_drm_hdcp_stop_receiver does not return HAL_DRM_ERROR_NONE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpStopReceiverP) -{ - uint32_t hdcp_id = 0; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_receiver(gHalHandle, 100, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_stop_receiver(gHalHandle, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpStopReceiverN1 - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Stop HDCP receiver - * @apicovered hal_drm_hdcp_stop_receiver - * @passcase when hal_drm_hdcp_stop_receiver returns HAL_DRM_ERROR_INVALID_STATE - * @failcase when hal_drm_hdcp_stop_receiver does not return HAL_DRM_ERROR_INVALID_STATE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpStopReceiverN1) -{ - uint32_t hdcp_id = 0; - - gRet = hal_drm_hdcp_stop_receiver(gHalHandle, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_STATE); -} - -/** - * @testcase HdcpStopReceiverN2 - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Stop HDCP receiver - * @apicovered hal_drm_hdcp_stop_receiver - * @passcase when hal_drm_hdcp_stop_receiver returns HAL_DRM_ERROR_INVALID_PARAMETER - * @failcase when hal_drm_hdcp_stop_receiver does not return HAL_DRM_ERROR_INVALID_PARAMETER - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpStopReceiverN2) -{ - uint32_t hdcp_id = 0; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_receiver(gHalHandle, 100, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_stop_receiver(nullptr, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpStartTransmitterP - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Positive, Start HDCP transmitter - * @apicovered hal_drm_hdcp_start_transmitter - * @passcase when hal_drm_hdcp_start_transmitter returns HAL_DRM_ERROR_NONE - * @failcase when hal_drm_hdcp_start_transmitter does not return HAL_DRM_ERROR_NONE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpStartTransmitterP) -{ - uint32_t hdcp_id = 0; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_transmitter(gHalHandle, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpStartTransmitterN1 - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Start HDCP transmitter - * @apicovered hal_drm_hdcp_start_transmitter - * @passcase when hal_drm_hdcp_start_transmitter returns HAL_DRM_ERROR_INVALID_STATE - * @failcase when hal_drm_hdcp_start_transmitter does not return HAL_DRM_ERROR_INVALID_STATE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpStartTransmitterN1) -{ - uint32_t hdcp_id = 0; - - gRet = hal_drm_hdcp_start_transmitter(gHalHandle, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_STATE); -} - -/** - * @testcase HdcpStartTransmitterN2 - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Start HDCP transmitter - * @apicovered hal_drm_hdcp_start_transmitter - * @passcase when hal_drm_hdcp_start_transmitter returns HAL_DRM_ERROR_INVALID_PARAMETER - * @failcase when hal_drm_hdcp_start_transmitter does not return HAL_DRM_ERROR_INVALID_PARAMETER - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpStartTransmitterN2) -{ - uint32_t hdcp_id = 0; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_transmitter(nullptr, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpStopTransmitterP - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Positive, Stop HDCP transmitter - * @apicovered hal_drm_hdcp_stop_transmitter - * @passcase when hal_drm_hdcp_stop_transmitter returns HAL_DRM_ERROR_NONE - * @failcase when hal_drm_hdcp_stop_transmitter does not return HAL_DRM_ERROR_NONE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpStopTransmitterP) -{ - uint32_t hdcp_id = 0; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_transmitter(gHalHandle, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_stop_transmitter(gHalHandle, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpStopTransmitterN1 - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Stop HDCP transmitter - * @apicovered hal_drm_hdcp_stop_transmitter - * @passcase when hal_drm_hdcp_stop_transmitter returns HAL_DRM_ERROR_INVALID_STATE - * @failcase when hal_drm_hdcp_stop_transmitter does not return HAL_DRM_ERROR_INVALID_STATE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpStopTransmitterN1) -{ - uint32_t hdcp_id = 0; - - gRet = hal_drm_hdcp_stop_transmitter(gHalHandle, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_STATE); -} - -/** - * @testcase HdcpStopTransmitterN2 - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Stop HDCP transmitter - * @apicovered hal_drm_hdcp_stop_transmitter - * @passcase when hal_drm_hdcp_stop_transmitter returns HAL_DRM_ERROR_INVALID_PARAMETER - * @failcase when hal_drm_hdcp_stop_transmitter does not return HAL_DRM_ERROR_INVALID_PARAMETER - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpStopTransmitterN2) -{ - uint32_t hdcp_id = 0; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_transmitter(gHalHandle, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_stop_transmitter(nullptr, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpAllocateBufferP - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Positive, Allocate output buffer - * @apicovered hal_drm_hdcp_allocate_output_buffer - * @passcase when hal_drm_hdcp_allocate_output_buffer returns HAL_DRM_ERROR_NONE - * @failcase when hal_drm_hdcp_allocate_output_buffer does not return HAL_DRM_ERROR_NONE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpAllocateBufferP) -{ - uint32_t hdcp_id = 0; - hal_drm_buffer_s output; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_transmitter(gHalHandle, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_allocate_output_buffer(gHalHandle, 1000, false, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_stop_transmitter(gHalHandle, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpAllocateBufferN - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Allocate output buffer - * @apicovered hal_drm_hdcp_allocate_output_buffer - * @passcase when hal_drm_hdcp_allocate_output_buffer returns HAL_DRM_ERROR_NONE - * @failcase when hal_drm_hdcp_allocate_output_buffer does not return HAL_DRM_ERROR_NONE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpAllocateBufferN) -{ - uint32_t hdcp_id = 0; - hal_drm_buffer_s output; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_transmitter(gHalHandle, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_allocate_output_buffer(nullptr, 1000, false, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_allocate_output_buffer(gHalHandle, 1000, false, nullptr); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_stop_transmitter(gHalHandle, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpReleaseBufferP - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Positive, Release output buffer - * @apicovered hal_drm_hdcp_release_output_buffer - * @passcase when hal_drm_hdcp_release_output_buffer returns HAL_DRM_ERROR_NONE - * @failcase when hal_drm_hdcp_release_output_buffer does not return HAL_DRM_ERROR_NONE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpReleaseBufferP) -{ - uint32_t hdcp_id = 0; - hal_drm_buffer_s output; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_transmitter(gHalHandle, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_allocate_output_buffer(gHalHandle, 1000, false, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_release_output_buffer(gHalHandle, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_stop_transmitter(gHalHandle, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpReleaseBufferN - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Release output buffer - * @apicovered hal_drm_hdcp_release_output_buffer - * @passcase when hal_drm_hdcp_release_output_buffer returns HAL_DRM_ERROR_NONE - * @failcase when hal_drm_hdcp_release_output_buffer does not return HAL_DRM_ERROR_NONE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpReleaseBufferN) -{ - uint32_t hdcp_id = 0; - hal_drm_buffer_s output; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_transmitter(gHalHandle, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_allocate_output_buffer(gHalHandle, 1000, false, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_release_output_buffer(nullptr, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_release_output_buffer(gHalHandle, nullptr); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_stop_transmitter(gHalHandle, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpDecryptP - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Positive, Decrypt HDCP data - * @apicovered hal_drm_hdcp_decrypt - * @passcase when hal_drm_hdcp_decrypt returns HAL_DRM_ERROR_NONE - * @failcase when hal_drm_hdcp_decrypt does not return HAL_DRM_ERROR_NONE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpDecryptP) -{ - uint32_t hdcp_id = 0; - hal_drm_buffer_s input, output; - uint32_t decrypt_info; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_transmitter(gHalHandle, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_allocate_output_buffer(gHalHandle, 1000, false, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - input.size = 100; - gRet = hal_drm_hdcp_decrypt(gHalHandle, &input, (void *)&decrypt_info, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_stop_transmitter(gHalHandle, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpDecryptN1 - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Decrypt HDCP data - * @apicovered hal_drm_hdcp_decrypt - * @passcase when hal_drm_hdcp_decrypt returns HAL_DRM_ERROR_INVALID_PARAMETER - * @failcase when hal_drm_hdcp_decrypt does not return HAL_DRM_ERROR_INVALID_PARAMETER - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpDecryptN1) -{ - uint32_t hdcp_id = 0; - hal_drm_buffer_s output; - int decrypt_info; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_transmitter(gHalHandle, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_decrypt(gHalHandle, nullptr, (void *)&decrypt_info, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_stop_transmitter(gHalHandle, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpEncryptP - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Positive, Encrypt HDCP data - * @apicovered hal_drm_hdcp_encrypt - * @passcase when hal_drm_hdcp_encrypt returns HAL_DRM_ERROR_NONE - * @failcase when hal_drm_hdcp_encrypt does not return HAL_DRM_ERROR_NONE - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpEncryptP) -{ - uint32_t hdcp_id = 0; - hal_drm_buffer_s input, output; - uint32_t encrypt_info; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_transmitter(gHalHandle, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_allocate_output_buffer(gHalHandle, 1000, false, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - input.size = 100; - gRet = hal_drm_hdcp_encrypt(gHalHandle, &input, hdcp_id, (void *)&encrypt_info, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_stop_transmitter(gHalHandle, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); -} - -/** - * @testcase HdcpEncryptN1 - * @since HAL_MODULE_DRM 1.0 - * @author SR(haesu.gwon) - * @reviewer SR(gilbok) - * @type auto - * @description Negative, Encrypt HDCP data - * @apicovered hal_drm_hdcp_encrypt - * @passcase when hal_drm_hdcp_encrypt returns HAL_DRM_ERROR_INVALID_PARAMETER - * @failcase when hal_drm_hdcp_encrypt does not return HAL_DRM_ERROR_INVALID_PARAMETER - * @precondition None - * @postcondition None - */ -TEST_F(DrmHalTest, HdcpEncryptN1) -{ - uint32_t hdcp_id = 0; - hal_drm_buffer_s input, output; - uint32_t encrypt_info; - input.size = 100; - - gRet = hal_drm_hdcp_open(gHalHandle, HAL_DRM_HDCP_DEVICE_RECEIVER, HAL_DRM_HDCP_VERSION_2_0); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_start_transmitter(gHalHandle, gSocketIp, gPortIp, &hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_encrypt(gHalHandle, nullptr, hdcp_id, (void *)&encrypt_info, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_encrypt(gHalHandle, &input, hdcp_id, nullptr, &output); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_encrypt(gHalHandle, &input, hdcp_id, (void *)&encrypt_info, nullptr); - ASSERT_EQ(gRet, HAL_DRM_ERROR_INVALID_PARAMETER); - - gRet = hal_drm_hdcp_stop_transmitter(gHalHandle, hdcp_id); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); - - gRet = hal_drm_hdcp_close(gHalHandle); - ASSERT_EQ(gRet, HAL_DRM_ERROR_NONE); } int main(int argc, char **argv)