1523f5352Sopenharmony_ci/*
2523f5352Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
3523f5352Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4523f5352Sopenharmony_ci * you may not use this file except in compliance with the License.
5523f5352Sopenharmony_ci * You may obtain a copy of the License at
6523f5352Sopenharmony_ci *
7523f5352Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8523f5352Sopenharmony_ci *
9523f5352Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10523f5352Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11523f5352Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12523f5352Sopenharmony_ci * See the License for the specific language governing permissions and
13523f5352Sopenharmony_ci * limitations under the License.
14523f5352Sopenharmony_ci */
15523f5352Sopenharmony_ci
16523f5352Sopenharmony_ci#ifndef OPENSLES_OPENHARMONY_H
17523f5352Sopenharmony_ci#define OPENSLES_OPENHARMONY_H
18523f5352Sopenharmony_ci
19523f5352Sopenharmony_ci#ifdef __cplusplus
20523f5352Sopenharmony_ciextern "C" {
21523f5352Sopenharmony_ci#endif
22523f5352Sopenharmony_ci
23523f5352Sopenharmony_ci#include "OpenSLES.h"
24523f5352Sopenharmony_ci#include "OpenSLES_Platform.h"
25523f5352Sopenharmony_ci
26523f5352Sopenharmony_ci/*---------------------------------------------------------------------------*/
27523f5352Sopenharmony_ci/* OH Buffer Queue Interface                                                    */
28523f5352Sopenharmony_ci/*---------------------------------------------------------------------------*/
29523f5352Sopenharmony_ci
30523f5352Sopenharmony_ciextern const SLInterfaceID SL_IID_OH_BUFFERQUEUE;
31523f5352Sopenharmony_ci
32523f5352Sopenharmony_cistruct SLOHBufferQueueItf_;
33523f5352Sopenharmony_citypedef const struct SLOHBufferQueueItf_ * const * SLOHBufferQueueItf;
34523f5352Sopenharmony_ci
35523f5352Sopenharmony_citypedef void (SLAPIENTRY *SlOHBufferQueueCallback)(
36523f5352Sopenharmony_ci    SLOHBufferQueueItf caller,
37523f5352Sopenharmony_ci    void *pContext,
38523f5352Sopenharmony_ci    SLuint32 size
39523f5352Sopenharmony_ci);
40523f5352Sopenharmony_ci
41523f5352Sopenharmony_ci/** OH Buffer queue state **/
42523f5352Sopenharmony_ci
43523f5352Sopenharmony_citypedef struct SLOHBufferQueueState_ {
44523f5352Sopenharmony_ci    SLuint32    count;
45523f5352Sopenharmony_ci    SLuint32    index;
46523f5352Sopenharmony_ci} SLOHBufferQueueState;
47523f5352Sopenharmony_ci
48523f5352Sopenharmony_ci
49523f5352Sopenharmony_cistruct SLOHBufferQueueItf_ {
50523f5352Sopenharmony_ci    SLresult (*Enqueue) (
51523f5352Sopenharmony_ci        SLOHBufferQueueItf self,
52523f5352Sopenharmony_ci        const void *buffer,
53523f5352Sopenharmony_ci        SLuint32 size
54523f5352Sopenharmony_ci    );
55523f5352Sopenharmony_ci    SLresult (*Clear) (
56523f5352Sopenharmony_ci        SLOHBufferQueueItf self
57523f5352Sopenharmony_ci    );
58523f5352Sopenharmony_ci    SLresult (*GetState) (
59523f5352Sopenharmony_ci        SLOHBufferQueueItf self,
60523f5352Sopenharmony_ci        SLOHBufferQueueState *state
61523f5352Sopenharmony_ci    );
62523f5352Sopenharmony_ci    SLresult (*GetBuffer) (
63523f5352Sopenharmony_ci        SLOHBufferQueueItf self,
64523f5352Sopenharmony_ci        SLuint8** buffer,
65523f5352Sopenharmony_ci        SLuint32* size
66523f5352Sopenharmony_ci    );
67523f5352Sopenharmony_ci    SLresult (*RegisterCallback) (
68523f5352Sopenharmony_ci        SLOHBufferQueueItf self,
69523f5352Sopenharmony_ci        SlOHBufferQueueCallback callback,
70523f5352Sopenharmony_ci        void* pContext
71523f5352Sopenharmony_ci    );
72523f5352Sopenharmony_ci};
73523f5352Sopenharmony_ci
74523f5352Sopenharmony_ci#ifdef __cplusplus
75523f5352Sopenharmony_ci} /* extern "C" */
76523f5352Sopenharmony_ci#endif
77523f5352Sopenharmony_ci
78523f5352Sopenharmony_ci#endif /* OPENSLES_OPENHARMONY_H */
79