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
14#define MP4_CREATE_64BIT_TIME 0x02
16#define MP4_CLOSE_DO_NOT_COMPUTE_BITRATE 0x01
17
26
36typedef 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
56MP4V2_EXPORT
58 MP4FileHandle hFile,
59 uint32_t flags DEFAULT(0) );
60
83MP4V2_EXPORT
84MP4FileHandle MP4Create(
85 const char* fileName,
86 uint32_t flags DEFAULT(0) );
87
114MP4V2_EXPORT
115MP4FileHandle 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
150MP4V2_EXPORT
151MP4FileHandle MP4CreateProvider(
152 const char* fileName,
153 uint32_t flags DEFAULT(0),
154 const MP4FileProvider* fileProvider DEFAULT(NULL) );
155
185MP4V2_EXPORT
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
218MP4V2_EXPORT
220 MP4FileHandle hFile,
221 bool dumpImplicits DEFAULT(0) );
222
259MP4V2_EXPORT
261 const char* fileName,
262 MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID) );
263
271MP4V2_EXPORT
272const char* MP4GetFilename(
273 MP4FileHandle hFile );
274
307MP4V2_EXPORT
309 MP4FileHandle hFile,
310 MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID) );
311
333MP4V2_EXPORT
334MP4FileHandle MP4Modify(
335 const char* fileName,
336 uint32_t flags DEFAULT(0) );
337
379MP4V2_EXPORT
381 const char* fileName,
382 const char* newFileName DEFAULT(NULL) );
383
384
403MP4V2_EXPORT
404MP4FileHandle MP4Read(
405 const char* fileName );
406
428MP4V2_EXPORT
429MP4FileHandle MP4ReadProvider(
430 const char* fileName,
431 const MP4FileProvider* fileProvider DEFAULT(NULL) );
432
435#endif /* MP4V2_FILE_H */
bool MP4Dump(MP4FileHandle hFile, bool dumpImplicits=0)
Dump mp4 file contents as ASCII either to stdout or the log callback (see MP4SetLogCallback)
MP4FileHandle MP4Modify(const char *fileName, uint32_t flags=0)
Modify an existing mp4 file.
void MP4Close(MP4FileHandle hFile, uint32_t flags=0)
Close an mp4 file.
MP4FileHandle MP4Read(const char *fileName)
Read an existing mp4 file.
char * MP4FileInfo(const char *fileName, MP4TrackId trackId=MP4_INVALID_TRACK_ID)
Return a textual summary of an mp4 file.
MP4FileHandle MP4CreateProvider(const char *fileName, uint32_t flags=0, const MP4FileProvider *fileProvider=NULL)
Create a new mp4 file.
bool MP4Optimize(const char *fileName, const char *newFileName=NULL)
Optimize the layout of an mp4 file.
char * MP4Info(MP4FileHandle hFile, MP4TrackId trackId=MP4_INVALID_TRACK_ID)
Return a textual summary of an mp4 file.
MP4FileHandle MP4ReadProvider(const char *fileName, const MP4FileProvider *fileProvider=NULL)
Read an existing mp4 file.
MP4FileMode_e
Enumeration of file modes for custom file provider.
Definition file.h:20
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.
struct MP4FileProvider_s MP4FileProvider
Structure of functions implementing custom file provider.
MP4FileHandle MP4Create(const char *fileName, uint32_t flags=0)
Create a new mp4 file.
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.
const char * MP4GetFilename(MP4FileHandle hFile)
Accessor for the filename associated with a file handle.
enum MP4FileMode_e MP4FileMode
Enumeration of file modes for custom file provider.
@ FILEMODE_UNDEFINED
undefined
Definition file.h:21
@ FILEMODE_MODIFY
file may be read/written
Definition file.h:23
@ FILEMODE_READ
file may be read
Definition file.h:22
@ FILEMODE_CREATE
file will be created/truncated for read/write
Definition file.h:24
#define MP4_INVALID_TRACK_ID
Constant: invalid MP4TrackId.
Definition general.h:49
Structure of functions implementing custom file provider.
Definition file.h:37