⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 avitypes.h

📁 SAMSUNG 5009的源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* list_stack_elem.h */
/* structure used to assist parsing of nested LISTs */
typedef struct list_stack_elem_s {
	struct list_stack_elem_s *parent; 
//	LIBAVI_FILE *file;
	AVI_FILE_st	*file;

//	LIBAVI_FILEOFFSET_T start;   /**< Byte offset in file of our list. */
	UINT	start;
//	LIBAVI_FILEOFFSET_T length;  /**< Length in bytes of the list. */
//	ULLONG	length;
	UINT	length;
//	LIBAVI_FILEOFFSET_T chunk;   /**< Current chunk within our list */
	UINT	chunk;

	fourCC_t 	ckID;
	fourCC_t 	listType;
	INT 			error;
	INT 			depth;
} list_stack_elem_t;
/* list_stack_elem.h */



/* video_info.h */
/// Structure conveying information about the video stream.
typedef struct video_info_s {

	/// frame period (and thus frame rate) is expressed as a rational number
	/// period = frame_period_divisor / frame_period_dividend  
	INT frame_period_divisor;   

	/// frame period (and thus frame rate) is expressed as a rational number
	/// period = frame_period_divisor / frame_period_dividend  
	INT frame_period_dividend;

	/// Pixel width of the encoded video.
	INT width;

	/// Pixel width of the encoded video.
	INT height;

	/// Null-terminated, 8-character string containing both FourCC codes, 
	/// e.g. "divxDX50".
	CHAR codec[9];
	
	/// has_drm identifies if there is drm in this file.
	INT has_drm;

	/// Drm info
	INT drm_version;

	INT quality;

	INT drm_size;

// This is the offset within the file where the drm info is writtern.
	int drm_offset;

	UCHAR *drm_info;

	INT streamNameSize;

	CHAR *streamName;

	/* 2005/11/07 : Park,HeeSang - Start */
	INT TrackIndex;
	/* 2005/11/07 : Park,HeeSang - End */


	/* <<< @: 5010-xxx.Park,HeeSang - Start : 05/11/22 :  */
	INT	Stream_track;	/* Indicate current  stream Track No */
	/* <<< @: 5010-xxx.Park,HeeSang - End :  05/11/22 :  */

//	char fourCC[5]; // 4 chars + null

	BOOL	VideoCodecInvalid;

	INT	dwLength;
} video_info_t;
/* video_info.h */


/* aviin.h */
/* A "private" structure */
typedef struct aviin_stream_entry_s {
	AVI_header_strh_t strh;
	chunk_type_t type;
	INT index;
} aviin_stream_entry_t;


/* <<< @: 5010-xxx.HoJune_Byun 06/01/11 :  Test Purpose Only  for AVI Extenion 2.0  */

enum AVI2IndexType
{
    AVI_INDEX_OF_INDEXES    = 0X00,
    AVI_INDEX_OF_CHUNKS     = 0X01,
    AVI_INDEX_IS_DATA       = 0X80,
    AVI_INDEX_2FIELD        = 0X01
};

typedef struct avi_standard_index_entry_s
{
    UINT32       dwOffset;       // qwBaseOffset + this is absolute file offset
    UINT32       dwSize;         // bit 31 is set if this is not a keyframe
} avi_standard_index_entry_t;

typedef struct avi_standard_index_chunk_struct_s
{
	UINT16	wLongsPerEntry; // must be sizeof(aIndex[0]) / sizeof(DWORD)
	char		bIndexSubType;  // must be 0
	char		bIndexType;     // must be AVI_INDEX_OF_CHUNKS
	UINT32	nEntriesInUse;  //
	UINT32	dwChunkId;      // '##dc' OR '##db' OR ...
	UINT64	qwBaseOffset;   // QUADWORD All dwOffsets in aIndex array are relative to this
	UINT32	dwReserved[3];    // must be 0 //only 1 UNIT32,not 3
    	avi_standard_index_entry_t *aIndex[MAX_AVI_TRACKS]; //big entry num(MAX_AVI2_KEY_INDEX), but not use 
} avi_standard_index_chunk_struct_t;

