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

📄 isomedia_dev.h

📁 一个用于智能手机的多媒体库适合S60 WinCE的跨平台开发库
💻 H
📖 第 1 页 / 共 5 页
字号:
	GF_ISOM_BOX	u64 nbBytes;} GF_DMEDBox;/*Number of bytes of immediate data to be sent*/typedef struct{	GF_ISOM_BOX	u64 nbBytes;} GF_DIMMBox;/*Number of bytes of repeated data to be sent*/typedef struct{	GF_ISOM_BOX	u64 nbBytes;} GF_DREPBox;/*Smallest relative transmission time, in milliseconds. signed integer for smoothing*/typedef struct{	GF_ISOM_BOX	s32 minTime;} GF_TMINBox;/*Largest relative transmission time, in milliseconds.*/typedef struct{	GF_ISOM_BOX	s32 maxTime;} GF_TMAXBox;/*Largest packet, in bytes, including 12-byte RTP header*/typedef struct{	GF_ISOM_BOX	u32 maxSize;} GF_PMAXBox;/*Longest packet duration, in milliseconds*/typedef struct{	GF_ISOM_BOX	u32 maxDur;} GF_DMAXBox;/*32-bit payload type number, followed by rtpmap payload string */typedef struct{	GF_ISOM_BOX	u32 payloadCode;	char *payloadString;} GF_PAYTBox;typedef struct{	GF_ISOM_BOX	char *string;} GF_NameBox;typedef struct{	GF_ISOM_BOX	GF_List *dataRates;	GF_List *boxList;} GF_HintInfoBox;/*Apple extension*/typedef struct{	GF_ISOM_FULL_BOX	u32 reserved;	char *data;	u32 dataSize;} GF_DataBox;typedef struct{	GF_ISOM_BOX	GF_DataBox *data;} GF_ListItemBox;typedef struct{	GF_ISOM_BOX	GF_List *tags;} GF_ItemListBox;/*OMA (P)DCF extensions*/typedef struct{	GF_ISOM_FULL_BOX	u8 EncryptionMethod;	u8 PaddingScheme;	u64 PlaintextLength;	char *ContentID;	char *RightsIssuerURL;	char *TextualHeaders;	u32 TextualHeadersLen;	GF_List *ExtendedHeaders;} GF_OMADRMCommonHeaderBox;typedef struct{	GF_ISOM_FULL_BOX	u8 GKEncryptionMethod;	char *GroupID;	u16 GKLength;	char *GroupKey;} GF_OMADRMGroupIDBox;typedef struct{	GF_ISOM_BOX	GF_List *boxes;} GF_OMADRMMutableInformationBox;typedef struct{	GF_ISOM_FULL_BOX	char TransactionID[16];} GF_OMADRMTransactionTrackingBox;typedef struct{	GF_ISOM_FULL_BOX	char *oma_ro;	u32 oma_ro_size;} GF_OMADRMRightsObjectBox;/*identical*/typedef struct __isma_format_box GF_OMADRMAUFormatBox;typedef struct __oma_kms_box{	GF_ISOM_FULL_BOX	GF_OMADRMCommonHeaderBox *hdr;	GF_OMADRMAUFormatBox *fmt;} GF_OMADRMKMSBox;/*		Data Map (media storage) stuff*//*regular file IO*/#define GF_ISOM_DATA_FILE			0x01/*File Mapaing object, read-only mode on complete files (no download)*/#define GF_ISOM_DATA_FILE_MAPPING		0x02/*External file object. Needs implementation*/#define GF_ISOM_DATA_FILE_EXTERN		0x03/*Data Map modes*/enum{	/*read mode*/	GF_ISOM_DATA_MAP_READ = 1,	/*write mode*/	GF_ISOM_DATA_MAP_WRITE = 2,	/*the following modes are just ways of signaling extended functionalities	edit mode, to make sure the file is here, set to GF_ISOM_DATA_MAP_READ afterwards*/	GF_ISOM_DATA_MAP_EDIT = 3,	/*read-only access to the movie file: we create a file mapping object	mode is set to GF_ISOM_DATA_MAP_READ afterwards*/	GF_ISOM_DATA_MAP_READ_ONLY = 4,};/*this is the DataHandler structure each data handler has its own bitstream*/#define GF_ISOM_BASE_DATA_HANDLER	\	u8	type;		\	u64	curPos;		\	u8	mode;		\	GF_BitStream *bs;typedef struct __tag_data_map{	GF_ISOM_BASE_DATA_HANDLER} GF_DataMap;typedef struct {	GF_ISOM_BASE_DATA_HANDLER	FILE *stream;	Bool last_acces_was_read;#ifndef GPAC_READ_ONLY	char *temp_file;#endif} GF_FileDataMap;/*file mapping handler. used if supported, only on read mode for complete files  (not in file download)*/typedef struct {	GF_ISOM_BASE_DATA_HANDLER	char *name;	u32 file_size;	char *byte_map;	u32 byte_pos;} GF_FileMappingDataMap;GF_Err gf_isom_datamap_new(const char *location, const char *parentPath, u8 mode, GF_DataMap **outDataMap);void gf_isom_datamap_del(GF_DataMap *ptr);GF_Err gf_isom_datamap_open(GF_MediaBox *minf, u32 dataRefIndex, u8 Edit);void gf_isom_datamap_close(GF_MediaInformationBox *minf);u32 gf_isom_datamap_get_data(GF_DataMap *map, char *buffer, u32 bufferLength, u64 Offset);/*File-based data map*/GF_DataMap *gf_isom_fdm_new(const char *sPath, u8 mode);void gf_isom_fdm_del(GF_FileDataMap *ptr);u32 gf_isom_fdm_get_data(GF_FileDataMap *ptr, char *buffer, u32 bufferLength, u64 fileOffset);#ifndef GPAC_READ_ONLYGF_DataMap *gf_isom_fdm_new_temp(const char *sTempPath);#endif/*file-mapping, read only*/GF_DataMap *gf_isom_fmo_new(const char *sPath, u8 mode);void gf_isom_fmo_del(GF_FileMappingDataMap *ptr);u32 gf_isom_fmo_get_data(GF_FileMappingDataMap *ptr, char *buffer, u32 bufferLength, u64 fileOffset);#ifndef GPAC_READ_ONLYu64 gf_isom_datamap_get_offset(GF_DataMap *map);GF_Err gf_isom_datamap_add_data(GF_DataMap *ptr, char *data, u32 dataSize);#endif	/*		Movie stuff*//*time def for MP4/QT/MJ2K files*/#define GF_ISOM_MAC_TIME_OFFSET 2082758400/*208284480 */#ifndef	GF_ISOM_NO_FRAGMENTS#define GF_ISOM_FORMAT_FRAG_FLAGS(pad, sync, deg) ( ( (pad) << 17) | ( ( !(sync) ) << 16) | (deg) );#define GF_ISOM_GET_FRAG_PAD(flag) ( (flag) >> 17) & 0x7#define GF_ISOM_GET_FRAG_SYNC(flag) ( ! ( ( (flag) >> 16) & 0x1))#define GF_ISOM_GET_FRAG_DEG(flag)	(flag) & 0x7FFF#endifenum{	GF_ISOM_FRAG_WRITE_READY	=	0x01,	GF_ISOM_FRAG_READ_DEBUG		=	0x02,};/*this is our movie object*/struct __tag_isom {	/*the last fatal error*/	GF_Err LastError;	/*the original filename*/	char *fileName;	/*the original file in read/edit, and also used in fragments mode	once the first moov has been written	Nota: this API doesn't allow fragments BEFORE the MOOV in order	to make easily parsable files (note there could be some data (mdat) before	the moov*/	GF_DataMap *movieFileMap;#ifndef GPAC_READ_ONLY	/*the final file name*/	char *finalName;	/*the file where we store edited samples (for READ_WRITE and WRITE mode only)*/	GF_DataMap *editFileMap;	/*the interleaving time for dummy mode (in movie TimeScale)*/	u32 interleavingTime;#endif	u8 openMode;	u8 storageMode;	/*if true 3GPP text streams are read as MPEG-4 StreamingText*/	u8 convert_streaming_text;	u8 is_jp2;	/*main boxes for fast access*/	/*moov*/	GF_MovieBox *moov;	/*our MDAT box (one and only one when we store the file)*/	GF_MediaDataBox *mdat;	/*file brand (since v2, NULL means mp4 v1)*/	GF_FileTypeBox *brand;	/*progressive download info*/	GF_ProgressiveDownloadBox *pdin;	/*meta box if any*/	GF_MetaBox *meta;#ifndef	GF_ISOM_NO_FRAGMENTS	u32 FragmentsFlags, NextMoofNumber;	/*active fragment*/	GF_MovieFragmentBox *moof;	/*in WRITE mode, this is the current MDAT where data is written*/	/*in READ mode this is the last valid file position before a gf_isom_box_read failed*/	u64 current_top_box_start;#endif	/*this contains ALL the root boxes excepts fragments*/	GF_List *TopBoxes;	/*default track for sync of MPEG4 streams - this is the first accessed stream without OCR info - only set in READ mode*/	s32 es_id_default_sync;};/*time function*/u64 gf_isom_get_mp4time();/*set the last error of the file. if file is NULL, set the static error (used for IO errors*/void gf_isom_set_last_error(GF_ISOFile *the_file, GF_Err error);GF_Err gf_isom_parse_movie_boxes(GF_ISOFile *mov, u64 *bytesMissing);GF_ISOFile *gf_isom_new_movie();/*Movie and Track access functions*/GF_TrackBox *gf_isom_get_track_from_file(GF_ISOFile *the_file, u32 trackNumber);GF_TrackBox *gf_isom_get_track(GF_MovieBox *moov, u32 trackNumber);GF_TrackBox *gf_isom_get_track_from_id(GF_MovieBox *moov, u32 trackID);u32 gf_isom_get_tracknum_from_id(GF_MovieBox *moov, u32 trackID);/*open a movie*/GF_ISOFile *gf_isom_open_file(const char *fileName, u32 OpenMode, const char *tmp_dir);/*close and delete a movie*/void gf_isom_delete_movie(GF_ISOFile *mov);/*StreamDescription reconstruction Functions*/GF_Err GetESD(GF_MovieBox *moov, u32 trackID, u32 StreamDescIndex, GF_ESD **outESD);GF_Err GetESDForTime(GF_MovieBox *moov, u32 trackID, u64 CTS, GF_ESD **outESD);GF_Err Media_GetSampleDesc(GF_MediaBox *mdia, u32 SampleDescIndex, GF_SampleEntryBox **out_entry, u32 *dataRefIndex);GF_Err Media_GetSampleDescIndex(GF_MediaBox *mdia, u64 DTS, u32 *sampleDescIndex);/*get esd for given sample desc - 	@true_desc_only: if true doesn't emulate desc and returns native ESD,				otherwise emulates if needed/possible (TimedText) and return a hard copy of the desc*/GF_Err Media_GetESD(GF_MediaBox *mdia, u32 sampleDescIndex, GF_ESD **esd, Bool true_desc_only);Bool Track_IsMPEG4Stream(u32 HandlerType);Bool IsMP4Description(u32 entryType);/*Find a reference of a given type*/GF_Err Track_FindRef(GF_TrackBox *trak, u32 ReferenceType, GF_TrackReferenceTypeBox **dpnd);/*Time and sample*/GF_Err GetMediaTime(GF_TrackBox *trak, u64 movieTime, u64 *MediaTime, s64 *SegmentStartTime, s64 *MediaOffset, u8 *useEdit);GF_Err Media_GetSample(GF_MediaBox *mdia, u32 sampleNumber, GF_ISOSample **samp, u32 *sampleDescriptionIndex, Bool no_data, u64 *out_offset);GF_Err Media_CheckDataEntry(GF_MediaBox *mdia, u32 dataEntryIndex);GF_Err Media_FindSyncSample(GF_SampleTableBox *stbl, u32 searchFromTime, u32 *sampleNumber, u8 mode);GF_Err Media_RewriteODFrame(GF_MediaBox *mdia, GF_ISOSample *sample);GF_Err Media_FindDataRef(GF_DataReferenceBox *dref, char *URLname, char *URNname, u32 *dataRefIndex);Bool Media_IsSelfContained(GF_MediaBox *mdia, u32 StreamDescIndex);/*check the TimeToSample for the given time and return the Sample numberif the entry is not found, return the closest sampleNumber in prevSampleNumber and 0 in sampleNumberif the DTS required is after all DTSs in the list, set prevSampleNumber and SampleNumber to 0useCTS specifies that we're looking for a composition time*/GF_Err findEntryForTime(GF_SampleTableBox *stbl, u64 DTS, u8 useCTS, u32 *sampleNumber, u32 *prevSampleNumber);/*Reading of the sample tables*/GF_Err stbl_GetSampleSize(GF_SampleSizeBox *stsz, u32 SampleNumber, u32 *Size);GF_Err stbl_GetSampleCTS(GF_CompositionOffsetBox *ctts, u32 SampleNumber, u32 *CTSoffset);GF_Err stbl_GetSampleDTS(GF_TimeToSampleBox *stts, u32 SampleNumber, u64 *DTS);/*find a RAP or set the prev / next RAPs if vars are passed*/GF_Err stbl_GetSampleRAP(GF_SyncSampleBox *stss, u32 SampleNumber, u8 *IsRAP, u32 *prevRAP, u32 *nextRAP);GF_Err stbl_GetSampleInfos(GF_SampleTableBox *stbl, u32 sampleNumber, u64 *offset, u32 *chunkNumber, u32 *descIndex, u8 *isEdited);GF_Err stbl_GetSampleShadow(GF_ShadowSyncBox *stsh, u32 *sampleNumber, u32 *syncNum);GF_Err stbl_GetPaddingBits(GF_PaddingBitsBox *padb, u32 SampleNumber, u8 *PadBits);u32 stbl_GetSampleFragmentCount(GF_SampleFragmentBox *stsf, u32 sampleNumber);u32 stbl_GetSampleFragmentSize(GF_SampleFragmentBox *stsf, u32 sampleNumber, u32 FragmentIndex);GF_Err stbl_GetSampleDepType(GF_SampleDependencyTypeBox *stbl, u32 SampleNumber, u32 *dependsOn, u32 *dependedOn, u32 *redundant);/*unpack sample2chunk and chunk offset so that we have 1 sample per chunk (edition mode only)*/GF_Err stbl_UnpackOffsets(GF_SampleTableBox *stbl);GF_Err SetTrackDuration(GF_TrackBox *trak);GF_Err Media_SetDuration(GF_TrackBox *trak);/*rewrites 3GP samples desc as MPEG-4 ESD*/GF_Err gf_isom_get_ttxt_esd(GF_MediaBox *mdia, GF_ESD **out_esd);/*inserts TTU header - only used when conversion to StreamingText is on*/GF_Err gf_isom_rewrite_text_sample(GF_ISOSample *samp, u32 sampleDescriptionIndex, u32 sample_dur);GF_UserDataMap *udta_getEntry(GF_UserDataBox *ptr, u32 box_type, bin128 *uuid);#ifndef GPAC_READ_ONLYGF_Err FlushCaptureMode(GF_ISOFile *movie);GF_Err CanAccessMovie(GF_ISOFile *movie, u32 Mode);GF_ISOFile *gf_isom_create_movie(const char *fileName, u32 OpenMode, const char *tmp_dir);void gf_isom_insert_moov(GF_ISOFile *file);GF_Err WriteToFile(GF_ISOFile *movie);GF_Err Track_SetStreamDescriptor(GF_TrackBox *trak, u32 StreamDescriptionIndex, u32 DataReferenceIndex, GF_ESD *esd, u32 *outStreamIndex);u8 RequestTrack(GF_MovieBox *moov, u32 TrackID);/*Track-Media setup*/GF_Err NewMedia(GF_MediaBox **mdia, u32 MediaType, u32 TimeScale);GF_Err Media_ParseODFrame(GF_MediaBox *mdia, GF_ISOSample *sample);GF_Err Media_AddSample(GF_MediaBox *mdia, u64 data_offset, GF_ISOSample *sample, u32 StreamDescIndex, u32 syncShadowNumber);GF_Err Media_CreateDataRef(GF_DataReferenceBox *dref, char *URLname, char *URNname, u32 *dataRefIndex);/*update a media sample. ONLY in edit mode*/GF_Err Media_UpdateSample(GF_MediaBox *mdia, u32 sampleNumber, GF_ISOSample *sample, Bool data_only);GF_Err Media_UpdateSampleReference(GF_MediaBox *mdia, u32 sampleNumber, GF_ISOSample *sample, u64 data_offset);/*addition in the sample tables*/GF_Err stbl_AddDTS(GF_SampleTableBox *stbl, u64 DTS, u32 *sampleNumber, u32 LastAUDefDuration);GF_Err stbl_AddCTS(GF_SampleTableBox *stbl, u32 sampleNumber, u32 CTSoffset);GF_Err stbl_AddSize(GF_SampleSizeBox *stsz, u32 sampleNumber, u32 size);GF_Err stbl_AddRAP(GF_SyncSampleBox *stss, u32 sampleNumber);GF_Err stbl_AddShadow(GF_ShadowSyncBox *stsh, u32 sampleNumber, u32 shadowNumber);GF_Err stbl_AddChunkOffset(GF_MediaBox *mdia, u32 sampleNumber, u32 StreamDescIndex, u64 offset);/*NB - no add for padding, this is done only through SetPaddingBits*/GF_Err stbl_AddSampleFragment(GF_SampleTableBox *stbl, u32 sampleNumber, u16 size);/*update of the sample tableall these functions are called in edit and we always have 1 sample per chunk*/GF_Err stbl_SetChunkOffset(GF_MediaBox *mdia, u32 sampleNumber, u64 offset);GF_Err stbl_SetSampleCTS(GF_SampleTableBox *stbl, u32 sampleNumber, u32 offset);GF_Err stbl_SetSampleSize(GF_SampleSizeBox *stsz, u32 SampleNumber, u32 size);GF_Err stbl_SetSampleRAP(GF_SyncSampleBox *stss, u32 SampleNumber, u8 isRAP);GF_Err stbl_SetSyncShadow(GF_ShadowSyncBox *stsh, u32 sampleNumber, u32 syncSample);GF_Err stbl_SetPaddingBits(GF_SampleTableBox *stbl, u32 SampleNumber, u8 bits);/*for adding fragmented samples*/GF_Err stbl_SampleSizeAppend(GF_SampleSizeBox *stsz, u32 data_size);/*writing of the final chunk info in edit mode*/GF_Err stbl_SetChunkAndOffset(GF_SampleTableBox *stbl, u32 sampleNumber, u32 StreamDescIndex, GF_SampleToChunkBox *the_stsc, GF_Box **the_stco, u64 data_offset, u8 forceNewChunk);/*EDIT LIST functions*/GF_EdtsEntry *CreateEditEntry(u64 EditDuration, u64 MediaTime, u8 EditMode);GF_Err stbl_SetRedundant(GF_SampleTableBox *stbl, u32 sampleNumber);GF_Err stbl_AddRedundant(GF_SampleTableBox *stbl, u32 sampleNumber);/*REMOVE functions*/GF_Err stbl_RemoveDTS(GF_SampleTableBox *stbl, u32 sampleNumber, u32 LastAUDefDuration);GF_Err stbl_RemoveCTS(GF_SampleTableBox *stbl, u32 sampleNumber);GF_Err stbl_RemoveSize(GF_SampleSizeBox *stsz, u32 sampleNumber);GF_Err stbl_RemoveChunk(GF_SampleTableBox *stbl, u32 sampleNumber);GF_Err stbl_RemoveRAP(GF_SampleTableBox *stbl, u32 sampleNumber);GF_Err stbl_RemoveShadow(GF_ShadowSyncBox *stsh, u32 sampleNumber);GF_Err stbl_RemovePaddingBits(GF_SampleTableBox *stbl, u32 SampleNumber);GF_Err stbl_RemoveSampleFragments(GF_SampleTableBox *stbl, u32 sampleNumber);GF_Err stbl_RemoveRedundant(GF_SampleTableBox *stbl, u32 SampleNumber);#ifndef	GF_ISOM_NO_FRAGMENTSGF_Err StoreFragment(GF_ISOFile *movie);#endif#endif	GF_Err GetNextMediaTime(GF_TrackBox *trak, u64 movieTime, u64 *OutMovieTime);GF_Err GetPrevMediaTime(GF_TrackBox *trak, u64 movieTime, u64 *OutMovieTime);Bool IsHintTrack(GF_TrackBox *trak);Bool CheckHintFormat(GF_TrackBox *trak, u32 HintType);u32 GetHintFormat(GF_TrackBox *trak);/*locate a box by its type or UUID*/GF_ItemListBox *gf_ismo_locate_box(GF_List *list, u32 boxType, bin128 UUID);GF_Err moov_AddBox(GF_Box *ptr, GF_Box *a);GF_Err tref_AddBox(GF_Box *ptr, GF_Box *a);GF_Err trak_AddBox(GF_Box *ptr, GF_Box *a);GF_Err mvex_AddBox(GF_Box *ptr, GF_Box *a);GF_Err stsd_AddBox(GF_SampleDescriptionBox *ptr, GF_Box *a);GF_Err hnti_AddBox(GF_HintTrackInfoBox *hnti, GF_Box *a);GF_Err udta_AddBox(GF_UserDataBox *ptr, GF_Box *a);GF_Err edts_AddBox(GF_Box *s, GF_Box *a);GF_Err stdp_Read(GF_Box *s, GF_BitStream *bs);GF_Err sdtp_Read(GF_Box *s, GF_BitStream *bs);GF_Err dinf_AddBox(GF_Box *s, GF_Box *a);GF_Err minf_AddBox(GF_Box *s, GF_Box *a);GF_Err mdia_AddBox(GF_Box *s, GF_Box *a);GF_Err stbl_AddBox(GF_SampleTableBox *ptr, GF_Box *a);GF_Err AVC_UpdateESD(GF_MPEGVisualSampleEntryBox *avc, GF_ESD *esd);void AVC_RewriteESDescriptor(GF_MPEGVisualSampleEntryBox *avc);GF_Err reftype_AddRefTrack(GF_TrackReferenceTypeBox *ref, u32 trackID, u16 *outRefIndex);/*		Hinting stuff*//*the HintType for each protocol*/enum{	GF_ISMO_HINT_RTP	= 1,	/*not supported yet*/	GF_ISMO_MPEG2_TS	= 2};/*****************************************************		RTP Data Entries*****************************************************/#define GF_ISMO_BASE_DTE_ENTRY	\	u8 source;typedef struct{	GF_ISMO_BASE_DTE_ENTRY} GF_GenericDTE;typedef struct{	GF_ISMO_BASE_DTE_ENTRY} GF_EmptyDTE;typedef struct

⌨️ 快捷键说明

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