libextractor  1.11
About: GNU libextractor is a library used to extract meta-data from files of arbitrary type.
  Fossies Dox: libextractor-1.11.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

mp4_extractor.c File Reference

plugin to support MP4 files More...

#include "platform.h"
#include "extractor.h"
#include <mp4v2/mp4v2.h>
Include dependency graph for mp4_extractor.c:

Go to the source code of this file.

Functions

static void * open_cb (const char *name, MP4FileMode mode)
 
static int seek_cb (void *handle, int64_t pos)
 
static int read_cb (void *handle, void *buffer, int64_t size, int64_t *nin, int64_t maxChunkSize)
 
static int write_cb (void *handle, const void *buffer, int64_t size, int64_t *nout, int64_t maxChunkSize)
 
static int close_cb (void *handle)
 
void EXTRACTOR_mp4_extract_method (struct EXTRACTOR_ExtractContext *ec)
 

Detailed Description

plugin to support MP4 files

Author
Christian Grothoff

Definition in file mp4_extractor.c.

Function Documentation

◆ close_cb()

static int close_cb ( void *  handle)
static

Write callback for libmp4v2. Does nothing.

Parameters
handlethe 'struct EXTRACTOR_ExtractContext'
Returns
false on success (always succeeds)

Definition at line 141 of file mp4_extractor.c.

Referenced by EXTRACTOR_mp4_extract_method().

◆ EXTRACTOR_mp4_extract_method()

void EXTRACTOR_mp4_extract_method ( struct EXTRACTOR_ExtractContext ec)

Main entry method for the MP4 extraction plugin.

Parameters
ecextraction context provided to the plugin

Definition at line 181 of file mp4_extractor.c.

References close_cb(), NULL, open_cb(), read_cb(), seek_cb(), and write_cb().

◆ open_cb()

static void* open_cb ( const char *  name,
MP4FileMode  mode 
)
static

Callback invoked by libmp4v2 to open the file. We cheated and passed our extractor context as the filename (fingers crossed) and will simply return it again to make it the handle.

Parameters
name"filename" to open
openmode, only reading allowed
Returns
NULL if the file is not opened for reading

Definition at line 42 of file mp4_extractor.c.

References name, and NULL.

Referenced by EXTRACTOR_mp4_extract_method().

◆ read_cb()

static int read_cb ( void *  handle,
void *  buffer,
int64_t  size,
int64_t *  nin,
int64_t  maxChunkSize 
)
static

Read callback for libmp4v2.

Parameters
handlethe 'struct EXTRACTOR_ExtractContext'
bufferwhere to write data read
sizedesired number of bytes to read
ninwhere to write number of bytes read
maxChunkSizesome chunk size (ignored)
Returns
true on failure, false on success

Definition at line 89 of file mp4_extractor.c.

References buffer, EXTRACTOR_ExtractContext::cls, and EXTRACTOR_ExtractContext::read.

Referenced by EXTRACTOR_mp4_extract_method().

◆ seek_cb()

static int seek_cb ( void *  handle,
int64_t  pos 
)
static

Seek callback for libmp4v2.

Parameters
handlethe 'struct EXTRACTOR_ExtractContext'
postarget seek position (relative or absolute?)
Returns
true on failure, false on success

Definition at line 63 of file mp4_extractor.c.

References EXTRACTOR_ExtractContext::cls, and EXTRACTOR_ExtractContext::seek.

Referenced by EXTRACTOR_mp4_extract_method().

◆ write_cb()

static int write_cb ( void *  handle,
const void *  buffer,
int64_t  size,
int64_t *  nout,
int64_t  maxChunkSize 
)
static

Write callback for libmp4v2.

Parameters
handlethe 'struct EXTRACTOR_ExtractContext'
bufferdata to write
sizedesired number of bytes to write
ninwhere to write number of bytes written
maxChunkSizesome chunk size (ignored)
Returns
true on failure (always fails)

Definition at line 123 of file mp4_extractor.c.

Referenced by EXTRACTOR_mp4_extract_method().