提交 0d416587 编写于 作者: Y yj

player_framework相关xts改成avcodec

Signed-off-by: Nyj <yujie57@huawei.com>
上级 41bf9425
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
module_output_path = "acts/ActsAvcodecNdkTest" module_output_path = "acts/ActsAvcodecNdkTest"
MEDIA_ROOT_DIR = "//foundation/multimedia/player_framework/" MEDIA_ROOT_DIR = "//foundation/multimedia/av_codec/"
ohos_moduletest_suite("ActsAvcodecNdkTest") { ohos_moduletest_suite("ActsAvcodecNdkTest") {
module_out_path = module_output_path module_out_path = module_output_path
...@@ -39,9 +39,6 @@ ohos_moduletest_suite("ActsAvcodecNdkTest") { ...@@ -39,9 +39,6 @@ ohos_moduletest_suite("ActsAvcodecNdkTest") {
"../../../../../../base/startup/init/interfaces/kits/syscap/include", "../../../../../../base/startup/init/interfaces/kits/syscap/include",
"$MEDIA_ROOT_DIR/interfaces/inner_api/native", "$MEDIA_ROOT_DIR/interfaces/inner_api/native",
"$MEDIA_ROOT_DIR/interfaces/kits/c", "$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 = [ cflags = [
...@@ -63,7 +60,7 @@ ohos_moduletest_suite("ActsAvcodecNdkTest") { ...@@ -63,7 +60,7 @@ ohos_moduletest_suite("ActsAvcodecNdkTest") {
] ]
deps = [ 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_adec",
"$MEDIA_ROOT_DIR/interfaces/kits/c:native_media_aenc", "$MEDIA_ROOT_DIR/interfaces/kits/c:native_media_aenc",
"$MEDIA_ROOT_DIR/interfaces/kits/c:native_media_codecbase", "$MEDIA_ROOT_DIR/interfaces/kits/c:native_media_codecbase",
...@@ -81,6 +78,6 @@ ohos_moduletest_suite("ActsAvcodecNdkTest") { ...@@ -81,6 +78,6 @@ ohos_moduletest_suite("ActsAvcodecNdkTest") {
"hiviewdfx_hilog_native:libhilog", "hiviewdfx_hilog_native:libhilog",
] ]
part_name = "player_framework" part_name = "av_codec"
subsystem_name = "multimedia" subsystem_name = "multimedia"
} }
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "ndktest_log.h" #include "ndktest_log.h"
namespace OHOS { namespace OHOS {
namespace Media { namespace MediaAVCodec {
class ADecEncSignal { class ADecEncSignal {
public: public:
std::mutex inMutexDec_; std::mutex inMutexDec_;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "native_avcodec_base.h" #include "native_avcodec_base.h"
using namespace OHOS; using namespace OHOS;
using namespace OHOS::Media; using namespace OHOS::MediaAVCodec;
using namespace std; using namespace std;
namespace { namespace {
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
using namespace std; using namespace std;
using namespace testing::ext; using namespace testing::ext;
using namespace OHOS; using namespace OHOS;
using namespace OHOS::Media; using namespace OHOS::MediaAVCodec;
namespace { namespace {
class ActsAudioDecEncNdkTest : public testing::Test { class ActsAudioDecEncNdkTest : public testing::Test {
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "native_avcodec_videoencoder.h" #include "native_avcodec_videoencoder.h"
namespace OHOS { namespace OHOS {
namespace Media { namespace MediaAVCodec {
class VDecEncSignal { class VDecEncSignal {
public: public:
std::mutex inMutexDec_; std::mutex inMutexDec_;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
using namespace std; using namespace std;
using namespace testing::ext; using namespace testing::ext;
using namespace OHOS; using namespace OHOS;
using namespace OHOS::Media; using namespace OHOS::MediaAVCodec;
namespace { namespace {
class ActsVideoDecEncNdkTest : public testing::Test { class ActsVideoDecEncNdkTest : public testing::Test {
...@@ -131,7 +131,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_010 ...@@ -131,7 +131,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_010
{OH_MD_KEY_FRAME_RATE, DEFAULT_FRAMERATE}, {OH_MD_KEY_FRAME_RATE, DEFAULT_FRAMERATE},
}; };
ASSERT_EQ(true, SetFormat(VideoFormat, VideoParam)); 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)); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat));
OH_AVFormat *OutDescDec = OH_VideoDecoder_GetOutputDescription(videoDec); OH_AVFormat *OutDescDec = OH_VideoDecoder_GetOutputDescription(videoDec);
...@@ -184,16 +184,16 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_020 ...@@ -184,16 +184,16 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_020
OH_AVFormat *VideoFormat = createFormat(); OH_AVFormat *VideoFormat = createFormat();
ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); 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->ConfigureEnc(VideoFormat));
ASSERT_EQ(AV_ERR_OK, vDecEncSample->GetSurface()); ASSERT_EQ(AV_ERR_OK, vDecEncSample->GetSurface());
ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetOutputSurface()); ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetOutputSurface());
ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareEnc()); ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareEnc());
ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareDec()); ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareDec());
ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); 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->SetParameterEnc(VideoFormat));
ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec());
ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetParameterDec(VideoFormat));
while (!vDecEncSample->GetEncEosState()) {}; while (!vDecEncSample->GetEncEosState()) {};
ASSERT_EQ(AV_ERR_OK, vDecEncSample->ResetDec()); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ResetDec());
...@@ -228,7 +228,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_030 ...@@ -228,7 +228,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_030
vDecEncSample->SetSavePath("/data/media/video_003.h264"); vDecEncSample->SetSavePath("/data/media/video_003.h264");
OH_AVFormat *VideoFormat = createFormat(); 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->ConfigureDec(VideoFormat));
ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat));
...@@ -271,7 +271,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_040 ...@@ -271,7 +271,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_040
vDecEncSample->SetSavePath("/data/media/video_004.h264"); vDecEncSample->SetSavePath("/data/media/video_004.h264");
OH_AVFormat *VideoFormat = createFormat(); 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->ConfigureDec(VideoFormat));
ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat));
...@@ -327,7 +327,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_050 ...@@ -327,7 +327,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_050
vDecEncSample->SetSavePath("/data/media/video_005.h264"); vDecEncSample->SetSavePath("/data/media/video_005.h264");
OH_AVFormat *VideoFormat = createFormat(); 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->ConfigureDec(VideoFormat));
ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat));
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "VDecEncNdkSample.h" #include "VDecEncNdkSample.h"
using namespace OHOS; using namespace OHOS;
using namespace OHOS::Media; using namespace OHOS::MediaAVCodec;
using namespace std; using namespace std;
namespace { namespace {
...@@ -567,27 +567,12 @@ int32_t VDecEncNdkSample::SetParameterEnc(struct OH_AVFormat *format) ...@@ -567,27 +567,12 @@ int32_t VDecEncNdkSample::SetParameterEnc(struct OH_AVFormat *format)
return OH_VideoEncoder_SetParameter(venc_, format); return OH_VideoEncoder_SetParameter(venc_, format);
} }
struct VEncObject : public OH_AVCodec {
explicit VEncObject(const std::shared_ptr<AVCodecVideoEncoder> &encoder)
: OH_AVCodec(AVMagic::MEDIA_MAGIC_VIDEO_ENCODER), videoEncoder_(encoder) {}
~VEncObject() = default;
const std::shared_ptr<AVCodecVideoEncoder> videoEncoder_;
};
int32_t VDecEncNdkSample::GetSurface() int32_t VDecEncNdkSample::GetSurface()
{ {
return OH_VideoEncoder_GetSurface(venc_, &nativeWindow_); return OH_VideoEncoder_GetSurface(venc_, &nativeWindow_);
} }
struct VDecObject : public OH_AVCodec {
explicit VDecObject(const std::shared_ptr<AVCodecVideoDecoder> &decoder)
: OH_AVCodec(AVMagic::MEDIA_MAGIC_VIDEO_DECODER), videoDecoder_(decoder) {}
~VDecObject() = default;
const std::shared_ptr<AVCodecVideoDecoder> videoDecoder_;
};
int32_t VDecEncNdkSample::SetOutputSurface() int32_t VDecEncNdkSample::SetOutputSurface()
{ {
return OH_VideoDecoder_SetSurface(vdec_, nativeWindow_); return OH_VideoDecoder_SetSurface(vdec_, nativeWindow_);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册