• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Multimedia<a name="EN-US_TOPIC_0000001078026808"></a>
2
3## Introduction<a name="section11660541593"></a>
4
5The multimedia subsystem provides a set of simple and easy-to-use APIs for you to access the system and media resources.
6
7This subsystem offers various media services covering audio, videos, and cameras, which provide the following capabilities:
8
9-   Audio playback and recording
10-   Video playback and recording
11-   Photographing and recording \(with cameras\)
12
13## System Architecture<a name="section11660541594"></a>
14
15**Figure 1** Architecture of the multimedia subsystem<a name="fig99659301300"></a>
16
17![](figures/multimedia-architecture.png)
18
19- **Media**: provides playback and recording APIs for applications, and invokes the Gstreamer, Histreamer, or other engines through cross-process calling or direct calling.
20  - For the mini system, the media component invokes Histreamer to support audio playback.
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).
22  - For the standard system, the media component invokes Gstreamer to support audio/video playback and recording.
23- **Audio**: supports audio input and output, policy management, and audio focus management.
24- **Camera**: provides camera operation APIs for preview, photographing, and video recording.
25- **Image**: supports encoding and decoding of common image formats.
26- **MediaLibrary**: supports local and distributed media data access management.
27- **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.
28- **Gstreamer**: an open-source GStreamer engine that supports streaming media, audio and video playback, and recording.
29
30## Directory Structure<a name="section161941989596"></a>
31
32The structure of the repository directory is as follows:
33
34```
35/foundation/multimedia                                 # Service code
36├── audio_lite                                         # Audio module for the small system
37│   ├── figures                                        # Architecture and process figures of the audio module for the small system
38│   ├── frameworks                                     # Audio framework implementation for the small system
39│   └── interfaces                                     # Audio module APIs for the small system
40├── audio_standard                                     # Audio module for the standard system
41│   ├── figures                                        # Architecture and process figures of the audio module for the standard system
42│   ├── frameworks                                     # Audio framework implementation for the standard system
43│   ├── interfaces                                     # Audio module APIs for the standard system
44│   ├── sa_profile                                     # Audio service profile for the standard system
45│   └── services                                       # Audio service implementation for the standard system
46├── camera_lite                                        # Camera module for the small system
47│   ├── figures                                        # Architecture and process figures of the camera module for the small system
48│   ├── frameworks                                     # Camera framework implementation for the small system
49│   └── interfaces                                     # Camera module APIs for the small system
50├── camera_standard                                    # Camera module for the standard system
51│   ├── figures                                        # Architecture and process figures of the camera module for the standard system
52│   ├── frameworks                                     # Camera framework implementation for the standard system
53│   └── interfaces                                     # Camera module APIs for the standard system
54├── media_lite                                         # Playback and recording module for the small system
55│   ├── figures                                        # Architecture and process figures of the playback and recording module for the small system
56│   ├── frameworks                                     # Playback and recording framework implementation for the small system
57│   ├── interfaces                                     # Playback and recording module APIs for the small system
58│   └── services                                       # Playback and recording service implementation for the small system
59├── media_standard                                     # Playback and recording module for the standard system
60│   ├── figures                                        # Architecture and process figures of the playback and recording module for the standard system
61│   ├── frameworks                                     # Playback and recording framework implementation for the standard system
62│   └── interfaces                                     # Playback and recording module APIs for the standard system
63├── histreamer                                         # Histreamer engine
64│   └── engine                                         # Media engine
65│       ├── player                                     # Encapsulated player
66│       ├── foundation                                 # Basic tools
67│       ├── pipeline                                   # Pipeline framework
68│       └── plugin                                     # Plugin framework
69│           └── plugins                                # Platform software plugins
70└── utils                                              # Subsystem utility module
71    └── lite                                           # Utility module for the small system
72        ├── figures                                    # Architecture and process figures of the utility module for the small system
73        ├── hals                                       # Hardware abstraction interfaces of the subsystem for the small system
74        ├── interfaces                                 # Utility module APIs for the standard system
75        └── src                                        # Utility module framework implementation for the small system
76```
77
78## Constraints<a name="section119744591305"></a>
79
80Hardware-based decoding and encoding functions of audio and video data are device-specific.
81
82## Usage Guidelines<a name="section1312121216216"></a>
83
84You can use the APIs in any of the provided classes based on your development requirements.
85
86-   For details about how to call media APIs to implement the video recording, preview, and playback, see  [Multimedia Development Guide](../application-dev/media).
87-   For a simple player, use  **Player**  and  **Recorder**  classes to quickly implement the playback and recording features.
88-   The  **CameraKit**  class provides a group of effective methods for controlling a camera, which facilitates the camera development.
89-   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.
90
91## Installation<a name="section11914418405"></a>
92
93Load the kernel and related drivers before installing the repository. For details, see readme files of kernel and driver subsystems.
94
95## Repositories Involved<a name="section1371113476307"></a>
96
97[multimedia\_camera\_lite](https://gitee.com/openharmony/multimedia_camera_lite)
98
99[multimedia\_audio\_lite](https://gitee.com/openharmony/multimedia_audio_lite)
100
101[multimedia\_media\_lite](https://gitee.com/openharmony/multimedia_media_lite)
102
103[multimedia\_utils\_lite](https://gitee.com/openharmony/multimedia_utils_lite)
104
105[multimedia\_histreamer](https://gitee.com/openharmony/multimedia_histreamer)
106
107[multimedia\_camera\_standard](https://gitee.com/openharmony/multimedia_camera_standard)
108
109[multimedia\_audio\_standard](https://gitee.com/openharmony/multimedia_audio_standard)
110
111[multimedia\_media\_standard](https://gitee.com/openharmony/multimedia_media_standard)
112