2014-05-17 20:05:46 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#ifndef GMPVideoDecoderParent_h_
|
|
|
|
#define GMPVideoDecoderParent_h_
|
|
|
|
|
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "gmp-video-decode.h"
|
|
|
|
#include "mozilla/gmp/PGMPVideoDecoderParent.h"
|
|
|
|
#include "GMPMessageUtils.h"
|
|
|
|
#include "GMPSharedMemManager.h"
|
|
|
|
#include "GMPVideoHost.h"
|
2014-07-10 20:35:56 -07:00
|
|
|
#include "GMPVideoDecoderProxy.h"
|
2014-05-17 20:05:46 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gmp {
|
|
|
|
|
|
|
|
class GMPParent;
|
|
|
|
|
2014-07-10 20:35:56 -07:00
|
|
|
class GMPVideoDecoderParent MOZ_FINAL : public PGMPVideoDecoderParent
|
|
|
|
, public GMPVideoDecoderProxy
|
2014-07-28 08:44:20 -07:00
|
|
|
, public GMPSharedMemManager
|
2014-05-17 20:05:46 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_REFCOUNTING(GMPVideoDecoderParent)
|
|
|
|
|
2014-08-31 20:50:23 -07:00
|
|
|
explicit GMPVideoDecoderParent(GMPParent *aPlugin);
|
2014-05-17 20:05:46 -07:00
|
|
|
|
|
|
|
GMPVideoHostImpl& Host();
|
2014-07-24 18:47:40 -07:00
|
|
|
nsresult Shutdown();
|
2014-05-17 20:05:46 -07:00
|
|
|
|
2014-07-10 18:43:04 -07:00
|
|
|
// GMPVideoDecoder
|
2014-07-24 18:47:40 -07:00
|
|
|
virtual void Close() MOZ_OVERRIDE;
|
2014-07-10 20:35:56 -07:00
|
|
|
virtual nsresult InitDecode(const GMPVideoCodec& aCodecSettings,
|
|
|
|
const nsTArray<uint8_t>& aCodecSpecific,
|
2014-07-24 18:47:40 -07:00
|
|
|
GMPVideoDecoderCallbackProxy* aCallback,
|
2014-07-10 20:36:21 -07:00
|
|
|
int32_t aCoreCount) MOZ_OVERRIDE;
|
2014-08-18 10:11:11 -07:00
|
|
|
virtual nsresult Decode(UniquePtr<GMPVideoEncodedFrame> aInputFrame,
|
2014-07-10 20:35:56 -07:00
|
|
|
bool aMissingFrames,
|
2014-07-10 20:36:21 -07:00
|
|
|
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
|
|
|
int64_t aRenderTimeMs = -1) MOZ_OVERRIDE;
|
|
|
|
virtual nsresult Reset() MOZ_OVERRIDE;
|
|
|
|
virtual nsresult Drain() MOZ_OVERRIDE;
|
2014-07-21 00:50:09 -07:00
|
|
|
virtual const uint64_t ParentID() MOZ_OVERRIDE { return reinterpret_cast<uint64_t>(mPlugin.get()); }
|
2014-07-01 19:26:35 -07:00
|
|
|
|
2014-07-01 19:26:35 -07:00
|
|
|
// GMPSharedMemManager
|
2014-07-28 08:44:20 -07:00
|
|
|
virtual bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem) MOZ_OVERRIDE
|
2014-07-01 19:26:35 -07:00
|
|
|
{
|
|
|
|
#ifdef GMP_SAFE_SHMEM
|
|
|
|
return AllocShmem(aSize, aType, aMem);
|
|
|
|
#else
|
|
|
|
return AllocUnsafeShmem(aSize, aType, aMem);
|
|
|
|
#endif
|
|
|
|
}
|
2014-07-28 08:44:20 -07:00
|
|
|
virtual void Dealloc(Shmem& aMem) MOZ_OVERRIDE
|
2014-07-01 19:26:35 -07:00
|
|
|
{
|
|
|
|
DeallocShmem(aMem);
|
|
|
|
}
|
|
|
|
|
2014-05-17 20:05:46 -07:00
|
|
|
private:
|
|
|
|
~GMPVideoDecoderParent();
|
|
|
|
|
|
|
|
// PGMPVideoDecoderParent
|
|
|
|
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
|
|
|
|
virtual bool RecvDecoded(const GMPVideoi420FrameData& aDecodedFrame) MOZ_OVERRIDE;
|
|
|
|
virtual bool RecvReceivedDecodedReferenceFrame(const uint64_t& aPictureId) MOZ_OVERRIDE;
|
|
|
|
virtual bool RecvReceivedDecodedFrame(const uint64_t& aPictureId) MOZ_OVERRIDE;
|
|
|
|
virtual bool RecvInputDataExhausted() MOZ_OVERRIDE;
|
2014-07-10 20:35:56 -07:00
|
|
|
virtual bool RecvDrainComplete() MOZ_OVERRIDE;
|
|
|
|
virtual bool RecvResetComplete() MOZ_OVERRIDE;
|
2014-07-23 14:35:01 -07:00
|
|
|
virtual bool RecvError(const GMPErr& aError) MOZ_OVERRIDE;
|
2014-07-01 19:26:35 -07:00
|
|
|
virtual bool RecvParentShmemForPool(Shmem& aEncodedBuffer) MOZ_OVERRIDE;
|
|
|
|
virtual bool AnswerNeedShmem(const uint32_t& aFrameBufferSize,
|
|
|
|
Shmem* aMem) MOZ_OVERRIDE;
|
2014-05-17 20:05:46 -07:00
|
|
|
virtual bool Recv__delete__() MOZ_OVERRIDE;
|
|
|
|
|
2014-07-24 18:47:40 -07:00
|
|
|
bool mIsOpen;
|
2014-10-13 15:04:59 -07:00
|
|
|
bool mShuttingDown;
|
2014-07-19 16:14:03 -07:00
|
|
|
nsRefPtr<GMPParent> mPlugin;
|
2014-07-24 18:47:40 -07:00
|
|
|
GMPVideoDecoderCallbackProxy* mCallback;
|
2014-05-17 20:05:46 -07:00
|
|
|
GMPVideoHostImpl mVideoHost;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gmp
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // GMPVideoDecoderParent_h_
|