1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/media/omx/MediaOmxDecoder.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 +#if !defined(MediaOmxDecoder_h_) 1.10 +#define MediaOmxDecoder_h_ 1.11 + 1.12 +#include "base/basictypes.h" 1.13 +#include "MediaDecoder.h" 1.14 +#include "MediaOmxReader.h" 1.15 +#include "AudioOffloadPlayerBase.h" 1.16 + 1.17 +namespace mozilla { 1.18 + 1.19 +class MediaOmxDecoder : public MediaDecoder 1.20 +{ 1.21 + typedef android::MediaSource MediaSource; 1.22 +public: 1.23 + MediaOmxDecoder(); 1.24 + virtual MediaDecoder* Clone(); 1.25 + virtual MediaDecoderStateMachine* CreateStateMachine(); 1.26 + 1.27 + virtual void MetadataLoaded(int aChannels, 1.28 + int aRate, 1.29 + bool aHasAudio, 1.30 + bool aHasVideo, 1.31 + MetadataTags* aTags); 1.32 + virtual void ChangeState(PlayState aState); 1.33 + virtual void ApplyStateToStateMachine(PlayState aState); 1.34 + virtual void SetVolume(double aVolume); 1.35 + virtual void PlaybackPositionChanged(); 1.36 + virtual void UpdateReadyStateForData(); 1.37 + virtual void SetElementVisibility(bool aIsVisible); 1.38 + virtual void SetCanOffloadAudio(bool aCanOffloadAudio); 1.39 + virtual void AddOutputStream(ProcessedMediaStream* aStream, 1.40 + bool aFinishWhenEnded); 1.41 + virtual void SetPlaybackRate(double aPlaybackRate); 1.42 + 1.43 + void AudioOffloadTearDown(); 1.44 + int64_t GetSeekTime() { return mRequestedSeekTarget.mTime; } 1.45 + void ResetSeekTime() { mRequestedSeekTarget.Reset(); } 1.46 + 1.47 +private: 1.48 + void PauseStateMachine(); 1.49 + void ResumeStateMachine(); 1.50 + 1.51 + MediaOmxReader* mReader; 1.52 + 1.53 + // Offloaded audio track 1.54 + android::sp<MediaSource> mAudioTrack; 1.55 + 1.56 + nsAutoPtr<AudioOffloadPlayerBase> mAudioOffloadPlayer; 1.57 + 1.58 + // Set by MediaOmxReader to denote current track can be offloaded 1.59 + bool mCanOffloadAudio; 1.60 + 1.61 + // Set when offload playback of current track fails in the middle and need to 1.62 + // fallback to state machine 1.63 + bool mFallbackToStateMachine; 1.64 +}; 1.65 + 1.66 +} // namespace mozilla 1.67 + 1.68 +#endif