#ifndef ka_scodec_h
#define ka_scodec_h

#include "inttypes.h"
#include "ka_block.h"
#include "ka_vars.h"
#include "ka_subtitles.h"

typedef struct ka_scodec_s ka_scodec_t;

typedef struct
{
  uint32_t typ;            // subtitles type
  ka_error_t* pErrorBlock;
  ka_vars_t* vars;
} ka_sparams_t;

typedef ka_scodec_t* (*ka_scodec_FNnew)(const ka_sparams_t* params);
typedef void  (*ka_scodec_FNdelete)(ka_scodec_t** ppcodec);
typedef int   (*ka_scodec_FNdecode)(ka_scodec_t* pcodec, ka_subtitles_t* subs, ka_block_t* b);

typedef struct
{
  const char*                 name;
  ka_scodec_FNnew             FNnew;
  ka_scodec_FNdelete          FNdelete;
  ka_scodec_FNdecode          FNdecode;
} kav_scodec_t;

extern const kav_scodec_t kav_scodec_dvb;
extern const kav_scodec_t kav_scodec_dvd;

struct ka_scodec_s
{
  const kav_scodec_t* vptr;
  ka_vars_t* vars;
  ka_error_t* pErrorBlock;
};

#endif
