Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
fec73bd9
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fec73bd9
编写于
8月 22, 2022
作者:
L
ling990
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify testcases Signed-off-by: ling990 <liling96@huawei.com>
Signed-off-by:
N
ling990
<
ling990@qq.com
>
上级
a387f71f
变更
4
展开全部
显示空白变更内容
内联
并排
Showing
4 changed file
with
998 addition
and
0 deletion
+998
-0
multimedia/media/media_cpp_standard/audioDecEncNdk/include/ADecEncNdkSample.h
...ia_cpp_standard/audioDecEncNdk/include/ADecEncNdkSample.h
+140
-0
multimedia/media/media_cpp_standard/audioDecEncNdk/include/ActsAudioDecEncNdkTest.h
..._standard/audioDecEncNdk/include/ActsAudioDecEncNdkTest.h
+49
-0
multimedia/media/media_cpp_standard/audioDecEncNdk/src/ADecEncNdkSample.cpp
...edia_cpp_standard/audioDecEncNdk/src/ADecEncNdkSample.cpp
+753
-0
multimedia/media/media_cpp_standard/include/ndktest_log.h
multimedia/media/media_cpp_standard/include/ndktest_log.h
+56
-0
未找到文件。
multimedia/media/media_cpp_standard/audioDecEncNdk/include/ADecEncNdkSample.h
0 → 100644
浏览文件 @
fec73bd9
/*
* 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.
*/
#ifndef AUDIODECENC_NDK_SAMPLE_H
#define AUDIODECENC_NDK_SAMPLE_H
#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <atomic>
#include <fstream>
#include <thread>
#include <mutex>
#include <queue>
#include <string>
#include "securec.h"
#include "native_avcodec_base.h"
#include "native_avcodec_audiodecoder.h"
#include "native_avcodec_audioencoder.h"
#include "nocopyable.h"
#include "ndktest_log.h"
namespace
OHOS
{
namespace
Media
{
class
ADecEncSignal
{
public:
std
::
mutex
inMutexDec_
;
std
::
condition_variable
inCondDec_
;
std
::
queue
<
uint32_t
>
inQueueDec_
;
std
::
queue
<
uint32_t
>
outQueueDec_
;
std
::
queue
<
uint32_t
>
sizeQueueDec_
;
std
::
queue
<
uint32_t
>
flagQueueDec_
;
std
::
queue
<
OH_AVMemory
*>
inBufferQueueDec_
;
std
::
queue
<
OH_AVMemory
*>
outBufferQueueDec_
;
std
::
mutex
inMutexEnc_
;
std
::
mutex
outMutexEnc_
;
std
::
condition_variable
inCondEnc_
;
std
::
condition_variable
outCondEnc_
;
std
::
queue
<
uint32_t
>
inQueueEnc_
;
std
::
queue
<
uint32_t
>
outQueueEnc_
;
std
::
queue
<
uint32_t
>
sizeQueueEnc_
;
std
::
queue
<
uint32_t
>
flagQueueEnc_
;
std
::
queue
<
OH_AVMemory
*>
inBufferQueueEnc_
;
std
::
queue
<
OH_AVMemory
*>
outBufferQueueEnc_
;
int32_t
errorNum_
=
0
;
std
::
atomic
<
bool
>
isFlushing_
=
false
;
};
class
ADecEncNdkSample
:
public
NoCopyable
{
public:
ADecEncNdkSample
()
=
default
;
~
ADecEncNdkSample
();
struct
OH_AVCodec
*
CreateAudioDecoder
(
std
::
string
mimetype
);
int32_t
ConfigureDec
(
struct
OH_AVFormat
*
format
);
int32_t
PrepareDec
();
int32_t
StartDec
();
int32_t
StopDec
();
int32_t
FlushDec
();
int32_t
ResetDec
();
int32_t
ReleaseDec
();
struct
OH_AVCodec
*
CreateAudioEncoder
(
std
::
string
mimetype
);
int32_t
ConfigureEnc
(
struct
OH_AVFormat
*
format
);
int32_t
PrepareEnc
();
int32_t
StartEnc
();
int32_t
StopEnc
();
int32_t
FlushEnc
();
int32_t
ResetEnc
();
int32_t
ReleaseEnc
();
int32_t
CalcuError
();
void
SetReadPath
(
const
char
*
inp_path
,
uint32_t
es
[],
uint32_t
length
);
void
SetEosState
(
bool
needSetEos
);
void
SetSavePath
(
const
char
*
outp_path
);
void
ReRead
();
void
ResetDecParam
();
void
ResetEncParam
();
int32_t
GetFrameCount
();
bool
GetEncEosState
();
bool
GetDecEosState
();
void
PopInqueueDec
();
void
PopOutqueueDec
();
void
PopInqueueEnc
();
void
PopOutqueueEnc
();
int32_t
PushInbufferDec
(
uint32_t
index
,
uint32_t
bufferSize
);
int32_t
PushInbufferEnc
();
ADecEncSignal
*
acodecSignal_
=
nullptr
;
uint32_t
decInCnt_
=
0
;
uint32_t
decOutCnt_
=
0
;
uint32_t
encInCnt_
=
0
;
uint32_t
encOutCnt_
=
0
;
bool
isDecInputEOS
=
false
;
bool
isEncInputEOS
=
false
;
bool
isDecOutputEOS
=
false
;
bool
isEncOutputEOS
=
false
;
bool
setEos
=
true
;
private:
struct
OH_AVCodec
*
adec_
;
void
InputFuncDec
();
std
::
atomic
<
bool
>
isDecRunning_
=
false
;
std
::
unique_ptr
<
std
::
ifstream
>
testFile_
;
std
::
unique_ptr
<
std
::
thread
>
inputLoopDec_
;
std
::
unique_ptr
<
std
::
thread
>
outputLoopDec_
;
struct
OH_AVCodecAsyncCallback
cbDec_
;
int64_t
timeStampDec_
=
0
;
struct
OH_AVCodec
*
aenc_
;
void
InputFuncEnc
();
void
OutputFuncEnc
();
int32_t
WriteToFile
();
std
::
atomic
<
bool
>
isEncRunning_
=
false
;
std
::
unique_ptr
<
std
::
thread
>
inputLoopEnc_
;
std
::
unique_ptr
<
std
::
thread
>
outputLoopEnc_
;
struct
OH_AVCodecAsyncCallback
cbEnc_
;
int64_t
timeStampEnc_
=
0
;
std
::
string
outDir_
=
"/data/media/out.aac"
;
const
char
*
INP_FILE
;
const
char
*
OUT_FILE
;
uint32_t
*
ES
;
uint32_t
ES_LENGTH
=
0
;
};
}
}
#endif // AUDIODECENC_NDK_SAMPLE_H
multimedia/media/media_cpp_standard/audioDecEncNdk/include/ActsAudioDecEncNdkTest.h
0 → 100644
浏览文件 @
fec73bd9
/*
* 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.
*/
#ifndef ACTSAUDIODECODER_NDK_FUNC_TEST_H
#define ACTSAUDIODECODER_NDK_FUNC_TEST_H
#include "gtest/gtest.h"
#include "ADecEncNdkSample.h"
namespace
OHOS
{
namespace
Media
{
class
ActsAudioDecEncNdkTest
:
public
testing
::
Test
{
public:
// Preset action of the test suite, which is executed before the first test case
static
void
SetUpTestCase
(
void
)
{
printf
(
"ActsAudioDecEncNdkTest::SetUpTestCase"
);
}
// Test suite cleanup action, which is executed after the last test case
static
void
TearDownTestCase
(
void
)
{
printf
(
"ActsAudioDecEncNdkTest::TearDownTestCase"
);
}
// Preset action of the test case
void
SetUp
(
void
)
{
printf
(
"ActsAudioDecEncNdkTest::SetUp"
);
}
// Cleanup action of the test case
virtual
void
TearDown
(
void
)
{
printf
(
"ActsAudioDecEncNdkTest::TearDown"
);
}
};
}
}
#endif
\ No newline at end of file
multimedia/media/media_cpp_standard/audioDecEncNdk/src/ADecEncNdkSample.cpp
0 → 100644
浏览文件 @
fec73bd9
此差异已折叠。
点击以展开。
multimedia/media/media_cpp_standard/include/ndktest_log.h
0 → 100644
浏览文件 @
fec73bd9
/*
* 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.
*/
#ifndef NDKTEST_LOG_H
#define NDKTEST_LOG_H
#include <stdio.h>
#define RET_FAIL (-1)
#define RET_OK 0
#define NDK_CHECK_AND_RETURN_RET_LOG(cond, ret, fmt, ...) \
do { \
if (!(cond)) { \
(void)printf("%s\n", fmt, ##__VA_ARGS__); \
return ret; \
} \
} while (0)
#define NDK_CHECK_AND_RETURN_LOG(cond, fmt, ...) \
do { \
if (!(cond)) { \
(void)printf("%s\n", fmt, ##__VA_ARGS__); \
return; \
} \
} while (0)
#define NDK_CHECK_AND_BREAK_LOG(cond, fmt, ...) \
if (!(cond)) { \
(void)printf("%s\n", fmt, ##__VA_ARGS__); \
break; \
}
#define NDK_CHECK_AND_CONTINUE_LOG(cond, fmt, ...) \
if (!(cond)) { \
(void)printf("%s\n", fmt, ##__VA_ARGS__); \
continue; \
}
#define NDK_CHECK_AND_LOG(cond, fmt, ...) \
if (!(cond)) { \
(void)printf("%s\n", fmt, ##__VA_ARGS__); \
}
#endif // NDK_LOG_H
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录