typedef struct avi_super_index_entry_s
{
	ULLONG	dwOffset;    // absolute file offset, offset 0 is unused entry??
	UINT32	dwSize;         // size of index chunk at this offset
	UINT32	dwDuration;		// time span in stream ticks
} avi_super_index_entry_t;

typedef struct avi_super_index_chunk_struct_s
{
	UINT16	wLongsPerEntry; // must be 4, size of each entry in aIndex array
	CHAR	bIndexSubType;  // must be 0 or AVI_INDEX-2FIELD
	CHAR		bIndexType;     // must be AVI_INDEX_OF_INDEXS
	UINT32	nEntriesInUse;  // number of entries in aIndex array that are used
	UINT32	dwChunkId;      // '##dc' OR '##db' OR ...
	UINT32	dwReserved[3];    // must be 0
	avi_super_index_entry_t *aIndex[MAX_AVI_TRACKS];//avi super Index Entries
} avi_super_index_chunk_struct_t;

typedef struct avi_index_chunk_struct_s
{
    UINT16	wLongsPerEntry; // size of each entry in aIndex array
    CHAR		bIndexSubType;  // must be 0
    CHAR		bIndexType;     // one of AVI_INDEX_* codes
    UINT		nEntriesInUse;  //
    UINT		dwChunkId;      // '##dc' OR '##db' OR .. No.. it's swaped, that is 'dc##' OR 'wb##' so on
    UINT		dwReserved[3];
} avi_index_chunk_struct_t;
/* <<< @: 5010-xxx.HoJune_Byun 06/01/11 :  Test Purpose Only  for AVI Extenion 2.0  */


/** Member variables.  Note that these are private and should not be used by users of the aviin library. */
typedef struct aviin_s {

	list_stack_elem_t *list;

	AVI_header_avih_t avih;

	INT odml_total_frames;

	video_info_t video_info[1];
	INT n_video_tracks;

	audio_info_t audio_info[12];
	INT n_audio_tracks;

	caption_info_t text_caption_info[12];
	INT n_text_caption_tracks;

	video_info_t bitmap_caption_info[12];
	INT n_bitmap_caption_tracks;

	chapter_info_t chapter_info[2];
	INT n_chapter_tracks;

	aviin_stream_entry_t stream_index[MAX_AVI_TRACKS];
	INT n_streams;

//	LIBAVI_FILEOFFSET_T start_idx1;
	ULLONG	start_idx1;


//	LIBAVI_FILEOFFSET_T start_indx;
//	long	start_indx;
//	LIBAVI_FILEOFFSET_T start_movi;
	UINT	start_movi;

	UINT			a_AudioValue;		/* 2005/12/05 : Park,HeeSang */

	ULONG	MoviSize;
	ULONG Idx1Size;
/* <<< @: 5010-xxx.HoJune_Byun 06/01/02 : LIST 'DXDT' MTDA Chunk */
	dmnu_info_t dmnu_info;
	int has_dmnu;

	dxdt_info_t dxdt_info;
	int has_dxdt;
	

	avi_super_index_chunk_struct_t	super_index_chunks[MAX_AVI_TRACKS];
	avi_standard_index_chunk_struct_t standard_index_chunks[MAX_AVI_TRACKS];

	
//	FILE_OFFSET start_indx[MAX_AVI_TRACKS];
	UINT		start_indx[MAX_AVI_TRACKS];

	avi_index_chunk_struct_t indx[MAX_AVI_TRACKS];
    
	int reverse4cc; /** reverse the 4cc codes for tracks so that, for example, 01wb would get read as an audio chunk */
	
	
//	FILE_OFFSET start_idx1;

//	FILE_OFFSET start_dxdt;
	UINT	start_dxdt;

//	FILE_OFFSET start_dmnu;
	UINT	start_dmnu;

//	FILE_OFFSET start_movi;


	//Additional fields for multiple riffs
	int riff_count;//includes all riffs including MENU riffs and MRIF chunks.
		
	//Tail menu info (from MENU riff)
	int has_dmnu_tail;
	dmnu_info_t dmnu_info_tail;

//	FILE_OFFSET start_dmnu_tail;
	UINT	start_dmnu_tail;
/* <<< @: 5010-xxx.HoJune_Byun 06/01/02 : LIST 'DXDT' MTDA Chunk */

	UINT	Size;// Size of one RIFF

	BOOL	Invalid;// validity of this file's Video Codec or Audio Codec
} aviin_t;


