1/*
2 * Copyright (C) 2017 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_TRACK_PLAYER_BASE_H__
18#define __ANDROID_TRACK_PLAYER_BASE_H__
19
20#include <media/AudioTrack.h>
21#include <media/PlayerBase.h>
22
23namespace android {
24
25class TrackPlayerBase : public PlayerBase
26{
27public:
28    explicit TrackPlayerBase();
29    virtual ~TrackPlayerBase();
30
31            void init(AudioTrack* pat, player_type_t playerType, audio_usage_t usage);
32    virtual void destroy();
33
34    //IPlayer implementation
35    virtual binder::Status applyVolumeShaper(
36            const media::VolumeShaper::Configuration& configuration,
37            const media::VolumeShaper::Operation& operation);
38
39    //FIXME move to protected field, so far made public to minimize changes to AudioTrack logic
40    sp<AudioTrack> mAudioTrack;
41
42            void setPlayerVolume(float vl, float vr);
43
44protected:
45
46    //PlayerBase virtuals
47    virtual status_t playerStart();
48    virtual status_t playerPause();
49    virtual status_t playerStop();
50    virtual status_t playerSetVolume();
51
52private:
53            void doDestroy();
54            status_t doSetVolume();
55
56    // volume coming from the player volume API
57    float mPlayerVolumeL, mPlayerVolumeR;
58};
59
60} // namespace android
61
62#endif /* __ANDROID_TRACK_PLAYER_BASE_H__ */
63