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)  

nsfe_extractor.c File Reference

plugin to support Nes Sound Format files More...

#include "platform.h"
#include "extractor.h"
#include "convert.h"
Include dependency graph for nsfe_extractor.c:

Go to the source code of this file.

Data Structures

struct  header
 
struct  infochunk
 

Macros

#define PAL_FLAG   0x01
 
#define DUAL_FLAG   0x02
 
#define VRCVI_FLAG   0x01
 
#define VRCVII_FLAG   0x02
 
#define FDS_FLAG   0x04
 
#define MMC5_FLAG   0x08
 
#define NAMCO_FLAG   0x10
 
#define SUNSOFT_FLAG   0x20
 
#define ADD(s, t)
 
#define ADDF(s, t)
 

Functions

static uint32_t nsfeuint (const char *data)
 
static char * nsfestring (const char *data, size_t size)
 
static int info_extract (struct EXTRACTOR_ExtractContext *ec, uint32_t size)
 
static int tlbl_extract (struct EXTRACTOR_ExtractContext *ec, uint32_t size)
 
static int auth_extract (struct EXTRACTOR_ExtractContext *ec, uint32_t size)
 
void EXTRACTOR_nsfe_extract_method (struct EXTRACTOR_ExtractContext *ec)
 

Detailed Description

plugin to support Nes Sound Format files

Author
Toni Ruottu
Christian Grothoff

Definition in file nsfe_extractor.c.

Macro Definition Documentation

◆ ADD

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

Give metadata to LE; return if 'proc' returns non-zero.

Parameters
smetadata value as UTF8
tmetadata type to use

Definition at line 108 of file nsfe_extractor.c.

◆ ADDF

#define ADDF (   s,
 
)
Value:
do { if (0 != ec->proc (ec->cls, "nsfe", t, \
"text/plain", s, strlen (s) \
+ 1)) { free (s); \
return 1; \
} free (s); } while (0)

Give metadata to LE; return if 'proc' returns non-zero.

Parameters
smetadata value as UTF8, free at the end
tmetadata type to use

Definition at line 121 of file nsfe_extractor.c.

◆ DUAL_FLAG

#define DUAL_FLAG   0x02

Definition at line 34 of file nsfe_extractor.c.

◆ FDS_FLAG

#define FDS_FLAG   0x04

Definition at line 39 of file nsfe_extractor.c.

◆ MMC5_FLAG

#define MMC5_FLAG   0x08

Definition at line 40 of file nsfe_extractor.c.

◆ NAMCO_FLAG

#define NAMCO_FLAG   0x10

Definition at line 41 of file nsfe_extractor.c.

◆ PAL_FLAG

#define PAL_FLAG   0x01

Definition at line 33 of file nsfe_extractor.c.

◆ SUNSOFT_FLAG

#define SUNSOFT_FLAG   0x20

Definition at line 42 of file nsfe_extractor.c.

◆ VRCVI_FLAG

#define VRCVI_FLAG   0x01

Definition at line 37 of file nsfe_extractor.c.

◆ VRCVII_FLAG

#define VRCVII_FLAG   0x02

Definition at line 38 of file nsfe_extractor.c.

Function Documentation

◆ auth_extract()

static int auth_extract ( struct EXTRACTOR_ExtractContext ec,
uint32_t  size 
)
static

Extract data from the AUTH chunk.

Parameters
ecextraction context
sizenumber of bytes in AUTH chunk
Returns
0 to continue extrating

Definition at line 285 of file nsfe_extractor.c.

References ADDF, EXTRACTOR_ExtractContext::cls, EXTRACTOR_METATYPE_ALBUM, EXTRACTOR_METATYPE_ARTIST, EXTRACTOR_METATYPE_COPYRIGHT, EXTRACTOR_METATYPE_RIPPER, nsfestring(), NULL, and EXTRACTOR_ExtractContext::read.

Referenced by EXTRACTOR_nsfe_extract_method().

◆ EXTRACTOR_nsfe_extract_method()

void EXTRACTOR_nsfe_extract_method ( struct EXTRACTOR_ExtractContext ec)

"extract" meta data from an Extended Nintendo Sound Format file

NSFE specification revision 2 (Sep. 3, 2003) was used, while this piece of software was originally written.

Parameters
ecextraction context

Definition at line 347 of file nsfe_extractor.c.

References auth_extract(), EXTRACTOR_ExtractContext::cls, EXTRACTOR_METAFORMAT_UTF8, EXTRACTOR_METATYPE_MIMETYPE, info_extract(), header::magicid, nsfeuint(), EXTRACTOR_ExtractContext::proc, EXTRACTOR_ExtractContext::read, EXTRACTOR_ExtractContext::seek, and tlbl_extract().

◆ info_extract()

static int info_extract ( struct EXTRACTOR_ExtractContext ec,
uint32_t  size 
)
static

◆ nsfestring()

static char* nsfestring ( const char *  data,
size_t  size 
)
static

Copy string starting at 'data' with at most 'size' bytes. (strndup).

Parameters
datainput data to copy
sizenumber of bytes in 'data'
Returns
copy of the string at data

Definition at line 84 of file nsfe_extractor.c.

References NULL.

Referenced by auth_extract(), and tlbl_extract().

◆ nsfeuint()

static uint32_t nsfeuint ( const char *  data)
static

Read an unsigned integer at the current offset.

Parameters
datainput data to parse
Returns
parsed integer

Definition at line 60 of file nsfe_extractor.c.

Referenced by EXTRACTOR_nsfe_extract_method().

◆ tlbl_extract()

static int tlbl_extract ( struct EXTRACTOR_ExtractContext ec,
uint32_t  size 
)
static

Extract data from the TLBL chunk.

Parameters
ecextraction context
sizenumber of bytes in TLBL chunk
Returns
0 to continue extrating

Definition at line 247 of file nsfe_extractor.c.

References ADDF, EXTRACTOR_ExtractContext::cls, EXTRACTOR_METATYPE_TITLE, nsfestring(), NULL, and EXTRACTOR_ExtractContext::read.

Referenced by EXTRACTOR_nsfe_extract_method().