//
// Automatically generated by ipdlc.
// Edit at your own risk
//

#ifndef PRemoteMediaManagerChild_h
#define PRemoteMediaManagerChild_h

#include "mozilla/PRemoteMediaManager.h"
#ifdef DEBUG
#include "prenv.h"
#endif  // DEBUG

#include "mozilla/Tainting.h"
#include "mozilla/ipc/MessageChannel.h"
#include "mozilla/ipc/ProtocolUtils.h"
// Headers for things that cannot be forward declared
#include "DecoderDoctorDiagnostics.h"
#include "EncoderConfig.h"
#include "ImageTypes.h"
#include "MediaData.h"
#include "MediaInfo.h"
#include "PerformanceRecorder.h"
#include "PlatformDecoderModule.h"
#include "TimeUnits.h"
#include "gfxPoint.h"
#include "gfxTypes.h"
#include "mozilla/gfx/FileHandleWrapper.h"
#include "mozilla/gfx/Matrix.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/gfx/Rect.h"
#include "mozilla/gfx/Types.h"
#include "mozilla/ipc/IPCTypes.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/SharedMemoryHandle.h"
#include "mozilla/layers/GpuFence.h"
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/layers/VideoBridgeUtils.h"
#include "mozilla/webrender/WebRenderTypes.h"
#include "nsRegion.h"

namespace mozilla {
namespace layers {
class PTextureChild;
} // namespace layers
} // namespace mozilla
namespace mozilla {
namespace layers {
class PTextureParent;
} // namespace layers
} // namespace mozilla

namespace mozilla {
class PRemoteCDMChild;
} // namespace mozilla
namespace mozilla {
class PRemoteCDMParent;
} // namespace mozilla

namespace mozilla {
class PRemoteDecoderChild;
} // namespace mozilla
namespace mozilla {
class PRemoteDecoderParent;
} // namespace mozilla

namespace mozilla {
class PRemoteEncoderChild;
} // namespace mozilla
namespace mozilla {
class PRemoteEncoderParent;
} // namespace mozilla

namespace mozilla {
class PRemoteCDMChild;
} // namespace mozilla

namespace mozilla {
class PRemoteDecoderChild;
} // namespace mozilla

namespace mozilla {
class PRemoteEncoderChild;
} // namespace mozilla

namespace mozilla {
struct null_t;
} // namespace mozilla

namespace mozilla {
namespace layers {
struct TextureFactoryIdentifier;
} // namespace layers
} // namespace mozilla

