multimedia.md 8.7 KB
Newer Older
M
mamingshuai 已提交
1
# Multimedia<a name="EN-US_TOPIC_0000001078026808"></a>
W
wenjun 已提交
2

M
mamingshuai 已提交
3
## Introduction<a name="section11660541593"></a>
W
wenjun 已提交
4

M
mamingshuai 已提交
5
The multimedia subsystem provides a set of simple and easy-to-use APIs for you to access the system and media resources.
W
wenjun 已提交
6

M
mamingshuai 已提交
7
This subsystem offers various media services covering audio, videos, and cameras, which provide the following capabilities:
L
liudongmiao 已提交
8

M
mamingshuai 已提交
9 10 11
-   Audio playback and recording
-   Video playback and recording
-   Photographing and recording \(with cameras\)
W
wenjun 已提交
12

W
wusongqing 已提交
13
## System Architecture<a name="section11660541594"></a>
W
wenjun 已提交
14

W
wusongqing 已提交
15
**Figure 1** Architecture of the multimedia subsystem<a name="fig99659301300"></a>
W
wenjun 已提交
16

W
wusongqing 已提交
17
![](figures/multimedia-architecture.png)
W
wenjun 已提交
18

W
wusongqing 已提交
19 20
- **Media**: provides playback and recording APIs for applications, and invokes the Gstreamer, Histreamer, or other engines through cross-process calling or direct calling.
  - For the mini system, the media component invokes Histreamer to support audio playback.
