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

#ifndef __GST_MVB_META_H__
#define __GST_MVB_META_H__


#include <gst/gst.h>
#include <gst/mvb/mvb-prelude.h>
#include "mvb_heap.h"

G_BEGIN_DECLS

typedef struct _GstMetaMvb GstMetaMvb;

struct _GstMetaMvb {
  GstMeta meta;

  int meta_fd;

  struct mvb_heap_t* priv_heap;
  struct mvb_slot_t* priv_slot_out;
  struct mvb_slot_t* priv_slot_internal_normal_basic;
  struct mvb_slot_t* priv_slot_internal_secure_basic;
};

GST_MVB_API
GType gst_meta_mvb_api_get_type (void);
#define GST_META_MVB_API_TYPE (gst_meta_mvb_api_get_type())

/* implementation */

GST_MVB_API
const GstMetaInfo *gst_meta_mvb_get_info (void);
#define GST_META_MVB_INFO (gst_meta_mvb_get_info())

#define GST_META_MVB_GET(buf) ((GstMetaMvb *)gst_buffer_get_meta(buf, GST_META_MVB_API_TYPE))
#define GST_META_MVB_ADD(buf) ((GstMetaMvb *)gst_buffer_add_meta(buf, GST_META_MVB_INFO,NULL))

GST_MVB_API
GstMetaMvb * gst_buffer_add_meta_mvb (GstBuffer * buffer);

GST_MVB_API
GstMetaMvb * gst_buffer_get_meta_mvb (GstBuffer * buffer);

GST_MVB_API
void gst_buffer_refresh_meta_mvb (GstMetaMvb * mvb_meta);

GST_MVB_API
int gst_meta_mvb_get_fd (GstMetaMvb* meta);

GST_MVB_API
uint64_t gst_meta_mvb_get_magic_num (GstMetaMvb* meta);

GST_MVB_API
uint32_t gst_meta_mvb_get_version (GstMetaMvb* meta);

GST_MVB_API
int32_t gst_meta_mvb_get_internal_fd (GstMetaMvb* meta, int index);

GST_MVB_API
int32_t gst_meta_mvb_get_internal_fd_count (GstMetaMvb* meta);

GST_MVB_API
void gst_meta_mvb_debug (GstMetaMvb* meta);

G_END_DECLS

#endif /* __GST_MVB_META_H__ */
