2012-05-31 17:54:23 -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(MediaPluginReader_h_)
|
|
|
|
#define MediaPluginReader_h_
|
2012-05-31 17:54:23 -07:00
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-05-31 17:54:23 -07:00
|
|
|
#include "MediaResource.h"
|
2012-11-14 11:46:40 -08:00
|
|
|
#include "MediaDecoderReader.h"
|
2012-12-12 14:53:58 -08:00
|
|
|
#include "ImageContainer.h"
|
2013-10-24 19:44:58 -07:00
|
|
|
#include "nsAutoPtr.h"
|
2012-12-12 14:53:58 -08:00
|
|
|
#include "mozilla/layers/SharedRGBImage.h"
|
|
|
|
|
2012-05-31 17:54:23 -07:00
|
|
|
#include "MPAPI.h"
|
|
|
|
|
2012-11-26 13:12:24 -08:00
|
|
|
class nsACString;
|
|
|
|
|
2012-11-14 11:45:33 -08:00
|
|
|
namespace mozilla {
|
|
|
|
|
2012-11-19 07:11:21 -08:00
|
|
|
class AbstractMediaDecoder;
|
|
|
|
|
2012-12-12 14:53:58 -08:00
|
|
|
namespace layers {
|
|
|
|
class ImageContainer;
|
|
|
|
}
|
2013-03-02 11:14:44 -08:00
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
class TimeRanges;
|
|
|
|
}
|
2012-12-12 14:53:58 -08:00
|
|
|
|
2012-11-14 11:46:40 -08:00
|
|
|
class MediaPluginReader : public MediaDecoderReader
|
2012-05-31 17:54:23 -07:00
|
|
|
{
|
|
|
|
nsCString mType;
|
|
|
|
MPAPI::Decoder *mPlugin;
|
2012-08-09 00:10:13 -07:00
|
|
|
bool mHasAudio;
|
|
|
|
bool mHasVideo;
|
2012-05-31 17:54:23 -07:00
|
|
|
nsIntRect mPicture;
|
|
|
|
nsIntSize mInitialFrame;
|
|
|
|
int64_t mVideoSeekTimeUs;
|
|
|
|
int64_t mAudioSeekTimeUs;
|
2013-10-24 19:44:58 -07:00
|
|
|
nsAutoPtr<VideoData> mLastVideoFrame;
|
2012-05-31 17:54:23 -07:00
|
|
|
public:
|
2012-11-26 13:12:24 -08:00
|
|
|
MediaPluginReader(AbstractMediaDecoder* aDecoder,
|
|
|
|
const nsACString& aContentType);
|
2012-11-14 11:46:40 -08:00
|
|
|
~MediaPluginReader();
|
2012-05-31 17:54:23 -07:00
|
|
|
|
2012-11-14 11:46:40 -08:00
|
|
|
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
|
2012-05-31 17:54:23 -07:00
|
|
|
virtual nsresult ResetDecode();
|
|
|
|
|
|
|
|
virtual bool DecodeAudioData();
|
|
|
|
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
|
2012-08-22 08:56:38 -07:00
|
|
|
int64_t aTimeThreshold);
|
2012-05-31 17:54:23 -07:00
|
|
|
|
|
|
|
virtual bool HasAudio()
|
|
|
|
{
|
|
|
|
return mHasAudio;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool HasVideo()
|
|
|
|
{
|
|
|
|
return mHasVideo;
|
|
|
|
}
|
|
|
|
|
2013-09-26 22:22:38 -07:00
|
|
|
virtual nsresult ReadMetadata(MediaInfo* aInfo,
|
2012-11-08 16:40:08 -08:00
|
|
|
MetadataTags** aTags);
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime);
|
2013-12-16 14:58:16 -08:00
|
|
|
|
2012-12-12 14:53:58 -08:00
|
|
|
class ImageBufferCallback : public MPAPI::BufferCallback {
|
|
|
|
typedef mozilla::layers::Image Image;
|
2013-12-16 14:58:16 -08:00
|
|
|
|
2012-12-12 14:53:58 -08:00
|
|
|
public:
|
|
|
|
ImageBufferCallback(mozilla::layers::ImageContainer *aImageContainer);
|
|
|
|
void *operator()(size_t aWidth, size_t aHeight,
|
2013-05-29 13:43:41 -07:00
|
|
|
MPAPI::ColorFormat aColorFormat) MOZ_OVERRIDE;
|
2012-12-12 14:53:58 -08:00
|
|
|
already_AddRefed<Image> GetImage();
|
2013-12-16 14:58:16 -08:00
|
|
|
|
2012-12-12 14:53:58 -08:00
|
|
|
private:
|
2013-12-16 14:58:16 -08:00
|
|
|
uint8_t *CreateI420Image(size_t aWidth, size_t aHeight);
|
|
|
|
|
2012-12-12 14:53:58 -08:00
|
|
|
mozilla::layers::ImageContainer *mImageContainer;
|
|
|
|
nsRefPtr<Image> mImage;
|
|
|
|
};
|
2013-12-16 14:58:16 -08:00
|
|
|
|
2012-05-31 17:54:23 -07:00
|
|
|
};
|
|
|
|
|
2012-11-14 11:45:33 -08:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2012-05-31 17:54:23 -07:00
|
|
|
#endif
|