📄 mpeg4_odf.h
字号:
typedef struct { QOS_BASE_QUALIFIER} GF_QoS_Default;typedef struct { QOS_BASE_QUALIFIER u32 MaxDelay;} GF_QoS_MaxDelay;typedef struct { QOS_BASE_QUALIFIER u32 PrefMaxDelay;} GF_QoS_PrefMaxDelay;typedef struct { QOS_BASE_QUALIFIER Float LossProb;} GF_QoS_LossProb;typedef struct { QOS_BASE_QUALIFIER u32 MaxGapLoss;} GF_QoS_MaxGapLoss;typedef struct { QOS_BASE_QUALIFIER u32 MaxAUSize;} GF_QoS_MaxAUSize;typedef struct { QOS_BASE_QUALIFIER u32 AvgAUSize;} GF_QoS_AvgAUSize;typedef struct { QOS_BASE_QUALIFIER u32 MaxAURate;} GF_QoS_MaxAURate;typedef struct { QOS_BASE_QUALIFIER u32 DataLength; /*max size class : 2^28 - 1*/ char *Data;} GF_QoS_Private;/*Registration Descriptor*/typedef struct { BASE_DESCRIPTOR u32 formatIdentifier; u32 dataLength; char *additionalIdentificationInfo;} GF_Registration;/*Language Descriptor*/typedef struct { BASE_DESCRIPTOR u32 langCode;} GF_Language;/*Elementary Stream Descriptor*/typedef struct{ BASE_DESCRIPTOR u16 ESID; u16 OCRESID; u16 dependsOnESID; u8 streamPriority; char *URLString; GF_DecoderConfig *decoderConfig; GF_SLConfig *slConfig; GF_IPIPtr *ipiPtr; GF_QoS_Descriptor *qos; GF_Registration *RegDescriptor; /*0 or 1 lang desc*/ GF_Language *langDesc; GF_List *IPIDataSet; GF_List *IPMPDescriptorPointers; GF_List *extensionDescriptors;} GF_ESD;/*Content Classification Descriptor*/typedef struct { BASE_DESCRIPTOR u32 classificationEntity; u16 classificationTable; u32 dataLength; char *contentClassificationData;} GF_CCDescriptor;/*this structure is used in GF_KeyWord*/typedef struct { char *keyWord;} GF_KeyWordItem;/*Key Word Descriptor*/typedef struct { BASE_DESCRIPTOR u32 languageCode; u8 isUTF8; GF_List *keyWordsList;} GF_KeyWord;/*Rating Descriptor*/typedef struct { BASE_DESCRIPTOR u32 ratingEntity; u16 ratingCriteria; u32 infoLength; char *ratingInfo;} GF_Rating;/*Short Textual Descriptor*/typedef struct { BASE_DESCRIPTOR u32 langCode; u8 isUTF8; char *eventName; char *eventText;} GF_ShortTextual;/*this structure is used in GF_ExpandedTextual*/typedef struct { char *text;} GF_ETD_ItemText;/*Expanded Textual Descriptor*/typedef struct { BASE_DESCRIPTOR u32 langCode; u8 isUTF8; GF_List *itemDescriptionList; GF_List *itemTextList; char *NonItemText;} GF_ExpandedTextual;/*this structure is used in GF_CC_Name*/typedef struct { u32 langCode; u8 isUTF8; char *contentCreatorName;} GF_ContentCreatorInfo;/*Content Creator Name GF_DescriptorNOTE: the desctructor will delete all the items in the list(GF_ContentCreatorInfo items) */typedef struct { BASE_DESCRIPTOR GF_List *ContentCreators;} GF_CC_Name;/*Content Creation Date Descriptor*/typedef struct { BASE_DESCRIPTOR char contentCreationDate[5];} GF_CC_Date;/*this structure is used in GF_OCICreators*/typedef struct { u32 langCode; u8 isUTF8; char *OCICreatorName;} GF_OCICreator_item;/*OCI Creator Name Descriptor*/typedef struct { BASE_DESCRIPTOR GF_List *OCICreators;} GF_OCICreators;/*OCI Creation Date Descriptor*/typedef struct { BASE_DESCRIPTOR char OCICreationDate[5];} GF_OCI_Data;/*this structure is used in GF_SMPTECamera*/typedef struct { u8 paramID; u32 param;} GF_SmpteParam;/*Smpte Camera Position Descriptor*/typedef struct { BASE_DESCRIPTOR u8 cameraID; GF_List *ParamList;} GF_SMPTECamera;/*Extension Profile Level Descriptor*/typedef struct { BASE_DESCRIPTOR u8 profileLevelIndicationIndex; u8 ODProfileLevelIndication; u8 SceneProfileLevelIndication; u8 AudioProfileLevelIndication; u8 VisualProfileLevelIndication; u8 GraphicsProfileLevelIndication; u8 MPEGJProfileLevelIndication;} GF_PLExt;/*Profile Level Indication Index Descriptor*/typedef struct { BASE_DESCRIPTOR u8 profileLevelIndicationIndex;} GF_PL_IDX;/*AVC config descriptor - not a real MPEG-4 descriptor *//*used for sequenceParameterSetNALUnit and pictureParameterSetNALUnit*/typedef struct{ u16 size; char *data;} GF_AVCConfigSlot;typedef struct { u8 configurationVersion; u8 AVCProfileIndication; u8 profile_compatibility; u8 AVCLevelIndication; u8 nal_unit_size; GF_List *sequenceParameterSets; GF_List *pictureParameterSets;} GF_AVCConfig;/************************************************************ Media Control Extensions************************************************************/typedef struct{ BASE_DESCRIPTOR Double startTime; Double Duration; char *SegmentName;} GF_Segment;typedef struct{ BASE_DESCRIPTOR Double mediaTimeStamp;} GF_MediaTime;/**************************************************************************** MPEG-4 SYSTEM - OBJECT DESCRIPTORS COMMANDS DECLARATION****************************************************************************//*************************************** Commands Tags***************************************/enum{ GF_ODF_OD_UPDATE_TAG = 0x01, GF_ODF_OD_REMOVE_TAG = 0x02, GF_ODF_ESD_UPDATE_TAG = 0x03, GF_ODF_ESD_REMOVE_TAG = 0x04, GF_ODF_IPMP_UPDATE_TAG = 0x05, GF_ODF_IPMP_REMOVE_TAG = 0x06, /*file format reserved*/ GF_ODF_ESD_REMOVE_REF_TAG = 0x07, GF_ODF_COM_ISO_BEGIN_TAG = 0x0D, GF_ODF_COM_ISO_END_TAG = 0xBF, GF_ODF_COM_USER_BEGIN_TAG = 0xC0, GF_ODF_COM_USER_END_TAG = 0xFE};/*************************************** OD commands***************************************/#define BASE_OD_COMMAND \ u8 tag;/*the (abstract) base command. */typedef struct { BASE_OD_COMMAND} GF_ODCom;/*the default bcommand*/typedef struct { BASE_OD_COMMAND u32 dataSize; char *data;} GF_BaseODCom;/*Object Descriptor UpdateNB: the list can contain OD or IOD, except internally in the File Format (only MP4_OD)*/typedef struct{ BASE_OD_COMMAND GF_List *objectDescriptors;} GF_ODUpdate;/*Object Descriptor Remove*/typedef struct{ BASE_OD_COMMAND u32 NbODs; u16 *OD_ID;} GF_ODRemove;/*Elementary Stream Descriptor Update*/typedef struct{ BASE_OD_COMMAND u16 ODID; GF_List *ESDescriptors;} GF_ESDUpdate;/*Elementary Stream Descriptor Remove*/typedef struct { BASE_OD_COMMAND u16 ODID; u32 NbESDs; u16 *ES_ID;} GF_ESDRemove;/*IPMP Descriptor Update*/typedef struct { BASE_OD_COMMAND GF_List *IPMPDescList;} GF_IPMPUpdate;/*IPMP Descriptor Remove*/typedef struct { BASE_OD_COMMAND u32 NbIPMPDs; /*now this is bad: only IPMPv1 descriptors can be removed at run tim...*/ u8 *IPMPDescID;} GF_IPMPRemove;/******************************************************************** OD Exports********************************************************************//*OD CODEC object - just a simple reader/writer*/typedef struct tagODCoDec{ GF_BitStream *bs; GF_List *CommandList;} GF_ODCodec;/*construction / destruction*/GF_ODCodec *gf_odf_codec_new();void gf_odf_codec_del(GF_ODCodec *codec);/* add a command to the codec command list. */GF_Err gf_odf_codec_add_com(GF_ODCodec *codec, GF_ODCom *command);/*encode the current coimmand list - once called the commands are destroyed*/GF_Err gf_odf_codec_encode(GF_ODCodec *codec, Bool delete_content);/*get the encoded AU. user is responsible of allocated space*/GF_Err gf_odf_codec_get_au(GF_ODCodec *codec, char **outAU, u32 *au_length);/* set the encoded AU to the codec*/GF_Err gf_odf_codec_set_au(GF_ODCodec *codec, char *au, u32 au_length);/*decode the previously set-up AU*/GF_Err gf_odf_codec_decode(GF_ODCodec *codec);/*get the first OD command in the list. Once called, the command is removed from the command list. Return NULL when commandList is empty*/GF_ODCom *gf_odf_codec_get_com(GF_ODCodec *codec);/*apply a command to the codec command list. Command is duplicated if neededThis is used for state maintenance and RAP generation.*/GF_Err gf_odf_codec_apply_com(GF_ODCodec *codec, GF_ODCom *command);/************************************************************ GF_ODCom Functions************************************************************//*Commands Creation / Destruction*/GF_ODCom *gf_odf_com_new(u8 tag);GF_Err gf_odf_com_del(GF_ODCom **com);/************************************************************ Descriptors Functions************************************************************//*Descriptors Creation / Destruction*/GF_Descriptor *gf_odf_desc_new(u8 tag);void gf_odf_desc_del(GF_Descriptor *desc);/*use this function to decode a standalone descriptorthe raw descriptor MUST be formatted with tag and size field!!!a new desc is created and you must delete it when done*/GF_Err gf_odf_desc_read(char *raw_desc, u32 descSize, GF_Descriptor * *outDesc);/*use this function to encode a standalone descriptorthe desc will be formatted with tag and size fieldthe output buffer is allocated and you must delete it when done*/GF_Err gf_odf_desc_write(GF_Descriptor *desc, char **outEncDesc, u32 *outSize);/*use this function to get the size of a standalone descriptor (including tag and size fields)return 0 if error*/u32 gf_odf_desc_size(GF_Descriptor *desc);/*this is usefull to duplicate on the fly a descriptor*/GF_Err gf_odf_desc_copy(GF_Descriptor *inDesc, GF_Descriptor **outDesc);/*This functions handles internally what desc can be added to another descand adds it. NO DUPLICATION of the descriptor, soonce a desc is added to its parent, destroying the parent WILL DESTROY this descriptor*/GF_Err gf_odf_desc_add_desc(GF_Descriptor *parentDesc, GF_Descriptor *newDesc);/*this is a helper for building a preformatted GF_ESD with decoderConfig, decoderSpecificInfo with no data and SLConfig descriptor with predefined*/GF_ESD *gf_odf_desc_esd_new(u32 sl_predefined);/*Since IPMP V2, we introduce a new set of functions to read / write a list of descriptorsthat have no containers (a bit like an OD command, but for descriptors)This is usefull for IPMPv2 DecoderSpecificInfo which contains a set of IPMP_DeclaratorsAs it could be used for other purposes we keep it genericyou must create the list yourself, the functions just encode/decode from/to the list*//*uncompress an encoded list of descriptors. You must pass an empty GF_List structureto know exactly what was in the buffer*/GF_Err gf_odf_desc_list_read(char *raw_list, u32 raw_size, GF_List *descList);/*compress all descriptors in the list into a single buffer. The buffer is allocatedby the lib and must be destroyed by your appyou must pass (outEncList != NULL && *outEncList == NULL)*/GF_Err gf_odf_desc_list_write(GF_List *descList, char **outEncList, u32 *outSize);/*returns size of encoded desc list*/GF_Err gf_odf_desc_list_size(GF_List *descList, u32 *outSize);/*destroy the descriptors in a list but not the list*/GF_Err gf_odf_desc_list_del(GF_List *descList);/*retuns NULL if unknown, otherwise value*/const char *gf_odf_stream_type_name(u32 streamType);u32 gf_odf_stream_type_by_name(const char *streamType);/*special function for authoring - convert DSI to BIFSConfig*/GF_BIFSConfig *gf_odf_get_bifs_config(GF_DefaultDescriptor *dsi, u8 oti);/*special function for authoring - convert DSI to LASERConfig*/GF_Err gf_odf_get_laser_config(GF_DefaultDescriptor *dsi, GF_LASERConfig *cfg);/*sepcial function for authoring - convert DSI to TextConfig*/GF_Err gf_odf_get_text_config(GF_DefaultDescriptor *dsi, u8 oti, GF_TextConfig *cfg);/*special function for authoring - convert DSI to UIConfig*/GF_Err gf_odf_get_ui_config(GF_DefaultDescriptor *dsi, GF_UIConfig *cfg);/*converts UIConfig to dsi - does not destroy input descr but does create output one*/GF_Err gf_odf_encode_ui_config(GF_UIConfig *cfg, GF_DefaultDescriptor **out_dsi);/*simple constructor/destructor*/GF_AVCConfig *gf_odf_avc_cfg_new();void gf_odf_avc_cfg_del(GF_AVCConfig *cfg);/*gets GF_AVCConfig from MPEG-4 DSI*/GF_AVCConfig *gf_odf_avc_cfg_read(char *dsi, u32 dsi_size);/*writes GF_AVCConfig as MPEG-4 DSI*/GF_Err gf_odf_avc_cfg_write(GF_AVCConfig *cfg, char **outData, u32 *outSize);/************************************************************ QoS Qualifiers Functions************************************************************//*QoS Qualifiers Creation / Destruction*/GF_QoS_Default *gf_odf_qos_new(u8 tag);GF_Err gf_odf_qos_del(GF_QoS_Default **qos);/*READ/WRITE functions: QoS qualifiers are special descriptors but follow the same rules as descriptors.therefore, use gf_odf_desc_read and gf_odf_desc_write for QoS*//*same function, but for QoS, as a Qualifier IS NOT a descriptor*/GF_Err gf_odf_qos_add_qualif(GF_QoS_Descriptor *desc, GF_QoS_Default *qualif);/* OCI Stream AU is a list of OCI event (like OD AU is a list of OD commands)*/typedef struct __tag_oci_event OCIEvent;OCIEvent *gf_oci_event_new(u16 EventID);void gf_oci_event_del(OCIEvent *event);GF_Err gf_oci_event_set_start_time(OCIEvent *event, u8 Hours, u8 Minutes, u8 Seconds, u8 HundredSeconds, u8 IsAbsoluteTime);GF_Err gf_oci_event_set_duration(OCIEvent *event, u8 Hours, u8 Minutes, u8 Seconds, u8 HundredSeconds);GF_Err gf_oci_event_add_desc(OCIEvent *event, GF_Descriptor *oci_desc);GF_Err gf_oci_event_get_id(OCIEvent *event, u16 *ID);GF_Err gf_oci_event_get_start_time(OCIEvent *event, u8 *Hours, u8 *Minutes, u8 *Seconds, u8 *HundredSeconds, u8 *IsAbsoluteTime);GF_Err gf_oci_event_get_duration(OCIEvent *event, u8 *Hours, u8 *Minutes, u8 *Seconds, u8 *HundredSeconds);u32 gf_oci_event_get_desc_count(OCIEvent *event);GF_Descriptor *gf_oci_event_get_desc(OCIEvent *event, u32 DescIndex);GF_Err gf_oci_event_rem_desc(OCIEvent *event, u32 DescIndex);typedef struct __tag_oci_codec OCICodec;/*construction / destructionIsEncoder specifies an OCI Event encoderversion is for future extensions, and only 0x01 is valid for now*/OCICodec *gf_oci_codec_new(u8 IsEncoder, u8 Version);void gf_oci_codec_del(OCICodec *codec);/* ENCODER FUNCTIONSadd a command to the codec event list. The event WILL BE DESTROYED BY THE CODEC after encoding*/GF_Err gf_oci_codec_add_event(OCICodec *codec, OCIEvent *event);/*encode AU. The memory allocation is done in placeWARNING: once this function called, the codec event List is empty and events destroyedyou must set *outAU = NULL*/GF_Err gf_oci_codec_encode(OCICodec *codec, char **outAU, u32 *au_length);/*Decoder: decode the previously set-up AUthe input buffer is cleared once decoded*/GF_Err gf_oci_codec_decode(OCICodec *codec, char *au, u32 au_length);/*get the first OCI Event in the list. Once called, the event is removed from the event list. Return NULL when the event List is emptyyou MUST delete events */OCIEvent *gf_oci_codec_get_event(OCICodec *codec);/*OD dump tools*/GF_Err gf_odf_dump_au(char *data, u32 dataLength, FILE *trace, u32 indent, Bool XMTDump);GF_Err gf_odf_dump_com(void *p, FILE *trace, u32 indent, Bool XMTDump);GF_Err gf_odf_dump_desc(void *ptr, FILE *trace, u32 indent, Bool XMTDump);GF_Err gf_odf_dump_com_list(GF_List *commandList, FILE *trace, u32 indent, Bool XMTDump);/*OCI dump tools*/GF_Err gf_oci_dump_event(OCIEvent *ev, FILE *trace, u32 indent, Bool XMTDump);GF_Err gf_oci_dump_au(u8 version, char *au, u32 au_length, FILE *trace, u32 indent, Bool XMTDump);/*OD parsing tools (XMT/BT)*//*returns desc tag based on name*/u32 gf_odf_get_tag_by_name(char *descName);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -