remove drm absolute path.

Signed-off-by: jiangchunli <jiangchunli1@huawei.com>
This commit is contained in:
jiangchunli 2024-08-19 06:14:40 +00:00
parent 73478f6b32
commit e3ad00ecbd
21 changed files with 107 additions and 17 deletions

View File

@ -26,7 +26,6 @@
#include "buffer/avbuffer_queue_consumer.h"
#include "buffer/avbuffer_queue_define.h"
#include "buffer/avbuffer_queue_producer.h"
#include "foundation/multimedia/drm_framework/services/drm_service/ipc/i_keysession_service.h"
namespace OHOS {
namespace MediaAVCodec {

View File

@ -20,7 +20,9 @@
#include "media_codec/media_codec.h"
#include "filter/filter.h"
#include "plugin/plugin_time.h"
#include "foundation/multimedia/drm_framework/services/drm_service/ipc/i_keysession_service.h"
#ifdef SUPPORT_DRM
#include "i_keysession_service.h"
#endif
namespace OHOS {
namespace Media {
@ -109,7 +111,9 @@ private:
sptr<AVBufferQueueProducer> inputBufferQueueProducer_;
bool isDrmProtected_ = false;
sptr<DrmStandard::IMediaKeySessionService> keySessionServiceProxy_;
#ifdef SUPPORT_DRM
sptr<DrmStandard::IMediaKeySessionService> keySessionServiceProxy_ = nullptr;
#endif
bool svpFlag_ = false;
bool isDump_ = false;
bool refreshTotalPauseTime_{false};

View File

@ -21,7 +21,7 @@
#include "buffer/avsharedmemory.h"
#include "meta/format.h"
#include "surface.h"
#include "i_keysession_service.h"
#include "drm_i_keysession_service.h"
namespace OHOS {
namespace MediaAVCodec {

View File

@ -30,9 +30,12 @@
#include "meta/format.h"
#include "filter/filter.h"
#include "media_sync_manager.h"
#include "foundation/multimedia/drm_framework/services/drm_service/ipc/i_keysession_service.h"
#include "common/media_core.h"
#include "common/seek_callback.h"
#include "drm_i_keysession_service.h"
#ifdef SUPPORT_DRM
#include "i_keysession_service.h"
#endif
namespace OHOS {
namespace Media {
@ -141,7 +144,9 @@ private:
int64_t stopTime_{0};
sptr<Surface> videoSurface_;
bool isDrmProtected_ = false;
sptr<DrmStandard::IMediaKeySessionService> keySessionServiceProxy_;
#ifdef SUPPORT_DRM
sptr<DrmStandard::IMediaKeySessionService> keySessionServiceProxy_ = nullptr;
#endif
bool svpFlag_ = false;
std::atomic<bool> isPaused_{false};
std::list<std::pair<int, std::shared_ptr<AVBuffer>>> outputBuffers_;

View File

@ -0,0 +1,23 @@
/*
* Copyright (C) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef DRM_IMEDIA_KEY_SESSION_SERVICE_H
#define DRM_IMEDIA_KEY_SESSION_SERVICE_H
namespace OHOS {
namespace DrmStandard {
class IMediaKeySessionService;
}
}
#endif // DRM_IMEDIA_KEY_SESSION_SERVICE_H

View File

@ -17,6 +17,9 @@
#include "avcodec_errors.h"
#include "avcodec_log.h"
#include "securec.h"
#ifdef SUPPORT_DRM
#include "i_keysession_service.h"
#endif
namespace {
constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_FRAMEWORK, "CodecDrmDecrypt"};
@ -672,12 +675,18 @@ void CodecDrmDecrypt::SetDecryptionConfig(const sptr<DrmStandard::IMediaKeySessi
svpFlag_ = SVP_FALSE;
}
mode_ = MetaDrmCencInfoMode::META_DRM_CENC_INFO_KEY_IV_SUBSAMPLES_SET;
#ifdef SUPPORT_DRM
keySessionServiceProxy_ = keySession;
CHECK_AND_RETURN_LOG((keySessionServiceProxy_ != nullptr), "SetDecryptConfig keySessionServiceProxy nullptr");
keySessionServiceProxy_->GetMediaDecryptModule(decryptModuleProxy_);
CHECK_AND_RETURN_LOG((decryptModuleProxy_ != nullptr), "SetDecryptConfig decryptModuleProxy_ nullptr");
#else
(void)keySession;
(void)svpFlag;
#endif
}
#ifdef SUPPORT_DRM
int32_t CodecDrmDecrypt::SetDrmBuffer(const std::shared_ptr<AVBuffer> &inBuf,
const std::shared_ptr<AVBuffer> &outBuf, DrmBuffer &inDrmBuffer, DrmBuffer &outDrmBuffer)
{
@ -705,6 +714,7 @@ int32_t CodecDrmDecrypt::SetDrmBuffer(const std::shared_ptr<AVBuffer> &inBuf,
outDrmBuffer.sharedMemType = static_cast<uint32_t>(outBuf->memory_->GetMemoryFlag());
return AVCS_ERR_OK;
}
#endif
int32_t CodecDrmDecrypt::DecryptMediaData(const MetaDrmCencInfo * const cencInfo, std::shared_ptr<AVBuffer> &inBuf,
std::shared_ptr<AVBuffer> &outBuf)

View File

@ -19,8 +19,11 @@
#include <mutex>
#include "buffer/avbuffer.h"
#include "meta/meta.h"
#include "foundation/multimedia/drm_framework/services/drm_service/ipc/i_keysession_service.h"
#include "foundation/multimedia/drm_framework/services/drm_service/ipc/i_mediadecryptmodule_service.h"
#include "drm_i_keysession_service.h"
#ifdef SUPPORT_DRM
#include "i_keysession_service.h"
#include "i_mediadecryptmodule_service.h"
#endif
namespace OHOS {
namespace MediaAVCodec {
@ -30,7 +33,9 @@ using MetaDrmSubSample = Plugins::MetaDrmSubSample;
using MetaDrmCencInfo = Plugins::MetaDrmCencInfo;
using MetaDrmCencAlgorithm = Plugins::MetaDrmCencAlgorithm;
using MetaDrmCencInfoMode = Plugins::MetaDrmCencInfoMode;
#ifdef SUPPORT_DRM
using DrmBuffer = DrmStandard::IMediaDecryptModuleService::DrmBuffer;
#endif
enum SvpMode : int32_t {
SVP_CLEAR = -1, /* it's not a protection video */
@ -75,15 +80,19 @@ private:
MetaDrmCencInfo *cencInfo) const;
int32_t DecryptMediaData(const MetaDrmCencInfo * const cencInfo, std::shared_ptr<AVBuffer> &inBuf,
std::shared_ptr<AVBuffer> &outBuf);
#ifdef SUPPORT_DRM
static int32_t SetDrmBuffer(const std::shared_ptr<AVBuffer> &inBuf, const std::shared_ptr<AVBuffer> &outBuf,
DrmBuffer &inDrmBuffer, DrmBuffer &outDrmBuffer);
#endif
private:
std::mutex configMutex_;
std::string codecName_;
int32_t codingType_ = 0;
#ifdef SUPPORT_DRM
sptr<DrmStandard::IMediaKeySessionService> keySessionServiceProxy_;
sptr<DrmStandard::IMediaDecryptModuleService> decryptModuleProxy_;
#endif
int32_t svpFlag_ = SVP_CLEAR;
MetaDrmCencInfoMode mode_ = MetaDrmCencInfoMode::META_DRM_CENC_INFO_KEY_IV_SUBSAMPLES_SET;
};

View File

@ -24,7 +24,7 @@
#include "buffer/avbuffer_queue_consumer.h"
#include "buffer/avbuffer_queue_define.h"
#include "buffer/avbuffer_queue_producer.h"
#include "foundation/multimedia/drm_framework/services/drm_service/ipc/i_keysession_service.h"
#include "drm_i_keysession_service.h"
namespace OHOS {
namespace MediaAVCodec {

View File

@ -29,7 +29,7 @@
#include "buffer/avbuffer_queue_consumer.h"
#include "buffer/avbuffer_queue_define.h"
#include "buffer/avbuffer_queue_producer.h"
#include "foundation/multimedia/drm_framework/services/drm_service/ipc/i_keysession_service.h"
#include "drm_i_keysession_service.h"
namespace OHOS {
namespace MediaAVCodec {

View File

@ -19,6 +19,9 @@
#include "common/log.h"
#include "common/media_core.h"
#include "avcodec_sysevent.h"
#ifdef SUPPORT_DRM
#include "i_keysession_service.h"
#endif
namespace {
constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, LOG_DOMAIN_SYSTEM_PLAYER, "AudioDecoderFilter" };
@ -278,7 +281,9 @@ Status AudioDecoderFilter::OnLinked(StreamType inType, const std::shared_ptr<Met
}
if (isDrmProtected_) {
MEDIA_LOG_D_SHORT("AudioDecoderFilter::isDrmProtected_ true.");
#ifdef SUPPORT_DRM
mediaCodec_->SetAudioDecryptionConfig(keySessionServiceProxy_, svpFlag_);
#endif
}
return Status::OK;
}
@ -313,10 +318,12 @@ Status AudioDecoderFilter::SetDecryptionConfig(const sptr<DrmStandard::IMediaKey
return Status::ERROR_INVALID_PARAMETER;
}
isDrmProtected_ = true;
keySessionServiceProxy_ = keySessionProxy;
(void)svp;
// audio svp: false
svpFlag_ = false;
#ifdef SUPPORT_DRM
keySessionServiceProxy_ = keySessionProxy;
#endif
return Status::OK;
}

View File

@ -223,7 +223,9 @@ Status DecoderSurfaceFilter::DoInitAfterLink()
ParseDecodeRateLimit();
videoDecoder_->SetOutputSurface(videoSurface_);
if (isDrmProtected_) {
#ifdef SUPPORT_DRM
videoDecoder_->SetDecryptConfig(keySessionServiceProxy_, svpFlag_);
#endif
}
videoSink_->SetParameter(meta_);
return Status::OK;
@ -436,7 +438,9 @@ void DecoderSurfaceFilter::SetParameter(const std::shared_ptr<Meta> &parameter)
videoDecoder_->Configure(configFormat_);
videoDecoder_->SetOutputSurface(videoSurface_);
if (isDrmProtected_) {
#ifdef SUPPORT_DRM
videoDecoder_->SetDecryptConfig(keySessionServiceProxy_, svpFlag_);
#endif
}
}
videoDecoder_->SetParameter(format);
@ -763,8 +767,10 @@ Status DecoderSurfaceFilter::SetDecryptConfig(const sptr<DrmStandard::IMediaKeyS
return Status::ERROR_INVALID_PARAMETER;
}
isDrmProtected_ = true;
keySessionServiceProxy_ = keySessionProxy;
svpFlag_ = svp;
#ifdef SUPPORT_DRM
keySessionServiceProxy_ = keySessionProxy;
#endif
return Status::OK;
}

View File

@ -20,6 +20,9 @@
#include "osal/utils/dump_buffer.h"
#include "avcodec_trace.h"
#include "plugin/plugin_manager_v2.h"
#ifdef SUPPORT_DRM
#include "i_keysession_service.h"
#endif
namespace {
constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, LOG_DOMAIN_AUDIO, "MediaCodec" };

View File

@ -28,8 +28,7 @@
#include "plugin/plugin_event.h"
#include "plugin/codec_plugin.h"
#include "osal/task/mutex.h"
#include "foundation/multimedia/drm_framework/services/drm_service/ipc/i_keysession_service.h"
#include "foundation/multimedia/av_codec/services/drm_decryptor/codec_drm_decrypt.h"
#include "codec_drm_decrypt.h"
namespace OHOS {
namespace Media {

View File

@ -18,6 +18,9 @@
#include "avcodec_parcel.h"
#include "avsharedmemory_ipc.h"
#include "buffer_client_producer.h"
#ifdef SUPPORT_DRM
#include "i_keysession_service.h"
#endif
namespace OHOS {
namespace MediaAVCodec {

View File

@ -25,7 +25,8 @@
#include "iremote_proxy.h"
#include "iremote_stub.h"
#include "surface.h"
#include "foundation/multimedia/drm_framework/services/drm_service/ipc/i_keysession_service.h"
#include "drm_i_keysession_service.h"
namespace OHOS {
namespace MediaAVCodec {
class IStandardCodecService : public IRemoteBroker {

View File

@ -30,6 +30,9 @@
#include "media_description.h"
#include "meta/meta_key.h"
#include "surface_type.h"
#ifdef SUPPORT_DRM
#include "i_keysession_service.h"
#endif
namespace {
constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_FRAMEWORK, "CodecServer"};

View File

@ -362,6 +362,7 @@ ohos_unittest("av_audio_media_codec_unit_test") {
"./",
"$av_codec_root_dir/interfaces",
"$av_codec_root_dir/interfaces/kits/c",
"$av_codec_root_dir/services/drm_decryptor",
"$av_codec_root_dir/services/engine/common/include",
"$av_codec_root_dir/services/media_engine/modules/media_codec",
]

View File

@ -97,6 +97,11 @@ ohos_unittest("decoder_filter_unit_test") {
"netmanager_base:net_conn_manager_if",
"safwk:system_ability_fwk",
]
if (av_codec_support_drm) {
external_deps += [ "drm_framework:drm_framework" ]
}
resource_config_file =
"$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
}

View File

@ -22,7 +22,7 @@
#include "media_codec/media_codec.h"
#include "filter/filter.h"
#include "plugin/plugin_time.h"
#include "foundation/multimedia/drm_framework/services/drm_service/ipc/i_keysession_service.h"
#include "drm_i_keysession_service.h"
#include "buffer/avbuffer_queue.h"
namespace OHOS {

View File

@ -120,6 +120,13 @@ ohos_unittest("codec_server_coverage_unit_test") {
"window_manager:libwm",
]
if (av_codec_support_drm) {
external_deps += [
"drm_framework:drm_framework",
"drm_framework:native_drm",
]
}
resource_config_file =
"$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
}

View File

@ -28,9 +28,14 @@
#include "buffer/avbuffer_queue_define.h"
#include "buffer/avbuffer_queue_producer.h"
#include "buffer/avsharedmemorybase.h"
#include "foundation/multimedia/drm_framework/services/drm_service/ipc/i_keysession_service.h"
#include "surface.h"
namespace OHOS {
namespace DrmStandard {
class IMediaKeySessionService;
}
}
namespace OHOS {
namespace MediaAVCodec {
enum class CallbackFlag : uint8_t {