// Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto.  Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once

#include <carb/Interface.h>

#include <memory>

namespace omni
{

struct IVideoEncoding
{
    CARB_PLUGIN_INTERFACE("omni::IVideoEncoding", 0, 1)

    /**
     * Prepare the encoding plugin to process frames.
     * @param videoFilename name of the MP4 file where the encoded video will be written
     * @param framerate number of frames per second
     * @param nframes total number of frames; if unknown, set to 0
     * @param overwriteVideo if set, overwrite existing MP4 file; otherwise, refuse to do anything if the file specified
     * in videoFilename exists.
     */
    bool(CARB_ABI* startEncoding)(const char* videoFilename, double framerate, uint32_t nframes, bool overwriteVideo);

    /**
     * Encode a frame and write the result to disk.
     * @param bufferRGBA8 raw frame image data; format: R8G8B8A8; size: width * height * 4
     * @param width frame width
     * @param height frame height
     */
    void(CARB_ABI* encodeNextFrameFromBuffer)(const uint8_t* bufferRGBA8, uint32_t width, uint32_t height);

    /**
     * Read a frame from an image file, encode, and write to disk. Warning: pixel formats other than RGBA8 will probably
     * not work (yet).
     * @param FrameFilename name of the file to read. Supported file formats: see carb::imaging
     */
    void(CARB_ABI* encodeNextFrameFromFile)(const char* FrameFilename);

    /**
     * Indicate that all frames have been encoded. This will ensure that writing to the output video file is done, and
     * close it.
     */
    void(CARB_ABI* finalizeEncoding)();
};

}
