/*******************************************************************
   MPEG Video sequance header interface
 *******************************************************************/

#ifndef SEQUENCE_HEADER_H
#define SEQUENCE_HEADER_H

#include "mpeg_io.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
	int frame;
	int scale;
} FRAME_PER_SCALE;
	
typedef struct {
	int profile_and_level;
	int progressive;
	int chroma_format;
	int low_delay;
	int frame_rate_ext_n;
	int frame_rate_ext_d;
} SEQUENCE_EXTENSION;

typedef struct {
	int video_format;
	int has_color_description;
	int color_primaries;
	int transfer_characteristics;
	int matrix_coeffients;
	int display_h_size;
	int display_v_size;
} SEQUENCE_DISPLAY_EXTENSION;

typedef struct {
	int scalable_mode;
	int layer;
	int lower_layer_prediction_h_size;
	int lower_layer_prediction_v_size;
	int h_subsampling_facter_m;
	int h_subsampling_facter_n;
	int v_subsampling_facter_m;
	int v_subsampling_facter_n;
	int picture_mux_enable;
	int mux_to_progressive_sequence;
	int pixture_mux_order;
	int pixture_mux_facter;
} SEQUENCE_SCALABLE_EXTENSION;

typedef struct {
	int h_size;
	int v_size;
	int aspect_ratio;
	int picture_rate;
	int bit_rate;
	int vbv_buffer_size;
	int mpeg1;
	int has_intra_quantizer_matrix;
	unsigned char iqm[64];
	int has_nonintra_quantizer_matrix;
	unsigned char nqm[64];
	
	int has_sequence_extension;
	SEQUENCE_EXTENSION se;

	int has_sequence_display_extension;
	SEQUENCE_DISPLAY_EXTENSION sd;

	int has_sequence_scalable_extension;
	SEQUENCE_SCALABLE_EXTENSION ss;

	FRAME_PER_SCALE fps;
} SEQUENCE_HEADER;

#ifndef SEQUENCE_HEADER_C
extern int read_sequence_header(MPEG_IO *in, SEQUENCE_HEADER *out);
#endif

#ifdef __cplusplus
}
#endif

#endif