📄 isomedia.h
字号:
/* * GPAC - Multimedia Framework C SDK * * Copyright (c) Jean Le Feuvre 2000-2005 * All rights reserved * * This file is part of GPAC / ISO Media File Format sub-project * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * GPAC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */#ifndef _GF_ISOMEDIA_H_#define _GF_ISOMEDIA_H_#ifdef __cplusplusextern "C" {#endif#include <gpac/mpeg4_odf.h>/*the isomedia file*/typedef struct __tag_isom GF_ISOFile;/*media sample object*/typedef struct{ /*data size*/ u32 dataLength; /*data with padding if requested*/ char *data; /*decoding time*/ u64 DTS; /*relative offset for composition if needed*/ u32 CTS_Offset; /*Random Access Point flag: 0: not random access 1: regular RAP, 2: sample is a redundant RAP. If set when adding the sample, this will create a sample dependency entry */ u8 IsRAP;} GF_ISOSample;/*creates a new empty sample*/GF_ISOSample *gf_isom_sample_new();/*delete a sample. NOTE:the buffer content will be destroyed by default.if you wish to keep the buffer, set dataLength to 0 in the sample before deleting itthe pointer is set to NULL after deletion*/void gf_isom_sample_del(GF_ISOSample **samp);/******************************************************************** FILE FORMAT CONSTANTS********************************************************************//*Modes for file opening NOTE 1: All the READ function in this API can be used in EDIT/WRITE mode. However, some unexpected errors or values may happen in that case, dependingon how much modifications you made (timing, track with 0 samples, ...) On the other hand, none of the EDIT/WRITE functions will work in READ mode. NOTE 2: The output structure of a edited file will sometimes be different from the original file, but the media-data and meta-data will be identical.The only change happens in the file media-data container(s) during edition NOTE 3: when editing the file, you MUST set the final name of the modified fileto something different. This API doesn't allow file overwriting.*/enum { /*Opens file for dumping: same as read-only but keeps all movie fragments info untouched*/ GF_ISOM_OPEN_READ_DUMP = 0, /*Opens a file in READ ONLY mode*/ GF_ISOM_OPEN_READ, /*Opens a file in WRITE ONLY mode. Media Data is captured on the fly. In this mode, the editing functions are disabled.*/ GF_ISOM_OPEN_WRITE, /*Opens an existing file in EDIT mode*/ GF_ISOM_OPEN_EDIT, /*Creates a new file in EDIT mode*/ GF_ISOM_WRITE_EDIT};/*Movie Options for file writing*/enum{ /*FLAT: the MediaData (MPEG4 ESs) is stored at the begining of the file*/ GF_ISOM_STORE_FLAT = 1, /*STREAMABLE: the MetaData (File Info) is stored at the begining of the file for fast access during download*/ GF_ISOM_STORE_STREAMABLE, /*INTERLEAVED: Same as STREAMABLE, plus the media data is mixed by chunk of fixed duration*/ GF_ISOM_STORE_INTERLEAVED, /*INTERLEAVED +DRIFT: Same as INTERLEAVED, and adds time drift control to avoid creating too long chunks*/ GF_ISOM_STORE_DRIFT_INTERLEAVED, /*tightly interleaves samples based on their DTS, therefore allowing better placement of samples in the file. This is used for both http interleaving and Hinting optimizations*/ GF_ISOM_STORE_TIGHT};/*Some track may depend on other tracks for several reasons. They reference these tracks through the following Reference Types*/enum{ /*ref type for the OD track dependencies*/ GF_ISOM_REF_OD = GF_4CC( 'm', 'p', 'o', 'd' ), /*ref type for stream dependencies*/ GF_ISOM_REF_DECODE = GF_4CC( 'd', 'p', 'n', 'd' ), /*ref type for OCR (Object Clock Reference) dependencies*/ GF_ISOM_REF_OCR = GF_4CC( 's', 'y', 'n', 'c' ), /*ref type for IPI (Intellectual Property Information) dependencies*/ GF_ISOM_REF_IPI = GF_4CC( 'i', 'p', 'i', 'r' ), /*ref type for Hint tracks*/ GF_ISOM_REF_HINT = GF_4CC( 'h', 'i', 'n', 't' ), /*ref type for QT Chapter tracks*/ GF_ISOM_REF_CHAP = GF_4CC( 'c', 'h', 'a', 'p' )};/*Track Edition flag*/enum { /*empty segment in the track (no media for this segment)*/ GF_ISOM_EDIT_EMPTY = 0x00, /*dwelled segment in the track (one media sample for this segment)*/ GF_ISOM_EDIT_DWELL = 0x01, /*normal segment in the track*/ GF_ISOM_EDIT_NORMAL = 0x02};/*Generic Media Types (YOU HAVE TO USE ONE OF THESE TYPES FOR COMPLIANT ISO MEDIA FILES)*/enum{ /*base media types*/ GF_ISOM_MEDIA_VISUAL = GF_4CC( 'v', 'i', 'd', 'e' ), GF_ISOM_MEDIA_AUDIO = GF_4CC( 's', 'o', 'u', 'n' ), GF_ISOM_MEDIA_HINT = GF_4CC( 'h', 'i', 'n', 't' ), GF_ISOM_MEDIA_TEXT = GF_4CC( 't', 'e', 'x', 't' ), GF_ISOM_MEDIA_SUBPIC = GF_4CC( 's', 'u', 'b', 'p' ), /*MPEG-4 media types*/ GF_ISOM_MEDIA_OD = GF_4CC( 'o', 'd', 's', 'm' ), GF_ISOM_MEDIA_OCR = GF_4CC( 'c', 'r', 's', 'm' ), GF_ISOM_MEDIA_SCENE = GF_4CC( 's', 'd', 's', 'm' ), GF_ISOM_MEDIA_MPEG7 = GF_4CC( 'm', '7', 's', 'm' ), GF_ISOM_MEDIA_OCI = GF_4CC( 'o', 'c', 's', 'm' ), GF_ISOM_MEDIA_IPMP = GF_4CC( 'i', 'p', 's', 'm' ), GF_ISOM_MEDIA_MPEGJ = GF_4CC( 'm', 'j', 's', 'm' ), /*GPAC-defined, for any track using MPEG-4 systems signaling but with undefined streaml types*/ GF_ISOM_MEDIA_ESM = GF_4CC( 'g', 'e', 's', 'm' ), GF_ISOM_MEDIA_FLASH = GF_4CC( 'f', 'l', 's', 'h' )};/* Encryption Scheme Type in the SchemeTypeInfoBox */enum { GF_ISOM_ISMACRYP_SCHEME = GF_4CC( 'i', 'A', 'E', 'C' )};/*specific media sub-types - you shall make sure the media sub type is what you expect*/enum{ /*reserved, internal use in the lib. Indicates the track complies to MPEG-4 system specification, and the usual OD framework tools may be used*/ GF_ISOM_SUBTYPE_MPEG4 = GF_4CC( 'M', 'P', 'E', 'G' ), /*reserved, internal use in the lib. Indicates the track is of GF_ISOM_SUBTYPE_MPEG4 but it is encrypted.*/ GF_ISOM_SUBTYPE_MPEG4_CRYP = GF_4CC( 'E', 'N', 'C', 'M' ), /*AVC/H264 media type - not listed as an MPEG-4 type, ALTHOUGH this library automatically remaps GF_AVCConfig to MPEG-4 ESD*/ GF_ISOM_SUBTYPE_AVC_H264 = GF_4CC( 'a', 'v', 'c', '1' ), /*3GPP(2) extension subtypes*/ GF_ISOM_SUBTYPE_3GP_H263 = GF_4CC( 's', '2', '6', '3' ), GF_ISOM_SUBTYPE_3GP_AMR = GF_4CC( 's', 'a', 'm', 'r' ), GF_ISOM_SUBTYPE_3GP_AMR_WB = GF_4CC( 's', 'a', 'w', 'b' ), GF_ISOM_SUBTYPE_3GP_EVRC = GF_4CC( 's', 'e', 'v', 'c' ), GF_ISOM_SUBTYPE_3GP_QCELP = GF_4CC( 's', 'q', 'c', 'p' ), GF_ISOM_SUBTYPE_3GP_SMV = GF_4CC( 's', 's', 'm', 'v' )};/*direction for sample search (including SyncSamples search)Function using search allways specify the desired time in composition (presentation) time (Sample N-1) DesiredTime (Sample N)FORWARD: will give the next sample given the desired time (eg, N)BACKWARD: will give the previous sample given the desired time (eg, N-1)SYNCFORWARD: will search from the desired point in time for a sync sample if any If no sync info, behaves as FORWARDSYNCBACKWARD: will search till the desired point in time for a sync sample if any If no sync info, behaves as BACKWARDSYNCSHADOW: use the sync shadow information to retrieve the sample. If no SyncShadow info, behave as SYNCBACKWARD*/enum{ GF_ISOM_SEARCH_FORWARD = 1, GF_ISOM_SEARCH_BACKWARD = 2, GF_ISOM_SEARCH_SYNC_FORWARD = 3, GF_ISOM_SEARCH_SYNC_BACKWARD = 4, GF_ISOM_SEARCH_SYNC_SHADOW = 5};/*Predefined File Brand codes (MPEG-4 and JPEG2000)*/enum{ /*file complying to the generic ISO Media File (base specification ISO/IEC 14496-12) this is the default brand when creating a new movie*/ GF_ISOM_BRAND_ISOM = GF_4CC( 'i', 's', 'o', 'm' ), /*file complying to the generic ISO Media File (base specification ISO/IEC 14496-12) + Meta extensions*/ GF_ISOM_BRAND_ISO2 = GF_4CC( 'i', 's', 'o', '2' ), /*file complying to ISO/IEC 14496-1 2001 edition. A .mp4 file without a brand is equivalent to a file compatible with this brand*/ GF_ISOM_BRAND_MP41 = GF_4CC( 'm', 'p', '4', '1' ), /*file complying to ISO/IEC 14496-14 (MP4 spec)*/ GF_ISOM_BRAND_MP42 = GF_4CC( 'm', 'p', '4', '2' ), /*file complying to ISO/IEC 15444-3 (JPEG2000) without profile restriction*/ GF_ISOM_BRAND_MJP2 = GF_4CC( 'm', 'j', 'p', '2' ), /*file complying to ISO/IEC 15444-3 (JPEG2000) with simple profile restriction*/ GF_ISOM_BRAND_MJ2S = GF_4CC( 'm', 'j', '2', 's' ), /*old versions of 3GPP spec (without timed text)*/ GF_ISOM_BRAND_3GP4 = GF_4CC('3', 'g', 'p', '4'), GF_ISOM_BRAND_3GP5 = GF_4CC('3', 'g', 'p', '5'), /*final version of 3GPP file spec*/ GF_ISOM_BRAND_3GP6 = GF_4CC('3', 'g', 'p', '6'), /*generci 3GPP file (several audio tracks, etc..)*/ GF_ISOM_BRAND_3GG6 = GF_4CC('3', 'g', 'g', '6'), /*3GPP2 file spec*/ GF_ISOM_BRAND_3G2A = GF_4CC('3', 'g', '2', 'a'), /*AVC file spec*/ GF_ISOM_BRAND_AVC1 = GF_4CC('a', 'v', 'c', '1'), /* file complying to ISO/IEC 21000-9:2005 (MPEG-21 spec)*/ GF_ISOM_BRAND_MP21 = GF_4CC('m', 'p', '2', '1'),};/*MPEG-4 ProfileAndLevel codes*/enum{ GF_ISOM_PL_AUDIO, GF_ISOM_PL_VISUAL, GF_ISOM_PL_GRAPHICS, GF_ISOM_PL_SCENE, GF_ISOM_PL_OD, GF_ISOM_PL_MPEGJ, /*not a profile, just set/unset inlineFlag*/ GF_ISOM_PL_INLINE,};/********************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -