michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #if !defined(MediaOmxDecoder_h_) michael@0: #define MediaOmxDecoder_h_ michael@0: michael@0: #include "base/basictypes.h" michael@0: #include "MediaDecoder.h" michael@0: #include "MediaOmxReader.h" michael@0: #include "AudioOffloadPlayerBase.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: class MediaOmxDecoder : public MediaDecoder michael@0: { michael@0: typedef android::MediaSource MediaSource; michael@0: public: michael@0: MediaOmxDecoder(); michael@0: virtual MediaDecoder* Clone(); michael@0: virtual MediaDecoderStateMachine* CreateStateMachine(); michael@0: michael@0: virtual void MetadataLoaded(int aChannels, michael@0: int aRate, michael@0: bool aHasAudio, michael@0: bool aHasVideo, michael@0: MetadataTags* aTags); michael@0: virtual void ChangeState(PlayState aState); michael@0: virtual void ApplyStateToStateMachine(PlayState aState); michael@0: virtual void SetVolume(double aVolume); michael@0: virtual void PlaybackPositionChanged(); michael@0: virtual void UpdateReadyStateForData(); michael@0: virtual void SetElementVisibility(bool aIsVisible); michael@0: virtual void SetCanOffloadAudio(bool aCanOffloadAudio); michael@0: virtual void AddOutputStream(ProcessedMediaStream* aStream, michael@0: bool aFinishWhenEnded); michael@0: virtual void SetPlaybackRate(double aPlaybackRate); michael@0: michael@0: void AudioOffloadTearDown(); michael@0: int64_t GetSeekTime() { return mRequestedSeekTarget.mTime; } michael@0: void ResetSeekTime() { mRequestedSeekTarget.Reset(); } michael@0: michael@0: private: michael@0: void PauseStateMachine(); michael@0: void ResumeStateMachine(); michael@0: michael@0: MediaOmxReader* mReader; michael@0: michael@0: // Offloaded audio track michael@0: android::sp mAudioTrack; michael@0: michael@0: nsAutoPtr mAudioOffloadPlayer; michael@0: michael@0: // Set by MediaOmxReader to denote current track can be offloaded michael@0: bool mCanOffloadAudio; michael@0: michael@0: // Set when offload playback of current track fails in the middle and need to michael@0: // fallback to state machine michael@0: bool mFallbackToStateMachine; michael@0: }; michael@0: michael@0: } // namespace mozilla michael@0: michael@0: #endif