#ifndef ka_vinfo_h
#define ka_vinfo_h

#include "inttypes.h"
#include "colorspace/ka_chroma.h"
#include "colorspace/ka_drawer.h"

typedef enum
{
  ka_vframe_type_I = 0
, ka_vframe_type_P = 1
, ka_vframe_type_B = 2
} ka_vframe_type;

typedef struct
{
  ka_vplanes_t planes;        // pointer to 3 planes (y,u,v)
  ka_vframe_type type;        // frame type
  uint32_t pts;               // time stamp
  uint32_t duration;          // frame duration (frame period * repeats)
  int display_type;           // 0 bottom first, 1 top first, 2 progressive frame
  int valid;                  // 1 valid, 0 dropped, -1 invalid
  uint32_t section;           // section to which the frame belongs
  uint32_t index;             // internal counter
  uint32_t temporal_reference;// codec temporal index
  uint32_t reference;         // codec frame reference
  uint32_t sequence_ref;      // codec sequence reference
} ka_vframe_t;

typedef struct
{
  const char* videotype;
  struct
  {
    uint32_t width;           // size rounded to upper block size
    uint32_t height;          // size rounded to upper block size
  } luminance;
  struct
  {
    uint32_t wshift;          // chroma width  = lumi width >> wshift
    uint32_t hshift;          // chroma height = lumi height >> hshift
    ka_chroma_type type;      // chroma format
  } chroma;
  // real size of the decoded frame (no rounding to block size)
  struct
  {
    uint32_t width;
    uint32_t height;
  } picture;
  // information
  uint32_t frame_period;      // in 1/(90 KHz)
  struct
  {
    uint32_t width;           // example: 4
    uint32_t height;          // example: 3
  } aspect_ratio;
   uint32_t bitrate;          // in Kb/s
  int progressive;
} ka_vinfo_t;

#endif
