• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 LowPowerVideoSink
18  * @{
19  *
20  * @brief The LowPowerVideoSink sub module provides variables, properties, and functions
21  * for lowpower video sink.
22  *
23  * @since 20
24  */
25 
26 /**
27  * @file lowpower_video_sink.h
28  *
29  * @brief Declare the Native API used for lowpower video sink.
30  *
31  * @library liblowpower_avsink.so
32  * @kit MediaKit
33  * @syscap SystemCapability.Multimedia.Media.LowPowerAVSink
34  * @since 20
35  */
36 
37 #ifndef NATIVE_LOWPOWER_VIDEO_SINK_H
38 #define NATIVE_LOWPOWER_VIDEO_SINK_H
39 
40 #include <stdint.h>
41 #include "native_averrors.h"
42 #include "native_avformat.h"
43 #include "lowpower_avsink_base.h"
44 #include "lowpower_video_sink_base.h"
45 #include "lowpower_audio_sink_base.h"
46 #include "native_window/external_window.h"
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 /**
53  * @brief Creates a lowpower video sink instance from the mime type, which is recommended in most cases.
54  *
55  * @param {const char*} mime mime type description string, refer to {@link AVCODEC_MIME_TYPE}
56  * @return Returns a Pointer to an OH_LowPowerVideoSink instance.
57  * Return nullptr if memory ran out or the mime type is not supported.
58  * @since 20
59  */
60 OH_LowPowerVideoSink* OH_LowPowerVideoSink_CreateByMime(const char* mime);
61 
62 /**
63  * @brief To configure the lowpower video sink, typically, you need to configure the description information of the
64  * decoded video track, which can be extracted from the OH_AVSource. This interface must be called before Prepare
65  * is called.
66  *
67  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
68  * @param {OH_AVFormat*} format A pointer to an OH_AVFormat to give the description of the video track to be decoded,
69  * key of format refer to lowpower_avsink_base.h
70  * @return Returns AV_ERR_OK if the execution is successful,
71  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
72  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
73  * {@link AV_ERR_UNSUPPORT} unsupported format.
74  * {@link AV_ERR_SERVICE_DIED} media service is died.
75  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
76  * @since 20
77  */
78 OH_AVErrCode OH_LowPowerVideoSink_Configure(OH_LowPowerVideoSink* sink, const OH_AVFormat* format);
79 
80 /**
81  * @brief Set dynamic parameters to the lowpower video sink.
82  * Note: This interface can only be called after the decoder is started.
83  * At the same time, incorrect parameter settings may cause video sink failure.
84  *
85  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
86  * @param {OH_AVFormat*} format pointer to an OH_AVFormat instance, key of format refer to lowpower_avsink_base.h
87  * @return Returns AV_ERR_OK if the execution is successful,
88  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
89  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
90  * {@link AV_ERR_UNSUPPORT} unsupported format.
91  * {@link AV_ERR_SERVICE_DIED} media service is died.
92  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
93  * @since 20
94  */
95 OH_AVErrCode OH_LowPowerVideoSink_SetParameter(OH_LowPowerVideoSink* sink, const OH_AVFormat* format);
96 
97 /**
98  * @brief Get parameter of current lowpower video sink.
99  *
100  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
101  * @param {OH_AVFormat*} format pointer to an OH_AVFormat instance, key of format refer to lowpower_avsink_base.h
102  * @return Returns AV_ERR_OK if the execution is successful,
103  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
104  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
105  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
106  * @since 20
107  */
108 OH_AVErrCode OH_LowPowerVideoSink_GetParameter(OH_LowPowerVideoSink* sink, OH_AVFormat* format);
109 
110 /**
111  * @brief Specify the output Surface to provide decoded lowpower video sink,
112  * this interface must be called before Prepare is called. In the executing state, it can be called directly.
113  *
114  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
115  * @param {OHNativeWindow*} surface A pointer to a OHNativeWindow instance, see {@link OHNativeWindow}
116  * @return Returns AV_ERR_OK if the execution is successful,
117  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
118  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
119  * {@link AV_ERR_SERVICE_DIED} media service is died.
120  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
121  * @since 20
122  */
123 OH_AVErrCode OH_LowPowerVideoSink_SetVideoSurface(OH_LowPowerVideoSink* sink, const OHNativeWindow* surface);
124 
125 /**
126  * @brief To prepare the internal resources of the lowpower video sink, the Configure interface must be called before
127  * calling this interface.
128  *
129  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
130  * @return Returns AV_ERR_OK if the execution is successful,
131  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
132  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
133  * {@link AV_ERR_UNSUPPORT} unsupported format.
134  * {@link AV_ERR_SERVICE_DIED} media service is died.
135  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
136  * @since 20
137  */
138 OH_AVErrCode OH_LowPowerVideoSink_Prepare(OH_LowPowerVideoSink* sink);
139 
140 /**
141  * @brief Start decoder of the lowpower video sink, this interface must be called after the Prepare is successful.
142  * After being successfully started, the lowpower audio sink will start reporting DataNeeded events.
143  *
144  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
145  * @return Returns AV_ERR_OK if the execution is successful,
146  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
147  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
148  * {@link AV_ERR_UNSUPPORT} unsupported format.
149  * {@link AV_ERR_SERVICE_DIED} media service is died.
150  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
151  * @since 20
152  */
153 OH_AVErrCode OH_LowPowerVideoSink_StartDecoder(OH_LowPowerVideoSink* sink);
154 
155 /**
156  * @brief Render first frame of video sink, this interface must be called after the StartDecode is successful and
157  * onFirstFrameDecoded is called.
158  *
159  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
160  * @return Returns AV_ERR_OK if the execution is successful,
161  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
162  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
163  * {@link AV_ERR_SERVICE_DIED} media service is died.
164  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
165  * @since 20
166  */
167 OH_AVErrCode OH_LowPowerVideoSink_RenderFirstFrame(OH_LowPowerVideoSink* sink);
168 
169 /**
170  * @brief Start renderer of the lowpower video sink, this interface must be called after the StartDecode is successful.
171  *
172  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
173  * @return Returns AV_ERR_OK if the execution is successful,
174  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
175  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
176  * {@link AV_ERR_UNSUPPORT} unsupported format.
177  * {@link AV_ERR_SERVICE_DIED} media service is died.
178  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
179  * @since 20
180  */
181 OH_AVErrCode OH_LowPowerVideoSink_StartRenderer(OH_LowPowerVideoSink* sink);
182 
183 /**
184  * @brief Pause the lowpower video sink, this interface must be called after the StartRender or Resume is successful.
185  * After being successfully paused, the lowpower video sink will pause reporting DataNeeded events..
186  *
187  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
188  * @return Returns AV_ERR_OK if the execution is successful,
189  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
190  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
191  * {@link AV_ERR_SERVICE_DIED} media service is died.
192  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
193  * @since 20
194  */
195 OH_AVErrCode OH_LowPowerVideoSink_Pause(OH_LowPowerVideoSink* sink);
196 
197 /**
198  * @brief Resume the lowpower video sink, this interface must be called after the Pause is successful.
199  * After being successfully resumed, the lowpower video sink will resume reporting DataNeeded events.
200  *
201  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSinkinstance
202  * @return Returns AV_ERR_OK if the execution is successful,
203  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
204  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
205  * {@link AV_ERR_SERVICE_DIED} media service is died.
206  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
207  * @since 20
208  */
209 OH_AVErrCode OH_LowPowerVideoSink_Resume(OH_LowPowerVideoSink* sink);
210 
211 /**
212  * @brief Clear cache data in the lowpower video sink, this interface is suggested to not be called after the Start
213  * or Resume. It should be noted that need to re-enter if the codec has been input before Codec-Specific-Data.
214  *
215  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
216  * @return Returns AV_ERR_OK if the execution is successful,
217  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
218  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
219  * {@link AV_ERR_SERVICE_DIED} media service is died.
220  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
221  * @since 20
222  */
223 OH_AVErrCode OH_LowPowerVideoSink_Flush(OH_LowPowerVideoSink* sink);
224 
225 /**
226  * @brief Stop the lowpower video sink.
227  *
228  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
229  * @return Returns AV_ERR_OK if the execution is successful,
230  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
231  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
232  * {@link AV_ERR_SERVICE_DIED} media service is died.
233  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
234  * @since 20
235  */
236 OH_AVErrCode OH_LowPowerVideoSink_Stop(OH_LowPowerVideoSink* sink);
237 
238 /**
239  * @brief Reset the lowpower video sink. Too reuse this instance, you need to call the Configure.
240  *
241  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
242  * @return Returns AV_ERR_OK if the execution is successful,
243  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
244  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
245  * {@link AV_ERR_SERVICE_DIED} media service is died.
246  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
247  * @since 20
248  */
249 OH_AVErrCode OH_LowPowerVideoSink_Reset(OH_LowPowerVideoSink* sink);
250 
251 /**
252  * @brief Clear the internal resources of the lowpower video sink and destroy the lowpower video sink instance.
253  *
254  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
255  * @return Returns AV_ERR_OK if the execution is successful,
256  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
257  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
258  * {@link AV_ERR_SERVICE_DIED} media service is died.
259  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
260  * @since 20
261  */
262 OH_AVErrCode OH_LowPowerVideoSink_Destroy(OH_LowPowerVideoSink* sink);
263 
264 /**
265  * @brief Set the lowpower audio sink instance to the lowpower video sink instance for audio video sync.
266  *
267  * @param {OH_LowPowerVideoSink*} videoSink Pointer to an OH_LowPowerVideoSink instance
268  * @param {OH_LowPowerAudioSink*} audioSink Pointer to an OH_LowPowerAudioSink instance
269  * @return Returns AV_ERR_OK if the execution is successful,
270  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
271  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
272  * {@link AV_ERR_SERVICE_DIED} media service is died.
273  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
274  * @since 20
275  */
276 OH_AVErrCode OH_LowPowerVideoSink_SetSyncAudioSink(
277     OH_LowPowerVideoSink* videoSink, OH_LowPowerAudioSink* audioSink);
278 
279 /**
280  * @brief Set target start frame pts, and the video frame will be renderred from the target pts.
281  *
282  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
283  * @param {const int64_t} framePts target video frame pts
284  * @param {OH_LowPowerVideoSink_OnTargetArrived*} onTargetArrived OH_LowPowerVideoSink_OnTargetArrived func,
285  * will be called once, refer to {@link OH_LowPowerVideoSink_OnTargetArrived}
286  * @param {const int64_t} timeoutMs if wait first frame over timeoutMs, onTargetArrived will be called directly.
287  * @param {void *} userData User specific data
288  * @return Returns AV_ERR_OK if the execution is successful,
289  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
290  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
291  * {@link AV_ERR_SERVICE_DIED} media service is died.
292  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
293  * @since 20
294  */
295 OH_AVErrCode OH_LowPowerVideoSink_SetTargetStartFrame(
296     OH_LowPowerVideoSink* sink,
297     const int64_t framePts,
298     OH_LowPowerVideoSink_OnTargetArrived onTargetArrived,
299     const int64_t timeoutMs,
300     void* userData);
301 
302 /**
303  * @brief Set playback speed for the lowpower video sink
304  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
305  * @param {const float} speed Indicates the value of the playback rate.
306  * The current version is valid in the range of 0.1-4.0
307  * @return Returns AV_ERR_OK if the execution is successful,
308  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
309  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
310  * {@link AV_ERR_SERVICE_DIED} media service is died.
311  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
312  * @since 20
313  */
314 OH_AVErrCode OH_LowPowerVideoSink_SetPlaybackSpeed(OH_LowPowerVideoSink* sink, const float speed);
315 
316 /**
317  * @brief Return frame packet buffer to lowpower video sink.
318  *
319  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
320  * @param {OH_AVSamplesBuffer*} samples Pointer to an OH_AVSamplesBuffer instance
321  * @return Returns AV_ERR_OK if the execution is successful,
322  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
323  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
324  * {@link AV_ERR_SERVICE_DIED} media service is died.
325  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
326  * @since 20
327  */
328 OH_AVErrCode OH_LowPowerVideoSink_ReturnSamples(OH_LowPowerVideoSink* sink, OH_AVSamplesBuffer* samples);
329 
330 /**
331  * @brief Regsister callback instance for lowpower video sink.
332  *
333  * @param {OH_LowPowerVideoSink*} sink Pointer to an OH_LowPowerVideoSink instance
334  * @param {OH_LowPowerVideoSinkCallback*} callback Pointer to an OH_LowPowerVideoSinkCallback instance
335  * @return Returns AV_ERR_OK if the execution is successful,
336  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
337  * {@link AV_ERR_INVALID_VAL} the sink or format is nullptr or invalid. Invalid param in format.
338  * {@link AV_ERR_SERVICE_DIED} media service is died.
339  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
340  * @since 20
341  */
342 OH_AVErrCode OH_LowPowerVideoSink_RegisterCallback(OH_LowPowerVideoSink* sink, OH_LowPowerVideoSinkCallback* callback);
343 
344 /**
345  * @brief Creates a lowpower video sink callback instance.
346  *
347  * @return Returns a Pointer to an OH_LowPowerVideoSinkCallback instance.
348  * Return nullptr if memory ran out.
349  * @since 20
350  */
351 OH_LowPowerVideoSinkCallback* OH_LowPowerVideoSinkCallback_Create(void);
352 
353 /**
354  * @brief Destroy the lowpower video sink callback instance.
355  *
356  * @param {OH_LowPowerVideoSinkCallback*} callback Pointer to an OH_LowPowerVideoSinkCallback instance
357  * @return Returns AV_ERR_OK if the execution is successful,
358  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
359  * {@link AV_ERR_INVALID_VAL} the callback is nullptr or invalid.
360  * @since 20
361  */
362 OH_AVErrCode OH_LowPowerVideoSinkCallback_Destroy(OH_LowPowerVideoSinkCallback* callback);
363 
364 /**
365  * @brief Add onDataNeeded listener to the lowpower video sink callback instance.
366  *
367  * @param {OH_LowPowerVideoSinkCallback*} callback Pointer to an OH_LowPowerVideoSinkCallback instance
368  * @param {OH_LowPowerVideoSink_OnDataNeeded} onDataNeeded OH_LowPowerVideoSink_OnDataNeeded function,
369  * refer to {@link OH_LowPowerVideoSink_OnDataNeeded}
370  * @param {void*} userData User specific data
371  * @return Returns AV_ERR_OK if the execution is successful,
372  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
373  * {@link AV_ERR_INVALID_VAL} the callback is nullptr or invalid.
374  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
375  * @since 20
376  */
377 OH_AVErrCode OH_LowPowerVideoSinkCallback_SetDataNeededListener(
378     OH_LowPowerVideoSinkCallback *callback, OH_LowPowerVideoSink_OnDataNeeded onDataNeeded, void *userData);
379 
380 /**
381  * @brief Add onError listener to the lowpower video sink callback instance.
382  *
383  * @param {OH_LowPowerVideoSinkCallback*} callback Pointer to an OH_LowPowerVideoSinkCallback instance
384  * @param {OH_LowPowerVideoSink_OnError} onError OH_LowPowerVideoSink_OnError function,
385  * refer to {@link OH_LowPowerVideoSink_OnError}
386  * @param {void*} userData User specific data
387  * @return Returns AV_ERR_OK if the execution is successful,
388  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
389  * {@link AV_ERR_INVALID_VAL} the callback is nullptr or invalid.
390  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
391  * @since 20
392  */
393 OH_AVErrCode OH_LowPowerVideoSinkCallback_SetErrorListener(
394     OH_LowPowerVideoSinkCallback* callback, OH_LowPowerVideoSink_OnError onError, void* userData);
395 
396 /**
397  * @brief Add onRenderStarted listener to the lowpower video sink callback instance.
398  *
399  * @param {OH_LowPowerVideoSinkCallback*} callback Pointer to an OH_LowPowerVideoSinkCallback instance
400  * @param {OH_LowPowerVideoSink_OnRenderStarted} onRenderStarted OH_LowPowerVideoSink_OnRenderStarted function,
401  * refer to {@link OH_LowPowerVideoSink_OnRenderStarted}
402  * @param {void*} userData User specific data
403  * @return Returns AV_ERR_OK if the execution is successful,
404  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
405  * {@link AV_ERR_INVALID_VAL} the callback is nullptr or invalid.
406  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
407  * @since 20
408  */
409 OH_AVErrCode OH_LowPowerVideoSinkCallback_SetRenderStartListener(
410     OH_LowPowerVideoSinkCallback* callback, OH_LowPowerVideoSink_OnRenderStarted onRenderStarted, void* userData);
411 
412 /**
413  * @brief Add onStreamChanged listener to the lowpower video sink callback instance.
414  *
415  * @param {OH_LowPowerVideoSinkCallback*} callback Pointer to an OH_LowPowerVideoSinkCallback instance
416  * @param {OH_LowPowerVideoSink_OnStreamChanged} onStreamChanged OH_LowPowerVideoSink_OnStreamChanged function,
417  * refer to {@link OH_LowPowerVideoSink_OnStreamChanged}
418  * @param {void*} userData User specific data
419  * @return Returns AV_ERR_OK if the execution is successful,
420  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
421  * {@link AV_ERR_INVALID_VAL} the callback is nullptr or invalid.
422  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
423  * @since 20
424  */
425 OH_AVErrCode OH_LowPowerVideoSinkCallback_SetStreamChangedListener(
426     OH_LowPowerVideoSinkCallback* callback, OH_LowPowerVideoSink_OnStreamChanged onStreamChanged, void* userData);
427 
428 /**
429  * @brief Add onRenderStarted listener to the lowpower video sink callback instance.
430  *
431  * @param {OH_LowPowerVideoSinkCallback*} callback Pointer to an OH_LowPowerVideoSinkCallback instance
432  * @param {OH_LowPowerVideoSink_OnFirstFrameDecoded} onFirstFrameDecoded OH_LowPowerVideoSink_OnFirstFrameDecoded
433  * function,
434  * refer to {@link OH_LowPowerVideoSink_OnFirstFrameDecoded}
435  * @param {void*} userData User specific data
436  * @return Returns AV_ERR_OK if the execution is successful,
437  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
438  * {@link AV_ERR_INVALID_VAL} the callback is nullptr or invalid.
439  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
440  * @since 20
441  */
442 OH_AVErrCode OH_LowPowerVideoSinkCallback_SetFirstFrameDecodedListener(
443     OH_LowPowerVideoSinkCallback* callback,
444     OH_LowPowerVideoSink_OnFirstFrameDecoded onFirstFrameDecoded,
445     void* userData);
446 
447 /**
448  * @brief Add onEos listener to the lowpower video sink callback instance.
449  *
450  * @param {OH_LowPowerVideoSinkCallback*} callback Pointer to an OH_LowPowerVideoSinkCallback instance
451  * @param {OH_LowPowerVideoSink_OnEos} onEos OH_LowPowerVideoSink_OnEos function,
452  * refer to {@link OH_LowPowerVideoSink_OnEos}
453  * @param {void*} userData User specific data
454  * @return Returns AV_ERR_OK if the execution is successful,
455  * otherwise returns a specific error code, refer to {@link OH_AVErrCode}
456  * {@link AV_ERR_INVALID_VAL} the callback is nullptr or invalid.
457  * {@link AV_ERR_OPERATE_NOT_PERMIT} operation not permitted.
458  * @since 20
459  */
460 OH_AVErrCode OH_LowPowerVideoSinkCallback_SetEosListener(OH_LowPowerVideoSinkCallback* callback,
461     OH_LowPowerVideoSink_OnEos onEos, void* userData);
462 
463 #ifdef __cplusplus
464 }
465 #endif
466 
467 #endif // NATIVE_LOWPOWER_VIDEO_SINK_H
468 
469 /** @} */
470