提交 794310f3 编写于 作者: Y yj

player_framework相关xts改成avcodec

Signed-off-by: Nyj <yujie57@huawei.com>
上级 0d416587
......@@ -41,11 +41,10 @@ void ActsVideoDecEncNdkTest::TearDownTestCase() {}
void ActsVideoDecEncNdkTest::SetUp() {}
void ActsVideoDecEncNdkTest::TearDown() {}
const string MIME_TYPE_AVC = "video/avc";
const string MIME_TYPE_MPEG4 = "video/mp4v-es";
constexpr uint32_t DEFAULT_WIDTH = 320;
constexpr uint32_t DEFAULT_HEIGHT = 240;
constexpr uint32_t DEFAULT_PIXELFORMAT = 2;
constexpr uint32_t DEFAULT_FRAMERATE = 60;
constexpr double DEFAULT_FRAMERATE = 60;
const char* READPATH = "/data/media/out_320_240_10s.h264";
bool CheckDecDesc(map<string, int> InDesc, OH_AVFormat* OutDesc)
......@@ -66,6 +65,12 @@ bool CheckDecDesc(map<string, int> InDesc, OH_AVFormat* OutDesc)
}
out = 0;
}
double dout;
bool res = OH_AVFormat_GetDoubleValue(OutDesc, OH_MD_KEY_FRAME_RATE, &dout);
if (!res || abs(dout - DEFAULT_FRAMERATE) > 1e-6) {
cout << "OH_AVFormat_GetDoubleValue error. key: " << OH_MD_KEY_FRAME_RATE << endl;
}
return true;
}
......@@ -89,7 +94,7 @@ struct OH_AVFormat* createFormat()
OH_AVFormat_SetIntValue(DefaultFormat, OH_MD_KEY_WIDTH, DEFAULT_WIDTH);
OH_AVFormat_SetIntValue(DefaultFormat, OH_MD_KEY_HEIGHT, DEFAULT_HEIGHT);
OH_AVFormat_SetIntValue(DefaultFormat, OH_MD_KEY_PIXEL_FORMAT, DEFAULT_PIXELFORMAT);
OH_AVFormat_SetIntValue(DefaultFormat, OH_MD_KEY_FRAME_RATE, DEFAULT_FRAMERATE);
OH_AVFormat_SetDoubleValue(DefaultFormat, OH_MD_KEY_FRAME_RATE, DEFAULT_FRAMERATE);
OH_AVFormat_SetStringValue(DefaultFormat, OH_MD_KEY_CODEC_MIME, OH_AVCODEC_MIMETYPE_VIDEO_AVC);
return DefaultFormat;
}
......@@ -117,7 +122,7 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_010
struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC);
ASSERT_NE(nullptr, videoDec);
struct OH_AVCodec* videoEnc = vDecEncSample->CreateVideoEncoderByMime(MIME_TYPE_MPEG4);
struct OH_AVCodec* videoEnc = vDecEncSample->CreateVideoEncoderByMime(MIME_TYPE_AVC);
ASSERT_NE(nullptr, videoEnc);
vDecEncSample->SetReadPath(READPATH);
vDecEncSample->SetSavePath("/data/media/video_001.h264");
......@@ -128,10 +133,10 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_010
{OH_MD_KEY_WIDTH, DEFAULT_WIDTH},
{OH_MD_KEY_HEIGHT, DEFAULT_HEIGHT},
{OH_MD_KEY_PIXEL_FORMAT, DEFAULT_PIXELFORMAT},
{OH_MD_KEY_FRAME_RATE, DEFAULT_FRAMERATE},
};
ASSERT_EQ(true, SetFormat(VideoFormat, VideoParam));
OH_AVFormat_SetIntValue(VideoFormat, OH_MD_KEY_TRACK_TYPE, OH_MediaType::MEDIA_TYPE_VID);
OH_AVFormat_SetDoubleValue(VideoFormat, OH_MD_KEY_FRAME_RATE, DEFAULT_FRAMERATE);
ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat));
OH_AVFormat *OutDescDec = OH_VideoDecoder_GetOutputDescription(videoDec);
......@@ -141,7 +146,6 @@ HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_010
ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat));
OH_AVFormat *OutDescEnc = OH_VideoEncoder_GetOutputDescription(videoEnc);
ASSERT_NE(nullptr, OutDescEnc);
ASSERT_EQ(true, CheckDecDesc(VideoParam, OutDescEnc));
ASSERT_EQ(AV_ERR_OK, vDecEncSample->GetSurface());
ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetOutputSurface());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册