include/mp4v2/file.h Source File
file.h
1 #ifndef MP4V2_FILE_H
2 #define MP4V2_FILE_H
3 
4 /**************************************************************************/
12 #define MP4_CREATE_64BIT_DATA 0x01
13 
14 #define MP4_CREATE_64BIT_TIME 0x02
15 
16 #define MP4_CLOSE_DO_NOT_COMPUTE_BITRATE 0x01
17 
19 typedef enum MP4FileMode_e
20 {
26 
36 typedef struct MP4FileProvider_s
37 {
38  void* ( *open )( const char* name, MP4FileMode mode );
39  int ( *seek )( void* handle, int64_t pos );
40  int ( *read )( void* handle, void* buffer, int64_t size, int64_t* nin, int64_t maxChunkSize );
41  int ( *write )( void* handle, const void* buffer, int64_t size, int64_t* nout, int64_t maxChunkSize );
42  int ( *close )( void* handle );
43  int ( *getSize )( void* handle, int64_t* nout );
45 
56 MP4V2_EXPORT
57 void MP4Close(
58  MP4FileHandle hFile,
59  uint32_t flags DEFAULT(0) );
60 
83 MP4V2_EXPORT
84 MP4FileHandle MP4Create(
85  const char* fileName,
86  uint32_t flags DEFAULT(0) );
87 
114 MP4V2_EXPORT
115 MP4FileHandle MP4CreateEx(
116  const char* fileName,
117  uint32_t flags DEFAULT(0),
118  int add_ftyp DEFAULT(1),
119  int add_iods DEFAULT(1),
120  char* majorBrand DEFAULT(0),
121  uint32_t minorVersion DEFAULT(0),
122  char** compatibleBrands DEFAULT(0),
123  uint32_t compatibleBrandsCount DEFAULT(0) );
124 
150 MP4V2_EXPORT
151 MP4FileHandle MP4CreateProvider(
152  const char* fileName,
153  uint32_t flags DEFAULT(0),
154  const MP4FileProvider* fileProvider DEFAULT(NULL) );
155 
185 MP4V2_EXPORT
186 MP4FileHandle MP4CreateProviderEx(
187  const char* fileName,
188  uint32_t flags DEFAULT(0),
189  const MP4FileProvider* fileProvider DEFAULT(NULL),
190  int add_ftyp DEFAULT(1),
191  int add_iods DEFAULT(1),
192  char* majorBrand DEFAULT(0),
193  uint32_t minorVersion DEFAULT(0),
194  char** compatibleBrands DEFAULT(0),
195  uint32_t compatibleBrandsCount DEFAULT(0) );
196 
218 MP4V2_EXPORT
219 bool MP4Dump(
220  MP4FileHandle hFile,
221  bool dumpImplicits DEFAULT(0) );
222 
259 MP4V2_EXPORT
261  const char* fileName,
262  MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID) );
263 
271 MP4V2_EXPORT
272 const char* MP4GetFilename(
273  MP4FileHandle hFile );
274 
307 MP4V2_EXPORT
308 char* MP4Info(
309  MP4FileHandle hFile,
310  MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID) );
311 
333 MP4V2_EXPORT
334 MP4FileHandle MP4Modify(
335  const char* fileName,
336  uint32_t flags DEFAULT(0) );
337 
379 MP4V2_EXPORT
381  const char* fileName,
382  const char* newFileName DEFAULT(NULL) );
383 
384 
403 MP4V2_EXPORT
404 MP4FileHandle MP4Read(
405  const char* fileName );
406 
428 MP4V2_EXPORT
429 MP4FileHandle MP4ReadProvider(
430  const char* fileName,
431  const MP4FileProvider* fileProvider DEFAULT(NULL) );
432 
435 #endif /* MP4V2_FILE_H */
MP4FileProvider_s
Structure of functions implementing custom file provider.
Definition: file.h:37
FILEMODE_READ
@ FILEMODE_READ
file may be read
Definition: file.h:22
MP4FileInfo
char * MP4FileInfo(const char *fileName, MP4TrackId trackId=MP4_INVALID_TRACK_ID)
Return a textual summary of an mp4 file.
MP4FileMode_e
MP4FileMode_e
Enumeration of file modes for custom file provider.
Definition: file.h:20
MP4Create
MP4FileHandle MP4Create(const char *fileName, uint32_t flags=0)
Create a new mp4 file.
MP4FileMode
enum MP4FileMode_e MP4FileMode
Enumeration of file modes for custom file provider.
MP4Close
void MP4Close(MP4FileHandle hFile, uint32_t flags=0)
Close an mp4 file.
MP4GetFilename
const char * MP4GetFilename(MP4FileHandle hFile)
Accessor for the filename associated with a file handle.
MP4Info
char * MP4Info(MP4FileHandle hFile, MP4TrackId trackId=MP4_INVALID_TRACK_ID)
Return a textual summary of an mp4 file.
MP4CreateEx
MP4FileHandle MP4CreateEx(const char *fileName, uint32_t flags=0, int add_ftyp=1, int add_iods=1, char *majorBrand=0, uint32_t minorVersion=0, char **compatibleBrands=0, uint32_t compatibleBrandsCount=0)
Create a new mp4 file with extended options.
MP4_INVALID_TRACK_ID
#define MP4_INVALID_TRACK_ID
Constant: invalid MP4TrackId.
Definition: general.h:49
FILEMODE_MODIFY
@ FILEMODE_MODIFY
file may be read/written
Definition: file.h:23
MP4ReadProvider
MP4FileHandle MP4ReadProvider(const char *fileName, const MP4FileProvider *fileProvider=NULL)
Read an existing mp4 file.
FILEMODE_CREATE
@ FILEMODE_CREATE
file will be created/truncated for read/write
Definition: file.h:24
MP4CreateProviderEx
MP4FileHandle MP4CreateProviderEx(const char *fileName, uint32_t flags=0, const MP4FileProvider *fileProvider=NULL, int add_ftyp=1, int add_iods=1, char *majorBrand=0, uint32_t minorVersion=0, char **compatibleBrands=0, uint32_t compatibleBrandsCount=0)
Create a new mp4 file with extended options.
MP4Optimize
bool MP4Optimize(const char *fileName, const char *newFileName=NULL)
Optimize the layout of an mp4 file.
MP4FileProvider
struct MP4FileProvider_s MP4FileProvider
Structure of functions implementing custom file provider.
MP4Modify
MP4FileHandle MP4Modify(const char *fileName, uint32_t flags=0)
Modify an existing mp4 file.
MP4Dump
bool MP4Dump(MP4FileHandle hFile, bool dumpImplicits=0)
Dump mp4 file contents as ASCII either to stdout or the log callback (see MP4SetLogCallback)
MP4Read
MP4FileHandle MP4Read(const char *fileName)
Read an existing mp4 file.
MP4CreateProvider
MP4FileHandle MP4CreateProvider(const char *fileName, uint32_t flags=0, const MP4FileProvider *fileProvider=NULL)
Create a new mp4 file.
FILEMODE_UNDEFINED
@ FILEMODE_UNDEFINED
undefined
Definition: file.h:21