IStreamSource.h revision e2b1028852120bcfded33b8f06f66b780437fe92
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_ISTREAMSOURCE_H_
18
19#define ANDROID_ISTREAMSOURCE_H_
20
21#include <binder/IInterface.h>
22
23namespace android {
24
25struct IMemory;
26struct IStreamListener;
27
28struct IStreamSource : public IInterface {
29    DECLARE_META_INTERFACE(StreamSource);
30
31    virtual void setListener(const sp<IStreamListener> &listener) = 0;
32    virtual void setBuffers(const Vector<sp<IMemory> > &buffers) = 0;
33
34    virtual void onBufferAvailable(size_t index) = 0;
35};
36
37struct IStreamListener : public IInterface {
38    DECLARE_META_INTERFACE(StreamListener);
39
40    enum Command {
41        FLUSH,
42        DISCONTINUITY,
43        EOS
44    };
45
46    virtual void queueBuffer(size_t index, size_t size) = 0;
47    virtual void queueCommand(Command cmd) = 0;
48};
49
50////////////////////////////////////////////////////////////////////////////////
51
52struct BnStreamSource : public BnInterface<IStreamSource> {
53    virtual status_t onTransact(
54            uint32_t code, const Parcel &data, Parcel *reply,
55            uint32_t flags = 0);
56};
57
58struct BnStreamListener : public BnInterface<IStreamListener> {
59    virtual status_t onTransact(
60            uint32_t code, const Parcel &data, Parcel *reply,
61            uint32_t flags = 0);
62};
63
64}  // namespace android
65
66#endif  // ANDROID_ISTREAMSOURCE_H_
67