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 "native_avcodec_base.h"
19da853ecaSopenharmony_ci#include "native_avdemuxer.h"
20da853ecaSopenharmony_ci#include "native_avformat.h"
21da853ecaSopenharmony_ci#include "native_avsource.h"
22da853ecaSopenharmony_ci#include "native_avmemory.h"
23da853ecaSopenharmony_ci#include "meta/meta_key.h"
24da853ecaSopenharmony_ci#include "meta/meta.h"
25da853ecaSopenharmony_ci#include "av_common.h"
26da853ecaSopenharmony_ci
27da853ecaSopenharmony_ci#include <iostream>
28da853ecaSopenharmony_ci#include <cstdio>
29da853ecaSopenharmony_ci#include <string>
30da853ecaSopenharmony_ci#include <fcntl.h>
31da853ecaSopenharmony_ci#include <cmath>
32da853ecaSopenharmony_ci#include <thread>
33da853ecaSopenharmony_ci
34da853ecaSopenharmony_ciusing namespace std;
35da853ecaSopenharmony_ciusing namespace OHOS;
36da853ecaSopenharmony_ciusing namespace OHOS::Media;
37da853ecaSopenharmony_ciusing namespace testing::ext;
38da853ecaSopenharmony_ci
39da853ecaSopenharmony_cinamespace OHOS {
40da853ecaSopenharmony_cinamespace Media {
41da853ecaSopenharmony_ciclass DemuxerFunc2NdkTest : public testing::Test {
42da853ecaSopenharmony_cipublic:
43da853ecaSopenharmony_ci    // SetUpTestCase: Called before all test cases
44da853ecaSopenharmony_ci    static void SetUpTestCase(void);
45da853ecaSopenharmony_ci    // TearDownTestCase: Called after all test case
46da853ecaSopenharmony_ci    static void TearDownTestCase(void);
47da853ecaSopenharmony_ci    // SetUp: Called before each test cases
48da853ecaSopenharmony_ci    void SetUp(void);
49da853ecaSopenharmony_ci    // TearDown: Called after each test cases
50da853ecaSopenharmony_ci    void TearDown(void);
51da853ecaSopenharmony_ci};
52da853ecaSopenharmony_ci
53da853ecaSopenharmony_cistatic OH_AVMemory *memory = nullptr;
54da853ecaSopenharmony_cistatic OH_AVSource *source = nullptr;
55da853ecaSopenharmony_cistatic OH_AVDemuxer *demuxer = nullptr;
56da853ecaSopenharmony_cistatic OH_AVFormat *sourceFormat = nullptr;
57da853ecaSopenharmony_cistatic OH_AVFormat *trackFormat = nullptr;
58da853ecaSopenharmony_cistatic OH_AVBuffer *avBuffer = nullptr;
59da853ecaSopenharmony_cistatic OH_AVFormat *format = nullptr;
60da853ecaSopenharmony_cistatic int32_t g_trackCount;
61da853ecaSopenharmony_cistatic int32_t g_width = 3840;
62da853ecaSopenharmony_cistatic int32_t g_height = 2160;
63da853ecaSopenharmony_ciconstexpr int32_t VTTBACK = 4;
64da853ecaSopenharmony_ciconstexpr int32_t VTTFORWARD = 7;
65da853ecaSopenharmony_ciconstexpr int32_t VTTSEEKFORWARD = 5100;
66da853ecaSopenharmony_ciconstexpr int32_t VTTSEEKBACK = 2100;
67da853ecaSopenharmony_civoid DemuxerFunc2NdkTest::SetUpTestCase() {}
68da853ecaSopenharmony_civoid DemuxerFunc2NdkTest::TearDownTestCase() {}
69da853ecaSopenharmony_civoid DemuxerFunc2NdkTest::SetUp()
70da853ecaSopenharmony_ci{
71da853ecaSopenharmony_ci    memory = OH_AVMemory_Create(g_width * g_height);
72da853ecaSopenharmony_ci    g_trackCount = 0;
73da853ecaSopenharmony_ci}
74da853ecaSopenharmony_civoid DemuxerFunc2NdkTest::TearDown()
75da853ecaSopenharmony_ci{
76da853ecaSopenharmony_ci    if (trackFormat != nullptr) {
77da853ecaSopenharmony_ci        OH_AVFormat_Destroy(trackFormat);
78da853ecaSopenharmony_ci        trackFormat = nullptr;
79da853ecaSopenharmony_ci    }
80da853ecaSopenharmony_ci
81da853ecaSopenharmony_ci    if (sourceFormat != nullptr) {
82da853ecaSopenharmony_ci        OH_AVFormat_Destroy(sourceFormat);
83da853ecaSopenharmony_ci        sourceFormat = nullptr;
84da853ecaSopenharmony_ci    }
85da853ecaSopenharmony_ci
86da853ecaSopenharmony_ci    if (memory != nullptr) {
87da853ecaSopenharmony_ci        OH_AVMemory_Destroy(memory);
88da853ecaSopenharmony_ci        memory = nullptr;
89da853ecaSopenharmony_ci    }
90da853ecaSopenharmony_ci    if (source != nullptr) {
91da853ecaSopenharmony_ci        OH_AVSource_Destroy(source);
92da853ecaSopenharmony_ci        source = nullptr;
93da853ecaSopenharmony_ci    }
94da853ecaSopenharmony_ci    if (demuxer != nullptr) {
95da853ecaSopenharmony_ci        OH_AVDemuxer_Destroy(demuxer);
96da853ecaSopenharmony_ci        demuxer = nullptr;
97da853ecaSopenharmony_ci    }
98da853ecaSopenharmony_ci    if (avBuffer != nullptr) {
99da853ecaSopenharmony_ci        OH_AVBuffer_Destroy(avBuffer);
100da853ecaSopenharmony_ci        avBuffer = nullptr;
101da853ecaSopenharmony_ci    }
102da853ecaSopenharmony_ci    if (format != nullptr) {
103da853ecaSopenharmony_ci        OH_AVFormat_Destroy(format);
104da853ecaSopenharmony_ci        format = nullptr;
105da853ecaSopenharmony_ci    }
106da853ecaSopenharmony_ci}
107da853ecaSopenharmony_ci} // namespace Media
108da853ecaSopenharmony_ci} // namespace OHOS
109da853ecaSopenharmony_cistatic int64_t GetFileSize(const char *fileName)
110da853ecaSopenharmony_ci{
111da853ecaSopenharmony_ci    int64_t fileSize = 0;
112da853ecaSopenharmony_ci    if (fileName != nullptr) {
113da853ecaSopenharmony_ci        struct stat fileStatus {};
114da853ecaSopenharmony_ci        if (stat(fileName, &fileStatus) == 0) {
115da853ecaSopenharmony_ci            fileSize = static_cast<int64_t>(fileStatus.st_size);
116da853ecaSopenharmony_ci        }
117da853ecaSopenharmony_ci    }
118da853ecaSopenharmony_ci    return fileSize;
119da853ecaSopenharmony_ci}
120da853ecaSopenharmony_ci
121da853ecaSopenharmony_ci/**
122da853ecaSopenharmony_ci * @tc.number    : SUB_MEDIA_DEMUXER_VTT_4800
123da853ecaSopenharmony_ci * @tc.name      : create vtt demuxer with file and read
124da853ecaSopenharmony_ci * @tc.desc      : function test
125da853ecaSopenharmony_ci */
126da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, SUB_MEDIA_DEMUXER_VTT_4800, TestSize.Level0)
127da853ecaSopenharmony_ci{
128da853ecaSopenharmony_ci    OH_AVCodecBufferAttr attr;
129da853ecaSopenharmony_ci    const char* mimeType = nullptr;
130da853ecaSopenharmony_ci    int vttIndex = 1;
131da853ecaSopenharmony_ci    int vttSubtitle = 0;
132da853ecaSopenharmony_ci    const char *file = "/data/test/media/webvtt_test.vtt";
133da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
134da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
135da853ecaSopenharmony_ci    cout << file << "----------------------" << fd << "---------" << size << endl;
136da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
137da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
138da853ecaSopenharmony_ci    demuxer = OH_AVDemuxer_CreateWithSource(source);
139da853ecaSopenharmony_ci    ASSERT_NE(demuxer, nullptr);
140da853ecaSopenharmony_ci    sourceFormat = OH_AVSource_GetSourceFormat(source);
141da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
142da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
143da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_CODEC_MIME, &mimeType));
144da853ecaSopenharmony_ci    ASSERT_EQ(0, strcmp(mimeType, OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT));
145da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount));
146da853ecaSopenharmony_ci    ASSERT_EQ(1, g_trackCount);
147da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SelectTrackByID(demuxer, 0));
148da853ecaSopenharmony_ci    int tarckType = 0;
149da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType));
150da853ecaSopenharmony_ci    ASSERT_EQ(tarckType, MEDIA_TYPE_SUBTITLE);
151da853ecaSopenharmony_ci    int64_t starttime = 0;
152da853ecaSopenharmony_ci    ASSERT_FALSE(OH_AVFormat_GetLongValue(trackFormat, OH_MD_KEY_TRACK_START_TIME, &starttime));
153da853ecaSopenharmony_ci    while (true) {
154da853ecaSopenharmony_ci        ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
155da853ecaSopenharmony_ci        if (attr.flags & OH_AVCodecBufferFlags::AVCODEC_BUFFER_FLAGS_EOS) {
156da853ecaSopenharmony_ci            cout << "   vtt is end !!!!!!!!!!!!!!!" << endl;
157da853ecaSopenharmony_ci            break;
158da853ecaSopenharmony_ci        }
159da853ecaSopenharmony_ci        uint8_t *data = OH_AVMemory_GetAddr(memory);
160da853ecaSopenharmony_ci        vttSubtitle = atoi(reinterpret_cast<const char*>(data));
161da853ecaSopenharmony_ci        cout << "subtitle" << "----------------" << vttSubtitle << "-----------------" << endl;
162da853ecaSopenharmony_ci        ASSERT_EQ(vttSubtitle, vttIndex);
163da853ecaSopenharmony_ci        vttIndex++;
164da853ecaSopenharmony_ci    }
165da853ecaSopenharmony_ci    close(fd);
166da853ecaSopenharmony_ci}
167da853ecaSopenharmony_ci
168da853ecaSopenharmony_ci/**
169da853ecaSopenharmony_ci * @tc.number    : SUB_MEDIA_DEMUXER_VTT_4900
170da853ecaSopenharmony_ci * @tc.name      : create vtt demuxer with file and forward back seek+read
171da853ecaSopenharmony_ci * @tc.desc      : function test
172da853ecaSopenharmony_ci */
173da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, SUB_MEDIA_DEMUXER_VTT_4900, TestSize.Level0)
174da853ecaSopenharmony_ci{
175da853ecaSopenharmony_ci    OH_AVCodecBufferAttr attr;
176da853ecaSopenharmony_ci    const char* mimeType = nullptr;
177da853ecaSopenharmony_ci    int vttIndex = 1;
178da853ecaSopenharmony_ci    int vttSubtitle = 0;
179da853ecaSopenharmony_ci    uint8_t *data = nullptr;
180da853ecaSopenharmony_ci    const char *file = "/data/test/media/webvtt_test.vtt";
181da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
182da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
183da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
184da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
185da853ecaSopenharmony_ci    demuxer = OH_AVDemuxer_CreateWithSource(source);
186da853ecaSopenharmony_ci    ASSERT_NE(demuxer, nullptr);
187da853ecaSopenharmony_ci    sourceFormat = OH_AVSource_GetSourceFormat(source);
188da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
189da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
190da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_CODEC_MIME, &mimeType));
191da853ecaSopenharmony_ci    ASSERT_EQ(0, strcmp(mimeType, OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT));
192da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount));
193da853ecaSopenharmony_ci    ASSERT_EQ(1, g_trackCount);
194da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SelectTrackByID(demuxer, 0));
195da853ecaSopenharmony_ci    int tarckType = 0;
196da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType));
197da853ecaSopenharmony_ci    ASSERT_EQ(tarckType, MEDIA_TYPE_SUBTITLE);
198da853ecaSopenharmony_ci    for (int index = 0; index < 5; index++) {
199da853ecaSopenharmony_ci        ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
200da853ecaSopenharmony_ci    }
201da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SeekToTime(demuxer, VTTSEEKBACK, SEEK_MODE_CLOSEST_SYNC));
202da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
203da853ecaSopenharmony_ci    data = OH_AVMemory_GetAddr(memory);
204da853ecaSopenharmony_ci    vttSubtitle = atoi(reinterpret_cast<const char*>(data));
205da853ecaSopenharmony_ci    ASSERT_EQ(vttSubtitle, VTTBACK);
206da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SeekToTime(demuxer, VTTSEEKFORWARD, SEEK_MODE_CLOSEST_SYNC));
207da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
208da853ecaSopenharmony_ci    data = OH_AVMemory_GetAddr(memory);
209da853ecaSopenharmony_ci    vttSubtitle = atoi(reinterpret_cast<const char*>(data));
210da853ecaSopenharmony_ci    vttIndex = VTTFORWARD;
211da853ecaSopenharmony_ci    ASSERT_EQ(vttSubtitle, VTTFORWARD);
212da853ecaSopenharmony_ci    while (true) {
213da853ecaSopenharmony_ci        ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
214da853ecaSopenharmony_ci        if (attr.flags & OH_AVCodecBufferFlags::AVCODEC_BUFFER_FLAGS_EOS) {
215da853ecaSopenharmony_ci            break;
216da853ecaSopenharmony_ci        }
217da853ecaSopenharmony_ci        data = OH_AVMemory_GetAddr(memory);
218da853ecaSopenharmony_ci        vttSubtitle = atoi(reinterpret_cast<const char*>(data));
219da853ecaSopenharmony_ci        vttIndex++;
220da853ecaSopenharmony_ci        ASSERT_EQ(vttSubtitle, vttIndex);
221da853ecaSopenharmony_ci    }
222da853ecaSopenharmony_ci    close(fd);
223da853ecaSopenharmony_ci}
224da853ecaSopenharmony_ci
225da853ecaSopenharmony_ci/**
226da853ecaSopenharmony_ci * @tc.number    : SUB_MEDIA_DEMUXER_VTT_5000
227da853ecaSopenharmony_ci * @tc.name      : create vtt demuxer with file and back seek+read
228da853ecaSopenharmony_ci * @tc.desc      : function test
229da853ecaSopenharmony_ci */
230da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, SUB_MEDIA_DEMUXER_VTT_5000, TestSize.Level0)
231da853ecaSopenharmony_ci{
232da853ecaSopenharmony_ci    OH_AVCodecBufferAttr attr;
233da853ecaSopenharmony_ci    const char* mimeType = nullptr;
234da853ecaSopenharmony_ci    int vttIndex = 1;
235da853ecaSopenharmony_ci    int vttSubtitle = 0;
236da853ecaSopenharmony_ci    uint8_t *data = nullptr;
237da853ecaSopenharmony_ci    const char *file = "/data/test/media/webvtt_test.vtt";
238da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
239da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
240da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
241da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
242da853ecaSopenharmony_ci    demuxer = OH_AVDemuxer_CreateWithSource(source);
243da853ecaSopenharmony_ci    ASSERT_NE(demuxer, nullptr);
244da853ecaSopenharmony_ci    sourceFormat = OH_AVSource_GetSourceFormat(source);
245da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
246da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
247da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_CODEC_MIME, &mimeType));
248da853ecaSopenharmony_ci    ASSERT_EQ(0, strcmp(mimeType, OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT));
249da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount));
250da853ecaSopenharmony_ci    ASSERT_EQ(1, g_trackCount);
251da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SelectTrackByID(demuxer, 0));
252da853ecaSopenharmony_ci    int tarckType = 0;
253da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType));
254da853ecaSopenharmony_ci    ASSERT_EQ(tarckType, MEDIA_TYPE_SUBTITLE);
255da853ecaSopenharmony_ci    for (int index = 0; index < 5; index++) {
256da853ecaSopenharmony_ci        ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
257da853ecaSopenharmony_ci        data = OH_AVMemory_GetAddr(memory);
258da853ecaSopenharmony_ci        vttSubtitle = atoi(reinterpret_cast<const char*>(data));
259da853ecaSopenharmony_ci        ASSERT_EQ(vttSubtitle, vttIndex);
260da853ecaSopenharmony_ci        vttIndex++;
261da853ecaSopenharmony_ci    }
262da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SeekToTime(demuxer, VTTSEEKBACK, SEEK_MODE_CLOSEST_SYNC));
263da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
264da853ecaSopenharmony_ci    data = OH_AVMemory_GetAddr(memory);
265da853ecaSopenharmony_ci    vttSubtitle = atoi(reinterpret_cast<const char*>(data));
266da853ecaSopenharmony_ci    vttIndex = 4;
267da853ecaSopenharmony_ci    ASSERT_EQ(vttSubtitle, vttIndex);
268da853ecaSopenharmony_ci    while (true) {
269da853ecaSopenharmony_ci        ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
270da853ecaSopenharmony_ci        if (attr.flags & OH_AVCodecBufferFlags::AVCODEC_BUFFER_FLAGS_EOS) {
271da853ecaSopenharmony_ci            break;
272da853ecaSopenharmony_ci        }
273da853ecaSopenharmony_ci        data = OH_AVMemory_GetAddr(memory);
274da853ecaSopenharmony_ci        vttSubtitle = atoi(reinterpret_cast<const char*>(data));
275da853ecaSopenharmony_ci        vttIndex++;
276da853ecaSopenharmony_ci        ASSERT_EQ(vttSubtitle, vttIndex);
277da853ecaSopenharmony_ci    }
278da853ecaSopenharmony_ci    close(fd);
279da853ecaSopenharmony_ci}
280da853ecaSopenharmony_ci
281da853ecaSopenharmony_ci/**
282da853ecaSopenharmony_ci * @tc.number    : SUB_MEDIA_DEMUXER_VTT_5100
283da853ecaSopenharmony_ci * @tc.name      : create vtt demuxer with file and forward seek+read
284da853ecaSopenharmony_ci * @tc.desc      : function test
285da853ecaSopenharmony_ci */
286da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, SUB_MEDIA_DEMUXER_VTT_5100, TestSize.Level0)
287da853ecaSopenharmony_ci{
288da853ecaSopenharmony_ci    OH_AVCodecBufferAttr attr;
289da853ecaSopenharmony_ci    const char* mimeType = nullptr;
290da853ecaSopenharmony_ci    int vttIndex = 1;
291da853ecaSopenharmony_ci    int vttSubtitle = 0;
292da853ecaSopenharmony_ci    uint8_t *data = nullptr;
293da853ecaSopenharmony_ci    const char *file = "/data/test/media/webvtt_test.vtt";
294da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
295da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
296da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
297da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
298da853ecaSopenharmony_ci    demuxer = OH_AVDemuxer_CreateWithSource(source);
299da853ecaSopenharmony_ci    ASSERT_NE(demuxer, nullptr);
300da853ecaSopenharmony_ci    sourceFormat = OH_AVSource_GetSourceFormat(source);
301da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
302da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
303da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_CODEC_MIME, &mimeType));
304da853ecaSopenharmony_ci    ASSERT_EQ(0, strcmp(mimeType, OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT));
305da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount));
306da853ecaSopenharmony_ci    ASSERT_EQ(1, g_trackCount);
307da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SelectTrackByID(demuxer, 0));
308da853ecaSopenharmony_ci    int tarckType = 0;
309da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType));
310da853ecaSopenharmony_ci    ASSERT_EQ(tarckType, MEDIA_TYPE_SUBTITLE);
311da853ecaSopenharmony_ci    for (int index = 0; index < 5; index++) {
312da853ecaSopenharmony_ci        ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
313da853ecaSopenharmony_ci        data = OH_AVMemory_GetAddr(memory);
314da853ecaSopenharmony_ci        vttSubtitle = atoi(reinterpret_cast<const char*>(data));
315da853ecaSopenharmony_ci        ASSERT_EQ(vttSubtitle, vttIndex);
316da853ecaSopenharmony_ci        vttIndex++;
317da853ecaSopenharmony_ci    }
318da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SeekToTime(demuxer, VTTSEEKFORWARD, SEEK_MODE_CLOSEST_SYNC));
319da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
320da853ecaSopenharmony_ci    data = OH_AVMemory_GetAddr(memory);
321da853ecaSopenharmony_ci    vttSubtitle = atoi(reinterpret_cast<const char*>(data));
322da853ecaSopenharmony_ci    vttIndex = 7;
323da853ecaSopenharmony_ci    ASSERT_EQ(vttSubtitle, vttIndex);
324da853ecaSopenharmony_ci    while (true) {
325da853ecaSopenharmony_ci        ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
326da853ecaSopenharmony_ci        if (attr.flags & OH_AVCodecBufferFlags::AVCODEC_BUFFER_FLAGS_EOS) {
327da853ecaSopenharmony_ci            break;
328da853ecaSopenharmony_ci        }
329da853ecaSopenharmony_ci        data = OH_AVMemory_GetAddr(memory);
330da853ecaSopenharmony_ci        vttSubtitle = atoi(reinterpret_cast<const char*>(data));
331da853ecaSopenharmony_ci        vttIndex++;
332da853ecaSopenharmony_ci        ASSERT_EQ(vttSubtitle, vttIndex);
333da853ecaSopenharmony_ci    }
334da853ecaSopenharmony_ci    close(fd);
335da853ecaSopenharmony_ci}
336da853ecaSopenharmony_ci
337da853ecaSopenharmony_ci/**
338da853ecaSopenharmony_ci * @tc.number    : SUB_MEDIA_DEMUXER_VTT_5600
339da853ecaSopenharmony_ci * @tc.name      : create vtt demuxer with error file -- no empty paragraphs
340da853ecaSopenharmony_ci * @tc.desc      : function test
341da853ecaSopenharmony_ci */
342da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, SUB_MEDIA_DEMUXER_VTT_5600, TestSize.Level2)
343da853ecaSopenharmony_ci{
344da853ecaSopenharmony_ci    OH_AVCodecBufferAttr attr;
345da853ecaSopenharmony_ci    const char* mimeType = nullptr;
346da853ecaSopenharmony_ci    const char *file = "/data/test/media/vtt_5600.vtt";
347da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
348da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
349da853ecaSopenharmony_ci    cout << file << "----------------------" << fd << "---------" << size << endl;
350da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
351da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
352da853ecaSopenharmony_ci    demuxer = OH_AVDemuxer_CreateWithSource(source);
353da853ecaSopenharmony_ci    ASSERT_NE(demuxer, nullptr);
354da853ecaSopenharmony_ci    sourceFormat = OH_AVSource_GetSourceFormat(source);
355da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
356da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
357da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_CODEC_MIME, &mimeType));
358da853ecaSopenharmony_ci    ASSERT_EQ(0, strcmp(mimeType, OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT));
359da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount));
360da853ecaSopenharmony_ci    ASSERT_EQ(1, g_trackCount);
361da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SelectTrackByID(demuxer, 0));
362da853ecaSopenharmony_ci    int tarckType = 0;
363da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType));
364da853ecaSopenharmony_ci    ASSERT_EQ(tarckType, MEDIA_TYPE_SUBTITLE);
365da853ecaSopenharmony_ci    while (true) {
366da853ecaSopenharmony_ci        ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
367da853ecaSopenharmony_ci        if (attr.flags & OH_AVCodecBufferFlags::AVCODEC_BUFFER_FLAGS_EOS) {
368da853ecaSopenharmony_ci            cout << "   vtt is end !!!!!!!!!!!!!!!" << endl;
369da853ecaSopenharmony_ci            break;
370da853ecaSopenharmony_ci        }
371da853ecaSopenharmony_ci        uint8_t *data = OH_AVMemory_GetAddr(memory);
372da853ecaSopenharmony_ci        cout << "subtitle"<< "----------------" << data << "-----------------" << endl;
373da853ecaSopenharmony_ci    }
374da853ecaSopenharmony_ci    close(fd);
375da853ecaSopenharmony_ci}
376da853ecaSopenharmony_ci
377da853ecaSopenharmony_ci/**
378da853ecaSopenharmony_ci * @tc.number    : SUB_MEDIA_DEMUXER_VTT_5700
379da853ecaSopenharmony_ci * @tc.name      : create vtt demuxer with error file -- subtitle sequence error
380da853ecaSopenharmony_ci * @tc.desc      : function test
381da853ecaSopenharmony_ci */
382da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, SUB_MEDIA_DEMUXER_VTT_5700, TestSize.Level2)
383da853ecaSopenharmony_ci{
384da853ecaSopenharmony_ci    OH_AVCodecBufferAttr attr;
385da853ecaSopenharmony_ci    const char* mimeType = nullptr;
386da853ecaSopenharmony_ci    const char *file = "/data/test/media/vtt_5700.vtt";
387da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
388da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
389da853ecaSopenharmony_ci    cout << file << "----------------------" << fd << "---------" << size << endl;
390da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
391da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
392da853ecaSopenharmony_ci    demuxer = OH_AVDemuxer_CreateWithSource(source);
393da853ecaSopenharmony_ci    ASSERT_NE(demuxer, nullptr);
394da853ecaSopenharmony_ci    sourceFormat = OH_AVSource_GetSourceFormat(source);
395da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
396da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
397da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_CODEC_MIME, &mimeType));
398da853ecaSopenharmony_ci    ASSERT_EQ(0, strcmp(mimeType, OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT));
399da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount));
400da853ecaSopenharmony_ci    ASSERT_EQ(1, g_trackCount);
401da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SelectTrackByID(demuxer, 0));
402da853ecaSopenharmony_ci    int tarckType = 0;
403da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType));
404da853ecaSopenharmony_ci    ASSERT_EQ(tarckType, MEDIA_TYPE_SUBTITLE);
405da853ecaSopenharmony_ci    while (true) {
406da853ecaSopenharmony_ci        ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
407da853ecaSopenharmony_ci        if (attr.flags & OH_AVCodecBufferFlags::AVCODEC_BUFFER_FLAGS_EOS) {
408da853ecaSopenharmony_ci            cout << "   vtt is end !!!!!!!!!!!!!!!" << endl;
409da853ecaSopenharmony_ci            break;
410da853ecaSopenharmony_ci        }
411da853ecaSopenharmony_ci        uint8_t *data = OH_AVMemory_GetAddr(memory);
412da853ecaSopenharmony_ci        cout << "subtitle" << "----------------" << data << "-----------------" << endl;
413da853ecaSopenharmony_ci    }
414da853ecaSopenharmony_ci    close(fd);
415da853ecaSopenharmony_ci}
416da853ecaSopenharmony_ci
417da853ecaSopenharmony_ci/**
418da853ecaSopenharmony_ci * @tc.number    : SUB_MEDIA_DEMUXER_VTT_5800
419da853ecaSopenharmony_ci * @tc.name      : create vtt demuxer with error file -- timeline format error null
420da853ecaSopenharmony_ci * @tc.desc      : function test
421da853ecaSopenharmony_ci */
422da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, SUB_MEDIA_DEMUXER_VTT_5800, TestSize.Level2)
423da853ecaSopenharmony_ci{
424da853ecaSopenharmony_ci    OH_AVCodecBufferAttr attr;
425da853ecaSopenharmony_ci    const char *file = "/data/test/media/vtt_5800.vtt";
426da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
427da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
428da853ecaSopenharmony_ci    cout << file << "----------------------" << fd << "---------" << size << endl;
429da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
430da853ecaSopenharmony_ci    demuxer = OH_AVDemuxer_CreateWithSource(source);
431da853ecaSopenharmony_ci    sourceFormat = OH_AVSource_GetSourceFormat(source);
432da853ecaSopenharmony_ci    OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount);
433da853ecaSopenharmony_ci    OH_AVDemuxer_SelectTrackByID(demuxer, 0);
434da853ecaSopenharmony_ci    int tarckType = 0;
435da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
436da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
437da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType));
438da853ecaSopenharmony_ci    ASSERT_EQ(tarckType, MEDIA_TYPE_SUBTITLE);
439da853ecaSopenharmony_ci    OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr);
440da853ecaSopenharmony_ci    uint8_t *data = OH_AVMemory_GetAddr(memory);
441da853ecaSopenharmony_ci    cout << "subtitle"<< "----------------" << data << "-----------------" << endl;
442da853ecaSopenharmony_ci    close(fd);
443da853ecaSopenharmony_ci}
444da853ecaSopenharmony_ci
445da853ecaSopenharmony_ci/**
446da853ecaSopenharmony_ci * @tc.number    : SUB_MEDIA_DEMUXER_VTT_5900
447da853ecaSopenharmony_ci * @tc.name      : create vtt demuxer with error file -- subtitle is empty
448da853ecaSopenharmony_ci * @tc.desc      : function test
449da853ecaSopenharmony_ci */
450da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, SUB_MEDIA_DEMUXER_VTT_5900, TestSize.Level2)
451da853ecaSopenharmony_ci{
452da853ecaSopenharmony_ci    OH_AVCodecBufferAttr attr;
453da853ecaSopenharmony_ci    const char* mimeType = nullptr;
454da853ecaSopenharmony_ci    const char *file = "/data/test/media/vtt_5900.vtt";
455da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
456da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
457da853ecaSopenharmony_ci    cout << file << "----------------------" << fd << "---------" << size << endl;
458da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
459da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
460da853ecaSopenharmony_ci    demuxer = OH_AVDemuxer_CreateWithSource(source);
461da853ecaSopenharmony_ci    ASSERT_NE(demuxer, nullptr);
462da853ecaSopenharmony_ci    sourceFormat = OH_AVSource_GetSourceFormat(source);
463da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
464da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
465da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_CODEC_MIME, &mimeType));
466da853ecaSopenharmony_ci    ASSERT_EQ(0, strcmp(mimeType, OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT));
467da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount));
468da853ecaSopenharmony_ci    ASSERT_EQ(1, g_trackCount);
469da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SelectTrackByID(demuxer, 0));
470da853ecaSopenharmony_ci    int tarckType = 0;
471da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType));
472da853ecaSopenharmony_ci    ASSERT_EQ(tarckType, MEDIA_TYPE_SUBTITLE);
473da853ecaSopenharmony_ci    while (true) {
474da853ecaSopenharmony_ci        ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
475da853ecaSopenharmony_ci        if (attr.flags & OH_AVCodecBufferFlags::AVCODEC_BUFFER_FLAGS_EOS) {
476da853ecaSopenharmony_ci            cout << "   vtt is end !!!!!!!!!!!!!!!" << endl;
477da853ecaSopenharmony_ci            break;
478da853ecaSopenharmony_ci        }
479da853ecaSopenharmony_ci        uint8_t *data = OH_AVMemory_GetAddr(memory);
480da853ecaSopenharmony_ci        cout << "subtitle"<< "----------------" << data << "-----------------" << endl;
481da853ecaSopenharmony_ci    }
482da853ecaSopenharmony_ci    close(fd);
483da853ecaSopenharmony_ci}
484da853ecaSopenharmony_ci
485da853ecaSopenharmony_ci/**
486da853ecaSopenharmony_ci * @tc.number    : SUB_MEDIA_DEMUXER_VTT_6000
487da853ecaSopenharmony_ci * @tc.name      : create vtt demuxer with error file -- vtt file is empty
488da853ecaSopenharmony_ci * @tc.desc      : function test
489da853ecaSopenharmony_ci * fail
490da853ecaSopenharmony_ci */
491da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, SUB_MEDIA_DEMUXER_VTT_6000, TestSize.Level2)
492da853ecaSopenharmony_ci{
493da853ecaSopenharmony_ci    OH_AVCodecBufferAttr attr;
494da853ecaSopenharmony_ci    const char *file = "/data/test/media/vtt_6000.vtt";
495da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
496da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
497da853ecaSopenharmony_ci    cout << file << "----------------------" << fd << "---------" << size << endl;
498da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
499da853ecaSopenharmony_ci    demuxer = OH_AVDemuxer_CreateWithSource(source);
500da853ecaSopenharmony_ci    sourceFormat = OH_AVSource_GetSourceFormat(source);
501da853ecaSopenharmony_ci    OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount);
502da853ecaSopenharmony_ci    OH_AVDemuxer_SelectTrackByID(demuxer, 0);
503da853ecaSopenharmony_ci    OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr);
504da853ecaSopenharmony_ci    uint8_t *data = OH_AVMemory_GetAddr(memory);
505da853ecaSopenharmony_ci    cout << "subtitle"<< "----------------" << data << "-----------------" << endl;
506da853ecaSopenharmony_ci    close(fd);
507da853ecaSopenharmony_ci}
508da853ecaSopenharmony_ci
509da853ecaSopenharmony_ci/**
510da853ecaSopenharmony_ci * @tc.number    : SUB_MEDIA_DEMUXER_VTT_6100
511da853ecaSopenharmony_ci * @tc.name      : create vtt demuxer with error file -- alternating Up and Down Times
512da853ecaSopenharmony_ci * @tc.desc      : function test
513da853ecaSopenharmony_ci */
514da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, SUB_MEDIA_DEMUXER_VTT_6100, TestSize.Level2)
515da853ecaSopenharmony_ci{
516da853ecaSopenharmony_ci    OH_AVCodecBufferAttr attr;
517da853ecaSopenharmony_ci    const char* mimeType = nullptr;
518da853ecaSopenharmony_ci    const char *file = "/data/test/media/vtt_6100.vtt";
519da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
520da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
521da853ecaSopenharmony_ci    cout << file << "----------------------" << fd << "---------" << size << endl;
522da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
523da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
524da853ecaSopenharmony_ci    demuxer = OH_AVDemuxer_CreateWithSource(source);
525da853ecaSopenharmony_ci    ASSERT_NE(demuxer, nullptr);
526da853ecaSopenharmony_ci    sourceFormat = OH_AVSource_GetSourceFormat(source);
527da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
528da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
529da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetStringValue(trackFormat, OH_MD_KEY_CODEC_MIME, &mimeType));
530da853ecaSopenharmony_ci    ASSERT_EQ(0, strcmp(mimeType, OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT));
531da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(sourceFormat, OH_MD_KEY_TRACK_COUNT, &g_trackCount));
532da853ecaSopenharmony_ci    ASSERT_EQ(1, g_trackCount);
533da853ecaSopenharmony_ci    ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_SelectTrackByID(demuxer, 0));
534da853ecaSopenharmony_ci    int tarckType = 0;
535da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, OH_MD_KEY_TRACK_TYPE, &tarckType));
536da853ecaSopenharmony_ci    ASSERT_EQ(tarckType, MEDIA_TYPE_SUBTITLE);
537da853ecaSopenharmony_ci    while (true) {
538da853ecaSopenharmony_ci        ASSERT_EQ(AV_ERR_OK, OH_AVDemuxer_ReadSample(demuxer, 0, memory, &attr));
539da853ecaSopenharmony_ci        if (attr.flags & OH_AVCodecBufferFlags::AVCODEC_BUFFER_FLAGS_EOS) {
540da853ecaSopenharmony_ci            cout << "   vtt is end !!!!!!!!!!!!!!!" << endl;
541da853ecaSopenharmony_ci            break;
542da853ecaSopenharmony_ci        }
543da853ecaSopenharmony_ci        uint8_t *data = OH_AVMemory_GetAddr(memory);
544da853ecaSopenharmony_ci        cout << "subtitle"<< "----------------" << data << "-----------------" << endl;
545da853ecaSopenharmony_ci    }
546da853ecaSopenharmony_ci    close(fd);
547da853ecaSopenharmony_ci}
548da853ecaSopenharmony_ci
549da853ecaSopenharmony_ci/**
550da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1000
551da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video ROTATE_NONE.mp4
552da853ecaSopenharmony_ci * @tc.desc     : function test
553da853ecaSopenharmony_ci */
554da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1000, TestSize.Level0)
555da853ecaSopenharmony_ci{
556da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
557da853ecaSopenharmony_ci    int32_t rotation = -1;
558da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/ROTATE_NONE.mp4";
559da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
560da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
561da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
562da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
563da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
564da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
565da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
566da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE);
567da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
568da853ecaSopenharmony_ci    close(fd);
569da853ecaSopenharmony_ci}
570da853ecaSopenharmony_ci
571da853ecaSopenharmony_ci/**
572da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1001
573da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video ROTATE_90.mp4
574da853ecaSopenharmony_ci * @tc.desc     : function test
575da853ecaSopenharmony_ci */
576da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1001, TestSize.Level1)
577da853ecaSopenharmony_ci{
578da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
579da853ecaSopenharmony_ci    int32_t rotation = -1;
580da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/ROTATE_90.mp4";
581da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
582da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
583da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
584da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
585da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
586da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
587da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
588da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_90);
589da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
590da853ecaSopenharmony_ci    close(fd);
591da853ecaSopenharmony_ci}
592da853ecaSopenharmony_ci
593da853ecaSopenharmony_ci/**
594da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1002
595da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video ROTATE_180.mp4
596da853ecaSopenharmony_ci * @tc.desc     : function test
597da853ecaSopenharmony_ci */
598da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1002, TestSize.Level1)
599da853ecaSopenharmony_ci{
600da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
601da853ecaSopenharmony_ci    int32_t rotation = -1;
602da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/ROTATE_180.mp4";
603da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
604da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
605da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
606da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
607da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
608da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
609da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
610da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_180);
611da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
612da853ecaSopenharmony_ci    close(fd);
613da853ecaSopenharmony_ci}
614da853ecaSopenharmony_ci
615da853ecaSopenharmony_ci/**
616da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1003
617da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video ROTATE_270.mp4
618da853ecaSopenharmony_ci * @tc.desc     : function test
619da853ecaSopenharmony_ci */
620da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1003, TestSize.Level1)
621da853ecaSopenharmony_ci{
622da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
623da853ecaSopenharmony_ci    int32_t rotation = -1;
624da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/ROTATE_270.mp4";
625da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
626da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
627da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
628da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
629da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
630da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
631da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
632da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_270);
633da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
634da853ecaSopenharmony_ci    close(fd);
635da853ecaSopenharmony_ci}
636da853ecaSopenharmony_ci
637da853ecaSopenharmony_ci/**
638da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1004
639da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video FLIP_H.mp4
640da853ecaSopenharmony_ci * @tc.desc     : function test
641da853ecaSopenharmony_ci */
642da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1004, TestSize.Level2)
643da853ecaSopenharmony_ci{
644da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
645da853ecaSopenharmony_ci    int32_t rotation = -1;
646da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/FLIP_H.mp4";
647da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
648da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
649da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
650da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
651da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
652da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
653da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
654da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_H);
655da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
656da853ecaSopenharmony_ci    close(fd);
657da853ecaSopenharmony_ci}
658da853ecaSopenharmony_ci
659da853ecaSopenharmony_ci/**
660da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1005
661da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video FLIP_V.mp4
662da853ecaSopenharmony_ci * @tc.desc     : function test
663da853ecaSopenharmony_ci */
664da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1005, TestSize.Level2)
665da853ecaSopenharmony_ci{
666da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
667da853ecaSopenharmony_ci    int32_t rotation = -1;
668da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/FLIP_V.mp4";
669da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
670da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
671da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
672da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
673da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
674da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
675da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
676da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_V);
677da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
678da853ecaSopenharmony_ci    close(fd);
679da853ecaSopenharmony_ci}
680da853ecaSopenharmony_ci
681da853ecaSopenharmony_ci/**
682da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1006
683da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video FLIP_H_90.mp4
684da853ecaSopenharmony_ci * @tc.desc     : function test
685da853ecaSopenharmony_ci */
686da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1006, TestSize.Level2)
687da853ecaSopenharmony_ci{
688da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
689da853ecaSopenharmony_ci    int32_t rotation = -1;
690da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/FLIP_H_90.mp4";
691da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
692da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
693da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
694da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
695da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
696da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
697da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
698da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_H_ROT90);
699da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
700da853ecaSopenharmony_ci    close(fd);
701da853ecaSopenharmony_ci}
702da853ecaSopenharmony_ci
703da853ecaSopenharmony_ci/**
704da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1007
705da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video FLIP_V_90.mp4
706da853ecaSopenharmony_ci * @tc.desc     : function test
707da853ecaSopenharmony_ci */
708da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1007, TestSize.Level2)
709da853ecaSopenharmony_ci{
710da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
711da853ecaSopenharmony_ci    int32_t rotation = -1;
712da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/FLIP_V_90.mp4";
713da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
714da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
715da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
716da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
717da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
718da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
719da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
720da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_V_ROT90);
721da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
722da853ecaSopenharmony_ci    close(fd);
723da853ecaSopenharmony_ci}
724da853ecaSopenharmony_ci
725da853ecaSopenharmony_ci/**
726da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1008
727da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video FLIP_H_180.mp4
728da853ecaSopenharmony_ci * @tc.desc     : function test
729da853ecaSopenharmony_ci */
730da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1008, TestSize.Level2)
731da853ecaSopenharmony_ci{
732da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
733da853ecaSopenharmony_ci    int32_t rotation = -1;
734da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/FLIP_H_180.mp4";
735da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
736da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
737da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
738da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
739da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
740da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
741da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
742da853ecaSopenharmony_ci    ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_V || rotation == OHOS::MediaAVCodec::FLIP_H_ROT180);
743da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
744da853ecaSopenharmony_ci    close(fd);
745da853ecaSopenharmony_ci}
746da853ecaSopenharmony_ci
747da853ecaSopenharmony_ci/**
748da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1009
749da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video FLIP_V_180.mp4
750da853ecaSopenharmony_ci * @tc.desc     : function test
751da853ecaSopenharmony_ci */
752da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1009, TestSize.Level2)
753da853ecaSopenharmony_ci{
754da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
755da853ecaSopenharmony_ci    int32_t rotation = -1;
756da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/FLIP_V_180.mp4";
757da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
758da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
759da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
760da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
761da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
762da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
763da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
764da853ecaSopenharmony_ci    ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_H || rotation == OHOS::MediaAVCodec::FLIP_V_ROT180);
765da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
766da853ecaSopenharmony_ci    close(fd);
767da853ecaSopenharmony_ci}
768da853ecaSopenharmony_ci
769da853ecaSopenharmony_ci/**
770da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1010
771da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video FLIP_H_270.mp4
772da853ecaSopenharmony_ci * @tc.desc     : function test
773da853ecaSopenharmony_ci */
774da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1010, TestSize.Level2)
775da853ecaSopenharmony_ci{
776da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
777da853ecaSopenharmony_ci    int32_t rotation = -1;
778da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/FLIP_H_270.mp4";
779da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
780da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
781da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
782da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
783da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
784da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
785da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
786da853ecaSopenharmony_ci    ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_V_ROT90 || rotation == OHOS::MediaAVCodec::FLIP_H_ROT270);
787da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
788da853ecaSopenharmony_ci    close(fd);
789da853ecaSopenharmony_ci}
790da853ecaSopenharmony_ci
791da853ecaSopenharmony_ci/**
792da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1011
793da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video FLIP_V_270.mp4
794da853ecaSopenharmony_ci * @tc.desc     : function test
795da853ecaSopenharmony_ci */
796da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1011, TestSize.Level2)
797da853ecaSopenharmony_ci{
798da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
799da853ecaSopenharmony_ci    int32_t rotation = -1;
800da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/FLIP_V_270.mp4";
801da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
802da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
803da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
804da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
805da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
806da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
807da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
808da853ecaSopenharmony_ci    ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_H_ROT90 || rotation == OHOS::MediaAVCodec::FLIP_V_ROT270);
809da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
810da853ecaSopenharmony_ci    close(fd);
811da853ecaSopenharmony_ci}
812da853ecaSopenharmony_ci
813da853ecaSopenharmony_ci/**
814da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1012
815da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video INVALID.mp4
816da853ecaSopenharmony_ci * @tc.desc     : function test
817da853ecaSopenharmony_ci */
818da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1012, TestSize.Level2)
819da853ecaSopenharmony_ci{
820da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
821da853ecaSopenharmony_ci    int32_t rotation = -1;
822da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/INVALID.mp4";
823da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
824da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
825da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
826da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
827da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
828da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
829da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
830da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE);
831da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
832da853ecaSopenharmony_ci    close(fd);
833da853ecaSopenharmony_ci}
834da853ecaSopenharmony_ci
835da853ecaSopenharmony_ci/**
836da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1013
837da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_ROTATE_NONE.mp4
838da853ecaSopenharmony_ci * @tc.desc     : function test
839da853ecaSopenharmony_ci */
840da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1013, TestSize.Level0)
841da853ecaSopenharmony_ci{
842da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
843da853ecaSopenharmony_ci    int32_t rotation = -1;
844da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_ROTATE_NONE.mp4";
845da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
846da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
847da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
848da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
849da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
850da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
851da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
852da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE);
853da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
854da853ecaSopenharmony_ci    close(fd);
855da853ecaSopenharmony_ci}
856da853ecaSopenharmony_ci
857da853ecaSopenharmony_ci/**
858da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1014
859da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_ROTATE_90.mp4
860da853ecaSopenharmony_ci * @tc.desc     : function test
861da853ecaSopenharmony_ci */
862da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1014, TestSize.Level1)
863da853ecaSopenharmony_ci{
864da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
865da853ecaSopenharmony_ci    int32_t rotation = -1;
866da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_ROTATE_90.mp4";
867da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
868da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
869da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
870da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
871da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
872da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
873da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
874da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_90);
875da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
876da853ecaSopenharmony_ci    close(fd);
877da853ecaSopenharmony_ci}
878da853ecaSopenharmony_ci
879da853ecaSopenharmony_ci/**
880da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1015
881da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_ROTATE_180.mp4
882da853ecaSopenharmony_ci * @tc.desc     : function test
883da853ecaSopenharmony_ci */
884da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1015, TestSize.Level1)
885da853ecaSopenharmony_ci{
886da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
887da853ecaSopenharmony_ci    int32_t rotation = -1;
888da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_ROTATE_180.mp4";
889da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
890da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
891da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
892da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
893da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
894da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
895da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
896da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_180);
897da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
898da853ecaSopenharmony_ci    close(fd);
899da853ecaSopenharmony_ci}
900da853ecaSopenharmony_ci
901da853ecaSopenharmony_ci/**
902da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1016
903da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_ROTATE_270.mp4
904da853ecaSopenharmony_ci * @tc.desc     : function test
905da853ecaSopenharmony_ci */
906da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1016, TestSize.Level1)
907da853ecaSopenharmony_ci{
908da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
909da853ecaSopenharmony_ci    int32_t rotation = -1;
910da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_ROTATE_270.mp4";
911da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
912da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
913da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
914da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
915da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
916da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
917da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
918da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_270);
919da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
920da853ecaSopenharmony_ci    close(fd);
921da853ecaSopenharmony_ci}
922da853ecaSopenharmony_ci
923da853ecaSopenharmony_ci/**
924da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1017
925da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_FLIP_H.mp4
926da853ecaSopenharmony_ci * @tc.desc     : function test
927da853ecaSopenharmony_ci */
928da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1017, TestSize.Level2)
929da853ecaSopenharmony_ci{
930da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
931da853ecaSopenharmony_ci    int32_t rotation = -1;
932da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_FLIP_H.mp4";
933da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
934da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
935da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
936da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
937da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
938da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
939da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
940da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_H);
941da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
942da853ecaSopenharmony_ci    close(fd);
943da853ecaSopenharmony_ci}
944da853ecaSopenharmony_ci
945da853ecaSopenharmony_ci/**
946da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1018
947da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_FLIP_V.mp4
948da853ecaSopenharmony_ci * @tc.desc     : function test
949da853ecaSopenharmony_ci */
950da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1018, TestSize.Level2)
951da853ecaSopenharmony_ci{
952da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
953da853ecaSopenharmony_ci    int32_t rotation = -1;
954da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_FLIP_V.mp4";
955da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
956da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
957da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
958da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
959da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
960da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
961da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
962da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_V);
963da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
964da853ecaSopenharmony_ci    close(fd);
965da853ecaSopenharmony_ci}
966da853ecaSopenharmony_ci
967da853ecaSopenharmony_ci/**
968da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1019
969da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_FLIP_H_90.mp4
970da853ecaSopenharmony_ci * @tc.desc     : function test
971da853ecaSopenharmony_ci */
972da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1019, TestSize.Level2)
973da853ecaSopenharmony_ci{
974da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
975da853ecaSopenharmony_ci    int32_t rotation = -1;
976da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_FLIP_H_90.mp4";
977da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
978da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
979da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
980da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
981da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
982da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
983da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
984da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_H_ROT90);
985da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
986da853ecaSopenharmony_ci    close(fd);
987da853ecaSopenharmony_ci}
988da853ecaSopenharmony_ci
989da853ecaSopenharmony_ci/**
990da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1020
991da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_FLIP_V_90.mp4
992da853ecaSopenharmony_ci * @tc.desc     : function test
993da853ecaSopenharmony_ci */
994da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1020, TestSize.Level2)
995da853ecaSopenharmony_ci{
996da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
997da853ecaSopenharmony_ci    int32_t rotation = -1;
998da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_FLIP_V_90.mp4";
999da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
1000da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
1001da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
1002da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
1003da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
1004da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
1005da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
1006da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::FLIP_V_ROT90);
1007da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
1008da853ecaSopenharmony_ci    close(fd);
1009da853ecaSopenharmony_ci}
1010da853ecaSopenharmony_ci
1011da853ecaSopenharmony_ci/**
1012da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1021
1013da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_FLIP_H_180.mp4
1014da853ecaSopenharmony_ci * @tc.desc     : function test
1015da853ecaSopenharmony_ci */
1016da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1021, TestSize.Level2)
1017da853ecaSopenharmony_ci{
1018da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
1019da853ecaSopenharmony_ci    int32_t rotation = -1;
1020da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_FLIP_H_180.mp4";
1021da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
1022da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
1023da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
1024da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
1025da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
1026da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
1027da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
1028da853ecaSopenharmony_ci    ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_V || rotation == OHOS::MediaAVCodec::FLIP_H_ROT180);
1029da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
1030da853ecaSopenharmony_ci    close(fd);
1031da853ecaSopenharmony_ci}
1032da853ecaSopenharmony_ci
1033da853ecaSopenharmony_ci/**
1034da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1022
1035da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_FLIP_V_180.mp4
1036da853ecaSopenharmony_ci * @tc.desc     : function test
1037da853ecaSopenharmony_ci */
1038da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1022, TestSize.Level2)
1039da853ecaSopenharmony_ci{
1040da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
1041da853ecaSopenharmony_ci    int32_t rotation = -1;
1042da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_FLIP_V_180.mp4";
1043da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
1044da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
1045da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
1046da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
1047da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
1048da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
1049da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
1050da853ecaSopenharmony_ci    ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_H || rotation == OHOS::MediaAVCodec::FLIP_V_ROT180);
1051da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
1052da853ecaSopenharmony_ci    close(fd);
1053da853ecaSopenharmony_ci}
1054da853ecaSopenharmony_ci
1055da853ecaSopenharmony_ci/**
1056da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1023
1057da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_FLIP_H_270.mp4
1058da853ecaSopenharmony_ci * @tc.desc     : function test
1059da853ecaSopenharmony_ci */
1060da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1023, TestSize.Level2)
1061da853ecaSopenharmony_ci{
1062da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
1063da853ecaSopenharmony_ci    int32_t rotation = -1;
1064da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_FLIP_H_270.mp4";
1065da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
1066da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
1067da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
1068da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
1069da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
1070da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
1071da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
1072da853ecaSopenharmony_ci    ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_V_ROT90 || rotation == OHOS::MediaAVCodec::FLIP_H_ROT270);
1073da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
1074da853ecaSopenharmony_ci    close(fd);
1075da853ecaSopenharmony_ci}
1076da853ecaSopenharmony_ci
1077da853ecaSopenharmony_ci/**
1078da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1024
1079da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_FLIP_V_270.mp4
1080da853ecaSopenharmony_ci * @tc.desc     : function test
1081da853ecaSopenharmony_ci */
1082da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1024, TestSize.Level2)
1083da853ecaSopenharmony_ci{
1084da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
1085da853ecaSopenharmony_ci    int32_t rotation = -1;
1086da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_FLIP_V_270.mp4";
1087da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
1088da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
1089da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
1090da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
1091da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
1092da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
1093da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
1094da853ecaSopenharmony_ci    ASSERT_TRUE(rotation == OHOS::MediaAVCodec::FLIP_H_ROT90 || rotation == OHOS::MediaAVCodec::FLIP_V_ROT270);
1095da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
1096da853ecaSopenharmony_ci    close(fd);
1097da853ecaSopenharmony_ci}
1098da853ecaSopenharmony_ci
1099da853ecaSopenharmony_ci/**
1100da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1025
1101da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video AV_INVALID.mp4
1102da853ecaSopenharmony_ci * @tc.desc     : function test
1103da853ecaSopenharmony_ci */
1104da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1025, TestSize.Level2)
1105da853ecaSopenharmony_ci{
1106da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
1107da853ecaSopenharmony_ci    int32_t rotation = -1;
1108da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/AV_INVALID.mp4";
1109da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
1110da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
1111da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
1112da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
1113da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
1114da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
1115da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
1116da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE);
1117da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
1118da853ecaSopenharmony_ci    close(fd);
1119da853ecaSopenharmony_ci}
1120da853ecaSopenharmony_ci
1121da853ecaSopenharmony_ci/**
1122da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1026
1123da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video UNDEFINED_FLV.flv
1124da853ecaSopenharmony_ci * @tc.desc     : function test
1125da853ecaSopenharmony_ci */
1126da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1026, TestSize.Level3)
1127da853ecaSopenharmony_ci{
1128da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
1129da853ecaSopenharmony_ci    int32_t rotation = 0;
1130da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/UNDEFINED_FLV.flv";
1131da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
1132da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
1133da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
1134da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
1135da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
1136da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
1137da853ecaSopenharmony_ci    ASSERT_FALSE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
1138da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE);
1139da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
1140da853ecaSopenharmony_ci    close(fd);
1141da853ecaSopenharmony_ci}
1142da853ecaSopenharmony_ci
1143da853ecaSopenharmony_ci/**
1144da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1027
1145da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video UNDEFINED_fmp4.mp4
1146da853ecaSopenharmony_ci * @tc.desc     : function test
1147da853ecaSopenharmony_ci */
1148da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1027, TestSize.Level3)
1149da853ecaSopenharmony_ci{
1150da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
1151da853ecaSopenharmony_ci    int32_t rotation = 0;
1152da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/UNDEFINED_FMP4.mp4";
1153da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
1154da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
1155da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
1156da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
1157da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
1158da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
1159da853ecaSopenharmony_ci    ASSERT_TRUE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
1160da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE);
1161da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
1162da853ecaSopenharmony_ci    close(fd);
1163da853ecaSopenharmony_ci}
1164da853ecaSopenharmony_ci
1165da853ecaSopenharmony_ci/**
1166da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1028
1167da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video UNDEFINED_MKV.mkv
1168da853ecaSopenharmony_ci * @tc.desc     : function test
1169da853ecaSopenharmony_ci */
1170da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1028, TestSize.Level3)
1171da853ecaSopenharmony_ci{
1172da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
1173da853ecaSopenharmony_ci    int32_t rotation = 0;
1174da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/UNDEFINED_MKV.mkv";
1175da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
1176da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
1177da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
1178da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
1179da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
1180da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
1181da853ecaSopenharmony_ci    ASSERT_FALSE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
1182da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE);
1183da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
1184da853ecaSopenharmony_ci    close(fd);
1185da853ecaSopenharmony_ci}
1186da853ecaSopenharmony_ci
1187da853ecaSopenharmony_ci/**
1188da853ecaSopenharmony_ci * @tc.number   : DEMUXER_ORIENTATIONTYPE_1029
1189da853ecaSopenharmony_ci * @tc.name     : determine the orientation type of the video UNDEFINED_TS.ts
1190da853ecaSopenharmony_ci * @tc.desc     : function test
1191da853ecaSopenharmony_ci */
1192da853ecaSopenharmony_ciHWTEST_F(DemuxerFunc2NdkTest, DEMUXER_ORIENTATIONTYPE_1029, TestSize.Level3)
1193da853ecaSopenharmony_ci{
1194da853ecaSopenharmony_ci    static OH_AVFormat *trackFormat = nullptr;
1195da853ecaSopenharmony_ci    int32_t rotation = 0;
1196da853ecaSopenharmony_ci    const char *file = "/data/test/media/rotation/UNDEFINED_TS.ts";
1197da853ecaSopenharmony_ci    int fd = open(file, O_RDONLY);
1198da853ecaSopenharmony_ci    int64_t size = GetFileSize(file);
1199da853ecaSopenharmony_ci    source = OH_AVSource_CreateWithFD(fd, 0, size);
1200da853ecaSopenharmony_ci    ASSERT_NE(source, nullptr);
1201da853ecaSopenharmony_ci    trackFormat = OH_AVSource_GetTrackFormat(source, 0);
1202da853ecaSopenharmony_ci    ASSERT_NE(trackFormat, nullptr);
1203da853ecaSopenharmony_ci    ASSERT_FALSE(OH_AVFormat_GetIntValue(trackFormat, Media::Tag::VIDEO_ORIENTATION_TYPE, &rotation));
1204da853ecaSopenharmony_ci    ASSERT_EQ(rotation, OHOS::MediaAVCodec::ROTATE_NONE);
1205da853ecaSopenharmony_ci    OH_AVFormat_Destroy(trackFormat);
1206da853ecaSopenharmony_ci    close(fd);
1207da853ecaSopenharmony_ci}