未验证 提交 f2a61fc3 编写于 作者: O openharmony_ci 提交者: Gitee

!3160 Add Media XTS test case, media codec format test case

Merge pull request !3160 from 郑世杰/master
......@@ -20,11 +20,13 @@ group("multimedia") {
"audio/audio_js_standard/audioManager:audio_manager_js_hap",
"camera/camera_js_standard:camera_standard_ets_hap",
"image/image_js_standard:image_js_hap",
"media/media_js_standard/audioCodecFormat:audio_codec_format_js_hap",
"media/media_js_standard/audioDecoder:audio_decoder_js_hap",
"media/media_js_standard/audioEncoder:audio_encoder_js_hap",
"media/media_js_standard/audioPlayer:audio_player_js_hap",
"media/media_js_standard/audioRecorder:audio_recorder_js_hap",
"media/media_js_standard/recorderFormat:recorder_format_js_hap",
"media/media_js_standard/videoCodecFormat:video_codec_format_js_hap",
"media/media_js_standard/videoDecoder:video_decoder_js_hap",
"media/media_js_standard/videoEncoder:video_encoder_js_hap",
"media/media_js_standard/videoPlayer:video_player_js_hap",
......
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("audio_codec_format_js_hap") {
hap_profile = "./src/main/config.json"
js2abc = true
deps = [
":audio_codec_format_js_assets",
":audio_codec_format_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAudioCodecFormatJsTest"
}
ohos_js_assets("audio_codec_format_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("audio_codec_format_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for audio codec format Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "2000000",
"package": "ohos.acts.multimedia.audio.codecformat",
"shell-timeout": "600000"
},
"kits": [
{
"test-file-name": [
"ActsAudioCodecFormatJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"rm -rf /storage/media/100/local/files/*",
"mkdir -p /data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"chmod 777 -R /data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/"
],
"teardown-command":[
]
},
{
"type": "PushKit",
"pre-push": [
],
"push": [
"./resource/audio/codecFormat/HEv2_AAC_2_96000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/LC_AAC_2_96000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/LC_AAC_1_96000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/LC_AAC_2_8000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/LC_AAC_1_8000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/LC_AAC_2_11025.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/LC_AAC_1_11025.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/LC_AAC_2_12000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/LC_AAC_1_12000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/LC_AAC_2_16000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/LC_AAC_1_16000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/LC_AAC_2_22050.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/LC_AAC_1_22050.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/HE_AAC_1_24000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/HE_AAC_2_24000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/HE_AAC_1_32000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/HE_AAC_2_32000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/HE_AAC_1_44100.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/HE_AAC_2_44100.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/HE_AAC_1_48000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/HE_AAC_2_48000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/HE_AAC_1_64000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/HE_AAC_2_64000.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/HE_AAC_1_88200.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/HE_AAC_2_88200.aac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_1_96000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_2_8000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_1_8000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_2_11025.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_1_11025.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_2_12000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_1_12000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_2_16000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_2_22050.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_1_16000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_1_22050.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_2_24000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_1_24000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_2_32000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_1_32000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_2_44100.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_1_44100.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_2_48000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_1_48000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_2_64000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_1_64000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_2_88200.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_1_88200.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/FLAC_2_96000.flac ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_2_96000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_1_96000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_1_8000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_1_12000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_1_16000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_1_22050.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_1_24000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_1_32000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_1_44100.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_1_48000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_1_64000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_1_88200.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_2_8000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_2_12000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_2_16000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_2_22050.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_2_24000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_2_32000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_2_44100.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_2_48000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_2_64000.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"./resource/audio/codecFormat/S16LE_2_88200.pcm ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 777 -R /data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/",
"chmod 777 /data/app/el1/bundle/public/ohos.acts.multimedia.audio.codecformat/ohos.acts.multimedia.audio.codecformat/assets/entry/resources/rawfile/*",
"chmod 777 -R /storage/media/100/local/files/",
"chmod 777 /storage/media/100/local/files/*",
"killall com.ohos.medialibrary.MediaScannerAbilityA",
"aa start -a MediaScannerAbility -b com.ohos.medialibrary.MediaScannerAbilityA"
],
"teardown-command":[
]
}
]
}
\ No newline at end of file
{
"app": {
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.codecformat",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
"default": {
"debug": true
}
},
"module": {
"abilities": [
{
"iconId": 16777218,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"descriptionId": 16777217,
"visible": true,
"labelId": 16777216,
"icon": "$media:icon",
"name": "ohos.acts.multimedia.audio.codecformat.MainAbility",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"homeAbility": true,
"launchType": "standard"
}
],
"deviceType": [
"default",
"tablet",
"tv",
"wearable"
],
"reqPermissions": [
{
"name" : "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.MEDIA_LOCATION",
"reason" : "use ohos.permission.MEDIA_LOCATION"
},
{
"name" : "ohos.permission.READ_MEDIA",
"reason" : "use ohos.permission.READ_MEDIA"
},
{
"name" : "ohos.permission.WRITE_MEDIA",
"reason" : "use ohos.permission.WRITE_MEDIA"
}
],
"mainAbility": "ohos.acts.multimedia.audio.codecformat.MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.multimedia.audio.codecformat",
"name": ".MyApplication",
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Core, ExpectExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
this.timeout = 600000
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import media from '@ohos.multimedia.media'
import fileio from '@ohos.fileio'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import featureAbility from '@ohos.ability.featureAbility'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import {getFileDescriptor, closeFileDescriptor} from './AudioFormatTestBase.test.js';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('AudioEncoderFormatCompatibilityPromise', function () {
let audioEncodeProcessor;
let eosframenum = 0;
let resetAtEOS = false;
let workdoneAtEOS = false;
let needgetMediaDes = false;
let needrelease = false;
let frameCnt = 1;
let timestamp = 0;
let rate = 0;
let sawInputEOS = false;
let sawOutputEOS = false;
let inputQueue = [];
let outputQueue = [];
let ES = [0, 2048];
let ES_LENGTH = 1000;
let readPath;
let fdRead;
let fdWrite;
let readStreamSync;
let fileAssetWrite;
let channelCount;
let channelCountList = [];
let sampleRateList = [];
let formatSampleRate = [];
const events = require('events');
const eventEmitter = new events.EventEmitter();
const context = featureAbility.getContext();
const mediaTest = mediaLibrary.getMediaLibrary(context);
let fileKeyObj = mediaLibrary.FileKey;
beforeAll(async function() {
console.info('beforeAll case 1');
await applyPermission();
console.info('beforeAll case after get permission');
})
beforeEach(function() {
console.info('beforeEach case');
})
afterEach(async function() {
console.info('afterEach case');
if (audioEncodeProcessor != null) {
console.info('case audioEncodeProcessor is not null');
await audioEncodeProcessor.release().then(() => {
console.info('audioEncodeProcessor release success');
audioEncodeProcessor = null;
}, failCallback).catch(failCatch);
}
await closeFileDescriptor(readPath);
await closeFdWrite();
})
afterAll(function() {
console.info('afterAll case');
})
let failCallback = function(err) {
console.info('case callback err : ' + err);
expect(err).assertUndefined();
}
let failCatch = function(err) {
console.info('case catch err : ' + err);
expect(err).assertUndefined();
}
async function resetParam() {
eosframenum = 0;
resetAtEOS = false;
workdoneAtEOS = false;
needgetMediaDes = false;
needrelease = false
frameCnt = 1;
timestamp = 0;
rate = 0;
sawInputEOS = false;
sawOutputEOS = false;
readStreamSync = undefined;
inputQueue = [];
outputQueue = [];
ES = [0, 4096]
ES_LENGTH = 1000;
}
async function beforeTest() {
console.info('beforeTest case');
audioEncodeProcessor = null;
eosframenum = 0;
resetAtEOS = false;
workdoneAtEOS = false;
needgetMediaDes = false;
needrelease = false
frameCnt = 1;
timestamp = 0;
rate = 0;
sawInputEOS = false;
sawOutputEOS = false;
readStreamSync = undefined;
inputQueue = [];
outputQueue = [];
ES = [0, 4096]
ES_LENGTH = 1000;
}
async function aferTest() {
console.info('afterTest case');
if (audioEncodeProcessor != null) {
console.info('case audioEncodeProcessor is not null');
await audioEncodeProcessor.release().then(() => {
console.info('audioEncodeProcessor release success');
audioEncodeProcessor = null;
}, failCallback).catch(failCatch);
}
await closeFileDescriptor(readPath);
await closeFdWrite();
}
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.codecformat', 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
console.info('[permission] case accessTokenID is ' + tokenID);
let permissionName1 = 'ohos.permission.MEDIA_LOCATION';
let permissionName2 = 'ohos.permission.READ_MEDIA';
let permissionName3 = 'ohos.permission.WRITE_MEDIA';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
} else {
console.info('[permission] case apply permission failed, createAtManager failed');
}
}
async function getFdWrite(pathName) {
console.info('[mediaLibrary] case start getFdWrite');
console.info('[mediaLibrary] case getFdWrite pathName is ' + pathName);
let mediaType = mediaLibrary.MediaType.AUDIO;
console.info('[mediaLibrary] case mediaType is ' + mediaType);
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_AUDIO);
console.info('[mediaLibrary] case getFdWrite publicPath is ' + publicPath);
let dataUri = await mediaTest.createAsset(mediaType, pathName, publicPath);
if (dataUri != undefined) {
let args = dataUri.id.toString();
let fetchOp = {
selections : fileKeyObj.ID + "=?",
selectionArgs : [args],
}
let fetchWriteFileResult = await mediaTest.getFileAssets(fetchOp);
console.info('[mediaLibrary] case getFdWrite getFileAssets() success');
fileAssetWrite = await fetchWriteFileResult.getAllObject();
console.info('[mediaLibrary] case getFdWrite getAllObject() success');
fdWrite = await fileAssetWrite[0].open('Rw');
console.info('[mediaLibrary] case getFdWrite fdWrite is ' + fdWrite);
}
}
async function getFdRead(pathName, done) {
await getFileDescriptor(pathName).then((res) => {
if (res == undefined) {
expect().assertFail();
console.info('case error fileDescriptor undefined, open file fail');
done();
} else {
fdRead = res.fd;
console.info("case fdRead is: " + fdRead);
}
})
}
async function closeFdWrite() {
if (fileAssetWrite != null) {
await fileAssetWrite[0].close(fdWrite).then(() => {
console.info('[mediaLibrary] case close fdWrite success, fd is ' + fdWrite);
}).catch((err) => {
console.info('[mediaLibrary] case close fdWrite failed');
});
} else {
console.info('[mediaLibrary] case fileAssetWrite is null');
}
}
function writeHead(len) {
try{
let head = new ArrayBuffer(7);
addADTStoPacket(head, len);
let res = fileio.writeSync(fdWrite, head, {length: 7});
console.info('case fileio.write head success');
} catch(e) {
console.info('case fileio.write head error is ' + e);
}
}
function writeFile(buf, len) {
try{
let res = fileio.writeSync(fdWrite, buf, {length: len});
console.info('case fileio.write buffer success');
} catch(e) {
console.info('case fileio.write buffer error is ' + e);
}
}
function readFile(path) {
console.info('read file start execution');
try{
console.info('filepath: ' + path);
readStreamSync = fileio.fdopenStreamSync(fdRead, 'rb');
}catch(e) {
console.info(e);
}
}
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
console.info('case lengthreal is :' + lengthreal);
}
function addADTStoPacket(head, len) {
let view = new Uint8Array(head);
console.info("start add ADTS to Packet");
let packetLen = len + 7; // 7: head length
let profile = 2; // 2: AAC LC
let freqIdx = rate; // 3: 48000HZ
let chanCfg = channelCount; // 1: 1 channel
console.info('rate: ' + rate);
view[0] = 0xFF;
view[1] = 0xF9;
view[2] = ((profile - 1) << 6) + (freqIdx << 2) + (chanCfg >> 2);
view[3] = ((chanCfg & 3) << 6) + (packetLen >> 11);
view[4] = (packetLen & 0x7FF) >> 3;
view[5] = ((packetLen & 7) << 5) + 0x1F;
view[6] = 0xFC;
}
async function resetWork() {
resetParam();
await audioEncodeProcessor.reset().then(async() => {
console.info("case reset success");
if (needrelease) {
await audioEncodeProcessor.release().then(() => {
console.info("case release success");
}, failCallback).catch(failCatch);
audioEncodeProcessor = null;
}
}, failCallback).catch(failCatch);
}
async function doneWork() {
await audioEncodeProcessor.stop().then(() => {
console.info("case stop success");
}, failCallback).catch(failCatch);
resetParam();
await audioEncodeProcessor.reset().then(() => {
console.info("case reset success");
}, failCallback).catch(failCatch);
await audioEncodeProcessor.release().then(() => {
console.info("case release success");
}, failCallback).catch(failCatch);
audioEncodeProcessor = null;
}
async function enqueueInputs(queue) {
while (queue.length > 0 && !sawInputEOS) {
let inputobject = queue.shift();
console.info("case frameCnt:" + frameCnt);
if (frameCnt == eosframenum || frameCnt == ES_LENGTH + 1) {
console.info("case EOS frame seperately")
inputobject.flags = 1;
inputobject.timeMs = 0;
inputobject.length = 0;
sawInputEOS = true;
} else {
console.info("case read frame from file");
inputobject.timeMs = timestamp;
inputobject.offset = 0;
inputobject.length = ES[1];
getContent(inputobject.data, ES[1]);
inputobject.flags = 0;
}
timestamp += 23;
frameCnt += 1;
audioEncodeProcessor.pushInputData(inputobject).then(() => {
console.info('case queueInput success');
});
}
}
async function dequeueOutputs(queue, nextStep, done) {
while (queue.length > 0 && !sawOutputEOS) {
let outputObject = queue.shift();
if (outputObject.flags == 1) {
sawOutputEOS = true;
await doneWork();
if(sampleRateList == false && channelCountList[0] != undefined) {
await aferTest();
channelCount = channelCountList.shift();
sampleRateList = formatSampleRate.toString().split(',');
console.info('channelCountList[0]: ' + channelCountList[0]);
console.info('formatSampleRate ' + formatSampleRate);
nextStep();
return;
}else if (channelCountList == false && sampleRateList == false) {
done();
} else {
await aferTest();
nextStep();
return;
}
} else {
writeFile(outputObject.data, outputObject.length);
console.info("write to file success");
}
audioEncodeProcessor.freeOutputBuffer(outputObject).then(() => {
console.info('release output success');
});
}
}
function printfDescription(obj) {
for (let item in obj) {
let property = obj[item];
console.info("AudioEncoder config is" + item + ":" + property);
}
}
function setCallback(nextStep, done) {
console.info('case callback');
audioEncodeProcessor.on('needInputData', async(inBuffer) => {
console.info('inputBufferAvailable');
inputQueue.push(inBuffer);
await enqueueInputs(inputQueue);
});
audioEncodeProcessor.on('newOutputData', async(outBuffer) => {
console.info('outputBufferAvailable');
if (needgetMediaDes) {
audioEncodeProcessor.getOutputMediaDescription().then((MediaDescription) => {
console.info("get OutputMediaDescription success");
console.info('get outputMediaDescription : ' + MediaDescription);
needgetMediaDes=false;
}, failCallback).catch(failCatch);
}
outputQueue.push(outBuffer);
await dequeueOutputs(outputQueue, nextStep, done);
});
audioEncodeProcessor.on('error',(err) => {
console.info('case error called,errName is' + err);
});
audioEncodeProcessor.on('streamChanged',(format) => {
console.info('Output format changed: ' + format);
});
}
eventEmitter.on('nextStep', async (done) => {
console.info('in case : nextStep success');
await beforeTest();
let sampleRate = Number(sampleRateList.shift());
let savePath = `AAC_LC_${channelCount}_${sampleRate}.aac`;
let srcPath = `S16LE_${channelCount}_${sampleRate}.pcm`;
if (channelCount === 2) {
ES = [0, 4096];
} else {
ES = [0, 2048];
}
let mediaDescription = {
"channel_count": channelCount,
"sample_rate": sampleRate,
"audio_sample_format": 1,
"codec_mime": 'audio/mp4a-latm',
}
await encodeSource(mediaDescription, savePath, srcPath, done);
});
async function getFormatCaps() {
await media.createAudioEncoderByMime('audio/mp4a-latm').then((processor) => {
console.info("case create createAudioEncoder success");
audioEncodeProcessor = processor;
}, failCallback).catch(failCatch);
await audioEncodeProcessor.getAudioEncoderCaps().then((AudioCaps) => {
console.info("case get AudioEncoderCaps success");
console.info("print AudioCaps: " + AudioCaps)
console.info("print AudioCaps.supportedSampleRates: " + AudioCaps.supportedSampleRates)
console.info("print AudioCaps.supportedChannel.min: " + AudioCaps.supportedChannel.min)
console.info("print AudioCaps.supportedChannel.max: " + AudioCaps.supportedChannel.max)
formatSampleRate = AudioCaps.supportedSampleRates;
for (let i = AudioCaps.supportedChannel.min; i <= AudioCaps.supportedChannel.max; i++) {
channelCountList.push(i);
}
}, failCallback).catch(failCatch);
await audioEncodeProcessor.release().then(() => {
console.info('audioEncodeProcessor release success');
audioEncodeProcessor = null;
}, failCallback).catch(failCatch);
}
async function encodeSource(config, savePath, srcPath, done){
console.info('start test case');
let mediaDescription = config;
readPath = srcPath;
needgetMediaDes = true;
workdoneAtEOS = true;
await getFdWrite(savePath);
console.info('case getFdWrite success');
await getFdRead(readPath, done);
console.info('case getFdRead success');
await media.createAudioEncoderByMime('audio/mp4a-latm').then((processor) => {
console.info("case create createAudioEncoder success");
audioEncodeProcessor = processor;
}, failCallback).catch(failCatch);
await audioEncodeProcessor.getAudioEncoderCaps().then((AudioCaps) => {
console.info("case get AudioEncoderCaps success");
console.info("print AudioCaps: " + AudioCaps)
}, failCallback).catch(failCatch);
await audioEncodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(readPath);
}, failCallback).catch(failCatch);
setCallback(function(){eventEmitter.emit('nextStep', done);}, done);
await audioEncodeProcessor.prepare().then(() => {
console.info("case prepare success");
}, failCallback).catch(failCatch);
await audioEncodeProcessor.start().then(() => {
console.info("case start success")
}, failCallback).catch(failCatch);
await audioEncodeProcessor.getOutputMediaDescription().then((mediaDescription) => {
console.info("getOutputMediaDescription success");
printfDescription(mediaDescription);
},failCallback).catch(failCatch);
audioEncodeProcessor.on('error',(err) => {
console.info(`case error called,errName is ${err.name}`);
console.info(`case error called,errCode is ${err.code}`);
console.info(`case error called,errMessage is ${err.message}`);
expect().assertFail();
done();
});
}
/* *
* @tc.number : SUB_MEDIA_AUDIO_ENCODER_FORMAT_COMPATIBILITY_AAC_PROMISE_01_0100
* @tc.name : 01.test acc format compatibility
* @tc.desc : audio encoder format compatibility test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_AUDIO_ENCODER_FORMAT_COMPATIBILITY_AAC_PROMISE_01_0100', 0, async function (done) {
console.info("case test acc format compatibility");
await getFormatCaps();
sampleRateList = formatSampleRate.toString().split(',');
channelCount = channelCountList.shift();
let nextStep = eventEmitter.emit('nextStep', done);
nextStep();
})
})
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import resourceManager from '@ohos.resourceManager';
export async function getFileDescriptor(fileName) {
let fileDescriptor = undefined;
await resourceManager.getResourceManager().then(async (mgr) => {
await mgr.getRawFileDescriptor(fileName).then(value => {
fileDescriptor = {fd: value.fd, offset: value.offset, length: value.length};
}).catch(error => {
console.log('case getRawFileDescriptor err: ' + error);
});
});
return fileDescriptor;
}
export async function closeFileDescriptor(fileName) {
await resourceManager.getResourceManager().then(async (mgr) => {
await mgr.closeRawFileDescriptor(fileName).then(value => {
console.log('case closeRawFileDescriptor success for file:' + fileName);
}).catch(error => {
console.log('case closeRawFileDescriptor err: ' + error);
});
});
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./AudioEncoderFormatCompatibilityPromiseTest.test.js')
require('./AudioDecoderFormatCompatibilityPromiseTest.test.js')
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
}
\ No newline at end of file
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("video_codec_format_js_hap") {
hap_profile = "./src/main/config.json"
js2abc = true
deps = [
":video_codec_format_js_assets",
":video_codec_format_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsVideoCodecFormatJsTest"
}
ohos_js_assets("video_codec_format_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("video_codec_format_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for video codec format Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "2000000",
"package": "ohos.acts.multimedia.video.codecformat",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsVideoCodecFormatJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"rm -rf /storage/media/100/local/files/*",
"mkdir -p /data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/",
"chmod 777 -R /data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/"
],
"teardown-command":[
]
},
{
"type": "PushKit",
"pre-push": [
],
"push": [
"./resource/media/es/H264_BP_720_480_10_3000000.h264 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/",
"./resource/media/es/H264_BP_720_480_30_768000.h264 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/",
"./resource/media/es/H264_BP_720_480_30_2000000.h264 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/",
"./resource/media/es/H264_HP_352_288_30_3000000.h264 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/",
"./resource/media/es/H264_HP_640_480_30_3000000.h264 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/",
"./resource/media/es/H264_HP_720_480_25_3000000.h264 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/",
"./resource/media/es/H264_HP_720_480_30_3000000.h264 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/",
"./resource/media/es/H264_MP_720_480_30_64000.h264 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/",
"./resource/media/es/H264_MP_720_480_30_128000.h264 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/",
"./resource/media/es/H264_MP_720_480_30_192000.h264 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/",
"./resource/media/es/H264_MP_720_480_30_384000.h264 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 777 -R /data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/",
"chmod 777 /data/app/el1/bundle/public/ohos.acts.multimedia.video.codecformat/ohos.acts.multimedia.video.codecformat/assets/entry/resources/rawfile/*"
],
"teardown-command":[
]
}
]
}
\ No newline at end of file
{
"app": {
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.video.codecformat",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
"default": {
"debug": true
}
},
"module": {
"abilities": [
{
"iconId": 16777218,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"descriptionId": 16777217,
"visible": true,
"labelId": 16777216,
"icon": "$media:icon",
"name": "ohos.acts.multimedia.video.codecformat.MainAbility",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"homeAbility": true,
"launchType": "standard"
}
],
"deviceType": [
"default",
"tablet",
"tv",
"wearable"
],
"reqPermissions": [
{
"name" : "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.MEDIA_LOCATION",
"reason" : "use ohos.permission.MEDIA_LOCATION"
},
{
"name" : "ohos.permission.READ_MEDIA",
"reason" : "use ohos.permission.READ_MEDIA"
},
{
"name" : "ohos.permission.WRITE_MEDIA",
"reason" : "use ohos.permission.WRITE_MEDIA"
}
],
"mainAbility": "ohos.acts.multimedia.video.codecformat.MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.multimedia.video.codecformat",
"name": ".MyApplication",
"js": [
{
"pages": [
"pages/index/index",
"pages/display/display"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<!--
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<xcomponent id = 'XcomponentId'
type = 'surface'
onload = 'LoadXcomponent'
style = 'width:720px; height:480px; border-color:red; border-width:5px';>
</xcomponent>
</div>
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Core, ExpectExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
console.info('onInit finish')
this.title = this.$t('strings.world');
},
onShow() {
},
onReady() {
},
LoadXcomponent() {
globalThis.value = this.$element('XcomponentId').getXComponentSurfaceId();
},
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<!--
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Core, ExpectExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
console.info('onInit finish')
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
this.timeout = 60000
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./VideoDecoderFormatPromiseTest.test.js')
require('./VideoEncoderFormatPromiseTest.test.js')
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import media from '@ohos.multimedia.media'
import mediademo from '@ohos.multimedia.mediademo'
import fileio from '@ohos.fileio'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import featureAbility from '@ohos.ability.featureAbility'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('VideoEncoderFormatPromise', function () {
let videoEncodeProcessor;
let mediaTest;
let surfaceID = '';
let outputQueue = [];
let outputCnt = 0;
let frameTotal = 100;
let stopAtEOS = false;
let resetAtEOS = false;
let flushAtEOS = false;
let sawOutputEOS = false;
let needGetMediaDes = false;
let fdWrite;
let fileAsset;
const context = featureAbility.getContext();
const mediaLibraryTest = mediaLibrary.getMediaLibrary(context);
let fileKeyObj = mediaLibrary.FileKey;
beforeAll(async function() {
console.info('beforeAll case 1');
await applyPermission();
console.info('beforeAll case after get permission');
})
beforeEach(function() {
console.info('beforeEach case');
videoEncodeProcessor = null;
mediaTest = null;
surfaceID = '';
outputQueue = [];
outputCnt = 0;
frameTotal = 100;
stopAtEOS = false;
resetAtEOS = false;
flushAtEOS = false;
sawOutputEOS = false;
needGetMediaDes = false;
})
afterEach(async function() {
console.info('afterEach case');
if (videoEncodeProcessor != null){
await videoEncodeProcessor.release().then(() => {
console.info("case release success");
}, failCallback).catch(failCatch);
videoEncodeProcessor = null;
}
await closeFdWrite();
})
afterAll(function() {
console.info('afterAll case');
})
let failCallback = function(err) {
console.info('case callback err : ' + err);
expect(err).assertUndefined();
}
let failCatch = function(err) {
console.info('case catch err : ' + err);
expect(err).assertUndefined();
}
function resetParam() {
outputQueue = [];
outputCnt = 0;
frameTotal = 100;
stopAtEOS = false;
resetAtEOS = false;
flushAtEOS = false;
sawOutputEOS = false;
needGetMediaDes = false;
}
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.video.codecformat', 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
console.info('[permission] case accessTokenID is ' + tokenID);
let permissionName1 = 'ohos.permission.MEDIA_LOCATION';
let permissionName2 = 'ohos.permission.READ_MEDIA';
let permissionName3 = 'ohos.permission.WRITE_MEDIA';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
} else {
console.info('[permission] case apply permission failed, createAtManager failed');
}
}
async function getFdWrite(pathName) {
console.info('[mediaLibrary] case start getFdWrite');
console.info('[mediaLibrary] case getFdWrite pathName is ' + pathName);
let mediaType = mediaLibrary.MediaType.VIDEO;
console.info('[mediaLibrary] case mediaType is ' + mediaType);
let publicPath = await mediaLibraryTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
console.info('[mediaLibrary] case getFdWrite publicPath is ' + publicPath);
let dataUri = await mediaLibraryTest.createAsset(mediaType, pathName, publicPath);
if (dataUri != undefined) {
let args = dataUri.id.toString();
let fetchOp = {
selections : fileKeyObj.ID + "=?",
selectionArgs : [args],
}
let fetchWriteFileResult = await mediaLibraryTest.getFileAssets(fetchOp);
console.info('[mediaLibrary] case getFdWrite getFileAssets() success');
fileAsset = await fetchWriteFileResult.getAllObject();
console.info('[mediaLibrary] case getFdWrite getAllObject() success');
fdWrite = await fileAsset[0].open('Rw');
console.info('[mediaLibrary] case getFdWrite fdWrite is ' + fdWrite);
}
}
async function closeFdWrite() {
if (fileAsset != null) {
await fileAsset[0].close(fdWrite).then(() => {
console.info('[mediaLibrary] case close fdWrite success, fd is ' + fdWrite);
}).catch((err) => {
console.info('[mediaLibrary] case close fdWrite failed');
});
} else {
console.info('[mediaLibrary] case fileAsset is null');
}
}
function writeFile(buf, len) {
try{
let res = fileio.writeSync(fdWrite, buf, {length: len});
console.info('case fileio.write buffer success');
} catch(e) {
console.info('case fileio.write buffer error is ' + e);
}
}
async function dequeueOutputs(done) {
while (outputQueue.length > 0) {
let outputObject = outputQueue.shift();
outputCnt += 1;
if (outputObject.flags == 1) {
console.info("last frame, make choice");
mediaTest.closeStream(surfaceID);
sawOutputEOS = true;
if (stopAtEOS) {
await toStop();
} else if (resetAtEOS) {
await toReset();
} else if (flushAtEOS) {
await toFlush();
} else {
await toReset();
await toRelease();
done();
}
} else {
console.info('not last frame, write data to file');
writeFile(outputObject.data, outputObject.length);
console.info("write to file success");
videoEncodeProcessor.freeOutputBuffer(outputObject).then(() => {
console.info('release output success');
});
}
}
}
function setCallback(done) {
console.info('case callback');
videoEncodeProcessor.on('newOutputData', async(outBuffer) => {
console.info('newOutputData');
console.info('outBuffer.flags: ' + outBuffer.flags);
if (needGetMediaDes) {
videoEncodeProcessor.getOutputMediaDescription().then((MediaDescription) => {
console.info("get OutputMediaDescription success");
console.info('get outputMediaDescription : ' + MediaDescription);
needGetMediaDes = false;
}, failCallback).catch(failCatch);
}
outputQueue.push(outBuffer);
dequeueOutputs(done);
});
videoEncodeProcessor.on('error',(err) => {
console.info('case error called,errName is' + err);
});
videoEncodeProcessor.on('streamChanged',(format) => {
console.info('Output format changed: ' + format);
});
}
async function printVideoCaps(videoCaps, width, height) {
console.info(`print videoCaps:
codecInfo.name ${videoCaps.codecInfo.name}
codecInfo.type ${videoCaps.codecInfo.type}
codecInfo.mimeType ${videoCaps.codecInfo.mimeType}
codecInfo.isHardwareAccelerated ${videoCaps.codecInfo.isHardwareAccelerated}
codecInfo.isSoftwareOnly ${videoCaps.codecInfo.isSoftwareOnly}
codecInfo.isVendor ${videoCaps.codecInfo.isVendor}
supportedBitrate [${videoCaps.supportedBitrate.min}, ${videoCaps.supportedBitrate.max}]
supportedFormats ${videoCaps.supportedFormats}
supportedHeightAlignment ${videoCaps.supportedHeightAlignment}
supportedWidthAlignment ${videoCaps.supportedWidthAlignment}
supportedWidth [${videoCaps.supportedWidth.min}, ${videoCaps.supportedWidth.max}]
supportedHeight [${videoCaps.supportedHeight.min}, ${videoCaps.supportedHeight.max}]
supportedProfiles ${videoCaps.supportedProfiles}
supportedLevels ${videoCaps.supportedLevels}
supportedBitrateMode ${videoCaps.supportedBitrateMode}
supportedQuality [${videoCaps.supportedQuality.min}, ${videoCaps.supportedQuality.max}]
supportedComplexity [${videoCaps.supportedComplexity.min}, ${videoCaps.supportedComplexity.max}]
`);
await videoCaps.getPreferredFrameRate(width, height).then((valueRange) => {
console.info("case getPreferredFrameRate valueRange success");
if (typeof (valueRange) != 'undefined') {
console.info('getPreferredFrameRate.min: ' + valueRange.min);
console.info('getPreferredFrameRate.max: ' + valueRange.max);
} else {
console.info('case getPreferredFrameRate valueRange is not defined');
expect().assertFail();
}
}, failCallback).catch(failCatch);
await videoCaps.getSupportedFrameRate(width, height).then((valueRange) => {
console.info("case getSupportedFrameRate valueRange success");
if (typeof (valueRange) != 'undefined') {
console.info('getSupportedFrameRate.min: ' + valueRange.min);
console.info('getSupportedFrameRate.max: ' + valueRange.max);
} else {
console.info('case getSupportedFrameRate valueRange is not defined');
expect().assertFail();
}
}, failCallback).catch(failCatch);
await videoCaps.isSizeSupported(width, height).then((trueORfalse) => {
console.info("case isSizeSupported valueRange for width:" + width + ", height: " + height);
if (typeof (trueORfalse) != 'undefined') {
console.info('videoCaps.isSizeSupported: ' + trueORfalse);
} else {
console.info('case isSizeSupported is not defined');
expect().assertFail();
}
}, failCallback).catch(failCatch);
}
function printfDescription(obj) {
for (let item in obj) {
let property = obj[item];
console.info("AudioEncoder config is " + item + ":" + property);
}
}
function toCreateStream() {
mediaTest = mediademo.createMediaTest();
}
function toSetStreamParam(width, height, framerate, frameTotal) {
console.info('case set stream parameter');
mediaTest.setResolution(width, height);
mediaTest.setFrameRate(framerate);
mediaTest.setFrameCount(frameTotal);
}
function toStartStream() {
console.info('case start stream');
mediaTest.startStream(surfaceID);
}
async function toFlush() {
outputQueue = [];
await videoEncodeProcessor.flush().then(() => {
console.info("case flush success");
}, failCallback).catch(failCatch);
}
async function toStop() {
await videoEncodeProcessor.stop().then(() => {
console.info("case stop success");
}, failCallback).catch(failCatch);
}
async function toReset() {
resetParam();
await videoEncodeProcessor.reset().then(() => {
console.info("case reset success");
}, failCallback).catch(failCatch);
}
async function toRelease() {
resetParam();
await videoEncodeProcessor.release().then(() => {
console.info("case release success");
videoEncodeProcessor = null;
}, failCallback).catch(failCatch);
}
async function encodeSource(config, path, name, done){
let mediaDescription = config;
await getFdWrite(path)
console.info('case getFdWrite success');
await media.createVideoEncoderByName(name).then((processor) => {
if (typeof (processor) != 'undefined') {
videoEncodeProcessor = processor;
console.info('in case : createVideoEncoderByName success');
} else {
console.info('in case : createVideoEncoderByName fail');
expect().assertFail();
done();
}
},failCallback).catch(failCatch);
await videoEncodeProcessor.getVideoEncoderCaps().then((videoCaps) => {
console.info("case get getVideoEncoderCaps success");
printVideoCaps(videoCaps, mediaDescription.width, mediaDescription.height);
},failCallback).catch(failCatch);
toCreateStream();
toSetStreamParam(mediaDescription.width, mediaDescription.height, mediaDescription.frame_rate, frameTotal);
await videoEncodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
}, failCallback).catch(failCatch);
setCallback(done);
await videoEncodeProcessor.getInputSurface().then((inputSurface) => {
expect(inputSurface != undefined).assertTrue();
console.info('case getInputSurface success');
surfaceID = inputSurface;
}, failCallback).catch(failCatch);
await videoEncodeProcessor.prepare().then(() => {
console.info("case prepare success");
}, failCallback).catch(failCatch);
toStartStream();
await videoEncodeProcessor.start().then(() => {
console.info("case start success");
}, failCallback).catch(failCatch);
await videoEncodeProcessor.getOutputMediaDescription().then((mediaDescription) => {
console.info("getOutputMediaDescription success");
printfDescription(mediaDescription);
},failCallback).catch(failCatch);
videoEncodeProcessor.on('error',(err) => {
console.info(`case error called,errName is ${err.name}`);
console.info(`case error called,errCode is ${err.code}`);
console.info(`case error called,errMessage is ${err.message}`);
expect().assertFail();
done();
});
}
/* *
* @tc.number : SUB_MEDIA_VIDEO_ENCODER_SOFTWARE_FORMAT_COMPATIBILITY_MPEG4_PROMISE_01_0100
* @tc.name : 000.test MPEG4 format-resolution 640*480-frame rate 30 FPS
* @tc.desc : video encoder format compatibility test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_ENCODER_SOFTWARE_FORMAT_COMPATIBILITY_MPEG4_PROMISE_01_0100', 0, async function (done) {
console.info("case test MPEG4 format-resolution 640*480-frame rate 30 FPS");
let savePath = 'rk_mpeg4_video_software_640_480_30.es';
let name= 'avenc_mpeg4';
let mediaDescription = {
"codec_mime": 'video/mp4v-es',
"width": 640,
"height": 480,
"pixel_format": 3,
"frame_rate" : 30
}
await encodeSource(mediaDescription, savePath, name, done);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_ENCODER_SOFTWARE_FORMAT_COMPATIBILITY_MPEG4_PROMISE_01_0200
* @tc.name : 000.test MPEG4 format-resolution 352*288-frame rate 30 FPS
* @tc.desc : video encoder format compatibility test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_ENCODER_SOFTWARE_FORMAT_COMPATIBILITY_MPEG4_PROMISE_01_0200', 0, async function (done) {
console.info("case test MPEG4 format-resolution 352*288-frame rate 30 FPS");
let savePath = 'rk_mpeg4_video_software_352_288_30.es';
let name= 'avenc_mpeg4';
let mediaDescription = {
"codec_mime": 'video/mp4v-es',
"width": 352,
"height": 288,
"pixel_format": 3,
"frame_rate" : 30,
}
await encodeSource(mediaDescription, savePath, name, done);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_ENCODER_SOFTWARE_FORMAT_COMPATIBILITY_MPEG4_PROMISE_02_0100
* @tc.name : 000.test MPEG4 format-resolution 640*480-frame rate 25 FPS
* @tc.desc : video encoder format compatibility test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_ENCODER_SOFTWARE_FORMAT_COMPATIBILITY_MPEG4_PROMISE_02_0100', 0, async function (done) {
console.info("case test MPEG4 format-resolution 640*480-frame rate 25 FPS");
let savePath = 'rk_mpeg4_video_software_640_480_25.es';
let name= 'avenc_mpeg4';
let mediaDescription = {
"codec_mime": 'video/mp4v-es',
"width": 640,
"height": 480,
"pixel_format": 3,
"frame_rate" : 25,
}
await encodeSource(mediaDescription, savePath, name, done);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_ENCODER_SOFTWARE_FORMAT_COMPATIBILITY_MPEG4_PROMISE_02_0200
* @tc.name : 000.test MPEG4 format-resolution 640*480-frame rate 10 FPS
* @tc.desc : video encoder format compatibility test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_ENCODER_SOFTWARE_FORMAT_COMPATIBILITY_MPEG4_PROMISE_02_0200', 0, async function (done) {
console.info("case test MPEG4 format-resolution 640*480-frame rate 10 FPS");
let savePath = 'rk_mpeg4_video_software_640_480_10.es';
let name= 'avenc_mpeg4';
let mediaDescription = {
"codec_mime": 'video/mp4v-es',
"width": 640,
"height": 480,
"pixel_format": 3,
"frame_rate" : 10,
}
await encodeSource(mediaDescription, savePath, name, done);
})
})
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import resourceManager from '@ohos.resourceManager';
export async function getFileDescriptor(fileName) {
let fileDescriptor;
await resourceManager.getResourceManager().then(async (mgr) => {
await mgr.getRawFileDescriptor(fileName).then(value => {
fileDescriptor = {fd: value.fd, offset: value.offset, length: value.length};
}).catch(error => {
console.log('case getRawFileDescriptor err: ' + error);
});
});
return fileDescriptor;
}
export async function closeFileDescriptor(fileName) {
await resourceManager.getResourceManager().then(async (mgr) => {
await mgr.closeRawFileDescriptor(fileName).then(value => {
console.log('case closeRawFileDescriptor success for fileName: ' + fileName);
}).catch(error => {
console.log('case closeRawFileDescriptor err: ' + error);
});
});
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
}
\ No newline at end of file
streamId:0 pts:0 pts_time:0.000000 size:197165 flag:1
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册