blob: c1f4f0932e9bc883a25e2479273b3446b361f7af [file] [log] [blame]
vivek mehta2192bc92012-12-04 11:46:08 -08001/*
2 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
3 * Not a Contribution, Apache license notifications and license are retained
4 * for attribution purposes only.
5 *
6 * Copyright (C) 2007 The Android Open Source Project
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21#ifndef ANDROID_IDIRECTTRACK_H
22#define ANDROID_IDIRECTTRACK_H
23
24#include <stdint.h>
25#include <sys/types.h>
26
27#include <utils/RefBase.h>
28#include <utils/Errors.h>
29#include <binder/IInterface.h>
30#include <binder/IMemory.h>
31
32
33namespace android {
34
35// ----------------------------------------------------------------------------
36
37class IDirectTrack : public IInterface
38{
39public:
40 DECLARE_META_INTERFACE(DirectTrack);
41
42 /* After it's created the track is not active. Call start() to
43 * make it active. If set, the callback will start being called.
44 */
45 virtual status_t start() = 0;
46
47 /* Stop a track. If set, the callback will cease being called and
48 * obtainBuffer will return an error. Buffers that are already released
49 * will be processed, unless flush() is called.
50 */
51 virtual void stop() = 0;
52
53 /* flush a stopped track. All pending buffers are discarded.
54 * This function has no effect if the track is not stoped.
55 */
56 virtual void flush() = 0;
57
58 /* mute or unmutes this track.
59 * While mutted, the callback, if set, is still called.
60 */
61 virtual void mute(bool) = 0;
62
63 /* Pause a track. If set, the callback will cease being called and
64 * obtainBuffer will return an error. Buffers that are already released
65 * will be processed, unless flush() is called.
66 */
67 virtual void pause() = 0;
68
69 /* set volume for both left and right channels.
70 */
71 virtual void setVolume(float l, float r) = 0;
72
73 virtual ssize_t write(const void*, size_t) = 0;
74
75 virtual int64_t getTimeStamp() = 0;
76};
77
78// ----------------------------------------------------------------------------
79
80class BnDirectTrack : public BnInterface<IDirectTrack>
81{
82public:
83 virtual status_t onTransact( uint32_t code,
84 const Parcel& data,
85 Parcel* reply,
86 uint32_t flags = 0);
87};
88
89// ----------------------------------------------------------------------------
90
91}; // namespace android
92
93#endif // ANDROID_IAUDIOTRACK_H