2012-09-27 04:33:43 +00: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 19:46:40 +00:00
|
|
|
#if !defined(MediaOmxReader_h_)
|
|
|
|
#define MediaOmxReader_h_
|
2012-09-27 04:33:43 +00:00
|
|
|
|
|
|
|
#include "MediaResource.h"
|
2012-11-14 19:46:40 +00:00
|
|
|
#include "MediaDecoderReader.h"
|
2013-09-05 20:25:17 +00:00
|
|
|
#include "nsRect.h"
|
2013-05-02 16:56:09 +00:00
|
|
|
#include <ui/GraphicBuffer.h>
|
2012-09-27 04:33:43 +00:00
|
|
|
|
2013-02-01 22:13:23 +00:00
|
|
|
namespace android {
|
|
|
|
class OmxDecoder;
|
|
|
|
}
|
2012-09-27 04:33:43 +00:00
|
|
|
|
2012-11-14 19:45:33 +00:00
|
|
|
namespace mozilla {
|
|
|
|
|
2013-03-02 19:14:44 +00:00
|
|
|
namespace dom {
|
|
|
|
class TimeRanges;
|
|
|
|
}
|
|
|
|
|
2012-11-19 15:11:21 +00:00
|
|
|
class AbstractMediaDecoder;
|
|
|
|
|
2012-11-14 19:46:40 +00:00
|
|
|
class MediaOmxReader : public MediaDecoderReader
|
2012-09-27 04:33:43 +00:00
|
|
|
{
|
|
|
|
nsCString mType;
|
|
|
|
bool mHasVideo;
|
|
|
|
bool mHasAudio;
|
|
|
|
nsIntRect mPicture;
|
|
|
|
nsIntSize mInitialFrame;
|
|
|
|
int64_t mVideoSeekTimeUs;
|
|
|
|
int64_t mAudioSeekTimeUs;
|
2012-11-27 04:08:40 +00:00
|
|
|
int32_t mSkipCount;
|
2013-09-23 09:53:36 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
android::sp<android::OmxDecoder> mOmxDecoder;
|
|
|
|
|
|
|
|
// Called by ReadMetadata() during MediaDecoderStateMachine::DecodeMetadata()
|
|
|
|
// on decode thread. It create and initialize the OMX decoder including
|
|
|
|
// setting up custom extractor. The extractor provide the essential
|
|
|
|
// information used for creating OMX decoder such as video/audio codec.
|
|
|
|
virtual nsresult InitOmxDecoder();
|
|
|
|
|
2012-09-27 04:33:43 +00:00
|
|
|
public:
|
2012-11-19 15:11:21 +00:00
|
|
|
MediaOmxReader(AbstractMediaDecoder* aDecoder);
|
2012-11-14 19:46:40 +00:00
|
|
|
~MediaOmxReader();
|
2012-09-27 04:33:43 +00:00
|
|
|
|
2012-11-14 19:46:40 +00:00
|
|
|
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
|
2012-09-27 04:33:43 +00:00
|
|
|
virtual nsresult ResetDecode();
|
|
|
|
|
2013-01-24 12:38:32 +00:00
|
|
|
virtual void NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset);
|
|
|
|
|
2012-09-27 04:33:43 +00:00
|
|
|
virtual bool DecodeAudioData();
|
|
|
|
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
|
|
|
|
int64_t aTimeThreshold);
|
|
|
|
|
|
|
|
virtual bool HasAudio()
|
|
|
|
{
|
|
|
|
return mHasAudio;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool HasVideo()
|
|
|
|
{
|
|
|
|
return mHasVideo;
|
|
|
|
}
|
|
|
|
|
2013-06-10 12:22:05 +00:00
|
|
|
virtual bool IsWaitingMediaResources();
|
|
|
|
|
|
|
|
virtual bool IsDormantNeeded();
|
|
|
|
virtual void ReleaseMediaResources();
|
|
|
|
|
2013-10-14 08:38:17 +00:00
|
|
|
virtual void ReleaseDecoder() MOZ_OVERRIDE;
|
|
|
|
|
2013-09-27 05:22:38 +00:00
|
|
|
virtual nsresult ReadMetadata(MediaInfo* aInfo,
|
2012-11-09 00:40:08 +00:00
|
|
|
MetadataTags** aTags);
|
2012-09-27 04:33:43 +00:00
|
|
|
virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime);
|
2013-03-02 19:14:44 +00:00
|
|
|
virtual nsresult GetBuffered(mozilla::dom::TimeRanges* aBuffered, int64_t aStartTime);
|
2013-04-11 00:58:25 +00:00
|
|
|
|
|
|
|
virtual void OnDecodeThreadStart() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual void OnDecodeThreadFinish() MOZ_OVERRIDE;
|
2012-09-27 04:33:43 +00:00
|
|
|
};
|
|
|
|
|
2012-11-14 19:45:33 +00:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2012-09-27 04:33:43 +00:00
|
|
|
#endif
|