/*<<< @: 20060206 : hs Seo :  new structure For MP4 (VDE)  */
typedef struct avi_info_VDE_s
{	
	INT	frame_period_divisor;
	INT	frame_period_dividend;
	INT	width;
	INT	height;
	INT	MaxBytesPerSec;	
}avi_info_VDE_t;
/*<<< @: 20060206 : hs Seo */




/* <<< @: 5010-xxx.HoJune_Byun 06/01/14 :  Test Purpose Only  for DIVX 6.0 */
#if _USE_DIVX6_TEST
typedef struct DIVX6_struct_s{

	aviin_t	*gRIFF_HeaderHandle[RIFF_MAX_NUM];/* previously it was gAvi_HeaderHandle, changed to support multiple RIFFs for DIVX6.0 */
	UINT	riff_num;

	aviin_t	*gMRIF_HeaderHandle[MRIF_MAX_NUM];
	UINT	mrif_num;


	UINT	Size;//accumulated file size of all RIFF's
	
}DIVX6_struct_t;
#endif/*  _USE_DIVX6_TEST */
/* <<< @: 5010-xxx.HoJune_Byun 06/01/14 :  Test Purpose Only  for DIVX 6.0 */




/* <<< @: 5010-xxx.HoJune_Byun 05/12/26 */
#if 0
void read_strl(aviin_t *handle);
void read_hdrl(aviin_t *handle);
#else
/* <<< @: 5010-xxx.HoJune_Byun 06/01/02 : LIST 'DXDT' MTDA Chunk */
void read_strl(aviin_t *handle, int allowReverse4cc);
void read_hdrl(aviin_t *handle, int allowReverse4cc);
/* <<< @: 5010-xxx.HoJune_Byun 06/01/02 : LIST 'DXDT' MTDA Chunk */
#endif
int	locate_IndexChunk(aviin_t	*handle, AVI_FILE_st	*pAviFile);
/* <<< @: 5010-xxx.HoJune_Byun 05/12/26 */


/** Destructor [and deallocation using sysfree()] */
avi_error_t aviin_close(aviin_t *handle);



/* <<< @: 5010-xxx.HoJune_Byun 05/11/23 : Inactivate unused code */
#if 0
/** Constructor [and allocation using malloc()] */
aviin_t *aviin_open(const char *filename);
avi_error_t aviin_get_summary(const aviin_t *handle, int *total_tracks, int *drm_present);

/** What is stored in this track? Is it CHUNK_TYPE_VIDEO or CHUNK_TYPE_AUDIO? */
avi_error_t aviin_get_chunk_type(const aviin_t *handle, int track_id, chunk_type_t *type);

avi_error_t aviin_get_drm_info(const aviin_t *handle, int track_id, void **drm_chunk, int *length);

avi_error_t aviin_get_video_format(const aviin_t *handle, int track_id, video_info_t *video_info, int *frames);

avi_error_t aviin_get_audio_format(const aviin_t *handle, int track_id, audio_info_t *audio_info);

avi_error_t aviin_get_text_caption_format(const aviin_t *handle, int track_id, caption_info_t *text_caption_info);

avi_error_t aviin_get_bitmap_caption_format(const aviin_t *handle, int track_id, video_info_t *bitmap_caption_info, int *frames);

avi_error_t aviin_get_chapter_format(const aviin_t *handle, int track_id, chapter_info_t *chapter_info);

avi_error_t aviin_get_next_chunk(aviin_t *handle, chunk_type_t *type, int *track_id, uint8_t *buffer, int *size);

/* Gives precise calculation of sample duation that works for all modes of VBR audio, video and DRM.
   Duration is (duration / timescale) seconds. */
avi_error_t aviin_get_sample_duration(const aviin_t *handle, int track_id, chunk_type_t type, int sample_size, int *duration, int *timescale);


/** Seeks to idx1 index and reads entry #n. Returns file pointer to orinal position on return.
    If n is too large for the index then the function returns END_OF_FILE. */
