Opens an MP4 file. The MP4 file is checked for a valid 'ftyp' header. A libmp4tag_t structure is allocated and returned for use in the other libmp4tag functions.
libmp4tag_t *mp4tag_open (const char *filename, int *mp4error)
filename : The file to open.
mp4error : A pointer to an integer. Returns the error code.
If the file does not have permissions to be written, the file will be opened for reading.
Returns: A pointer to an allocated libmp4tag_t structure. This pointer must be freed in a call to mp4tag_free.
Initializes libmp4tag to process a stream. A libmp4tag_t structure is allocated and returned for use in the other libmp4tag functions.
Note that if the MP4 tags are located after the audio/video, the stream will be completely read in.
#include <stdint.h>
libmp4tag_t *mp4tag_openstream (mp4tag_readcb_t readcb, mp4tag_seekcb_t, void *userdata, uint32_t timeout, int *mp4error)
readcb : The read callback.
typedef size_t (mp4tag_readcb_t)(char buff, size_t sz, size_t nmemb, void *udata);
The read callback does not need to return all of the requested data immediately, it may return partial data. It must be able to provide the requested data before the timeout occurs.
seekcb : The seek callback.
typedef int (mp4tag_seekcb_t)(size_t offset, void udata);
The seek callback must reposition the stream to the offset, or wait for the stream to reach the appropriate offset.
userdata : Pointer to user data. This pointer will be passed to the read and seek callback routines.
timeout : Timeout in milliseconds when processing the data.
mp4error : A pointer to an integer. Returns the error code.
Returns: A pointer to an allocated libmp4tag_t structure. This pointer must be freed in a call to mp4tag_free.
void mp4tag_set_option (libmp4tag_t *libmp4tag, int option)
libmp4tag : The libmp4tag_t structure returned from mp4tag_open.
option : The value is 'or'd together with existing options.
Options:
MP4TAG_OPTION_KEEP_BACKUP :
Make a copy of the original file. The backup has '-mp4tag.bak' appended.
#include <stdint.h>
void mp4tag_set_option (libmp4tag_t *libmp4tag, int32_t freespacesz)
libmp4tag : The libmp4tag_t structure returned from mp4tag_open.
freespacesz : When re-writing the MP4 file, the size of the new free space box.
int mp4tag_parse (libmp4tag_t *libmp4tag)
libmp4tag : The libmp4tag_t structure returned from mp4tag_open.
Returns: MP4TAG_OK or other error code.
Closes any open files and frees all memory.
void mp4tag_free (libmp4tag_t *libmp4tag)
libmp4tag : The libmp4tag_t structure returned from mp4tag_open.