mirror of
https://github.com/openharmony/multimedia_media_utils_lite.git
synced 2026-07-01 03:22:21 -04:00
update openharmony 1.0.1
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
### 该问题是怎么引起的?
|
||||
|
||||
|
||||
|
||||
### 重现步骤
|
||||
|
||||
|
||||
|
||||
### 报错信息
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
### 相关的Issue
|
||||
|
||||
|
||||
### 原因(目的、解决的问题等)
|
||||
|
||||
|
||||
### 描述(做了什么,变更了什么)
|
||||
|
||||
|
||||
### 测试用例(新增、改动、可能影响的功能)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
# Copyright (c) 2020 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("//build/lite/config/component/lite_component.gni")
|
||||
import("//build/lite/ndk/ndk.gni")
|
||||
|
||||
shared_library("media_common") {
|
||||
sources = [
|
||||
"src/format.cpp",
|
||||
"src/source.cpp",
|
||||
]
|
||||
cflags = ["-fPIC"]
|
||||
cflags += ["-Wall"]
|
||||
cflags_cc = cflags
|
||||
include_dirs = [
|
||||
"include",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
]
|
||||
public_deps = [
|
||||
"//third_party/bounds_checking_function:libsec_shared",
|
||||
"$ohos_vendor_adapter_dir/../../hardware:hardware_media_sdk",
|
||||
"$ohos_vendor_adapter_dir/../../middleware:middleware_source_sdk",
|
||||
]
|
||||
}
|
||||
# Copyright (c) 2020 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("//build/lite/config/component/lite_component.gni")
|
||||
import("//build/lite/ndk/ndk.gni")
|
||||
|
||||
shared_library("media_common") {
|
||||
sources = [
|
||||
"src/format.cpp",
|
||||
"src/source.cpp",
|
||||
]
|
||||
cflags = [ "-fPIC" ]
|
||||
cflags += [ "-Wall" ]
|
||||
cflags_cc = cflags
|
||||
include_dirs = [
|
||||
"include",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
]
|
||||
public_deps = [
|
||||
"$ohos_vendor_adapter_dir:hardware_media_sdk",
|
||||
"$ohos_vendor_adapter_dir/../modules/middleware:middleware_source_sdk",
|
||||
"//third_party/bounds_checking_function:libsec_shared",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
# MEDIA\_UTILS\_LITE<a name="EN-US_TOPIC_0000001127127417"></a>
|
||||
|
||||
- [Introduction](#section11660541593)
|
||||
- [Directory Structure](#section8685144625320)
|
||||
- [Usage](#section1648194512427)
|
||||
- [Constraints](#section161941989596)
|
||||
- [Repositories Involved](#section105062051111614)
|
||||
|
||||
## Introduction<a name="section11660541593"></a>
|
||||
|
||||
This repository defines common information such as media error codes and data types required for audio and video recording and playback.
|
||||
|
||||
Data types
|
||||
|
||||
- **SourceType**: type of the media source to play
|
||||
- **BufferFlags**: flags of the data carried in the buffer
|
||||
- **AudioSourceType**: enumeration of audio input source types
|
||||
- **AudioCodecFormat**: enumeration of audio data formats
|
||||
- **AudioStreamType**: enumeration of audio stream types
|
||||
- **AudioBitWidth**: enumeration of sampling bit width
|
||||
|
||||
The following table lists the error codes.
|
||||
|
||||
<a name="table7158151314620"></a>
|
||||
<table><thead align="left"><tr id="row1722018139620"><th class="cellrowborder" valign="top" width="24.95%" id="mcps1.1.4.1.1"><p id="p172202131066"><a name="p172202131066"></a><a name="p172202131066"></a>Code</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="42.91%" id="mcps1.1.4.1.2"><p id="p5220913569"><a name="p5220913569"></a><a name="p5220913569"></a>Macro</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="32.14%" id="mcps1.1.4.1.3"><p id="p1722061317617"><a name="p1722061317617"></a><a name="p1722061317617"></a>Description</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="row1422020137612"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p202201213562"><a name="p202201213562"></a><a name="p202201213562"></a>0xffffffff</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p0220171317612"><a name="p0220171317612"></a><a name="p0220171317612"></a>ERR_INVALID_READ</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p82208133618"><a name="p82208133618"></a><a name="p82208133618"></a>Data reading failed.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row82203139620"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p1122013131168"><a name="p1122013131168"></a><a name="p1122013131168"></a>0x0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p1322011315617"><a name="p1322011315617"></a><a name="p1322011315617"></a>SUCCESS</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p142207137613"><a name="p142207137613"></a><a name="p142207137613"></a>Operation succeeded.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row15220213066"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p14220131313612"><a name="p14220131313612"></a><a name="p14220131313612"></a>0x3c10000</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p1822016133612"><a name="p1822016133612"></a><a name="p1822016133612"></a>ERROR</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p1422071317614"><a name="p1422071317614"></a><a name="p1422071317614"></a>Operation failed.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row3220191311619"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p22201013865"><a name="p22201013865"></a><a name="p22201013865"></a>0x3c10001</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p52211813262"><a name="p52211813262"></a><a name="p52211813262"></a>ERR_ILLEGAL_STATE</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p102211913669"><a name="p102211913669"></a><a name="p102211913669"></a>Invalid status.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1222119131064"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p152211413962"><a name="p152211413962"></a><a name="p152211413962"></a>0x2A05</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p7221113864"><a name="p7221113864"></a><a name="p7221113864"></a>ERR_INVALID_PARAM</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p12211813968"><a name="p12211813968"></a><a name="p12211813968"></a>Invalid parameter.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1122110131163"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p1222111131761"><a name="p1222111131761"></a><a name="p1222111131761"></a>0x3c10003</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p1622171317617"><a name="p1622171317617"></a><a name="p1622171317617"></a>ERR_EARLY_PREPARE</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p1722117131610"><a name="p1722117131610"></a><a name="p1722117131610"></a>Early start.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1322191310611"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p2221713569"><a name="p2221713569"></a><a name="p2221713569"></a>0x3c10004</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p1422115131164"><a name="p1422115131164"></a><a name="p1422115131164"></a>ERR_SOURCE_NOT_SET</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p1722119131068"><a name="p1722119131068"></a><a name="p1722119131068"></a>Media source not set.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row62216139614"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p182218133619"><a name="p182218133619"></a><a name="p182218133619"></a>0x3c10005</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p72211813061"><a name="p72211813061"></a><a name="p72211813061"></a>ERR_INVALID_OPERATION</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p2221161310618"><a name="p2221161310618"></a><a name="p2221161310618"></a>Invalid operation.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row2022111312610"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p1722111139618"><a name="p1722111139618"></a><a name="p1722111139618"></a>0x2A09</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p12211713767"><a name="p12211713767"></a><a name="p12211713767"></a>ERR_NOFREE_CHANNEL</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p1622115137617"><a name="p1622115137617"></a><a name="p1622115137617"></a>No free channel.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row8221201314611"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p122217138616"><a name="p122217138616"></a><a name="p122217138616"></a>0x3c10007</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p1022110130620"><a name="p1022110130620"></a><a name="p1022110130620"></a>ERR_READ_BUFFER</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p1322116131064"><a name="p1322116131064"></a><a name="p1322116131064"></a>Error occurred during buffer reading.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row142221813263"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p32221713964"><a name="p32221713964"></a><a name="p32221713964"></a>0x3c10008</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p1622221317615"><a name="p1622221317615"></a><a name="p1622221317615"></a>ERR_NOT_STARTED</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p11222413963"><a name="p11222413963"></a><a name="p11222413963"></a>Device not started.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1922217130615"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p19222213267"><a name="p19222213267"></a><a name="p19222213267"></a>0x3c100c8</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p32221213768"><a name="p32221213768"></a><a name="p32221213768"></a>ERR_UNKNOWN</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p20222171320618"><a name="p20222171320618"></a><a name="p20222171320618"></a>Unknown error.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
**Figure 1** Position of this repository \(in the dotted blue box\) in the multimedia subsystem<a name="fig9521193714117"></a>
|
||||
-in-the-multimedia-subsystem.png "position-of-this-repository-(in-the-dotted-blue-box)-in-the-multimedia-subsystem")
|
||||
|
||||
## Directory Structure<a name="section8685144625320"></a>
|
||||
|
||||
```
|
||||
foundation/multimedia/utils/lite
|
||||
├── include # Header file of the data types and media formats
|
||||
└── hals # HAL adaptation APIs
|
||||
└── src # Implementation of the data types and media formats
|
||||
```
|
||||
|
||||
## Usage<a name="section1648194512427"></a>
|
||||
|
||||
Build a single repository in the root directory.
|
||||
|
||||
```
|
||||
# Select the development board.
|
||||
hb set
|
||||
# Build this repository.
|
||||
hb build media_service
|
||||
```
|
||||
|
||||
## Constraints<a name="section161941989596"></a>
|
||||
|
||||
C++ 11 or later
|
||||
|
||||
## Repositories Involved<a name="section105062051111614"></a>
|
||||
|
||||
/hmf/multimedia/camera\_lite
|
||||
|
||||
/hmf/multimedia/audio\_lite
|
||||
|
||||
/hmf/multimedia/media\_lite
|
||||
|
||||
/hmf/multimedia/service\_lite
|
||||
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
# 媒体子系统MEDIA\_UTILS\_LITE组件<a name="ZH-CN_TOPIC_0000001127127417"></a>
|
||||
|
||||
- [简介](#section11660541593)
|
||||
- [目录](#section8685144625320)
|
||||
- [使用说明](#section1648194512427)
|
||||
- [约束](#section161941989596)
|
||||
- [相关仓](#section105062051111614)
|
||||
|
||||
## 简介<a name="section11660541593"></a>
|
||||
|
||||
提供媒体错误码等公用信息的定义,以及录制、播放音频和视频所需的数据类型。
|
||||
|
||||
数据类型:
|
||||
|
||||
- SourceType:播放片源类型
|
||||
- BufferFlags:Buffer承载数据标识
|
||||
- AudioSourceType:定义音频输入源类型枚举
|
||||
- AudioCodecFormat:定义音频数据格式枚举
|
||||
- AudioStreamType:定义音频流类型枚举
|
||||
- AudioBitWidth:定义采样位宽枚举
|
||||
|
||||
错误码:
|
||||
|
||||
<a name="table7158151314620"></a>
|
||||
<table><thead align="left"><tr id="row1722018139620"><th class="cellrowborder" valign="top" width="24.95%" id="mcps1.1.4.1.1"><p id="p172202131066"><a name="p172202131066"></a><a name="p172202131066"></a>错误代码</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="42.91%" id="mcps1.1.4.1.2"><p id="p5220913569"><a name="p5220913569"></a><a name="p5220913569"></a>宏定义</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="32.14%" id="mcps1.1.4.1.3"><p id="p1722061317617"><a name="p1722061317617"></a><a name="p1722061317617"></a>描述</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="row1422020137612"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p202201213562"><a name="p202201213562"></a><a name="p202201213562"></a>0xffffffff</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p0220171317612"><a name="p0220171317612"></a><a name="p0220171317612"></a>ERR_INVALID_READ</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p82208133618"><a name="p82208133618"></a><a name="p82208133618"></a>读数据失败</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row82203139620"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p1122013131168"><a name="p1122013131168"></a><a name="p1122013131168"></a>0x0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p1322011315617"><a name="p1322011315617"></a><a name="p1322011315617"></a>SUCCESS</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p142207137613"><a name="p142207137613"></a><a name="p142207137613"></a>操作成功</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row15220213066"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p14220131313612"><a name="p14220131313612"></a><a name="p14220131313612"></a>0x3c10000</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p1822016133612"><a name="p1822016133612"></a><a name="p1822016133612"></a>ERROR</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p1422071317614"><a name="p1422071317614"></a><a name="p1422071317614"></a>操作失败</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row3220191311619"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p22201013865"><a name="p22201013865"></a><a name="p22201013865"></a>0x3c10001</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p52211813262"><a name="p52211813262"></a><a name="p52211813262"></a>ERR_ILLEGAL_STATE</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p102211913669"><a name="p102211913669"></a><a name="p102211913669"></a>状态错误</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1222119131064"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p152211413962"><a name="p152211413962"></a><a name="p152211413962"></a>0x2A05</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p7221113864"><a name="p7221113864"></a><a name="p7221113864"></a>ERR_INVALID_PARAM</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p12211813968"><a name="p12211813968"></a><a name="p12211813968"></a>参数无效</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1122110131163"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p1222111131761"><a name="p1222111131761"></a><a name="p1222111131761"></a>0x3c10003</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p1622171317617"><a name="p1622171317617"></a><a name="p1622171317617"></a>ERR_EARLY_PREPARE</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p1722117131610"><a name="p1722117131610"></a><a name="p1722117131610"></a>媒体启动提前</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1322191310611"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p2221713569"><a name="p2221713569"></a><a name="p2221713569"></a>0x3c10004</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p1422115131164"><a name="p1422115131164"></a><a name="p1422115131164"></a>ERR_SOURCE_NOT_SET</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p1722119131068"><a name="p1722119131068"></a><a name="p1722119131068"></a>媒体源未设置</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row62216139614"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p182218133619"><a name="p182218133619"></a><a name="p182218133619"></a>0x3c10005</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p72211813061"><a name="p72211813061"></a><a name="p72211813061"></a>ERR_INVALID_OPERATION</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p2221161310618"><a name="p2221161310618"></a><a name="p2221161310618"></a>无效操作</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row2022111312610"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p1722111139618"><a name="p1722111139618"></a><a name="p1722111139618"></a>0x2A09</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p12211713767"><a name="p12211713767"></a><a name="p12211713767"></a>ERR_NOFREE_CHANNEL</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p1622115137617"><a name="p1622115137617"></a><a name="p1622115137617"></a>通道无空闲</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row8221201314611"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p122217138616"><a name="p122217138616"></a><a name="p122217138616"></a>0x3c10007</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p1022110130620"><a name="p1022110130620"></a><a name="p1022110130620"></a>ERR_READ_BUFFER</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p1322116131064"><a name="p1322116131064"></a><a name="p1322116131064"></a>读缓冲区出错</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row142221813263"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p32221713964"><a name="p32221713964"></a><a name="p32221713964"></a>0x3c10008</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p1622221317615"><a name="p1622221317615"></a><a name="p1622221317615"></a>ERR_NOT_STARTED</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p11222413963"><a name="p11222413963"></a><a name="p11222413963"></a>设备未启动</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1922217130615"><td class="cellrowborder" valign="top" width="24.95%" headers="mcps1.1.4.1.1 "><p id="p19222213267"><a name="p19222213267"></a><a name="p19222213267"></a>0x3c100c8</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="42.91%" headers="mcps1.1.4.1.2 "><p id="p32221213768"><a name="p32221213768"></a><a name="p32221213768"></a>ERR_UNKNOWN</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="32.14%" headers="mcps1.1.4.1.3 "><p id="p20222171320618"><a name="p20222171320618"></a><a name="p20222171320618"></a>未知错误</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
**图 1** 媒体子系统架构(蓝色虚线框是media\_utils)<a name="fig9521193714117"></a>
|
||||
.png "媒体子系统架构(蓝色虚线框是media_utils)")
|
||||
|
||||
## 目录<a name="section8685144625320"></a>
|
||||
|
||||
```
|
||||
foundation/multimedia/utils/lite
|
||||
├── include # 数据类型和媒体格式头文件
|
||||
└── hals # HAL层适配接口
|
||||
└── src # 数据类型和媒体格式实现
|
||||
```
|
||||
|
||||
## 使用说明<a name="section1648194512427"></a>
|
||||
|
||||
单仓的编译构建,在根目录下进行单仓的构建和编译
|
||||
|
||||
```
|
||||
# 开发板选择
|
||||
hb set
|
||||
# 构建和编译
|
||||
hb build media_service
|
||||
```
|
||||
|
||||
## 约束<a name="section161941989596"></a>
|
||||
|
||||
C++11版本或以上
|
||||
|
||||
## 相关仓<a name="section105062051111614"></a>
|
||||
|
||||
/hmf/multimedia/camera\_lite
|
||||
|
||||
/hmf/multimedia/audio\_lite
|
||||
|
||||
/hmf/multimedia/media\_lite
|
||||
|
||||
/hmf/multimedia/service\_lite
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
Executable
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2020-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 COMMON_PLATFORM_VO_H
|
||||
#define COMMON_PLATFORM_VO_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif /* End of #ifdef __cplusplus */
|
||||
|
||||
typedef int32_t HalVideoOutputHdl;
|
||||
|
||||
typedef struct {
|
||||
int32_t regionPositionX;
|
||||
int32_t regionPositionY;
|
||||
int32_t regionWidth;
|
||||
int32_t regionHeight;
|
||||
uint32_t priority;
|
||||
} HalVideoOutputAttr;
|
||||
|
||||
int32_t HalCreateVideoOutput(HalVideoOutputHdl *handle, HalVideoOutputAttr attr);
|
||||
|
||||
int32_t HalConfigVideoOutput(HalVideoOutputHdl handle, HalVideoOutputAttr attr);
|
||||
|
||||
int32_t HalGetVideoOutputConfig(HalVideoOutputHdl handle, HalVideoOutputAttr *attr);
|
||||
|
||||
int32_t HalDestroyVideoOutput(HalVideoOutputHdl handle);
|
||||
|
||||
int32_t HalStartVideoOutput(HalVideoOutputHdl handle);
|
||||
|
||||
int32_t HalStopVideoOutput(HalVideoOutputHdl handle);
|
||||
|
||||
int32_t HalWriteVo(HalVideoOutputHdl handle, const void *buffer);
|
||||
|
||||
int32_t HalPlayerVoInit(HalVideoOutputHdl *handle);
|
||||
|
||||
int32_t HalPlayerSysInit(void);
|
||||
|
||||
void HalPlayerVoDeinit(HalVideoOutputHdl handle);
|
||||
|
||||
int32_t HalCreateCameraVideoOutput(uint32_t deviceId, HalVideoOutputAttr *attr);
|
||||
|
||||
int32_t HalDestroyCameraVideoOutput();
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* End of #ifdef __cplusplus */
|
||||
|
||||
#endif /* End of #ifndef COMMON_PLATFORM_VO_H */
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2020-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 OHOS_CAMERA_HAL_H
|
||||
#define OHOS_CAMERA_HAL_H
|
||||
|
||||
#include "stdbool.h"
|
||||
#include "stdint.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif /* End of #ifdef __cplusplus */
|
||||
|
||||
#define HAL_MEDIA_OK 0
|
||||
#define HAL_MEDIA_ERR 1
|
||||
|
||||
typedef int32_t HalProcessorHdl;
|
||||
#define HAL_INVALID_PROCESSOR (-1)
|
||||
#define HAL_MAX_VPSS_NUM 10
|
||||
/* necessary and significant attr */
|
||||
typedef struct {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t fps;
|
||||
} HalVideoProcessorAttr;
|
||||
|
||||
HalProcessorHdl HalCreateVideoProcessor(HalVideoProcessorAttr *attr);
|
||||
void HalCameraGetProcessorAttr(HalProcessorHdl hdls[HAL_MAX_VPSS_NUM], HalVideoProcessorAttr attrs[HAL_MAX_VPSS_NUM],
|
||||
int32_t *size);
|
||||
uint32_t HalGetProcessorDeviceId(HalProcessorHdl hdl);
|
||||
void HalDestroyVideoProcessor();
|
||||
|
||||
/* camera */
|
||||
int32_t HalMediaInitialize();
|
||||
int32_t HalCameraInitialize();
|
||||
void HalCameraUnInitialize();
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* End of #ifdef __cplusplus */
|
||||
#endif // OHOS_CAMERA_HAL_H
|
||||
+39
-30
@@ -41,12 +41,12 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Media {
|
||||
constexpr int32_t MODULE_MEDIA = 1;
|
||||
constexpr int32_t SUBSYS_MEDIA = 30;
|
||||
constexpr int MODULE_MEDIA = 1;
|
||||
constexpr int SUBSYS_MEDIA = 30;
|
||||
|
||||
using ErrCode = int32_t;
|
||||
constexpr int32_t SUBSYSTEM_BIT_NUM = 21;
|
||||
constexpr int32_t MODULE_BIT_NUM = 16;
|
||||
constexpr int SUBSYSTEM_BIT_NUM = 21;
|
||||
constexpr int MODULE_BIT_NUM = 16;
|
||||
|
||||
/**
|
||||
* @brief Generates a start error code with a unique identifier based on specified subsystem and module bit numbers.
|
||||
@@ -64,32 +64,41 @@ constexpr ErrCode ErrCodeOffset(unsigned int subsystem, unsigned int module = 0)
|
||||
|
||||
constexpr int32_t BASE_MEDIA_ERR_OFFSET = ErrCodeOffset(SUBSYS_MEDIA, MODULE_MEDIA);
|
||||
|
||||
enum MediaErrorCode : int32_t {
|
||||
/** Invalid data size that has been read */
|
||||
ERR_INVALID_READ = -1,
|
||||
/** Success */
|
||||
SUCCESS = 0,
|
||||
/** Fail */
|
||||
ERROR = BASE_MEDIA_ERR_OFFSET,
|
||||
/** Status error */
|
||||
ERR_ILLEGAL_STATE = BASE_MEDIA_ERR_OFFSET + 1,
|
||||
/** Invalid parameter */
|
||||
ERR_INVALID_PARAM = BASE_MEDIA_ERR_OFFSET + 2,
|
||||
/** Early media preparation */
|
||||
ERR_EARLY_PREPARE = BASE_MEDIA_ERR_OFFSET + 3,
|
||||
/** No media source */
|
||||
ERR_SOURCE_NOT_SET = BASE_MEDIA_ERR_OFFSET + 4,
|
||||
/** Invalid operation */
|
||||
ERR_INVALID_OPERATION = BASE_MEDIA_ERR_OFFSET + 5,
|
||||
/** No idle channel */
|
||||
ERR_NOFREE_CHANNEL = BASE_MEDIA_ERR_OFFSET + 6,
|
||||
/** Buffer reading failed */
|
||||
ERR_READ_BUFFER = BASE_MEDIA_ERR_OFFSET + 7,
|
||||
/** Device not started */
|
||||
ERR_NOT_STARTED = BASE_MEDIA_ERR_OFFSET + 8,
|
||||
/** Unknown error */
|
||||
ERR_UNKNOWN = BASE_MEDIA_ERR_OFFSET + 200,
|
||||
};
|
||||
/** Invalid data size that has been read */
|
||||
const int32_t ERR_INVALID_READ = -1;
|
||||
|
||||
/** Success */
|
||||
const int32_t SUCCESS = 0;
|
||||
|
||||
/** Fail */
|
||||
const int32_t ERROR = BASE_MEDIA_ERR_OFFSET;
|
||||
|
||||
/** Status error */
|
||||
const int32_t ERR_ILLEGAL_STATE = BASE_MEDIA_ERR_OFFSET + 1;
|
||||
|
||||
/** Invalid parameter */
|
||||
const int32_t ERR_INVALID_PARAM = BASE_MEDIA_ERR_OFFSET + 2;
|
||||
|
||||
/** Early media preparation */
|
||||
const int32_t ERR_EARLY_PREPARE = BASE_MEDIA_ERR_OFFSET + 3;
|
||||
|
||||
/** No media source */
|
||||
const int32_t ERR_SOURCE_NOT_SET = BASE_MEDIA_ERR_OFFSET + 4;
|
||||
|
||||
/** Invalid operation */
|
||||
const int32_t ERR_INVALID_OPERATION = BASE_MEDIA_ERR_OFFSET + 5;
|
||||
|
||||
/** No idle channel */
|
||||
const int32_t ERR_NOFREE_CHANNEL = BASE_MEDIA_ERR_OFFSET + 6;
|
||||
|
||||
/** Buffer reading failed */
|
||||
const int32_t ERR_READ_BUFFER = BASE_MEDIA_ERR_OFFSET + 7;
|
||||
|
||||
/** Device not started */
|
||||
const int32_t ERR_NOT_STARTED = BASE_MEDIA_ERR_OFFSET + 8;
|
||||
|
||||
/** Unknown error */
|
||||
const int32_t ERR_UNKNOWN = BASE_MEDIA_ERR_OFFSET + 200;
|
||||
} // namespace Media
|
||||
} // namespace OHOS
|
||||
#endif // MEDIA_ERRORS_H
|
||||
|
||||
+12
-12
@@ -72,7 +72,7 @@ const std::string KEY_TIME_US = "timeUs";
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
enum AudioSourceType {
|
||||
typedef enum {
|
||||
/** Invalid audio source */
|
||||
AUDIO_SOURCE_INVALID = -1,
|
||||
/** Default audio source */
|
||||
@@ -105,7 +105,7 @@ enum AudioSourceType {
|
||||
AUDIO_HOTWORD = 1999,
|
||||
/** Extended remote submix */
|
||||
AUDIO_REMOTE_SUBMIX_EXTEND = 10007,
|
||||
};
|
||||
} AudioSourceType;
|
||||
|
||||
/**
|
||||
* @brief Defines the audio Device Descriptor.
|
||||
@@ -113,14 +113,14 @@ enum AudioSourceType {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
struct AudioDeviceDesc {
|
||||
typedef struct {
|
||||
/** Device name */
|
||||
std::string deviceName;
|
||||
/** Type of the audio input source */
|
||||
AudioSourceType inputSourceType;
|
||||
/** Bits 31-24: reserved bits; bits 23-16: mode ID; bits 15-8: device ID; bits 7-0: channel ID */
|
||||
uint32_t deviceId;
|
||||
};
|
||||
} AudioDeviceDesc;
|
||||
|
||||
/**
|
||||
* @brief Enumerates audio stream types.
|
||||
@@ -128,7 +128,7 @@ struct AudioDeviceDesc {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
enum AudioStreamType {
|
||||
typedef enum {
|
||||
/** Default audio stream type */
|
||||
TYPE_DEFAULT = -1,
|
||||
/** Media */
|
||||
@@ -155,7 +155,7 @@ enum AudioStreamType {
|
||||
TYPE_TTS = 10,
|
||||
/** Accessibility */
|
||||
TYPE_ACCESSIBILITY = 11,
|
||||
};
|
||||
} AudioStreamType;
|
||||
|
||||
/**
|
||||
* @brief Enumerates video codec formats.
|
||||
@@ -163,14 +163,14 @@ enum AudioStreamType {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
enum VideoCodecFormat {
|
||||
typedef enum {
|
||||
/** Default format */
|
||||
VIDEO_DEFAULT = 0,
|
||||
/** H.264 */
|
||||
H264 = 2,
|
||||
/** High Efficiency Video Coding (HEVC) */
|
||||
HEVC = 5,
|
||||
};
|
||||
} VideoCodecFormat;
|
||||
|
||||
/**
|
||||
* @brief Enumerates audio codec formats.
|
||||
@@ -178,7 +178,7 @@ enum VideoCodecFormat {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
enum AudioCodecFormat {
|
||||
typedef enum {
|
||||
/** Default format */
|
||||
AUDIO_DEFAULT = 0,
|
||||
/** Advanced Audio Coding Low Complexity (AAC-LC) */
|
||||
@@ -193,7 +193,7 @@ enum AudioCodecFormat {
|
||||
AAC_ELD = 5,
|
||||
/** Invalid value */
|
||||
FORMAT_BUTT,
|
||||
};
|
||||
} AudioCodecFormat;
|
||||
|
||||
/**
|
||||
* @brief Enumerates audio bit widths.
|
||||
@@ -201,7 +201,7 @@ enum AudioCodecFormat {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
enum AudioBitWidth {
|
||||
typedef enum {
|
||||
/** 8-bit width */
|
||||
BIT_WIDTH_8 = 8,
|
||||
/** 16-bit width */
|
||||
@@ -210,5 +210,5 @@ enum AudioBitWidth {
|
||||
BIT_WIDTH_24 = 24,
|
||||
/** Invalid value */
|
||||
BIT_WIDTH_BUTT,
|
||||
};
|
||||
} AudioBitWidth;
|
||||
#endif // MEDIA_INFO_H
|
||||
|
||||
Executable → Regular
@@ -176,17 +176,6 @@ public:
|
||||
*/
|
||||
explicit Source(const std::string& uri);
|
||||
|
||||
/**
|
||||
* @brief A constructor used to create a {@link Source} instance based on a specified URI and header.
|
||||
*
|
||||
* If the HTTP URL header does not carry valid information for network playback, this function is equivalent to
|
||||
* {@link Source(const std::string& uri)}.
|
||||
*
|
||||
* @param uri Indicates the media source URI.
|
||||
* @param header Indicates the header.
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
Source(const std::string &uri, const std::map<std::string, std::string> &header);
|
||||
|
||||
/**
|
||||
@@ -225,15 +214,6 @@ public:
|
||||
*/
|
||||
const std::string &GetSourceUri() const;
|
||||
|
||||
/**
|
||||
* @brief Obtains the HTTP header for the media source.
|
||||
*
|
||||
* This function is called only when the {@link SourceType} is {@link SOURCE_TYPE_URI}.
|
||||
*
|
||||
* @return Returns the media source header.
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
const std::map<std::string, std::string> &GetSourceHeader() const;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user