1b5323222bd524876dda1ebf89694f186278e2229Eric Laurent/* 2b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * Copyright (C) 2017 The Android Open Source Project 3b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * 4b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * Licensed under the Apache License, Version 2.0 (the "License"); 5b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * you may not use this file except in compliance with the License. 6b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * You may obtain a copy of the License at 7b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * 8b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * http://www.apache.org/licenses/LICENSE-2.0 9b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * 10b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * Unless required by applicable law or agreed to in writing, software 11b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * distributed under the License is distributed on an "AS IS" BASIS, 12b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * See the License for the specific language governing permissions and 14b5323222bd524876dda1ebf89694f186278e2229Eric Laurent * limitations under the License. 15b5323222bd524876dda1ebf89694f186278e2229Eric Laurent */ 16b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 17b5323222bd524876dda1ebf89694f186278e2229Eric Laurent#ifndef __ANDROID_TRACK_PLAYER_BASE_H__ 18b5323222bd524876dda1ebf89694f186278e2229Eric Laurent#define __ANDROID_TRACK_PLAYER_BASE_H__ 19b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 20b5323222bd524876dda1ebf89694f186278e2229Eric Laurent#include <media/AudioTrack.h> 21b5323222bd524876dda1ebf89694f186278e2229Eric Laurent#include <media/PlayerBase.h> 22b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 23b5323222bd524876dda1ebf89694f186278e2229Eric Laurentnamespace android { 24b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 25b5323222bd524876dda1ebf89694f186278e2229Eric Laurentclass TrackPlayerBase : public PlayerBase 26b5323222bd524876dda1ebf89694f186278e2229Eric Laurent{ 27b5323222bd524876dda1ebf89694f186278e2229Eric Laurentpublic: 28b5323222bd524876dda1ebf89694f186278e2229Eric Laurent explicit TrackPlayerBase(); 29b5323222bd524876dda1ebf89694f186278e2229Eric Laurent virtual ~TrackPlayerBase(); 30b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 31b5323222bd524876dda1ebf89694f186278e2229Eric Laurent void init(AudioTrack* pat, player_type_t playerType, audio_usage_t usage); 32b5323222bd524876dda1ebf89694f186278e2229Eric Laurent virtual void destroy(); 33b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 34b5323222bd524876dda1ebf89694f186278e2229Eric Laurent //IPlayer implementation 35b5323222bd524876dda1ebf89694f186278e2229Eric Laurent virtual void applyVolumeShaper( 36b5323222bd524876dda1ebf89694f186278e2229Eric Laurent const sp<VolumeShaper::Configuration>& configuration, 37b5323222bd524876dda1ebf89694f186278e2229Eric Laurent const sp<VolumeShaper::Operation>& operation); 38b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 39b5323222bd524876dda1ebf89694f186278e2229Eric Laurent //FIXME move to protected field, so far made public to minimize changes to AudioTrack logic 40b5323222bd524876dda1ebf89694f186278e2229Eric Laurent sp<AudioTrack> mAudioTrack; 41b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 42b5323222bd524876dda1ebf89694f186278e2229Eric Laurent void setPlayerVolume(float vl, float vr); 43b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 44b5323222bd524876dda1ebf89694f186278e2229Eric Laurentprotected: 45b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 46b5323222bd524876dda1ebf89694f186278e2229Eric Laurent //PlayerBase virtuals 47b5323222bd524876dda1ebf89694f186278e2229Eric Laurent virtual status_t playerStart(); 48b5323222bd524876dda1ebf89694f186278e2229Eric Laurent virtual status_t playerPause(); 49b5323222bd524876dda1ebf89694f186278e2229Eric Laurent virtual status_t playerStop(); 50b5323222bd524876dda1ebf89694f186278e2229Eric Laurent virtual status_t playerSetVolume(); 51b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 52b5323222bd524876dda1ebf89694f186278e2229Eric Laurentprivate: 53b5323222bd524876dda1ebf89694f186278e2229Eric Laurent void doDestroy(); 54b5323222bd524876dda1ebf89694f186278e2229Eric Laurent status_t doSetVolume(); 55b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 56b5323222bd524876dda1ebf89694f186278e2229Eric Laurent // volume coming from the player volume API 57b5323222bd524876dda1ebf89694f186278e2229Eric Laurent float mPlayerVolumeL, mPlayerVolumeR; 58b5323222bd524876dda1ebf89694f186278e2229Eric Laurent}; 59b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 60b5323222bd524876dda1ebf89694f186278e2229Eric Laurent} // namespace android 61b5323222bd524876dda1ebf89694f186278e2229Eric Laurent 62b5323222bd524876dda1ebf89694f186278e2229Eric Laurent#endif /* __ANDROID_TRACK_PLAYER_BASE_H__ */ 63