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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 5 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | #if !defined(MediaOmxDecoder_h_) |
michael@0 | 7 | #define MediaOmxDecoder_h_ |
michael@0 | 8 | |
michael@0 | 9 | #include "base/basictypes.h" |
michael@0 | 10 | #include "MediaDecoder.h" |
michael@0 | 11 | #include "MediaOmxReader.h" |
michael@0 | 12 | #include "AudioOffloadPlayerBase.h" |
michael@0 | 13 | |
michael@0 | 14 | namespace mozilla { |
michael@0 | 15 | |
michael@0 | 16 | class MediaOmxDecoder : public MediaDecoder |
michael@0 | 17 | { |
michael@0 | 18 | typedef android::MediaSource MediaSource; |
michael@0 | 19 | public: |
michael@0 | 20 | MediaOmxDecoder(); |
michael@0 | 21 | virtual MediaDecoder* Clone(); |
michael@0 | 22 | virtual MediaDecoderStateMachine* CreateStateMachine(); |
michael@0 | 23 | |
michael@0 | 24 | virtual void MetadataLoaded(int aChannels, |
michael@0 | 25 | int aRate, |
michael@0 | 26 | bool aHasAudio, |
michael@0 | 27 | bool aHasVideo, |
michael@0 | 28 | MetadataTags* aTags); |
michael@0 | 29 | virtual void ChangeState(PlayState aState); |
michael@0 | 30 | virtual void ApplyStateToStateMachine(PlayState aState); |
michael@0 | 31 | virtual void SetVolume(double aVolume); |
michael@0 | 32 | virtual void PlaybackPositionChanged(); |
michael@0 | 33 | virtual void UpdateReadyStateForData(); |
michael@0 | 34 | virtual void SetElementVisibility(bool aIsVisible); |
michael@0 | 35 | virtual void SetCanOffloadAudio(bool aCanOffloadAudio); |
michael@0 | 36 | virtual void AddOutputStream(ProcessedMediaStream* aStream, |
michael@0 | 37 | bool aFinishWhenEnded); |
michael@0 | 38 | virtual void SetPlaybackRate(double aPlaybackRate); |
michael@0 | 39 | |
michael@0 | 40 | void AudioOffloadTearDown(); |
michael@0 | 41 | int64_t GetSeekTime() { return mRequestedSeekTarget.mTime; } |
michael@0 | 42 | void ResetSeekTime() { mRequestedSeekTarget.Reset(); } |
michael@0 | 43 | |
michael@0 | 44 | private: |
michael@0 | 45 | void PauseStateMachine(); |
michael@0 | 46 | void ResumeStateMachine(); |
michael@0 | 47 | |
michael@0 | 48 | MediaOmxReader* mReader; |
michael@0 | 49 | |
michael@0 | 50 | // Offloaded audio track |
michael@0 | 51 | android::sp<MediaSource> mAudioTrack; |
michael@0 | 52 | |
michael@0 | 53 | nsAutoPtr<AudioOffloadPlayerBase> mAudioOffloadPlayer; |
michael@0 | 54 | |
michael@0 | 55 | // Set by MediaOmxReader to denote current track can be offloaded |
michael@0 | 56 | bool mCanOffloadAudio; |
michael@0 | 57 | |
michael@0 | 58 | // Set when offload playback of current track fails in the middle and need to |
michael@0 | 59 | // fallback to state machine |
michael@0 | 60 | bool mFallbackToStateMachine; |
michael@0 | 61 | }; |
michael@0 | 62 | |
michael@0 | 63 | } // namespace mozilla |
michael@0 | 64 | |
michael@0 | 65 | #endif |