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