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