avi_error_t aviin_get_idx1_entry(const aviin_t *handle, int n, int *track_id, chunk_type_t *type, int *sample_size, int *is_keyframe);

/** Jumps to the media sample whose position in the index is #n. */
avi_error_t aviin_goto_idx1_sample(const aviin_t *handle, int n);
#endif/* 0 */
/* <<< @: 5010-xxx.HoJune_Byun 05/11/23 : Inactivate unused code */


aviin_t *iPAR_GetAviHeaderInfo( void );
/* aviin.h */

/*<<< @: 20060206 : hs Seo :  new structure For MP4 (VDE)  */
avi_info_VDE_t * iPAR_GetAviInfoVDE( void );
/*<<< @: 20060206 : hs Seo */


 /* avi_fs.h*/
//static FS_RETURN	AVI_FS_FillCacheBuf(AVI_FILE_st *pFile);
FS_RETURN	AVI_FS_FillCacheBuf(AVI_FILE_st *pFile);
SH_RETURN	AVI_FS_Init(AVI_FILE_st *pFile, FS_File_t FileHandle, UINT Offset, UINT CacheSize);
SH_RETURN	AVI_FS_Deinit(AVI_FILE_st *pFile);
UINT		AVI_FS_read(AVI_FILE_st *pFile, void *pBuf, UINT Size);
UINT		AVI_FS_Tell(AVI_FILE_st *pFile);
//INT			AVI_FS_Seek(AVI_FILE_st *pFile, UINT Offset, UINT Origin);
INT			AVI_FS_Seek(AVI_FILE_st *pFile, long long Offset, UINT Origin);
INT			AVI_FS_Getc(AVI_FILE_st *pFile);
 /* avi_fs.h*/



/* chunk.h */
/* look ahead at next chunk */
VOID chunk_look_ahead(AVI_FILE_st *pfile, fourCC_t *fourCC1, UINT *length, fourCC_t *fourCC2, INT *perr);
/* chunk.h */



/** Converts a string to a fourCC */
fourCC_t make_fourCC(CHAR *s);
/** Converts a fourCC to a string */
VOID fourCC_to_str(fourCC_t fourCC, CHAR *s);


/** Compare two fourCC's */
INT 	fourCC_equal(fourCC_t a, fourCC_t b);

/** Write a four CC into the AVI output file. */
//int write_fourCC(fourCC_t fourCC, LIBAVI_FILE *f);

/** Read a four CC from an AVI file. */
INT read_fourCC(fourCC_t *fourCC, AVI_FILE_st *pfile);

/** Gets stream ID from "01wb"-style chunk ID */
INT 	fourCC_streamID(fourCC_t a);

#if _USE_AVI_EXTENSION_TEST
INT	fourCC_IndexID(fourCC_t a);
#endif

/** Is our fourCC "??wb" ? */
INT 	fourCC_is_audio(fourCC_t a);

/** Gets chunk_type from "01wb"-style chunk ID */
chunk_type_t get_chunk_type(fourCC_t a);


/* <<< @: 5010-xxx.HoJune_Byun 05/11/24 :  Inactivate unused code */
#if 0
/** Create FourCC from stream id and chunk type. */
fourCC_t create_fourCC(INT stream_id, chunk_type_t type);
/* fourcc.h */
#endif/* 0 */
/* <<< @: 5010-xxx.HoJune_Byun 05/11/24 :  Inactivate unused code */


/* <<< @: 5010-xxx.HoJune_Byun 05/11/23 : Inactivate unused code */
#if 0
/* render the above structure to a buffer */
void strf_mp3_extra_to_buffer(AVI_header_strf_mp3_t *hdr, uint8_t *buff);
#endif/* 0 */
/* <<< @: 5010-xxx.HoJune_Byun 05/11/23 : Inactivate unused code */

#if 0
/* functions to write the various headers */
int write_RIFF_form_header(fourCC_t fourCC, FILE *f, int *perr);
int write_header_avih(AVI_header_avih_t *hdr, FILE *f);
int write_header_strh(AVI_header_strh_t *hdr, FILE *f);
int write_header_strf_video(AVI_header_strf_video_t *hdr, FILE *f);
int write_header_strd_video(AVI_header_strd_drm_info_t *strd, FILE *f);
int write_header_strf_audio(AVI_header_strf_audio_t *hdr, FILE *f);
int write_header_strf_text_caption(AVI_header_strf_caption_t *hdr, FILE *f);
int write_header_strf_chapter(AVI_header_strf_chapter_t *hdr, FILE *f);
int write_header_strn(AVI_header_strn_t *hdr, FILE *f);
#endif



