Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
michael@0 | 3 | /* |
michael@0 | 4 | * Copyright (c) 2014 The Linux Foundation. All rights reserved. |
michael@0 | 5 | * Copyright (C) 2009 The Android Open Source Project |
michael@0 | 6 | * |
michael@0 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
michael@0 | 8 | * you may not use this file except in compliance with the License. |
michael@0 | 9 | * You may obtain a copy of the License at |
michael@0 | 10 | * |
michael@0 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 12 | * |
michael@0 | 13 | * Unless required by applicable law or agreed to in writing, software |
michael@0 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
michael@0 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
michael@0 | 16 | * See the License for the specific language governing permissions and |
michael@0 | 17 | * limitations under the License. |
michael@0 | 18 | */ |
michael@0 | 19 | |
michael@0 | 20 | #ifndef AUDIO_OFFLOAD_PLAYER_BASE_H_ |
michael@0 | 21 | #define AUDIO_OFFLOAD_PLAYER_BASE_H_ |
michael@0 | 22 | |
michael@0 | 23 | #include "MediaDecoderOwner.h" |
michael@0 | 24 | #include "MediaOmxDecoder.h" |
michael@0 | 25 | |
michael@0 | 26 | namespace mozilla { |
michael@0 | 27 | |
michael@0 | 28 | class MediaOmxDecoder; |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * AudioOffloadPlayer interface class which has funtions used by MediaOmxDecoder |
michael@0 | 32 | * This is to reduce the dependency of AudioOffloadPlayer in MediaOmxDecoder |
michael@0 | 33 | */ |
michael@0 | 34 | class AudioOffloadPlayerBase |
michael@0 | 35 | { |
michael@0 | 36 | typedef android::status_t status_t; |
michael@0 | 37 | typedef android::MediaSource MediaSource; |
michael@0 | 38 | |
michael@0 | 39 | public: |
michael@0 | 40 | virtual ~AudioOffloadPlayerBase() {}; |
michael@0 | 41 | |
michael@0 | 42 | // Caller retains ownership of "aSource". |
michael@0 | 43 | virtual void SetSource(const android::sp<MediaSource> &aSource) {} |
michael@0 | 44 | |
michael@0 | 45 | // Start the source if it's not already started and open the AudioSink to |
michael@0 | 46 | // create an offloaded audio track |
michael@0 | 47 | virtual status_t Start(bool aSourceAlreadyStarted = false) |
michael@0 | 48 | { |
michael@0 | 49 | return android::NO_INIT; |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | virtual status_t ChangeState(MediaDecoder::PlayState aState) |
michael@0 | 53 | { |
michael@0 | 54 | return android::NO_INIT; |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | virtual void SetVolume(double aVolume) {} |
michael@0 | 58 | |
michael@0 | 59 | virtual double GetMediaTimeSecs() { return 0; } |
michael@0 | 60 | |
michael@0 | 61 | // To update progress bar when the element is visible |
michael@0 | 62 | virtual void SetElementVisibility(bool aIsVisible) {} |
michael@0 | 63 | |
michael@0 | 64 | // Update ready state based on current play state. Not checking data |
michael@0 | 65 | // availability since offloading is currently done only when whole compressed |
michael@0 | 66 | // data is available |
michael@0 | 67 | virtual MediaDecoderOwner::NextFrameStatus GetNextFrameStatus() |
michael@0 | 68 | { |
michael@0 | 69 | return MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE; |
michael@0 | 70 | } |
michael@0 | 71 | }; |
michael@0 | 72 | |
michael@0 | 73 | } // namespace mozilla |
michael@0 | 74 | |
michael@0 | 75 | #endif // AUDIO_OFFLOAD_PLAYER_BASE_H_ |