• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @addtogroup LowPowerPlayer
18 * @{
19 *
20 * @ @brief Provides unified APIs for media services to access low power player drivers.
21 *
22 * The media service can obtain a low power player driver object or proxy, and then invoke the
23 * API provided by the object or proxy, The module provides APIs for initializing the custom data
24 * and audio and video codecs, setting parameters, and controlling and transferring data.
25 *
26 * @since 6.0
27 * @version 1.0
28 */
29
30package ohos.hdi.low_power_player.v1_0;
31
32import ohos.hdi.low_power_player.v1_0.ILppAudioSinkCallback;
33
34/**
35 * @brief Defines the APIs for the low power player audio sink adapter.
36 *
37 * The APIs can be used to:
38 * - Creates and controls the hifiAdpter module.
39 * - Provides the channels for the bottom layer to callback data and write data to the bottom layer.
40 * - Supports the anchor update and computing synchronization on core A.
41 * - Obtains the hifiAdapter instance IDs.
42 * For details, see the description of the APIs.
43 */
44
45interface ILppAudioSinkAdapter {
46    /**
47     * @brief Obtains the audio channel Id.
48     *
49     * @param channelId Indicates the hifiAdapter instance IDs.
50     *
51     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
52     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
53     *
54     * @since 6.0
55     * @version 1.0
56     */
57    GetChannelID([out] unsigned int channelId);
58
59    /**
60     * @brief Starts.
61     *
62     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
63     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
64     *
65     * @since 6.0
66     * @version 1.0
67     */
68    Start();
69
70    /**
71     * @brief Pauses.
72     *
73     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
74     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
75     *
76     * @since 6.0
77     * @version 1.0
78     */
79    Pause();
80
81    /**
82     * @brief Resumes.
83     *
84     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
85     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
86     *
87     * @since 6.0
88     * @version 1.0
89     */
90    Resume();
91
92    /**
93     * @brief Flushs audio data.
94     *
95     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
96     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
97     *
98     * @since 6.0
99     * @version 1.0
100     */
101    Flush();
102
103    /**
104     * @brief Stops.
105     *
106     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
107     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
108     *
109     * @since 6.0
110     * @version 1.0
111     */
112    Stop();
113
114    /**
115     * @brief Resets.
116     *
117     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
118     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
119     *
120     * @since 6.0
121     * @version 1.0
122     */
123    Reset();
124
125    /**
126     * @brief Registers the Callback for lpp audio sink adapter.
127     *
128     *
129     *
130     * @param sinkCallback Indicates the callback to register.
131     *
132     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
133     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
134     *
135     * @since 6.0
136     * @version 1.0
137     */
138    RegisterCallback([in] ILppAudioSinkCallback sinkCallback);
139
140    /**
141     * @brief Sets the parameter for this component, that is, sends an initialization parameter
142     * structure to the component.
143     *
144     *
145     *
146     * @param parameter Indicates the Key-value pair parameter for configuration item extension.
147     *
148     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
149     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
150     *
151     * @since 6.0
152     * @version 1.0
153     */
154    SetParameter([in] Map<String, String> parameter);
155
156    /**
157     * @brief Obtains the parameter settings of this component.
158     *
159     *
160     *
161     * @param parameter Indicates the Key-value pair parameter for configuration item extension.
162     *
163     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
164     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
165     *
166     * @since 6.0
167     * @version 1.0
168     */
169    GetParameter([out] Map<String, String> parameter);
170
171    /**
172     * @brief writes the audio data.
173     *
174     *
175     * @param ptr Indicates the audio data.
176     * @param size Indicates the audio data size.
177     * @param size Indicates size of the audio data that has been written.
178     *
179     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
180     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
181     *
182     * @since 6.0
183     * @version 1.0
184     */
185    WriteAudioData([in] byte ptr, [in] unsigned int size, [out] unsigned int writtenSize);
186
187    /**
188     * @brief Obtains the current playback progress.
189     *
190     *
191     *
192     * @param currentPts Indicates the current pts.
193     *
194     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
195     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
196     *
197     * @since 6.0
198     * @version 1.0
199     */
200    GetCurrentTime([out] long currentPts);
201
202    /**
203     * @brief Sets the playback speed.
204     *
205     *
206     *
207     * @param speed Indicates the speed of audio playback.
208     *
209     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
210     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
211     *
212     * @since 6.0
213     * @version 1.0
214     */
215    SetPlaybackSpeed([in] float speed);
216}
217