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)  

ogg_extractor.c File Reference

plugin to support OGG files More...

#include "platform.h"
#include "extractor.h"
#include <vorbis/vorbisfile.h>
Include dependency graph for ogg_extractor.c:

Go to the source code of this file.

Macros

#define OGG_HEADER   0x4f676753
 
#define ADD(t, s)
 
#define ADDG(t, d)
 

Functions

static size_t read_ogg (void *ptr, size_t size, size_t nmemb, void *datasource)
 
static int seek_ogg (void *datasource, ogg_int64_t offset, int whence)
 
static long tell_ogg (void *datasource)
 
static char * get_comment (vorbis_comment *vc, const char *label)
 
void EXTRACTOR_ogg_extract_method (struct EXTRACTOR_ExtractContext *ec)
 

Detailed Description

plugin to support OGG files

Author
Christian Grothoff

Definition in file ogg_extractor.c.

Macro Definition Documentation

◆ ADD

#define ADD (   t,
 
)
Value:
do { if (0 != (ret = ec->proc (ec->cls, "ogg", t, \
"text/plain", s, strlen (s) \
+ 1))) goto FINISH; \
} while (0)
@ EXTRACTOR_METAFORMAT_UTF8
Definition: extractor.h:102

Extract meta data from vorbis using the given LE type and value.

Parameters
tLE meta data type
smeta data to add

Definition at line 131 of file ogg_extractor.c.

◆ ADDG

#define ADDG (   t,
 
)
Value:
do { m = get_comment (comments, d); if (NULL != m) ADD (t,m); \
} while (0)
#define NULL
Definition: getopt1.c:60
#define ADD(t, s)
static char * get_comment(vorbis_comment *vc, const char *label)

Extract meta data from vorbis using the given LE type and label.

Parameters
tLE meta data type
dvorbis meta data label

Definition at line 144 of file ogg_extractor.c.

◆ OGG_HEADER

#define OGG_HEADER   0x4f676753

Bytes each ogg file must begin with (not used, but we might choose to add this back in the future to improve performance for non-ogg files).

Definition at line 34 of file ogg_extractor.c.

Function Documentation

◆ EXTRACTOR_ogg_extract_method()

◆ get_comment()

static char* get_comment ( vorbis_comment *  vc,
const char *  label 
)
static

Extract the associated meta data for a given label from vorbis.

Parameters
vcvorbis comment data
labellabel marking the desired entry
Returns
NULL on error, otherwise the meta data

Definition at line 116 of file ogg_extractor.c.

References NULL.

◆ read_ogg()

static size_t read_ogg ( void *  ptr,
size_t  size,
size_t  nmemb,
void *  datasource 
)
static

Custom read function for ogg.

Parameters
ptrwhere to write the data
sizenumber of bytes to read per member
nmembnumber of members to read
datasourcethe 'struct EXTRACTOR_ExtractContext'
Returns
0 on end-of-data, 0 with errno set to indicate read error

Definition at line 47 of file ogg_extractor.c.

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

Referenced by EXTRACTOR_ogg_extract_method().

◆ seek_ogg()

static int seek_ogg ( void *  datasource,
ogg_int64_t  offset,
int  whence 
)
static

Seek to a particular position in the file.

Parameters
datasourcethe 'struct EXTRACTOR_ExtractContext'
offsetwhere to seek
whencehow to seek
Returns
-1 on error, new position on success

Definition at line 79 of file ogg_extractor.c.

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

Referenced by EXTRACTOR_ogg_extract_method().

◆ tell_ogg()

static long tell_ogg ( void *  datasource)
static

Tell ogg where we are in the file

Parameters
datasourcethe 'struct EXTRACTOR_ExtractContext'
Returns

Definition at line 98 of file ogg_extractor.c.

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

Referenced by EXTRACTOR_ogg_extract_method().