1094332d3Sopenharmony_ci/*
2094332d3Sopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License.
5094332d3Sopenharmony_ci * You may obtain a copy of the License at
6094332d3Sopenharmony_ci *
7094332d3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8094332d3Sopenharmony_ci *
9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and
13094332d3Sopenharmony_ci * limitations under the License.
14094332d3Sopenharmony_ci */
15094332d3Sopenharmony_ci
16094332d3Sopenharmony_ci/**
17094332d3Sopenharmony_ci * @addtogroup Audio
18094332d3Sopenharmony_ci * @{
19094332d3Sopenharmony_ci *
20094332d3Sopenharmony_ci * @brief Defines audio-related APIs, including custom data types and functions for loading drivers,
21094332d3Sopenharmony_ci * accessing a driver adapter, and rendering and capturing audios.
22094332d3Sopenharmony_ci *
23094332d3Sopenharmony_ci * @since 1.0
24094332d3Sopenharmony_ci * @version 1.0
25094332d3Sopenharmony_ci */
26094332d3Sopenharmony_ci
27094332d3Sopenharmony_ci/**
28094332d3Sopenharmony_ci * @file audio_capture.h
29094332d3Sopenharmony_ci *
30094332d3Sopenharmony_ci * @brief Declares APIs for audio capturing.
31094332d3Sopenharmony_ci *
32094332d3Sopenharmony_ci * @since 1.0
33094332d3Sopenharmony_ci * @version 1.0
34094332d3Sopenharmony_ci */
35094332d3Sopenharmony_ci
36094332d3Sopenharmony_ci#ifndef AUDIO_CAPTURE_H
37094332d3Sopenharmony_ci#define AUDIO_CAPTURE_H
38094332d3Sopenharmony_ci
39094332d3Sopenharmony_ci#include "audio_types.h"
40094332d3Sopenharmony_ci#include "audio_control.h"
41094332d3Sopenharmony_ci#include "audio_attribute.h"
42094332d3Sopenharmony_ci#include "audio_scene.h"
43094332d3Sopenharmony_ci#include "audio_volume.h"
44094332d3Sopenharmony_ci
45094332d3Sopenharmony_ci/**
46094332d3Sopenharmony_ci * @brief Provides capabilities for audio capturing, including controlling the capturing, setting audio attributes,
47094332d3Sopenharmony_ci * scenes, and volume, and capturing audio frames.
48094332d3Sopenharmony_ci *
49094332d3Sopenharmony_ci * @see AudioControl
50094332d3Sopenharmony_ci * @see AudioAttribute
51094332d3Sopenharmony_ci * @see AudioScene
52094332d3Sopenharmony_ci * @see AudioVolume
53094332d3Sopenharmony_ci * @since 1.0
54094332d3Sopenharmony_ci * @version 1.0
55094332d3Sopenharmony_ci */
56094332d3Sopenharmony_cistruct AudioCapture {
57094332d3Sopenharmony_ci    /**
58094332d3Sopenharmony_ci     * @brief Defines the audio control. For details, see {@link AudioControl}.
59094332d3Sopenharmony_ci     */
60094332d3Sopenharmony_ci    struct AudioControl control;
61094332d3Sopenharmony_ci    /**
62094332d3Sopenharmony_ci     * @brief Defines the audio attribute. For details, see {@link AudioAttribute}.
63094332d3Sopenharmony_ci     */
64094332d3Sopenharmony_ci    struct AudioAttribute attr;
65094332d3Sopenharmony_ci    /**
66094332d3Sopenharmony_ci     * @brief Defines the audio scene. For details, see {@link AudioScene}.
67094332d3Sopenharmony_ci     */
68094332d3Sopenharmony_ci    struct AudioScene scene;
69094332d3Sopenharmony_ci    /**
70094332d3Sopenharmony_ci     * @brief Defines audio volume. For details, see {@link AudioVolume}.
71094332d3Sopenharmony_ci     */
72094332d3Sopenharmony_ci    struct AudioVolume volume;
73094332d3Sopenharmony_ci
74094332d3Sopenharmony_ci    /**
75094332d3Sopenharmony_ci     * @brief Reads a frame of input data (uplink data) from the audio driver for capturing.
76094332d3Sopenharmony_ci     *
77094332d3Sopenharmony_ci     * @param capture Indicates the pointer to the <b>AudioCapture</b> object to operate.
78094332d3Sopenharmony_ci     * @param frame Indicates the pointer to the input data to read.
79094332d3Sopenharmony_ci     * @param requestBytes Indicates the size of the input data, in bytes.
80094332d3Sopenharmony_ci     * @param replyBytes Indicates the pointer to the actual length (in bytes) of the audio data to read.
81094332d3Sopenharmony_ci     * @return Returns <b>0</b> if the input data is read successfully; returns a negative value otherwise.
82094332d3Sopenharmony_ci     */
83094332d3Sopenharmony_ci    int32_t (*CaptureFrame)(struct AudioCapture *capture, void *frame, uint64_t requestBytes, uint64_t *replyBytes);
84094332d3Sopenharmony_ci
85094332d3Sopenharmony_ci    /**
86094332d3Sopenharmony_ci     * @brief Obtains the last number of input audio frames.
87094332d3Sopenharmony_ci     *
88094332d3Sopenharmony_ci     * @param capture Indicates the pointer to the <b>AudioCapture</b> object to operate.
89094332d3Sopenharmony_ci     * @param frames Indicates the pointer to the last number of input audio frames.
90094332d3Sopenharmony_ci     * @param time Indicates the pointer to the timestamp associated with the frame.
91094332d3Sopenharmony_ci     * @return Returns <b>0</b> if the last number is obtained; returns a negative value otherwise.
92094332d3Sopenharmony_ci     * @see CaptureFrame
93094332d3Sopenharmony_ci     */
94094332d3Sopenharmony_ci    int32_t (*GetCapturePosition)(struct AudioCapture *capture, uint64_t *frames, struct AudioTimeStamp *time);
95094332d3Sopenharmony_ci};
96094332d3Sopenharmony_ci
97094332d3Sopenharmony_ci#endif /* AUDIO_CAPTURE_H */
98094332d3Sopenharmony_ci/** @} */
99