1da853ecaSopenharmony_ci/* 2da853ecaSopenharmony_ci * Copyright (C) 2024 Huawei Device Co., Ltd. 3da853ecaSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4da853ecaSopenharmony_ci * you may not use this file except in compliance with the License. 5da853ecaSopenharmony_ci * You may obtain a copy of the License at 6da853ecaSopenharmony_ci * 7da853ecaSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8da853ecaSopenharmony_ci * 9da853ecaSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10da853ecaSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11da853ecaSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12da853ecaSopenharmony_ci * See the License for the specific language governing permissions and 13da853ecaSopenharmony_ci * limitations under the License. 14da853ecaSopenharmony_ci */ 15da853ecaSopenharmony_ci 16da853ecaSopenharmony_ci#include "gtest/gtest.h" 17da853ecaSopenharmony_ci 18da853ecaSopenharmony_ci#include "avdemuxer.h" 19da853ecaSopenharmony_ci#include "avsource.h" 20da853ecaSopenharmony_ci#include "meta/format.h" 21da853ecaSopenharmony_ci#include "avcodec_errors.h" 22da853ecaSopenharmony_ci#include "avcodec_common.h" 23da853ecaSopenharmony_ci#include "buffer/avsharedmemory.h" 24da853ecaSopenharmony_ci#include "buffer/avsharedmemorybase.h" 25da853ecaSopenharmony_ci#include "securec.h" 26da853ecaSopenharmony_ci#include "inner_demuxer_sample.h" 27da853ecaSopenharmony_ci 28da853ecaSopenharmony_ci#include "native_avcodec_base.h" 29da853ecaSopenharmony_ci#include "native_avdemuxer.h" 30da853ecaSopenharmony_ci#include "native_avformat.h" 31da853ecaSopenharmony_ci#include "native_avsource.h" 32da853ecaSopenharmony_ci#include "native_avmemory.h" 33da853ecaSopenharmony_ci#include "meta/meta_key.h" 34da853ecaSopenharmony_ci#include "meta/meta.h" 35da853ecaSopenharmony_ci#include "av_common.h" 36da853ecaSopenharmony_ci 37da853ecaSopenharmony_ci#include <iostream> 38da853ecaSopenharmony_ci#include <cstdio> 39da853ecaSopenharmony_ci#include <string> 40da853ecaSopenharmony_ci#include <fcntl.h> 41da853ecaSopenharmony_ci#include <thread> 42da853ecaSopenharmony_ci 43da853ecaSopenharmony_ciusing namespace std; 44da853ecaSopenharmony_ciusing namespace OHOS; 45da853ecaSopenharmony_ciusing namespace OHOS::MediaAVCodec; 46da853ecaSopenharmony_ciusing namespace OHOS::Media; 47da853ecaSopenharmony_ciusing namespace testing::ext; 48da853ecaSopenharmony_ci 49da853ecaSopenharmony_cinamespace { 50da853ecaSopenharmony_ciclass DemuxerNet2NdkTest : public testing::Test { 51da853ecaSopenharmony_cipublic: 52da853ecaSopenharmony_ci // SetUpTestCase: Called before all test cases 53da853ecaSopenharmony_ci static void SetUpTestCase(void); 54da853ecaSopenharmony_ci // TearDownTestCase: Called after all test case 55da853ecaSopenharmony_ci static void TearDownTestCase(void); 56da853ecaSopenharmony_ci // SetUp: Called before each test cases 57da853ecaSopenharmony_ci void SetUp(void); 58da853ecaSopenharmony_ci // TearDown: Called after each test cases 59da853ecaSopenharmony_ci void TearDown(void); 60da853ecaSopenharmony_ci 61da853ecaSopenharmony_cipublic: 62da853ecaSopenharmony_ci int32_t fd_ = -1; 63da853ecaSopenharmony_ci int64_t size; 64da853ecaSopenharmony_ci}; 65da853ecaSopenharmony_cistatic OH_AVMemory *memory = nullptr; 66da853ecaSopenharmony_cistatic OH_AVFormat *sourceFormat = nullptr; 67da853ecaSopenharmony_cistatic OH_AVFormat *trackFormat = nullptr; 68da853ecaSopenharmony_cistatic OH_AVSource *source = nullptr; 69da853ecaSopenharmony_cistatic OH_AVDemuxer *demuxer = nullptr; 70da853ecaSopenharmony_cistatic int32_t g_trackCount = 0; 71da853ecaSopenharmony_cistatic OH_AVBuffer *avBuffer = nullptr; 72da853ecaSopenharmony_ci 73da853ecaSopenharmony_cistatic int32_t g_width = 3840; 74da853ecaSopenharmony_cistatic int32_t g_height = 2160; 75da853ecaSopenharmony_civoid DemuxerNet2NdkTest::SetUpTestCase() {} 76da853ecaSopenharmony_civoid DemuxerNet2NdkTest::TearDownTestCase() {} 77da853ecaSopenharmony_civoid DemuxerNet2NdkTest::SetUp() 78da853ecaSopenharmony_ci{ 79da853ecaSopenharmony_ci memory = OH_AVMemory_Create(g_width * g_height); 80da853ecaSopenharmony_ci g_trackCount = 0; 81da853ecaSopenharmony_ci} 82da853ecaSopenharmony_civoid DemuxerNet2NdkTest::TearDown() 83da853ecaSopenharmony_ci{ 84da853ecaSopenharmony_ci if (fd_ > 0) { 85da853ecaSopenharmony_ci close(fd_); 86da853ecaSopenharmony_ci fd_ = -1; 87da853ecaSopenharmony_ci } 88da853ecaSopenharmony_ci if (demuxer != nullptr) { 89da853ecaSopenharmony_ci OH_AVDemuxer_Destroy(demuxer); 90da853ecaSopenharmony_ci demuxer = nullptr; 91da853ecaSopenharmony_ci } 92da853ecaSopenharmony_ci if (memory != nullptr) { 93da853ecaSopenharmony_ci OH_AVMemory_Destroy(memory); 94da853ecaSopenharmony_ci memory = nullptr; 95da853ecaSopenharmony_ci } 96da853ecaSopenharmony_ci if (source != nullptr) { 97da853ecaSopenharmony_ci OH_AVSource_Destroy(source); 98da853ecaSopenharmony_ci source = nullptr; 99da853ecaSopenharmony_ci } 100da853ecaSopenharmony_ci if (avBuffer != nullptr) { 101da853ecaSopenharmony_ci OH_AVBuffer_Destroy(avBuffer); 102da853ecaSopenharmony_ci avBuffer = nullptr; 103da853ecaSopenharmony_ci } 104da853ecaSopenharmony_ci if (trackFormat != nullptr) { 105da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 106da853ecaSopenharmony_ci trackFormat = nullptr; 107da853ecaSopenharmony_ci } 108da853ecaSopenharmony_ci if (sourceFormat != nullptr) { 109da853ecaSopenharmony_ci OH_AVFormat_Destroy(sourceFormat); 110da853ecaSopenharmony_ci sourceFormat = nullptr; 111da853ecaSopenharmony_ci } 112da853ecaSopenharmony_ci} 113da853ecaSopenharmony_ci} // namespace 114da853ecaSopenharmony_ci 115da853ecaSopenharmony_cinamespace { 116da853ecaSopenharmony_ci static void CheckVideoKey() 117da853ecaSopenharmony_ci { 118da853ecaSopenharmony_ci uint8_t *codecConfig = nullptr; 119da853ecaSopenharmony_ci size_t bufferSize; 120da853ecaSopenharmony_ci int64_t bitrate = 0; 121da853ecaSopenharmony_ci const char* mimeType = nullptr; 122da853ecaSopenharmony_ci double frameRate; 123da853ecaSopenharmony_ci int32_t currentWidth = 0; 124da853ecaSopenharmony_ci int32_t currentHeight = 0; 125da853ecaSopenharmony_ci const char* language = nullptr; 126da853ecaSopenharmony_ci int32_t rotation; 127da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetLongValue(trackFormat, OH_MD_KEY_BITRATE, &bitrate)); 128da853ecaSopenharmony_ci int bitrateResult = 1660852; 129da853ecaSopenharmony_ci ASSERT_EQ(bitrateResult, bitrate); 130da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetBuffer(trackFormat, OH_MD_KEY_CODEC_CONFIG, &codecConfig, &bufferSize)); 131da853ecaSopenharmony_ci int bufferSizeResult = 255; 132da853ecaSopenharmony_ci ASSERT_EQ(bufferSizeResult, bufferSize); 133da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_CODEC_MIME, &mimeType)); 134da853ecaSopenharmony_ci int expectNum = 0; 135da853ecaSopenharmony_ci ASSERT_EQ(expectNum, strcmp(mimeType, OH_AVCODEC_MIMETYPE_VIDEO_VVC)); 136da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetDoubleValue(trackFormat, OH_MD_KEY_FRAME_RATE, &frameRate)); 137da853ecaSopenharmony_ci int frameRateResult = 50.000000; 138da853ecaSopenharmony_ci ASSERT_EQ(frameRateResult, frameRate); 139da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_HEIGHT, ¤tHeight)); 140da853ecaSopenharmony_ci int currentHeightResult = 1080; 141da853ecaSopenharmony_ci ASSERT_EQ(currentHeightResult, currentHeight); 142da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_WIDTH, ¤tWidth)); 143da853ecaSopenharmony_ci int currentWidthResult = 1920; 144da853ecaSopenharmony_ci ASSERT_EQ(currentWidthResult, currentWidth); 145da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_LANGUAGE, &language)); 146da853ecaSopenharmony_ci ASSERT_EQ(0, strcmp(language, "und")); 147da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_ROTATION, &rotation)); 148da853ecaSopenharmony_ci ASSERT_EQ(0, rotation); 149da853ecaSopenharmony_ci } 150da853ecaSopenharmony_ci 151da853ecaSopenharmony_ci static void CheckAudioKey() 152da853ecaSopenharmony_ci { 153da853ecaSopenharmony_ci int32_t aacisAdts = 0; 154da853ecaSopenharmony_ci int64_t channelLayout; 155da853ecaSopenharmony_ci int32_t audioCount = 0; 156da853ecaSopenharmony_ci int32_t sampleFormat; 157da853ecaSopenharmony_ci int64_t bitrate = 0; 158da853ecaSopenharmony_ci int32_t bitsPreCodedSample; 159da853ecaSopenharmony_ci uint8_t *codecConfig = nullptr; 160da853ecaSopenharmony_ci size_t bufferSize; 161da853ecaSopenharmony_ci const char* mimeType = nullptr; 162da853ecaSopenharmony_ci int32_t sampleRate = 0; 163da853ecaSopenharmony_ci const char* language = nullptr; 164da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_AAC_IS_ADTS, &aacisAdts)); 165da853ecaSopenharmony_ci int aacisAdtsResult = 1; 166da853ecaSopenharmony_ci ASSERT_EQ(aacisAdtsResult, aacisAdts); 167da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetLongValue(trackFormat, OH_MD_KEY_CHANNEL_LAYOUT, &channelLayout)); 168da853ecaSopenharmony_ci int channelLayoutResult = 3; 169da853ecaSopenharmony_ci ASSERT_EQ(channelLayoutResult, channelLayout); 170da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_AUD_CHANNEL_COUNT, &audioCount)); 171da853ecaSopenharmony_ci int audioCountResult = 2; 172da853ecaSopenharmony_ci ASSERT_EQ(audioCountResult, audioCount); 173da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_AUDIO_SAMPLE_FORMAT, &sampleFormat)); 174da853ecaSopenharmony_ci int sampleFormatResult = 0; 175da853ecaSopenharmony_ci ASSERT_EQ(sampleFormatResult, sampleFormat); 176da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetLongValue(trackFormat, OH_MD_KEY_BITRATE, &bitrate)); 177da853ecaSopenharmony_ci int bitrateResult = 127881; 178da853ecaSopenharmony_ci ASSERT_EQ(bitrateResult, bitrate); 179da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_BITS_PER_CODED_SAMPLE, &bitsPreCodedSample)); 180da853ecaSopenharmony_ci int bitsPreCodedSampleResult = 16; 181da853ecaSopenharmony_ci ASSERT_EQ(bitsPreCodedSampleResult, bitsPreCodedSample); 182da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetBuffer(trackFormat, OH_MD_KEY_CODEC_CONFIG, &codecConfig, &bufferSize)); 183da853ecaSopenharmony_ci int bufferSizeResult = 5; 184da853ecaSopenharmony_ci ASSERT_EQ(bufferSizeResult, bufferSize); 185da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_CODEC_MIME, &mimeType)); 186da853ecaSopenharmony_ci int expectNum = 0; 187da853ecaSopenharmony_ci ASSERT_EQ(expectNum, strcmp(mimeType, OH_AVCODEC_MIMETYPE_AUDIO_AAC)); 188da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_LANGUAGE, &language)); 189da853ecaSopenharmony_ci ASSERT_EQ(expectNum, strcmp(language, "eng")); 190da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_AUD_SAMPLE_RATE, &sampleRate)); 191da853ecaSopenharmony_ci int sampleRateResult = 48000; 192da853ecaSopenharmony_ci ASSERT_EQ(sampleRateResult, sampleRate); 193da853ecaSopenharmony_ci } 194da853ecaSopenharmony_ci static void CheckAudioKeyVVC() 195da853ecaSopenharmony_ci { 196da853ecaSopenharmony_ci uint8_t *codecConfig = nullptr; 197da853ecaSopenharmony_ci size_t bufferSize; 198da853ecaSopenharmony_ci const char* language = nullptr; 199da853ecaSopenharmony_ci int64_t bitrate = 0; 200da853ecaSopenharmony_ci double frameRate; 201da853ecaSopenharmony_ci int32_t currentWidth = 0; 202da853ecaSopenharmony_ci int32_t currentHeight = 0; 203da853ecaSopenharmony_ci int tarckType = 0; 204da853ecaSopenharmony_ci const char* mimeType = nullptr; 205da853ecaSopenharmony_ci int32_t rotation; 206da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetLongValue(trackFormat, OH_MD_KEY_BITRATE, &bitrate)); 207da853ecaSopenharmony_ci int bitrateResutlt = 10014008; 208da853ecaSopenharmony_ci ASSERT_EQ(bitrateResutlt, bitrate); 209da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetBuffer(trackFormat, OH_MD_KEY_CODEC_CONFIG, &codecConfig, &bufferSize)); 210da853ecaSopenharmony_ci size_t bufferSizeResult = 247; 211da853ecaSopenharmony_ci ASSERT_EQ(bufferSizeResult, bufferSize); 212da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_CODEC_MIME, &mimeType)); 213da853ecaSopenharmony_ci int expectNum = 0; 214da853ecaSopenharmony_ci ASSERT_EQ(expectNum, strcmp(mimeType, OH_AVCODEC_MIMETYPE_VIDEO_VVC)); 215da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetDoubleValue(trackFormat, OH_MD_KEY_FRAME_RATE, &frameRate)); 216da853ecaSopenharmony_ci double frameRateResult = 60.000000; 217da853ecaSopenharmony_ci ASSERT_EQ(frameRateResult, frameRate); 218da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_HEIGHT, ¤tHeight)); 219da853ecaSopenharmony_ci int currentHeightResult = 2160; 220da853ecaSopenharmony_ci ASSERT_EQ(currentHeightResult, currentHeight); 221da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_WIDTH, ¤tWidth)); 222da853ecaSopenharmony_ci int currentWidthResult = 3840; 223da853ecaSopenharmony_ci ASSERT_EQ(currentWidthResult, currentWidth); 224da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_LANGUAGE, &language)); 225da853ecaSopenharmony_ci ASSERT_EQ(expectNum, strcmp(language, "und")); 226da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_ROTATION, &rotation)); 227da853ecaSopenharmony_ci int rotationResult = 0; 228da853ecaSopenharmony_ci ASSERT_EQ(rotationResult, rotation); 229da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType)); 230da853ecaSopenharmony_ci int tarckTypeResult = 1; 231da853ecaSopenharmony_ci ASSERT_EQ(tarckTypeResult, tarckType); 232da853ecaSopenharmony_ci } 233da853ecaSopenharmony_ci 234da853ecaSopenharmony_ci static void SetAudioValue(OH_AVCodecBufferAttr attr, bool &audioIsEnd, int &audioFrame, int &aKeyCount) 235da853ecaSopenharmony_ci { 236da853ecaSopenharmony_ci if (attr.flags & OH_AVCodecBufferFlags::AVCODEC_BUFFER_FLAGS_EOS) { 237da853ecaSopenharmony_ci audioIsEnd = true; 238da853ecaSopenharmony_ci cout << audioFrame << " audio is end !!!!!!!!!!!!!!!" << endl; 239da853ecaSopenharmony_ci } else { 240da853ecaSopenharmony_ci audioFrame++; 241da853ecaSopenharmony_ci if (attr.flags & OH_AVCodecBufferFlags::AVCODEC_BUFFER_FLAGS_SYNC_FRAME) { 242da853ecaSopenharmony_ci aKeyCount++; 243da853ecaSopenharmony_ci } 244da853ecaSopenharmony_ci } 245da853ecaSopenharmony_ci } 246da853ecaSopenharmony_ci 247da853ecaSopenharmony_ci static void SetVideoValue(OH_AVCodecBufferAttr attr, bool &videoIsEnd, int &videoFrame, int &vKeyCount) 248da853ecaSopenharmony_ci { 249da853ecaSopenharmony_ci if (attr.flags & OH_AVCodecBufferFlags::AVCODEC_BUFFER_FLAGS_EOS) { 250da853ecaSopenharmony_ci videoIsEnd = true; 251da853ecaSopenharmony_ci cout << videoFrame << " video is end !!!!!!!!!!!!!!!" << endl; 252da853ecaSopenharmony_ci } else { 253da853ecaSopenharmony_ci videoFrame++; 254da853ecaSopenharmony_ci cout << "video track !!!!!" << endl; 255da853ecaSopenharmony_ci if (attr.flags & OH_AVCodecBufferFlags::AVCODEC_BUFFER_FLAGS_SYNC_FRAME) { 256da853ecaSopenharmony_ci vKeyCount++; 257da853ecaSopenharmony_ci } 258da853ecaSopenharmony_ci } 259da853ecaSopenharmony_ci } 260da853ecaSopenharmony_ci 261da853ecaSopenharmony_ci /** 262da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1000 263da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video ROTATE_NONE.mp4 264da853ecaSopenharmony_ci * @tc.desc : function test 265da853ecaSopenharmony_ci */ 266da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1000, TestSize.Level0) 267da853ecaSopenharmony_ci{ 268da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 269da853ecaSopenharmony_ci int32_t rotation = -1; 270da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/ROTATE_NONE.mp4"; 271da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 272da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 273da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 274da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 275da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 276da853ecaSopenharmony_ci ASSERT_EQ(rotation, MediaAVCodec::ROTATE_NONE); 277da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 278da853ecaSopenharmony_ci} 279da853ecaSopenharmony_ci 280da853ecaSopenharmony_ci/** 281da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1001 282da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video ROTATE_90.mp4 283da853ecaSopenharmony_ci * @tc.desc : function test 284da853ecaSopenharmony_ci */ 285da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1001, TestSize.Level1) 286da853ecaSopenharmony_ci{ 287da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 288da853ecaSopenharmony_ci int32_t rotation = -1; 289da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/ROTATE_90.mp4"; 290da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 291da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 292da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 293da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 294da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 295da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_90); 296da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 297da853ecaSopenharmony_ci} 298da853ecaSopenharmony_ci 299da853ecaSopenharmony_ci/** 300da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1002 301da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video ROTATE_180.mp4 302da853ecaSopenharmony_ci * @tc.desc : function test 303da853ecaSopenharmony_ci */ 304da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1002, TestSize.Level1) 305da853ecaSopenharmony_ci{ 306da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 307da853ecaSopenharmony_ci int32_t rotation = -1; 308da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/ROTATE_180.mp4"; 309da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 310da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 311da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 312da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 313da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 314da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_180); 315da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 316da853ecaSopenharmony_ci} 317da853ecaSopenharmony_ci 318da853ecaSopenharmony_ci/** 319da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1003 320da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video ROTATE_270.mp4 321da853ecaSopenharmony_ci * @tc.desc : function test 322da853ecaSopenharmony_ci */ 323da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1003, TestSize.Level1) 324da853ecaSopenharmony_ci{ 325da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 326da853ecaSopenharmony_ci int32_t rotation = -1; 327da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/ROTATE_270.mp4"; 328da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 329da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 330da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 331da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 332da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 333da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_270); 334da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 335da853ecaSopenharmony_ci} 336da853ecaSopenharmony_ci 337da853ecaSopenharmony_ci/** 338da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1004 339da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video FLIP_H.mp4 340da853ecaSopenharmony_ci * @tc.desc : function test 341da853ecaSopenharmony_ci */ 342da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1004, TestSize.Level2) 343da853ecaSopenharmony_ci{ 344da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 345da853ecaSopenharmony_ci int32_t rotation = -1; 346da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/FLIP_H.mp4"; 347da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 348da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 349da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 350da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 351da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 352da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_H); 353da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 354da853ecaSopenharmony_ci} 355da853ecaSopenharmony_ci 356da853ecaSopenharmony_ci/** 357da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1005 358da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video FLIP_V.mp4 359da853ecaSopenharmony_ci * @tc.desc : function test 360da853ecaSopenharmony_ci */ 361da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1005, TestSize.Level2) 362da853ecaSopenharmony_ci{ 363da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 364da853ecaSopenharmony_ci int32_t rotation = -1; 365da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/FLIP_V.mp4"; 366da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 367da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 368da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 369da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 370da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 371da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_V); 372da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 373da853ecaSopenharmony_ci} 374da853ecaSopenharmony_ci 375da853ecaSopenharmony_ci/** 376da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1006 377da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video FLIP_H_90.mp4 378da853ecaSopenharmony_ci * @tc.desc : function test 379da853ecaSopenharmony_ci */ 380da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1006, TestSize.Level2) 381da853ecaSopenharmony_ci{ 382da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 383da853ecaSopenharmony_ci int32_t rotation = -1; 384da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/FLIP_H_90.mp4";; 385da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 386da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 387da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 388da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 389da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 390da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_H_ROT90); 391da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 392da853ecaSopenharmony_ci} 393da853ecaSopenharmony_ci 394da853ecaSopenharmony_ci/** 395da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1007 396da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video FLIP_V_90.mp4 397da853ecaSopenharmony_ci * @tc.desc : function test 398da853ecaSopenharmony_ci */ 399da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1007, TestSize.Level2) 400da853ecaSopenharmony_ci{ 401da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 402da853ecaSopenharmony_ci int32_t rotation = -1; 403da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/FLIP_V_90.mp4"; 404da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 405da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 406da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 407da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 408da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 409da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_V_ROT90); 410da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 411da853ecaSopenharmony_ci} 412da853ecaSopenharmony_ci 413da853ecaSopenharmony_ci/** 414da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1008 415da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video FLIP_H_180.mp4 416da853ecaSopenharmony_ci * @tc.desc : function test 417da853ecaSopenharmony_ci */ 418da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1008, TestSize.Level2) 419da853ecaSopenharmony_ci{ 420da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 421da853ecaSopenharmony_ci int32_t rotation = -1; 422da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/FLIP_H_180.mp4"; 423da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 424da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 425da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 426da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 427da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 428da853ecaSopenharmony_ci ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_V || rotation == OHOS::MediaAVCodec::FLIP_H_ROT180); 429da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 430da853ecaSopenharmony_ci} 431da853ecaSopenharmony_ci 432da853ecaSopenharmony_ci/** 433da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1009 434da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video FLIP_V_180.mp4 435da853ecaSopenharmony_ci * @tc.desc : function test 436da853ecaSopenharmony_ci */ 437da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1009, TestSize.Level2) 438da853ecaSopenharmony_ci{ 439da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 440da853ecaSopenharmony_ci int32_t rotation = -1; 441da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/FLIP_V_180.mp4"; 442da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 443da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 444da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 445da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 446da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 447da853ecaSopenharmony_ci ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_H || rotation == OHOS::MediaAVCodec::FLIP_V_ROT180); 448da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 449da853ecaSopenharmony_ci} 450da853ecaSopenharmony_ci 451da853ecaSopenharmony_ci/** 452da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1010 453da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video FLIP_H_270.mp4 454da853ecaSopenharmony_ci * @tc.desc : function test 455da853ecaSopenharmony_ci */ 456da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1010, TestSize.Level2) 457da853ecaSopenharmony_ci{ 458da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 459da853ecaSopenharmony_ci int32_t rotation = -1; 460da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/FLIP_H_270.mp4"; 461da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 462da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 463da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 464da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 465da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 466da853ecaSopenharmony_ci ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_V_ROT90 || rotation == OHOS::MediaAVCodec::FLIP_H_ROT270); 467da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 468da853ecaSopenharmony_ci} 469da853ecaSopenharmony_ci 470da853ecaSopenharmony_ci/** 471da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1011 472da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video FLIP_V_270.mp4 473da853ecaSopenharmony_ci * @tc.desc : function test 474da853ecaSopenharmony_ci */ 475da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1011, TestSize.Level2) 476da853ecaSopenharmony_ci{ 477da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 478da853ecaSopenharmony_ci int32_t rotation = -1; 479da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/FLIP_V_270.mp4"; 480da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 481da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 482da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 483da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 484da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 485da853ecaSopenharmony_ci ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_H_ROT90 || rotation == OHOS::MediaAVCodec::FLIP_V_ROT270); 486da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 487da853ecaSopenharmony_ci} 488da853ecaSopenharmony_ci 489da853ecaSopenharmony_ci/** 490da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1012 491da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video INVALID.mp4 492da853ecaSopenharmony_ci * @tc.desc : function test 493da853ecaSopenharmony_ci */ 494da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1012, TestSize.Level2) 495da853ecaSopenharmony_ci{ 496da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 497da853ecaSopenharmony_ci int32_t rotation = -1; 498da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/INVALID.mp4"; 499da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 500da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 501da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 502da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 503da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 504da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE); 505da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 506da853ecaSopenharmony_ci} 507da853ecaSopenharmony_ci 508da853ecaSopenharmony_ci/** 509da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1013 510da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_ROTATE_NONE.mp4 511da853ecaSopenharmony_ci * @tc.desc : function test 512da853ecaSopenharmony_ci */ 513da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1013, TestSize.Level0) 514da853ecaSopenharmony_ci{ 515da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 516da853ecaSopenharmony_ci int32_t rotation = -1; 517da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_ROTATE_NONE.mp4"; 518da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 519da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 520da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 521da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 522da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 523da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE); 524da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 525da853ecaSopenharmony_ci} 526da853ecaSopenharmony_ci 527da853ecaSopenharmony_ci/** 528da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1014 529da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_ROTATE_90.mp4 530da853ecaSopenharmony_ci * @tc.desc : function test 531da853ecaSopenharmony_ci */ 532da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1014, TestSize.Level1) 533da853ecaSopenharmony_ci{ 534da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 535da853ecaSopenharmony_ci int32_t rotation = -1; 536da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_ROTATE_90.mp4"; 537da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 538da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 539da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 540da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 541da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 542da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_90); 543da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 544da853ecaSopenharmony_ci} 545da853ecaSopenharmony_ci 546da853ecaSopenharmony_ci/** 547da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1015 548da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_ROTATE_180.mp4 549da853ecaSopenharmony_ci * @tc.desc : function test 550da853ecaSopenharmony_ci */ 551da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1015, TestSize.Level1) 552da853ecaSopenharmony_ci{ 553da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 554da853ecaSopenharmony_ci int32_t rotation = -1; 555da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_ROTATE_180.mp4"; 556da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 557da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 558da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 559da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 560da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 561da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_180); 562da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 563da853ecaSopenharmony_ci} 564da853ecaSopenharmony_ci 565da853ecaSopenharmony_ci/** 566da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1016 567da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_ROTATE_270.mp4 568da853ecaSopenharmony_ci * @tc.desc : function test 569da853ecaSopenharmony_ci */ 570da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1016, TestSize.Level1) 571da853ecaSopenharmony_ci{ 572da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 573da853ecaSopenharmony_ci int32_t rotation = -1; 574da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_ROTATE_270.mp4"; 575da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 576da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 577da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 578da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 579da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 580da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_270); 581da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 582da853ecaSopenharmony_ci} 583da853ecaSopenharmony_ci 584da853ecaSopenharmony_ci/** 585da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1017 586da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_FLIP_H.mp4 587da853ecaSopenharmony_ci * @tc.desc : function test 588da853ecaSopenharmony_ci */ 589da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1017, TestSize.Level2) 590da853ecaSopenharmony_ci{ 591da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 592da853ecaSopenharmony_ci int32_t rotation = -1; 593da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_FLIP_H.mp4"; 594da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 595da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 596da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 597da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 598da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 599da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_H); 600da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 601da853ecaSopenharmony_ci} 602da853ecaSopenharmony_ci 603da853ecaSopenharmony_ci/** 604da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1018 605da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_FLIP_V.mp4 606da853ecaSopenharmony_ci * @tc.desc : function test 607da853ecaSopenharmony_ci */ 608da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1018, TestSize.Level2) 609da853ecaSopenharmony_ci{ 610da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 611da853ecaSopenharmony_ci int32_t rotation = -1; 612da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_FLIP_V.mp4"; 613da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 614da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 615da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 616da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 617da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 618da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_V); 619da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 620da853ecaSopenharmony_ci} 621da853ecaSopenharmony_ci 622da853ecaSopenharmony_ci/** 623da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1019 624da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_FLIP_H_90.mp4 625da853ecaSopenharmony_ci * @tc.desc : function test 626da853ecaSopenharmony_ci */ 627da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1019, TestSize.Level2) 628da853ecaSopenharmony_ci{ 629da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 630da853ecaSopenharmony_ci int32_t rotation = -1; 631da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_FLIP_H_90.mp4"; 632da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 633da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 634da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 635da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 636da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 637da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_H_ROT90); 638da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 639da853ecaSopenharmony_ci} 640da853ecaSopenharmony_ci 641da853ecaSopenharmony_ci/** 642da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1020 643da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_FLIP_V_90.mp4 644da853ecaSopenharmony_ci * @tc.desc : function test 645da853ecaSopenharmony_ci */ 646da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1020, TestSize.Level2) 647da853ecaSopenharmony_ci{ 648da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 649da853ecaSopenharmony_ci int32_t rotation = -1; 650da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_FLIP_V_90.mp4"; 651da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 652da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 653da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 654da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 655da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 656da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_V_ROT90); 657da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 658da853ecaSopenharmony_ci} 659da853ecaSopenharmony_ci 660da853ecaSopenharmony_ci/** 661da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1021 662da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_FLIP_H_180.mp4 663da853ecaSopenharmony_ci * @tc.desc : function test 664da853ecaSopenharmony_ci */ 665da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1021, TestSize.Level2) 666da853ecaSopenharmony_ci{ 667da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 668da853ecaSopenharmony_ci int32_t rotation = -1; 669da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_FLIP_H_180.mp4"; 670da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 671da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 672da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 673da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 674da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 675da853ecaSopenharmony_ci ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_V || rotation == OHOS::MediaAVCodec::FLIP_H_ROT180); 676da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 677da853ecaSopenharmony_ci} 678da853ecaSopenharmony_ci 679da853ecaSopenharmony_ci/** 680da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1022 681da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_FLIP_V_180.mp4 682da853ecaSopenharmony_ci * @tc.desc : function test 683da853ecaSopenharmony_ci */ 684da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1022, TestSize.Level2) 685da853ecaSopenharmony_ci{ 686da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 687da853ecaSopenharmony_ci int32_t rotation = -1; 688da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_FLIP_V_180.mp4"; 689da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 690da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 691da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 692da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 693da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 694da853ecaSopenharmony_ci ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_H || rotation == OHOS::MediaAVCodec::FLIP_V_ROT180); 695da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 696da853ecaSopenharmony_ci} 697da853ecaSopenharmony_ci 698da853ecaSopenharmony_ci/** 699da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1023 700da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_FLIP_H_270.mp4 701da853ecaSopenharmony_ci * @tc.desc : function test 702da853ecaSopenharmony_ci */ 703da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1023, TestSize.Level2) 704da853ecaSopenharmony_ci{ 705da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 706da853ecaSopenharmony_ci int32_t rotation = -1; 707da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_FLIP_H_270.mp4"; 708da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 709da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 710da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 711da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 712da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 713da853ecaSopenharmony_ci ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_V_ROT90 || rotation == OHOS::MediaAVCodec::FLIP_H_ROT270); 714da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 715da853ecaSopenharmony_ci} 716da853ecaSopenharmony_ci 717da853ecaSopenharmony_ci/** 718da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1024 719da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_FLIP_V_270.mp4 720da853ecaSopenharmony_ci * @tc.desc : function test 721da853ecaSopenharmony_ci */ 722da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1024, TestSize.Level2) 723da853ecaSopenharmony_ci{ 724da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 725da853ecaSopenharmony_ci int32_t rotation = -1; 726da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_FLIP_V_270.mp4"; 727da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 728da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 729da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 730da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 731da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 732da853ecaSopenharmony_ci ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_H_ROT90 || rotation == OHOS::MediaAVCodec::FLIP_V_ROT270); 733da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 734da853ecaSopenharmony_ci} 735da853ecaSopenharmony_ci 736da853ecaSopenharmony_ci/** 737da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1025 738da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video AV_INVALID.mp4 739da853ecaSopenharmony_ci * @tc.desc : function test 740da853ecaSopenharmony_ci */ 741da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1025, TestSize.Level2) 742da853ecaSopenharmony_ci{ 743da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 744da853ecaSopenharmony_ci int32_t rotation = -1; 745da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/AV_INVALID.mp4"; 746da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 747da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 748da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 749da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 750da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 751da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE); 752da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 753da853ecaSopenharmony_ci} 754da853ecaSopenharmony_ci 755da853ecaSopenharmony_ci/** 756da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1026 757da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video UNDEFINED_FLV.flv 758da853ecaSopenharmony_ci * @tc.desc : function test 759da853ecaSopenharmony_ci */ 760da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1026, TestSize.Level3) 761da853ecaSopenharmony_ci{ 762da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 763da853ecaSopenharmony_ci int32_t rotation = 0; 764da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/UNDEFINED_FLV.flv"; 765da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 766da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 767da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 768da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 769da853ecaSopenharmony_ci ASSERT_FALSE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 770da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE); 771da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 772da853ecaSopenharmony_ci} 773da853ecaSopenharmony_ci 774da853ecaSopenharmony_ci/** 775da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1027 776da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video UNDEFINED_fmp4.mp4 777da853ecaSopenharmony_ci * @tc.desc : function test 778da853ecaSopenharmony_ci */ 779da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1027, TestSize.Level3) 780da853ecaSopenharmony_ci{ 781da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 782da853ecaSopenharmony_ci int32_t rotation = 0; 783da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/UNDEFINED_FMP4.mp4"; 784da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 785da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 786da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 787da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 788da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 789da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE); 790da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 791da853ecaSopenharmony_ci} 792da853ecaSopenharmony_ci 793da853ecaSopenharmony_ci/** 794da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1028 795da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video UNDEFINED_MKV.mkv 796da853ecaSopenharmony_ci * @tc.desc : function test 797da853ecaSopenharmony_ci */ 798da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1028, TestSize.Level3) 799da853ecaSopenharmony_ci{ 800da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 801da853ecaSopenharmony_ci int32_t rotation = 0; 802da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/UNDEFINED_MKV.mkv"; 803da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 804da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 805da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 806da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 807da853ecaSopenharmony_ci ASSERT_FALSE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 808da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE); 809da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 810da853ecaSopenharmony_ci} 811da853ecaSopenharmony_ci 812da853ecaSopenharmony_ci/** 813da853ecaSopenharmony_ci * @tc.number : DEMUXER_ORIENTATIONTYPE_1029 814da853ecaSopenharmony_ci * @tc.name : determine the orientation type of the video UNDEFINED_TS.ts 815da853ecaSopenharmony_ci * @tc.desc : function test 816da853ecaSopenharmony_ci */ 817da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_ORIENTATIONTYPE_1029, TestSize.Level3) 818da853ecaSopenharmony_ci{ 819da853ecaSopenharmony_ci static OH_AVFormat *trackFormat = nullptr; 820da853ecaSopenharmony_ci int32_t rotation = 0; 821da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/rotation/UNDEFINED_TS.ts"; 822da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 823da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 824da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 825da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 826da853ecaSopenharmony_ci ASSERT_FALSE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation)); 827da853ecaSopenharmony_ci ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE); 828da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 829da853ecaSopenharmony_ci} 830da853ecaSopenharmony_ci 831da853ecaSopenharmony_ci/** 832da853ecaSopenharmony_ci * @tc.number : DEMUXER_VVC_NET_0100 833da853ecaSopenharmony_ci * @tc.name : demuxer 8bit H266 MP4 file, read 834da853ecaSopenharmony_ci * @tc.desc : function test 835da853ecaSopenharmony_ci */ 836da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_VVC_NET_0100, TestSize.Level0) 837da853ecaSopenharmony_ci{ 838da853ecaSopenharmony_ci if (memory == nullptr) { 839da853ecaSopenharmony_ci memory = OH_AVMemory_Create(g_width * g_height); 840da853ecaSopenharmony_ci } 841da853ecaSopenharmony_ci int tarckType = 0; 842da853ecaSopenharmony_ci OH_AVCodecBufferAttr attr; 843da853ecaSopenharmony_ci bool videoIsEnd = false; 844da853ecaSopenharmony_ci int videoFrame = 0; 845da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/vvc_8bit_3840_2160.mp4"; 846da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 847da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 848da853ecaSopenharmony_ci demuxer = OH_AVDemuxer_CreateWithSource(source); 849da853ecaSopenharmony_ci ASSERT_NE(demuxer, nullptr); 850da853ecaSopenharmony_ci sourceFormat = OH_AVSource_GetSourceFormat(source); 851da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount)); 852da853ecaSopenharmony_ci ASSERT_EQ(1, g_trackCount); 853da853ecaSopenharmony_ci for (int32_t index = 0; index < g_trackCount; index++) { 854da853ecaSopenharmony_ci ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SelectTrackByID(demuxer, index)); 855da853ecaSopenharmony_ci } 856da853ecaSopenharmony_ci int vKeyCount = 0; 857da853ecaSopenharmony_ci while (!videoIsEnd) { 858da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 859da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 860da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType)); 861da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 862da853ecaSopenharmony_ci trackFormat = nullptr; 863da853ecaSopenharmony_ci if (videoIsEnd) { 864da853ecaSopenharmony_ci continue; 865da853ecaSopenharmony_ci } 866da853ecaSopenharmony_ci ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr)); 867da853ecaSopenharmony_ci SetVideoValue(attr, videoIsEnd, videoFrame, vKeyCount); 868da853ecaSopenharmony_ci } 869da853ecaSopenharmony_ci ASSERT_EQ(videoFrame, 600); 870da853ecaSopenharmony_ci ASSERT_EQ(vKeyCount, 10); 871da853ecaSopenharmony_ci} 872da853ecaSopenharmony_ci 873da853ecaSopenharmony_ci/** 874da853ecaSopenharmony_ci * @tc.number : DEMUXER_VVC_NET_0200 875da853ecaSopenharmony_ci * @tc.name : demuxer 10bit H266 MP4 file, read 876da853ecaSopenharmony_ci * @tc.desc : function test 877da853ecaSopenharmony_ci */ 878da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_VVC_NET_0200, TestSize.Level0) 879da853ecaSopenharmony_ci{ 880da853ecaSopenharmony_ci if (memory == nullptr) { 881da853ecaSopenharmony_ci memory = OH_AVMemory_Create(g_width * g_height); 882da853ecaSopenharmony_ci } 883da853ecaSopenharmony_ci int tarckType = 0; 884da853ecaSopenharmony_ci OH_AVCodecBufferAttr attr; 885da853ecaSopenharmony_ci bool videoIsEnd = false; 886da853ecaSopenharmony_ci int videoFrame = 0; 887da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/vvc_aac_10bit_1920_1080.mp4"; 888da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 889da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 890da853ecaSopenharmony_ci demuxer = OH_AVDemuxer_CreateWithSource(source); 891da853ecaSopenharmony_ci ASSERT_NE(demuxer, nullptr); 892da853ecaSopenharmony_ci sourceFormat = OH_AVSource_GetSourceFormat(source); 893da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount)); 894da853ecaSopenharmony_ci ASSERT_EQ(2, g_trackCount); 895da853ecaSopenharmony_ci for (int32_t index = 0; index < g_trackCount; index++) { 896da853ecaSopenharmony_ci ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SelectTrackByID(demuxer, index)); 897da853ecaSopenharmony_ci } 898da853ecaSopenharmony_ci int vKeyCount = 0; 899da853ecaSopenharmony_ci int aKeyCount = 0; 900da853ecaSopenharmony_ci int audioFrame = 0; 901da853ecaSopenharmony_ci bool audioIsEnd = false; 902da853ecaSopenharmony_ci while (!audioIsEnd || !videoIsEnd) { 903da853ecaSopenharmony_ci for (int32_t index = 0; index < g_trackCount; index++) { 904da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, index); 905da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 906da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType)); 907da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 908da853ecaSopenharmony_ci trackFormat = nullptr; 909da853ecaSopenharmony_ci if ((audioIsEnd && (tarckType == 0)) || (videoIsEnd && (tarckType == 1))) { 910da853ecaSopenharmony_ci continue; 911da853ecaSopenharmony_ci } 912da853ecaSopenharmony_ci ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, index, memory, &attr)); 913da853ecaSopenharmony_ci if (tarckType == OHOS::Media::MEDIA_TYPE_VID) { 914da853ecaSopenharmony_ci SetVideoValue(attr, videoIsEnd, videoFrame, vKeyCount); 915da853ecaSopenharmony_ci } else if (tarckType == OHOS::Media::MEDIA_TYPE_AUD) { 916da853ecaSopenharmony_ci SetAudioValue(attr, audioIsEnd, audioFrame, aKeyCount); 917da853ecaSopenharmony_ci } 918da853ecaSopenharmony_ci } 919da853ecaSopenharmony_ci } 920da853ecaSopenharmony_ci ASSERT_EQ(audioFrame, 2812); 921da853ecaSopenharmony_ci ASSERT_EQ(aKeyCount, 2812); 922da853ecaSopenharmony_ci ASSERT_EQ(videoFrame, 3000); 923da853ecaSopenharmony_ci ASSERT_EQ(vKeyCount, 63); 924da853ecaSopenharmony_ci} 925da853ecaSopenharmony_ci 926da853ecaSopenharmony_ci/** 927da853ecaSopenharmony_ci * @tc.number : DEMUXER_VVC_NET_0300 928da853ecaSopenharmony_ci * @tc.name : demuxer 8bit H266 MP4 file, read+seek 929da853ecaSopenharmony_ci * @tc.desc : function test 930da853ecaSopenharmony_ci */ 931da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_VVC_NET_0300, TestSize.Level0) 932da853ecaSopenharmony_ci{ 933da853ecaSopenharmony_ci if (memory == nullptr) { 934da853ecaSopenharmony_ci memory = OH_AVMemory_Create(g_width * g_height); 935da853ecaSopenharmony_ci } 936da853ecaSopenharmony_ci int64_t duration = 0; 937da853ecaSopenharmony_ci OH_AVCodecBufferAttr attr; 938da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/vvc_8bit_3840_2160.mp4"; 939da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 940da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 941da853ecaSopenharmony_ci demuxer = OH_AVDemuxer_CreateWithSource(source); 942da853ecaSopenharmony_ci ASSERT_NE(demuxer, nullptr); 943da853ecaSopenharmony_ci sourceFormat = OH_AVSource_GetSourceFormat(source); 944da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount)); 945da853ecaSopenharmony_ci ASSERT_EQ(1, g_trackCount); 946da853ecaSopenharmony_ci for (int32_t index = 0; index < g_trackCount; index++) { 947da853ecaSopenharmony_ci ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SelectTrackByID(demuxer, index)); 948da853ecaSopenharmony_ci } 949da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetLongValue(sourceFormat, OH_MD_KEY_DURATION, &duration)); 950da853ecaSopenharmony_ci ASSERT_EQ(duration, 10000000); 951da853ecaSopenharmony_ci for (int index = 0; index < (duration / 1000); index++) { 952da853ecaSopenharmony_ci ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr)); 953da853ecaSopenharmony_ci ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SeekToTime(demuxer, index, OH_AVSeekMode::SEEK_MODE_CLOSEST_SYNC)); 954da853ecaSopenharmony_ci } 955da853ecaSopenharmony_ci} 956da853ecaSopenharmony_ci 957da853ecaSopenharmony_ci/** 958da853ecaSopenharmony_ci * @tc.number : DEMUXER_VVC_NET_0400 959da853ecaSopenharmony_ci * @tc.name : demuxer 10bit H266 MP4 file, read+seek 960da853ecaSopenharmony_ci * @tc.desc : function test 961da853ecaSopenharmony_ci */ 962da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_VVC_NET_0400, TestSize.Level0) 963da853ecaSopenharmony_ci{ 964da853ecaSopenharmony_ci if (memory == nullptr) { 965da853ecaSopenharmony_ci memory = OH_AVMemory_Create(g_width * g_height); 966da853ecaSopenharmony_ci } 967da853ecaSopenharmony_ci int64_t duration = 0; 968da853ecaSopenharmony_ci OH_AVCodecBufferAttr attr; 969da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/vvc_aac_10bit_1920_1080.mp4"; 970da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 971da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 972da853ecaSopenharmony_ci demuxer = OH_AVDemuxer_CreateWithSource(source); 973da853ecaSopenharmony_ci ASSERT_NE(demuxer, nullptr); 974da853ecaSopenharmony_ci sourceFormat = OH_AVSource_GetSourceFormat(source); 975da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount)); 976da853ecaSopenharmony_ci ASSERT_EQ(2, g_trackCount); 977da853ecaSopenharmony_ci for (int32_t index = 0; index < g_trackCount; index++) { 978da853ecaSopenharmony_ci ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SelectTrackByID(demuxer, index)); 979da853ecaSopenharmony_ci } 980da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetLongValue(sourceFormat, OH_MD_KEY_DURATION, &duration)); 981da853ecaSopenharmony_ci ASSERT_EQ(duration, 60000000); 982da853ecaSopenharmony_ci for (int num = 0; num < (duration / 1000); num++) { 983da853ecaSopenharmony_ci for (int32_t index = 0; index < g_trackCount; index++) { 984da853ecaSopenharmony_ci ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, index, memory, &attr)); 985da853ecaSopenharmony_ci ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SeekToTime(demuxer, num, OH_AVSeekMode::SEEK_MODE_CLOSEST_SYNC)); 986da853ecaSopenharmony_ci } 987da853ecaSopenharmony_ci } 988da853ecaSopenharmony_ci} 989da853ecaSopenharmony_ci 990da853ecaSopenharmony_ci/** 991da853ecaSopenharmony_ci * @tc.number : DEMUXER_VVC_NET_0500 992da853ecaSopenharmony_ci * @tc.name : demuxer 8bit H266 MP4 file, check key 993da853ecaSopenharmony_ci * @tc.desc : function test 994da853ecaSopenharmony_ci */ 995da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_VVC_NET_0500, TestSize.Level0) 996da853ecaSopenharmony_ci{ 997da853ecaSopenharmony_ci int64_t duration = 0; 998da853ecaSopenharmony_ci int64_t startTime; 999da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/vvc_8bit_3840_2160.mp4"; 1000da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 1001da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 1002da853ecaSopenharmony_ci sourceFormat = OH_AVSource_GetSourceFormat(source); 1003da853ecaSopenharmony_ci ASSERT_NE(sourceFormat, nullptr); 1004da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 1005da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 1006da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetLongValue(sourceFormat, OH_MD_KEY_DURATION, &duration)); 1007da853ecaSopenharmony_ci int durationResutlt = 10000000; 1008da853ecaSopenharmony_ci ASSERT_EQ(durationResutlt, duration); 1009da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetLongValue(sourceFormat, OH_MD_KEY_START_TIME, &startTime)); 1010da853ecaSopenharmony_ci int startTimeResult = 0; 1011da853ecaSopenharmony_ci ASSERT_EQ(startTimeResult, startTime); 1012da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount)); 1013da853ecaSopenharmony_ci ASSERT_EQ(1, g_trackCount); 1014da853ecaSopenharmony_ci CheckAudioKeyVVC(); 1015da853ecaSopenharmony_ci} 1016da853ecaSopenharmony_ci 1017da853ecaSopenharmony_ci/** 1018da853ecaSopenharmony_ci * @tc.number : DEMUXER_VVC_NET_0600 1019da853ecaSopenharmony_ci * @tc.name : demuxer 10bit H266 MP4 file, check key 1020da853ecaSopenharmony_ci * @tc.desc : function test 1021da853ecaSopenharmony_ci */ 1022da853ecaSopenharmony_ciHWTEST_F(DemuxerNet2NdkTest, DEMUXER_VVC_NET_0600, TestSize.Level0) 1023da853ecaSopenharmony_ci{ 1024da853ecaSopenharmony_ci int64_t duration = 0; 1025da853ecaSopenharmony_ci int64_t startTime; 1026da853ecaSopenharmony_ci int tarckType = 0; 1027da853ecaSopenharmony_ci const char *uri = "http://192.168.3.11:8080/share/vvc_aac_10bit_1920_1080.mp4"; 1028da853ecaSopenharmony_ci source = OH_AVSource_CreateWithURI(const_cast<char *>(uri)); 1029da853ecaSopenharmony_ci ASSERT_NE(source, nullptr); 1030da853ecaSopenharmony_ci sourceFormat = OH_AVSource_GetSourceFormat(source); 1031da853ecaSopenharmony_ci ASSERT_NE(sourceFormat, nullptr); 1032da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetLongValue(sourceFormat, OH_MD_KEY_DURATION, &duration)); 1033da853ecaSopenharmony_ci ASSERT_EQ(60000000, duration); 1034da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetLongValue(sourceFormat, OH_MD_KEY_START_TIME, &startTime)); 1035da853ecaSopenharmony_ci ASSERT_EQ(0, startTime); 1036da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount)); 1037da853ecaSopenharmony_ci ASSERT_EQ(2, g_trackCount); 1038da853ecaSopenharmony_ci for (int32_t index = 0; index < g_trackCount; index++) { 1039da853ecaSopenharmony_ci trackFormat = OH_AVSource_GetTrackFormat(source, 0); 1040da853ecaSopenharmony_ci ASSERT_NE(trackFormat, nullptr); 1041da853ecaSopenharmony_ci ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType)); 1042da853ecaSopenharmony_ci OH_AVFormat_Destroy(trackFormat); 1043da853ecaSopenharmony_ci trackFormat = nullptr; 1044da853ecaSopenharmony_ci if (tarckType == OHOS::Media::MEDIA_TYPE_VID) { 1045da853ecaSopenharmony_ci CheckVideoKey(); 1046da853ecaSopenharmony_ci } else if (tarckType == OHOS::Media::MEDIA_TYPE_AUD) { 1047da853ecaSopenharmony_ci CheckAudioKey(); 1048da853ecaSopenharmony_ci } 1049da853ecaSopenharmony_ci } 1050da853ecaSopenharmony_ci} 1051da853ecaSopenharmony_ci} // namespace