namespace mozilla {


class PRemoteMediaManagerChild :
    public mozilla::ipc::IToplevelProtocol
{
private:
    friend class ::mozilla::PRemoteCDMChild;
    friend class ::mozilla::PRemoteDecoderChild;
    friend class ::mozilla::PRemoteEncoderChild;
public:
    static constexpr ::mozilla::ipc::ProtocolId kProtocolId = PRemoteMediaManagerMsgStart;
protected:
    typedef mozilla::ipc::ActorId ActorId;
    typedef ::mozilla::AudioInfo AudioInfo;
    typedef ::mozilla::layers::BufferDescriptor BufferDescriptor;
    typedef ::mozilla::ipc::ByteBuf ByteBuf;
    typedef ::mozilla::gfx::ChromaSubsampling ChromaSubsampling;
    typedef ::mozilla::gfx::ColorDepth ColorDepth;
    typedef ::mozilla::gfx::ColorRange ColorRange;
    typedef ::mozilla::gfx::ColorSpace2 ColorSpace2;
    typedef ::mozilla::layers::CompositeProcessFencesHolderId CompositeProcessFencesHolderId;
    typedef ::mozilla::CryptoInfo CryptoInfo;
    typedef ::mozilla::CryptoScheme CryptoScheme;
    typedef ::mozilla::DecoderDoctorDiagnostics DecoderDoctorDiagnostics;
    typedef ::mozilla::layers::EGLImageDescriptor EGLImageDescriptor;
    typedef ::mozilla::EncoderConfig EncoderConfig;
    template<class FooSide> using Endpoint = mozilla::ipc::Endpoint<FooSide>;
    typedef ::mozilla::wr::ExternalImageId ExternalImageId;
    typedef ::mozilla::wr::ExternalImageSource ExternalImageSource;
    typedef ::mozilla::ipc::FileDescriptor FileDescriptor;
    typedef ::mozilla::gfx::FileHandleWrapper FileHandleWrapper;
    typedef ::mozilla::layers::GpuFence GpuFence;
    typedef ::mozilla::layers::GpuProcessTextureId GpuProcessTextureId;
    typedef ::mozilla::gfx::IntRect IntRect;
    typedef ::mozilla::gfx::IntSize IntSize;
    template<class FooSide> using ManagedEndpoint = mozilla::ipc::ManagedEndpoint<FooSide>;
    typedef ::mozilla::gfx::Matrix4x4 Matrix4x4;
    typedef ::mozilla::layers::MaybeVideoBridgeSource MaybeVideoBridgeSource;
    typedef ::mozilla::MediaDataIPDL MediaDataIPDL;
    typedef ::mozilla::layers::MemoryOrShmem MemoryOrShmem;
    typedef ::mozilla::CreateDecoderParams::OptionSet OptionSet;
    typedef ::mozilla::PRemoteCDMChild PRemoteCDMChild;
    typedef ::mozilla::PRemoteCDMParent PRemoteCDMParent;
    typedef ::mozilla::PRemoteDecoderChild PRemoteDecoderChild;
    typedef ::mozilla::PRemoteDecoderParent PRemoteDecoderParent;
    typedef ::mozilla::PRemoteEncoderChild PRemoteEncoderChild;
    typedef ::mozilla::PRemoteEncoderParent PRemoteEncoderParent;
    typedef ::mozilla::layers::PTextureChild PTextureChild;
    typedef ::mozilla::layers::PTextureParent PTextureParent;
    typedef base::ProcessId ProcessId;
    typedef mozilla::ipc::ProtocolId ProtocolId;
    typedef ::mozilla::layers::RGBDescriptor RGBDescriptor;
    typedef ::mozilla::ipc::ReadOnlySharedMemoryHandle ReadOnlySharedMemoryHandle;
    typedef ::mozilla::RemoteDecoderInfoIPDL RemoteDecoderInfoIPDL;
    typedef ::mozilla::layers::RemoteDecoderVideoSubDescriptor RemoteDecoderVideoSubDescriptor;
    typedef ::mozilla::layers::RemoteTextureId RemoteTextureId;
    typedef ::mozilla::layers::RemoteTextureOwnerId RemoteTextureOwnerId;
    typedef mozilla::ipc::ResponseRejectReason ResponseRejectReason;
    typedef ::mozilla::ipc::Shmem Shmem;
    typedef ::mozilla::StereoMode StereoMode;
    typedef ::mozilla::layers::SurfaceDescriptor SurfaceDescriptor;
    typedef ::mozilla::layers::SurfaceDescriptorAndroidHardwareBuffer SurfaceDescriptorAndroidHardwareBuffer;
    typedef ::mozilla::layers::SurfaceDescriptorBuffer SurfaceDescriptorBuffer;
    typedef ::mozilla::layers::SurfaceDescriptorCanvasSurface SurfaceDescriptorCanvasSurface;
    typedef ::mozilla::layers::SurfaceDescriptorD3D10 SurfaceDescriptorD3D10;
    typedef ::mozilla::layers::SurfaceDescriptorDMABuf SurfaceDescriptorDMABuf;
    typedef ::mozilla::layers::SurfaceDescriptorDXGIYCbCr SurfaceDescriptorDXGIYCbCr;
    typedef ::mozilla::layers::SurfaceDescriptorDcompSurface SurfaceDescriptorDcompSurface;
    typedef ::mozilla::layers::SurfaceDescriptorExternalImage SurfaceDescriptorExternalImage;
    typedef ::mozilla::layers::SurfaceDescriptorGPUVideo SurfaceDescriptorGPUVideo;
    typedef ::mozilla::layers::SurfaceDescriptorMacIOSurface SurfaceDescriptorMacIOSurface;
    typedef ::mozilla::layers::SurfaceDescriptorRemoteDecoder SurfaceDescriptorRemoteDecoder;
    typedef ::mozilla::layers::SurfaceDescriptorRemoteDecoderId SurfaceDescriptorRemoteDecoderId;
    typedef ::mozilla::layers::SurfaceDescriptorRemoteTexture SurfaceDescriptorRemoteTexture;
    typedef ::mozilla::layers::SurfaceDescriptorShared SurfaceDescriptorShared;
    typedef ::mozilla::layers::SurfaceDescriptorSharedGLTexture SurfaceDescriptorSharedGLTexture;
    typedef ::mozilla::gfx::SurfaceFormat SurfaceFormat;
    typedef ::mozilla::layers::SurfaceTextureDescriptor SurfaceTextureDescriptor;
    typedef ::mozilla::layers::TextureFactoryIdentifier TextureFactoryIdentifier;
    typedef ::mozilla::media::TimeUnit TimeUnit;
    typedef ::mozilla::TrackingId TrackingId;
    typedef ::mozilla::gfx::TransferFunction TransferFunction;
    template<class T> using UniquePtr = mozilla::UniquePtr<T>;
    typedef ::mozilla::VideoDecoderInfoIPDL VideoDecoderInfoIPDL;
    typedef ::mozilla::VideoInfo VideoInfo;
    typedef ::mozilla::WindowsHandle WindowsHandle;
    typedef ::mozilla::layers::YCbCrDescriptor YCbCrDescriptor;
    typedef ::mozilla::gfx::YUVColorSpace YUVColorSpace;
    typedef ::gfxImageFormat gfxImageFormat;
    typedef ::gfxPoint gfxPoint;
    typedef ::int16_t int16_t;
    typedef ::int32_t int32_t;
    typedef ::int64_t int64_t;
    typedef ::int8_t int8_t;
    typedef ::intptr_t intptr_t;
    typedef ::nsCString nsCString;
    typedef ::nsIntRegion nsIntRegion;
    typedef ::nsString nsString;
    typedef ::nsresult nsresult;
    typedef ::mozilla::null_t null_t;
    typedef ::uint16_t uint16_t;
    typedef ::uint32_t uint32_t;
    typedef ::uint64_t uint64_t;
    typedef ::uint8_t uint8_t;
    typedef ::uintptr_t uintptr_t;

protected:
    void
    ProcessingError(
            Result aCode,
            const char* aReason) override;
    bool
    ShouldContinueFromReplyTimeout() override;

public:
    typedef mozilla::ipc::IProtocol IProtocol;
    typedef IPC::Message Message;
    typedef base::ProcessHandle ProcessHandle;
    typedef mozilla::ipc::MessageChannel MessageChannel;

public:
    MOZ_IMPLICIT PRemoteMediaManagerChild();

    virtual ~PRemoteMediaManagerChild();

protected:
    void
    ActorAlloc() final;
    void
    ActorDealloc() final;
public:
    ::base::ProcessId
    OtherPid() const;
    ::GeckoChildID
    OtherChildID() const;
    ::mozilla::ipc::EndpointProcInfo
    OtherEndpointProcInfo() const;

    void
    ManagedPRemoteCDMChild(nsTArray<PRemoteCDMChild*>& aArr) const;
    const ManagedContainer<PRemoteCDMChild>&
    ManagedPRemoteCDMChild() const;

    void
    ManagedPRemoteDecoderChild(nsTArray<PRemoteDecoderChild*>& aArr) const;
    const ManagedContainer<PRemoteDecoderChild>&
    ManagedPRemoteDecoderChild() const;

    void
    ManagedPRemoteEncoderChild(nsTArray<PRemoteEncoderChild*>& aArr) const;
    const ManagedContainer<PRemoteEncoderChild>&
    ManagedPRemoteEncoderChild() const;

    mozilla::Span<mozilla::ipc::ProtocolId const>
    ManagedProtocolIds() const final;

    UntypedManagedContainer*
    GetManagedActors(mozilla::ipc::ProtocolId aProtocol) final;

    ManagedEndpoint<PRemoteCDMParent>
    OpenPRemoteCDMEndpoint(PRemoteCDMChild* aActor);
    bool
    BindPRemoteCDMEndpoint(
            ManagedEndpoint<PRemoteCDMChild> aEndpoint,
            PRemoteCDMChild* aActor);

    ManagedEndpoint<PRemoteDecoderParent>
    OpenPRemoteDecoderEndpoint(PRemoteDecoderChild* aActor);
    bool
    BindPRemoteDecoderEndpoint(
            ManagedEndpoint<PRemoteDecoderChild> aEndpoint,
            PRemoteDecoderChild* aActor);

    ManagedEndpoint<PRemoteEncoderParent>
    OpenPRemoteEncoderEndpoint(PRemoteEncoderChild* aActor);
    bool
    BindPRemoteEncoderEndpoint(
            ManagedEndpoint<PRemoteEncoderChild> aEndpoint,
            PRemoteEncoderChild* aActor);

    PRemoteDecoderChild*
    SendPRemoteDecoderConstructor(
            const RemoteDecoderInfoIPDL& info,
            const OptionSet& options,
            const mozilla::Maybe<TextureFactoryIdentifier>& identifier,
            const mozilla::Maybe<uint64_t>& mediaEngineId,
            const mozilla::Maybe<TrackingId>& trackingId,
            PRemoteCDMChild* cdm);

    PRemoteDecoderChild*
    SendPRemoteDecoderConstructor(
            PRemoteDecoderChild* actor,
            const RemoteDecoderInfoIPDL& info,
            const OptionSet& options,
            const mozilla::Maybe<TextureFactoryIdentifier>& identifier,
            const mozilla::Maybe<uint64_t>& mediaEngineId,
            const mozilla::Maybe<TrackingId>& trackingId,
            PRemoteCDMChild* cdm);

    PRemoteEncoderChild*
    SendPRemoteEncoderConstructor(
            PRemoteEncoderChild* actor,
            const EncoderConfig& config);

    PRemoteCDMChild*
    SendPRemoteCDMConstructor(
            PRemoteCDMChild* actor,
            const nsAString& keySystem);

    bool
    SendReadback(
            const SurfaceDescriptorGPUVideo& sd,
            SurfaceDescriptor* aResult);

    bool
    SendDeallocateSurfaceDescriptorGPUVideo(const SurfaceDescriptorGPUVideo& sd);

    bool
    SendOnSetCurrent(const SurfaceDescriptorGPUVideo& sd);

    void
    DeallocManagee(
            mozilla::ipc::ProtocolId aProtocolId,
            IProtocol* aListener) override;

    Result
    OnMessageReceived(const Message& msg__) override;

    Result
    OnMessageReceived(
            const Message& msg__,
            UniquePtr<Message>& reply__) override;

private:
    ManagedContainer<PRemoteCDMChild> mManagedPRemoteCDMChild;
    ManagedContainer<PRemoteDecoderChild> mManagedPRemoteDecoderChild;
    ManagedContainer<PRemoteEncoderChild> mManagedPRemoteEncoderChild;
};


} // namespace mozilla
namespace IPC {
template<>
struct ParamTraits <::mozilla::PRemoteMediaManagerChild*>
{
    typedef ::mozilla::PRemoteMediaManagerChild* paramType;
    static void
    Write(
            IPC::MessageWriter* aWriter,
            const paramType& aVar);
    static IPC::ReadResult<paramType>
    Read(IPC::MessageReader* aReader);
};
} // namespace IPC

#endif // ifndef PRemoteMediaManagerChild_h
