blob: d310cee3096deb70cddae5db1dd7e2cc3955bdf9 [file] [log] [blame]
Andreas Huber52b52cd2010-11-23 11:41:34 -08001/*
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
Andreas Huberae9d5072010-12-06 10:36:06 -080025struct AMessage;
Andreas Huber52b52cd2010-11-23 11:41:34 -080026struct IMemory;
27struct IStreamListener;
28
29struct IStreamSource : public IInterface {
30 DECLARE_META_INTERFACE(StreamSource);
31
32 virtual void setListener(const sp<IStreamListener> &listener) = 0;
33 virtual void setBuffers(const Vector<sp<IMemory> > &buffers) = 0;
34
35 virtual void onBufferAvailable(size_t index) = 0;
36};
37
38struct IStreamListener : public IInterface {
39 DECLARE_META_INTERFACE(StreamListener);
40
41 enum Command {
Andreas Huberae9d5072010-12-06 10:36:06 -080042 EOS,
Andreas Huber52b52cd2010-11-23 11:41:34 -080043 DISCONTINUITY,
Andreas Huber52b52cd2010-11-23 11:41:34 -080044 };
45
46 virtual void queueBuffer(size_t index, size_t size) = 0;
Andreas Huberae9d5072010-12-06 10:36:06 -080047
Andreas Huber669ad132011-03-02 15:34:46 -080048 // When signalling a discontinuity you can optionally
49 // specify an int64_t PTS timestamp in "msg".
50 // If present, rendering of data following the discontinuity
51 // will be suppressed until media time reaches this timestamp.
52 static const char *const kKeyResumeAtPTS;
53
Andreas Huberae9d5072010-12-06 10:36:06 -080054 virtual void issueCommand(
55 Command cmd, bool synchronous, const sp<AMessage> &msg = NULL) = 0;
Andreas Huber52b52cd2010-11-23 11:41:34 -080056};
57
58////////////////////////////////////////////////////////////////////////////////
59
60struct BnStreamSource : public BnInterface<IStreamSource> {
61 virtual status_t onTransact(
62 uint32_t code, const Parcel &data, Parcel *reply,
63 uint32_t flags = 0);
64};
65
66struct BnStreamListener : public BnInterface<IStreamListener> {
67 virtual status_t onTransact(
68 uint32_t code, const Parcel &data, Parcel *reply,
69 uint32_t flags = 0);
70};
71
72} // namespace android
73
74#endif // ANDROID_ISTREAMSOURCE_H_