// Copyright (c) 2011-2018 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#ifndef __MFX_MJPEG_ENCODE_INTERFACE_H__
#define __MFX_MJPEG_ENCODE_INTERFACE_H__

#include "mfx_common.h"

#if defined (MFX_ENABLE_MJPEG_VIDEO_ENCODE)

#include <vector>
#include <assert.h>
#include "mfxdefs.h"
#include "mfxvideo++int.h"

#include "mfx_mjpeg_encode_hw_utils.h"


namespace MfxHwMJpegEncode
{

    class DriverEncoder
    {
    public:

        virtual ~DriverEncoder(){}

        virtual
        mfxStatus CreateAuxilliaryDevice(
            VideoCORE * core,
            mfxU32      width,
            mfxU32      height,
            bool        isTemporal = false) = 0;

        virtual
        mfxStatus CreateAccelerationService(
            mfxVideoParam const & par) = 0;

        virtual
        mfxStatus RegisterBitstreamBuffer(
            mfxFrameAllocResponse & response) = 0;

        virtual
        mfxStatus Execute(DdiTask &task, mfxHDL surface) = 0;

        virtual
        mfxStatus QueryBitstreamBufferInfo(
            mfxFrameAllocRequest & request) = 0;

        virtual
        mfxStatus QueryEncodeCaps(
            JpegEncCaps & caps) = 0;

        virtual
        mfxStatus QueryStatus(
            DdiTask & task) = 0;

        virtual
        mfxStatus UpdateBitstream(
            mfxMemId    MemId,
            DdiTask   & task) = 0;

        virtual
        mfxStatus Destroy() = 0;

        virtual
            mfxStatus CreateWrapBuffers(
                const mfxU16& /*numFrameMin*/,
                const mfxVideoParam& /*par*/) { return MFX_ERR_NONE; }

    };

    DriverEncoder* CreatePlatformMJpegEncoder( VideoCORE* core );

}; // namespace

#endif // #if defined (MFX_ENABLE_MJPEG_VIDEO_ENCODE)
#endif // __MFX_MJPEG_ENCODE_INTERFACE_H__
