// SPDX-License-Identifier: GPL-2.0+ AND LGPL-2.0+ AND LGPL-2.1+

#ifndef __GST_MVB_BUFFER_POOL_H__
#define __GST_MVB_BUFFER_POOL_H__

#ifdef __cplusplus
extern "C" {
#endif

#include <gst/gst.h>
#include <gst/mvb/mvb-prelude.h>
#include <gst/mvb/mvb.h>
#include <gst/video/gstvideopool.h>

G_BEGIN_DECLS

typedef struct _GstMvbBufferPool      GstMvbBufferPool;
typedef struct _GstMvbBufferPoolClass GstMvbBufferPoolClass;

#define GST_TYPE_MVB_BUFFER_POOL      (gst_mvb_buffer_pool_get_type())
#define GST_IS_MVB_BUFFER_POOL(obj)   (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_MVB_BUFFER_POOL))
#define GST_MVB_BUFFER_POOL(obj)      (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_MVB_BUFFER_POOL, GstMvbBufferPool))
#define GST_MVB_BUFFER_POOL_CAST(obj) ((GstMvbBufferPool*) (obj))

#define GST_BUFFER_POOL_OPTION_MVB_PROTECTED "GstBufferPoolOptionMvbProtected"

struct _GstMvbBufferPool {
    GstVideoBufferPool bufferpool;
    /* These parameters are needed in Mvb-allocate API */
    GstVideoInfo info;
    guint size;  // sometimes required size > info->size
    gboolean is_info_valid;
};

struct _GstMvbBufferPoolClass {
    GstVideoBufferPoolClass parent_class;
};

GST_MVB_API
GType gst_mvb_buffer_pool_get_type(void);

GST_MVB_API
GstBufferPool* gst_mvb_buffer_pool_new();

#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstMvbBufferPool, gst_object_unref)
#endif

G_END_DECLS

#ifdef __cplusplus
}
#endif
#endif /* __GST_MVB_BUFFER_POOL_H__ */
