#ifndef _VAAPI_H264_H
#define _VAAPI_H264_H

#include <stdio.h>
#include <va/va.h>

typedef struct _VAAPIContext VAAPIContext;
typedef struct _PProcContext PProcContext;
typedef struct _HWEncContext HWEncContext;
typedef struct _YUV_Surf YUV_Surf;

VAAPIContext *vaapi_context_create(int card);
void vaapi_context_destroy(VAAPIContext *ctx);
YUV_Surf *vaapi_create_yuv(VAAPIContext *ctx, int width, int height);
void vaapi_destroy_yuv(VAAPIContext *ctx, YUV_Surf *surf);
int vaapi_export_yuv(VAAPIContext *ctx, YUV_Surf *surf, uint8_t **buf);
int vaapi_yuv_width(YUV_Surf *surf);
int vaapi_yuv_height(YUV_Surf *surf);

int vaapi_get_drmfd(VAAPIContext *ctx);

PProcContext *pproc_context_create(VAAPIContext *ctx);
void pproc_context_destroy(PProcContext *ctx);
int pproc_import_rgb(PProcContext *ctx, int name, int width, int height,
                     int stride);
int pproc_export_rgb(PProcContext *ctx, uint8_t **buf);
int pproc_do_convert(PProcContext *ctx, YUV_Surf *surf);

HWEncContext *hwenc_context_create(VAAPIContext *ctx, int profile);
void hwenc_context_destroy(HWEncContext *ctx);
int hwenc_import_yuv(HWEncContext *ctx, YUV_Surf *surf);
int hwenc_upload_surface(VAAPIContext *ctx, YUV_Surf *surf, unsigned char *buf);
int hwenc_params_level(HWEncContext *ctx, uint8_t lv);
int hwenc_params(HWEncContext *ctx, int i_period, int idr_period, int bitrate);
int hwenc_do_encode(HWEncContext *ctx);
void hwenc_force_idr(HWEncContext *ctx);
int hwenc_export_h264(HWEncContext *ctx, uint8_t **buf);

#endif /* _VAAPI_H264_H */
