From 0d416587c15cf8c70064d3fde22a844dcc2896df Mon Sep 17 00:00:00 2001 From: yj Date: Sun, 25 Jun 2023 16:35:43 +0800 Subject: [PATCH] =?UTF-8?q?player=5Fframework=E7=9B=B8=E5=85=B3xts?= =?UTF-8?q?=E6=94=B9=E6=88=90avcodec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yj --- multimedia/media/media_cpp_standard/BUILD.gn | 9 +++------ .../audioDecEncNdk/include/ADecEncNdkSample.h | 2 +- .../audioDecEncNdk/src/ADecEncNdkSample.cpp | 2 +- .../src/ActsAudioDecEncNdkTest.cpp | 2 +- .../videoDecEncNdk/include/VDecEncNdkSample.h | 2 +- .../src/ActsVideoDecEncNdkTest.cpp | 16 ++++++++-------- .../videoDecEncNdk/src/VDecEncNdkSample.cpp | 17 +---------------- 7 files changed, 16 insertions(+), 34 deletions(-) diff --git a/multimedia/media/media_cpp_standard/BUILD.gn b/multimedia/media/media_cpp_standard/BUILD.gn index ffd5f1ed9..5fdac1b68 100644 --- a/multimedia/media/media_cpp_standard/BUILD.gn +++ b/multimedia/media/media_cpp_standard/BUILD.gn @@ -14,7 +14,7 @@ import("//test/xts/tools/build/suite.gni") module_output_path = "acts/ActsAvcodecNdkTest" -MEDIA_ROOT_DIR = "//foundation/multimedia/player_framework/" +MEDIA_ROOT_DIR = "//foundation/multimedia/av_codec/" ohos_moduletest_suite("ActsAvcodecNdkTest") { module_out_path = module_output_path @@ -39,9 +39,6 @@ ohos_moduletest_suite("ActsAvcodecNdkTest") { "../../../../../../base/startup/init/interfaces/kits/syscap/include", "$MEDIA_ROOT_DIR/interfaces/inner_api/native", "$MEDIA_ROOT_DIR/interfaces/kits/c", - "$MEDIA_ROOT_DIR/frameworks/native/capi/common", - "$MEDIA_ROOT_DIR/interfaces/kits/c", - "$MEDIA_ROOT_DIR/interfaces/inner_api/native", ] cflags = [ @@ -63,7 +60,7 @@ ohos_moduletest_suite("ActsAvcodecNdkTest") { ] deps = [ - "$MEDIA_ROOT_DIR/interfaces/inner_api/native:media_client", + "$MEDIA_ROOT_DIR/interfaces/inner_api/native:av_codec_client", "$MEDIA_ROOT_DIR/interfaces/kits/c:native_media_adec", "$MEDIA_ROOT_DIR/interfaces/kits/c:native_media_aenc", "$MEDIA_ROOT_DIR/interfaces/kits/c:native_media_codecbase", @@ -81,6 +78,6 @@ ohos_moduletest_suite("ActsAvcodecNdkTest") { "hiviewdfx_hilog_native:libhilog", ] - part_name = "player_framework" + part_name = "av_codec" subsystem_name = "multimedia" } diff --git a/multimedia/media/media_cpp_standard/audioDecEncNdk/include/ADecEncNdkSample.h b/multimedia/media/media_cpp_standard/audioDecEncNdk/include/ADecEncNdkSample.h index 672ea072e..784b2f3ef 100644 --- a/multimedia/media/media_cpp_standard/audioDecEncNdk/include/ADecEncNdkSample.h +++ b/multimedia/media/media_cpp_standard/audioDecEncNdk/include/ADecEncNdkSample.h @@ -33,7 +33,7 @@ #include "ndktest_log.h" namespace OHOS { -namespace Media { +namespace MediaAVCodec { class ADecEncSignal { public: std::mutex inMutexDec_; diff --git a/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ADecEncNdkSample.cpp b/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ADecEncNdkSample.cpp index 895c4683e..15b0a2105 100644 --- a/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ADecEncNdkSample.cpp +++ b/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ADecEncNdkSample.cpp @@ -19,7 +19,7 @@ #include "native_avcodec_base.h" using namespace OHOS; -using namespace OHOS::Media; +using namespace OHOS::MediaAVCodec; using namespace std; namespace { diff --git a/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp b/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp index 26d172d61..13e1f6814 100644 --- a/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp +++ b/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp @@ -26,7 +26,7 @@ using namespace std; using namespace testing::ext; using namespace OHOS; -using namespace OHOS::Media; +using namespace OHOS::MediaAVCodec; namespace { class ActsAudioDecEncNdkTest : public testing::Test { diff --git a/multimedia/media/media_cpp_standard/videoDecEncNdk/include/VDecEncNdkSample.h b/multimedia/media/media_cpp_standard/videoDecEncNdk/include/VDecEncNdkSample.h index ef641f94a..e052c5d44 100644 --- a/multimedia/media/media_cpp_standard/videoDecEncNdk/include/VDecEncNdkSample.h +++ b/multimedia/media/media_cpp_standard/videoDecEncNdk/include/VDecEncNdkSample.h @@ -35,7 +35,7 @@ #include "native_avcodec_videoencoder.h" namespace OHOS { -namespace Media { +namespace MediaAVCodec { class VDecEncSignal { public: std::mutex inMutexDec_; diff --git a/multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp b/multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp index e3f5c0bca..ef90951b0 100644 --- a/multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp +++ b/multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp @@ -25,7 +25,7 @@ using namespace std; using namespace testing::ext; using namespace OHOS; -using namespace OHOS::Media; +using namespace OHOS::MediaAVCodec; namespace { class ActsVideoDecEncNdkTest : public testing::Test { @@ -131,7 +131,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_010 {OH_MD_KEY_FRAME_RATE, DEFAULT_FRAMERATE}, }; ASSERT_EQ(true, SetFormat(VideoFormat, VideoParam)); - OH_AVFormat_SetIntValue(VideoFormat, OH_MD_KEY_TRACK_TYPE, MEDIA_TYPE_VID); + OH_AVFormat_SetIntValue(VideoFormat, OH_MD_KEY_TRACK_TYPE, OH_MediaType::MEDIA_TYPE_VID); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); OH_AVFormat *OutDescDec = OH_VideoDecoder_GetOutputDescription(videoDec); @@ -184,16 +184,16 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_020 OH_AVFormat *VideoFormat = createFormat(); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); - OH_AVFormat_SetIntValue(VideoFormat, OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE, CBR); + OH_AVFormat_SetIntValue(VideoFormat, OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE, OH_VideoEncodeBitrateMode::CBR); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); ASSERT_EQ(AV_ERR_OK, vDecEncSample->GetSurface()); ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetOutputSurface()); ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareEnc()); ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareDec()); ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); - ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetParameterDec(VideoFormat)); - ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetParameterEnc(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetParameterDec(VideoFormat)); while (!vDecEncSample->GetEncEosState()) {}; ASSERT_EQ(AV_ERR_OK, vDecEncSample->ResetDec()); @@ -228,7 +228,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_030 vDecEncSample->SetSavePath("/data/media/video_003.h264"); OH_AVFormat *VideoFormat = createFormat(); - OH_AVFormat_SetIntValue(VideoFormat, OH_MD_KEY_PROFILE, AVC_PROFILE_BASELINE); + OH_AVFormat_SetIntValue(VideoFormat, OH_MD_KEY_PROFILE, OH_AVCProfile::AVC_PROFILE_BASELINE); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); @@ -271,7 +271,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_040 vDecEncSample->SetSavePath("/data/media/video_004.h264"); OH_AVFormat *VideoFormat = createFormat(); - OH_AVFormat_SetIntValue(VideoFormat, OH_MD_KEY_PROFILE, AVC_PROFILE_HIGH); + OH_AVFormat_SetIntValue(VideoFormat, OH_MD_KEY_PROFILE, OH_AVCProfile::AVC_PROFILE_HIGH); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); @@ -327,7 +327,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_050 vDecEncSample->SetSavePath("/data/media/video_005.h264"); OH_AVFormat *VideoFormat = createFormat(); - OH_AVFormat_SetIntValue(VideoFormat, OH_MD_KEY_PROFILE, AVC_PROFILE_MAIN); + OH_AVFormat_SetIntValue(VideoFormat, OH_MD_KEY_PROFILE, OH_AVCProfile::AVC_PROFILE_MAIN); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); diff --git a/multimedia/media/media_cpp_standard/videoDecEncNdk/src/VDecEncNdkSample.cpp b/multimedia/media/media_cpp_standard/videoDecEncNdk/src/VDecEncNdkSample.cpp index e66e203a0..cb9dc0442 100644 --- a/multimedia/media/media_cpp_standard/videoDecEncNdk/src/VDecEncNdkSample.cpp +++ b/multimedia/media/media_cpp_standard/videoDecEncNdk/src/VDecEncNdkSample.cpp @@ -23,7 +23,7 @@ #include "VDecEncNdkSample.h" using namespace OHOS; -using namespace OHOS::Media; +using namespace OHOS::MediaAVCodec; using namespace std; namespace { @@ -567,27 +567,12 @@ int32_t VDecEncNdkSample::SetParameterEnc(struct OH_AVFormat *format) return OH_VideoEncoder_SetParameter(venc_, format); } -struct VEncObject : public OH_AVCodec { - explicit VEncObject(const std::shared_ptr &encoder) - : OH_AVCodec(AVMagic::MEDIA_MAGIC_VIDEO_ENCODER), videoEncoder_(encoder) {} - ~VEncObject() = default; - - const std::shared_ptr videoEncoder_; -}; int32_t VDecEncNdkSample::GetSurface() { return OH_VideoEncoder_GetSurface(venc_, &nativeWindow_); } -struct VDecObject : public OH_AVCodec { - explicit VDecObject(const std::shared_ptr &decoder) - : OH_AVCodec(AVMagic::MEDIA_MAGIC_VIDEO_DECODER), videoDecoder_(decoder) {} - ~VDecObject() = default; - - const std::shared_ptr videoDecoder_; -}; - int32_t VDecEncNdkSample::SetOutputSurface() { return OH_VideoDecoder_SetSurface(vdec_, nativeWindow_); -- GitLab