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#ifndef OPENSLES_OPENHARMONY_H
17#define OPENSLES_OPENHARMONY_H
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include "OpenSLES.h"
24#include "OpenSLES_Platform.h"
25
26/*---------------------------------------------------------------------------*/
27/* OH Buffer Queue Interface                                                    */
28/*---------------------------------------------------------------------------*/
29
30extern const SLInterfaceID SL_IID_OH_BUFFERQUEUE;
31
32struct SLOHBufferQueueItf_;
33typedef const struct SLOHBufferQueueItf_ * const * SLOHBufferQueueItf;
34
35typedef void (SLAPIENTRY *SlOHBufferQueueCallback)(
36    SLOHBufferQueueItf caller,
37    void *pContext,
38    SLuint32 size
39);
40
41/** OH Buffer queue state **/
42
43typedef struct SLOHBufferQueueState_ {
44    SLuint32    count;
45    SLuint32    index;
46} SLOHBufferQueueState;
47
48
49struct SLOHBufferQueueItf_ {
50    SLresult (*Enqueue) (
51        SLOHBufferQueueItf self,
52        const void *buffer,
53        SLuint32 size
54    );
55    SLresult (*Clear) (
56        SLOHBufferQueueItf self
57    );
58    SLresult (*GetState) (
59        SLOHBufferQueueItf self,
60        SLOHBufferQueueState *state
61    );
62    SLresult (*GetBuffer) (
63        SLOHBufferQueueItf self,
64        SLuint8** buffer,
65        SLuint32* size
66    );
67    SLresult (*RegisterCallback) (
68        SLOHBufferQueueItf self,
69        SlOHBufferQueueCallback callback,
70        void* pContext
71    );
72};
73
74#ifdef __cplusplus
75} /* extern "C" */
76#endif
77
78#endif /* OPENSLES_OPENHARMONY_H */
79