BYTE2 divx_swap_2(BYTE2 data_p);
BYTE4 divx_swap_4(BYTE4 data_p);
BYTE8	divx_swap_8(BYTE4	fourCC_1, BYTE4	fourCC_2);

INT	read_val64(void *pValue64, void *pValue32_1, void *pValue32_2, AVI_FILE_st *pFile);
INT	read_val32(void *pValue32, AVI_FILE_st *pFile);
INT	read_val16(void *pValue16, AVI_FILE_st *pFile);
INT	read_val8(void *pValue8, AVI_FILE_st *pFile);





/* functions to read the various headers */
INT read_header_avih(AVI_header_avih_t *hdr, AVI_FILE_st *pfile) ;
INT read_header_avih(AVI_header_avih_t *hdr, AVI_FILE_st *f);
INT read_header_strh(AVI_header_strh_t *hdr, AVI_FILE_st *f);
INT read_header_strf_video(AVI_header_strf_video_t *hdr, AVI_FILE_st *f);
INT read_header_strd_video(AVI_header_strd_drm_info_t *hdr, AVI_FILE_st *f);
INT read_header_strf_audio(AVI_header_strf_audio_t *hdr, AVI_FILE_st *f);
INT read_header_strf_text_caption(AVI_header_strf_caption_t *hdr, AVI_FILE_st *f);
INT read_header_strf_chapter(AVI_header_strf_chapter_t *hdr, AVI_FILE_st *f);
INT read_header_strn(AVI_header_strn_t *hdr, AVI_FILE_st *f);

// utility function to round values up to a two byte boundary.
long padEven(long size);
/* Header.h */

list_stack_elem_t *new_list(list_stack_elem_t *parent, AVI_FILE_st *file);

list_stack_elem_t* ascend_list(list_stack_elem_t *listElem);

VOID delete_list_recursive(list_stack_elem_t *listElem);

#if 0
VOID skip_list(const list_stack_elem_t *listElem);
#endif/* 0 */

INT end_of_list(const list_stack_elem_t *listElem);

fourCC_t next_chunk_in_list(list_stack_elem_t *listElem);


/* <<< @: 5010-xxx.HoJune_Byun 06/01/02 : LIST 'DXDT' MTDA Chunk */
void read_dmnu(aviin_t *handle);
void read_dxdt(aviin_t *handle);
/* <<< @: 5010-xxx.HoJune_Byun 06/01/02 : LIST 'DXDT' MTDA Chunk */

/* <<< @: 5010-xxx.HoJune_Byun 06/01/11 :  SUPPORT AVI EXTENSION */
//void read_indx(aviin_t *handle);
void read_indx(aviin_t *handle, int allowReverse4cc);
/* <<< @: 5010-xxx.HoJune_Byun 06/01/11 : AVI EXTENSION */

VOID ClearFlagNotSupportAVIVideo(VOID);

#if _COP_5009_SIMPLE_SOL
VOID ClearFlagAVUNSync(VOID);
#endif

#if _API_CAP_SUP_PAR_AVI2_INDEX	
BOOL GetAVI2IndexFlag(VOID);
VOID SetAVI2IndexFlag(VOID);
VOID ClearAVI2IndexFlag(VOID);
SH_RETURN AVI_INDEX2_Init(void);
void AVI_INDEX2_DeInit(void);
void AVI_INDEX2_Mapping(void);
SH_RETURN	iPAR_AVI2IxParsing(FS_File_t FileHandle, UINT Index2Offset, UINT Index2size);
#endif

/* <<< @: 5010-xxx.HoJune_Byun 06/01/14 :  Test Purpose Only  for DIVX 6.0 */
#if _USE_DIVX6_TEST
	avi_error_t	DIVX6_close(DIVX6_struct_t *pDivx6Handle);
#endif

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -