diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md
deleted file mode 100755
index f09d98d..0000000
--- a/.gitee/ISSUE_TEMPLATE.zh-CN.md
+++ /dev/null
@@ -1,13 +0,0 @@
-### 该问题是怎么引起的?
-
-
-
-### 重现步骤
-
-
-
-### 报错信息
-
-
-
-
diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
deleted file mode 100755
index 33948fd..0000000
--- a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
+++ /dev/null
@@ -1,15 +0,0 @@
-### 相关的Issue
-
-
-### 原因(目的、解决的问题等)
-
-
-### 描述(做了什么,变更了什么)
-
-
-### 测试用例(新增、改动、可能影响的功能)
-
-
-
-
-
diff --git a/BUILD.gn b/BUILD.gn
index e6db9d0..d361f88 100755
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -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",
+ ]
+}
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..f2a42ef
--- /dev/null
+++ b/README.md
@@ -0,0 +1,156 @@
+# MEDIA\_UTILS\_LITE
+
+- [Introduction](#section11660541593)
+- [Directory Structure](#section8685144625320)
+- [Usage](#section1648194512427)
+- [Constraints](#section161941989596)
+- [Repositories Involved](#section105062051111614)
+
+## Introduction
+
+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.
+
+
+
Code
+ |
+Macro
+ |
+Description
+ |
+
+
+0xffffffff
+ |
+ERR_INVALID_READ
+ |
+Data reading failed.
+ |
+
+0x0
+ |
+SUCCESS
+ |
+Operation succeeded.
+ |
+
+0x3c10000
+ |
+ERROR
+ |
+Operation failed.
+ |
+
+0x3c10001
+ |
+ERR_ILLEGAL_STATE
+ |
+Invalid status.
+ |
+
+0x2A05
+ |
+ERR_INVALID_PARAM
+ |
+Invalid parameter.
+ |
+
+0x3c10003
+ |
+ERR_EARLY_PREPARE
+ |
+Early start.
+ |
+
+0x3c10004
+ |
+ERR_SOURCE_NOT_SET
+ |
+Media source not set.
+ |
+
+0x3c10005
+ |
+ERR_INVALID_OPERATION
+ |
+Invalid operation.
+ |
+
+0x2A09
+ |
+ERR_NOFREE_CHANNEL
+ |
+No free channel.
+ |
+
+0x3c10007
+ |
+ERR_READ_BUFFER
+ |
+Error occurred during buffer reading.
+ |
+
+0x3c10008
+ |
+ERR_NOT_STARTED
+ |
+Device not started.
+ |
+
+0x3c100c8
+ |
+ERR_UNKNOWN
+ |
+Unknown error.
+ |
+
+
+
+
+**Figure 1** Position of this repository \(in the dotted blue box\) in the multimedia subsystem
+-in-the-multimedia-subsystem.png "position-of-this-repository-(in-the-dotted-blue-box)-in-the-multimedia-subsystem")
+
+## Directory Structure
+
+```
+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
+
+Build a single repository in the root directory.
+
+```
+# Select the development board.
+hb set
+# Build this repository.
+hb build media_service
+```
+
+## Constraints
+
+C++ 11 or later
+
+## Repositories Involved
+
+/hmf/multimedia/camera\_lite
+
+/hmf/multimedia/audio\_lite
+
+/hmf/multimedia/media\_lite
+
+/hmf/multimedia/service\_lite
+
diff --git a/README_zh.md b/README_zh.md
new file mode 100644
index 0000000..f0ea04c
--- /dev/null
+++ b/README_zh.md
@@ -0,0 +1,156 @@
+# 媒体子系统MEDIA\_UTILS\_LITE组件
+
+- [简介](#section11660541593)
+- [目录](#section8685144625320)
+- [使用说明](#section1648194512427)
+- [约束](#section161941989596)
+- [相关仓](#section105062051111614)
+
+## 简介
+
+提供媒体错误码等公用信息的定义,以及录制、播放音频和视频所需的数据类型。
+
+数据类型:
+
+- SourceType:播放片源类型
+- BufferFlags:Buffer承载数据标识
+- AudioSourceType:定义音频输入源类型枚举
+- AudioCodecFormat:定义音频数据格式枚举
+- AudioStreamType:定义音频流类型枚举
+- AudioBitWidth:定义采样位宽枚举
+
+错误码:
+
+
+错误代码
+ |
+宏定义
+ |
+描述
+ |
+
+
+0xffffffff
+ |
+ERR_INVALID_READ
+ |
+读数据失败
+ |
+
+0x0
+ |
+SUCCESS
+ |
+操作成功
+ |
+
+0x3c10000
+ |
+ERROR
+ |
+操作失败
+ |
+
+0x3c10001
+ |
+ERR_ILLEGAL_STATE
+ |
+状态错误
+ |
+
+0x2A05
+ |
+ERR_INVALID_PARAM
+ |
+参数无效
+ |
+
+0x3c10003
+ |
+ERR_EARLY_PREPARE
+ |
+媒体启动提前
+ |
+
+0x3c10004
+ |
+ERR_SOURCE_NOT_SET
+ |
+媒体源未设置
+ |
+
+0x3c10005
+ |
+ERR_INVALID_OPERATION
+ |
+无效操作
+ |
+
+0x2A09
+ |
+ERR_NOFREE_CHANNEL
+ |
+通道无空闲
+ |
+
+0x3c10007
+ |
+ERR_READ_BUFFER
+ |
+读缓冲区出错
+ |
+
+0x3c10008
+ |
+ERR_NOT_STARTED
+ |
+设备未启动
+ |
+
+0x3c100c8
+ |
+ERR_UNKNOWN
+ |
+未知错误
+ |
+
+
+
+
+**图 1** 媒体子系统架构(蓝色虚线框是media\_utils)
+.png "媒体子系统架构(蓝色虚线框是media_utils)")
+
+## 目录
+
+```
+foundation/multimedia/utils/lite
+├── include # 数据类型和媒体格式头文件
+└── hals # HAL层适配接口
+└── src # 数据类型和媒体格式实现
+```
+
+## 使用说明
+
+单仓的编译构建,在根目录下进行单仓的构建和编译
+
+```
+# 开发板选择
+hb set
+# 构建和编译
+hb build media_service
+```
+
+## 约束
+
+C++11版本或以上
+
+## 相关仓
+
+/hmf/multimedia/camera\_lite
+
+/hmf/multimedia/audio\_lite
+
+/hmf/multimedia/media\_lite
+
+/hmf/multimedia/service\_lite
+
diff --git a/figures/position-of-this-repository-(in-the-dotted-blue-box)-in-the-multimedia-subsystem.png b/figures/position-of-this-repository-(in-the-dotted-blue-box)-in-the-multimedia-subsystem.png
new file mode 100644
index 0000000..430bcfa
Binary files /dev/null and b/figures/position-of-this-repository-(in-the-dotted-blue-box)-in-the-multimedia-subsystem.png differ
diff --git a/figures/媒体子系统架构(蓝色虚线框是media_utils).png b/figures/媒体子系统架构(蓝色虚线框是media_utils).png
new file mode 100644
index 0000000..8d2a33f
Binary files /dev/null and b/figures/媒体子系统架构(蓝色虚线框是media_utils).png differ
diff --git a/hals/hal_display.h b/hals/hal_display.h
new file mode 100755
index 0000000..9690f9d
--- /dev/null
+++ b/hals/hal_display.h
@@ -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
+
+#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 */
diff --git a/hals/hal_media.h b/hals/hal_media.h
new file mode 100755
index 0000000..9fec07b
--- /dev/null
+++ b/hals/hal_media.h
@@ -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
\ No newline at end of file
diff --git a/include/media_errors.h b/include/media_errors.h
index dd74dda..44abe3d 100755
--- a/include/media_errors.h
+++ b/include/media_errors.h
@@ -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
diff --git a/include/media_info.h b/include/media_info.h
index dec3874..94ce91c 100755
--- a/include/media_info.h
+++ b/include/media_info.h
@@ -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
diff --git a/include/media_log.h b/include/media_log.h
old mode 100755
new mode 100644
diff --git a/include/source.h b/include/source.h
index 07b05f6..4b4027a 100755
--- a/include/source.h
+++ b/include/source.h
@@ -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 &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 &GetSourceHeader() const;
/**
diff --git a/readme.md b/readme.md
deleted file mode 100755
index ec3c557..0000000
--- a/readme.md
+++ /dev/null
@@ -1,3 +0,0 @@
-详见:https://gitee.com/openharmony/docs/blob/master/readme/媒体子系统README.md
-
-see: https://gitee.com/openharmony/docs/blob/master/docs-en/readme/media-subsystem.md