1 /*
2  * Copyright (c) 2021-2021 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 HISTREAMER_FOUNDATION_AVBUFFER_QUEUE_DEFINE_H
17 #define HISTREAMER_FOUNDATION_AVBUFFER_QUEUE_DEFINE_H
18 
19 #include "common/status.h"
20 #include "buffer/avbuffer.h"
21 #include "iremote_broker.h"
22 
23 namespace OHOS {
24 namespace Media {
25 
26 constexpr uint32_t AVBUFFER_QUEUE_MAX_QUEUE_SIZE = 32;
27 
28 class AVBufferQueueProducer;
29 class AVBufferQueueConsumer;
30 
31 class IBrokerListener : public IRemoteBroker {
32 public:
33     IBrokerListener() = default;
34     ~IBrokerListener() noexcept override = default;
35     virtual void OnBufferFilled(std::shared_ptr<AVBuffer>&) = 0;
36 
37     DECLARE_INTERFACE_DESCRIPTOR(u"Media.IAVBufferFilledListener")
38 };
39 
40 class IProducerListener : public IRemoteBroker {
41 public:
42     IProducerListener() = default;
43     ~IProducerListener() noexcept override = default;
44     virtual void OnBufferAvailable() = 0;
45     DECLARE_INTERFACE_DESCRIPTOR(u"Media.IProducerListener")
46 };
47 
48 // consumer不具备跨进程能力
49 class IConsumerListener : public RefBase {
50 public:
51     IConsumerListener() = default;
52     ~IConsumerListener() noexcept override = default;
53     virtual void OnBufferAvailable() = 0;
54 };
55 
56 } // namespace Media
57 } // namespace OHOS
58 
59 #endif // HISTREAMER_FOUNDATION_AVBUFFER_QUEUE_DEFINE_H
60