J
jiaoyanlin3 已提交
21
  - For the small system, the media component invokes recorder_lite to support audio/video recording and invokes player_lite by default to support audio/video playback. If the system variable **debug.media_service.histreamer** is set to **1**, the component invokes Histreamer to support audio/video playback. For details, see [syspara Module](https://gitee.com/openharmony/docs/blob/master/en/device-dev/subsystems/subsys-boot-init-sysparam.md) or [syspara_lite](https://gitee.com/openharmony/startup_syspara_lite).
W
wusongqing 已提交
22 23 24 25 26 27 28
  - For the standard system, the media component invokes Gstreamer to support audio/video playback and recording.
- **Audio**: supports audio input and output, policy management, and audio focus management.
- **Camera**: provides camera operation APIs for preview, photographing, and video recording.
- **Image**: supports encoding and decoding of common image formats.
- **MediaLibrary**: supports local and distributed media data access management.
- **Histreamer**: a lightweight media engine that supports file/network streaming media input, audio/video decoding and playback, audio/video encoding and recording, and plugin extension.
- **Gstreamer**: an open-source GStreamer engine that supports streaming media, audio and video playback, and recording.
M
mamingshuai 已提交
29 30 31 32

## Directory Structure<a name="section161941989596"></a>

The structure of the repository directory is as follows:
L
liudongmiao 已提交
33 34

```
M
mamingshuai 已提交
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
/foundation/multimedia                                 # Service code
├── audio_lite                                         # Audio module for the small system
│   ├── figures                                        # Architecture and process figures of the audio module for the small system
│   ├── frameworks                                     # Audio framework implementation for the small system
│   └── interfaces                                     # Audio module APIs for the small system
├── audio_standard                                     # Audio module for the standard system
│   ├── figures                                        # Architecture and process figures of the audio module for the standard system
│   ├── frameworks                                     # Audio framework implementation for the standard system
│   ├── interfaces                                     # Audio module APIs for the standard system
│   ├── sa_profile                                     # Audio service profile for the standard system
│   └── services                                       # Audio service implementation for the standard system
├── camera_lite                                        # Camera module for the small system
│   ├── figures                                        # Architecture and process figures of the camera module for the small system
│   ├── frameworks                                     # Camera framework implementation for the small system
│   └── interfaces                                     # Camera module APIs for the small system
├── camera_standard                                    # Camera module for the standard system
│   ├── figures                                        # Architecture and process figures of the camera module for the standard system
│   ├── frameworks                                     # Camera framework implementation for the standard system
│   └── interfaces                                     # Camera module APIs for the standard system
├── media_lite                                         # Playback and recording module for the small system
│   ├── figures                                        # Architecture and process figures of the playback and recording module for the small system
│   ├── frameworks                                     # Playback and recording framework implementation for the small system
│   ├── interfaces                                     # Playback and recording module APIs for the small system
│   └── services                                       # Playback and recording service implementation for the small system
├── media_standard                                     # Playback and recording module for the standard system
│   ├── figures                                        # Architecture and process figures of the playback and recording module for the standard system
│   ├── frameworks                                     # Playback and recording framework implementation for the standard system
│   └── interfaces                                     # Playback and recording module APIs for the standard system
W
wusongqing 已提交
63 64 65 66 67 68 69
├── histreamer                                         # Histreamer engine
│   └── engine                                         # Media engine
│       ├── player                                     # Encapsulated player
│       ├── foundation                                 # Basic tools
│       ├── pipeline                                   # Pipeline framework
│       └── plugin                                     # Plugin framework
│           └── plugins                                # Platform software plugins
M
mamingshuai 已提交
70 71 72 73 74 75
└── utils                                              # Subsystem utility module
    └── lite                                           # Utility module for the small system
        ├── figures                                    # Architecture and process figures of the utility module for the small system
        ├── hals                                       # Hardware abstraction interfaces of the subsystem for the small system
        ├── interfaces                                 # Utility module APIs for the standard system
        └── src                                        # Utility module framework implementation for the small system
L
liudongmiao 已提交
76
```
W
wenjun 已提交
77

M
mamingshuai 已提交
78
## Constraints<a name="section119744591305"></a>
W
wenjun 已提交
79

M
mamingshuai 已提交
80
Hardware-based decoding and encoding functions of audio and video data are device-specific.
W
wenjun 已提交
81

M
mamingshuai 已提交
82
## Usage Guidelines<a name="section1312121216216"></a>
W
wenjun 已提交
83

M
mamingshuai 已提交
84
You can use the APIs in any of the provided classes based on your development requirements.
H
harmony_zhangjian 已提交
85

J
jiaoyanlin3 已提交
86
-   For details about how to call media APIs to implement the video recording, preview, and playback, see  [Multimedia Development Guide](https://gitee.com/openharmony/docs/tree/master/en/application-dev/media).
M
mamingshuai 已提交
87 88 89
-   For a simple player, use  **Player**  and  **Recorder**  classes to quickly implement the playback and recording features.
-   The  **CameraKit**  class provides a group of effective methods for controlling a camera, which facilitates the camera development.
-   You can create a  **CameraKit**  object and register various callbacks to respond to many events in the multimedia module. Then, create a  **Camera**  object to operate camera resources, for example, to start preview, recording, and stream capturing, and set related parameters.
W
wenjun 已提交
90

M
mamingshuai 已提交
91
## Installation<a name="section11914418405"></a>
W
wenjun 已提交
92

93
Load the kernel and related drivers before installing the repository. For details, see readme files of kernel and driver subsystems.
H
harmony_zhangjian 已提交
94

M
mamingshuai 已提交
95
## Repositories Involved<a name="section1371113476307"></a>
W
wenjun 已提交
96

97
[multimedia\_camera\_lite](https://gitee.com/openharmony/multimedia_camera_lite)
W
wenjun 已提交
98

99
[multimedia\_audio\_lite](https://gitee.com/openharmony/multimedia_audio_lite)
W
wenjun 已提交
100

101
[multimedia\_media\_lite](https://gitee.com/openharmony/multimedia_media_lite)
W
wenjun 已提交
102

103
[multimedia\_utils\_lite](https://gitee.com/openharmony/multimedia_utils_lite)
W
wenjun 已提交
104

W
wusongqing 已提交
105 106
[multimedia\_histreamer](https://gitee.com/openharmony/multimedia_histreamer)

107
[multimedia\_camera\_standard](https://gitee.com/openharmony/multimedia_camera_standard)
W
wenjun 已提交
108

109
[multimedia\_audio\_standard](https://gitee.com/openharmony/multimedia_audio_standard)
W
wenjun 已提交
110

111
[multimedia\_media\_standard](https://gitee.com/openharmony/multimedia_media_standard)