/*******************************************************************
                            GOP interface
 *******************************************************************/

#ifndef GOP_H
#define GOP_H

#include "video_stream.h"
#include "timecode.h"
#include "sequence_header.h"
#include "picture_header.h"

typedef struct {
	size_t offset;
	unsigned int start_frame;
	unsigned int frame_count;
} GOP;

typedef struct {
	VIDEO_STREAM *p;
	int frame;
	int scale;
	READ_PICTURE_HEADER_OPTION *pic_opt;
} READ_GOP_PARAMETER;

typedef struct {
	void *arg1;
	GOP  (* func)(void *, int);
	void (* release)(void *);
} FIND_GOP;

#ifdef __cplusplus
extern "C" {
#endif

#ifndef GOP_C
extern int next_gop(VIDEO_STREAM *p);
extern READ_GOP_PARAMETER *new_read_gop_parameter(VIDEO_STREAM *stream, SEQUENCE_HEADER *seq, READ_PICTURE_HEADER_OPTION *pic_opt);
extern void delete_read_gop_parameter(void *p);
extern int read_gop(READ_GOP_PARAMETER *in, GOP *out);
extern int count_frame(READ_GOP_PARAMETER *p);
extern GOP find_gop_with_timecode(void *p, int frame);
extern int last_gop(VIDEO_STREAM *p);
#endif
	
#ifdef __cplusplus
}
#endif

#endif
