Skip to content

bindings.metadata2

Melchor Garau Madrigal edited this page Feb 9, 2017 · 3 revisions

Contains all the functions and objects for FLAC/metadata2 interface. Don't think this documentation is a full replacement of the FLAC's one. Only tells all available functions, and the relation to the FLAC API, with a short description. If this documents lacks a function from the FLAC API, it means that has no bounded.

functions

Buffer? chain_new()

FLAC__metadata_chain_new()

Creates an instance of a Metadata Chain or returns null if could not create it.

chain_delete(Buffer chain)

FLAC__metadata_chain_delete()

Deletes an instance of a Metadata Chain created by bindings.metadata2.chain_new(). Passing an invalid object could crash node or make unexpected things.

Number chain_status(Buffer chain)

FLAC__metadata_chain_status()

Gets the current state of the chain. You can get a string value of it with bindings.metadata2.ChainStatusString.

Boolean chain_read(Buffer chain, String filename)

FLAC__metadata_chain_read()

Reads all metadata from a FLAC file into the chain.

Boolean chain_read_ogg(Buffer chain, String filename)

FLAC__metadata_chain_read_ogg()

Reads all metadata from a OGG FLAC file into the chain.

Boolean chain_write(Buffer chain, bool usePadding, bool preserveFileStats)

FLAC__metadata_chain_write()

Writes all metadata in the chain into the FLAC file. Read carefully the documentation of this function about the use of usePadding and preserverFileStats.

chain_merge_padding(Buffer chain)

FLAC__metadata_chain_merge_padding()

Merge adjacent PADDING blocks into a single one.

chain_sort_padding(Buffer chain)

FLAC__metadata_chain_sort_padding()

Moves all PADDING blocks to the end of the chain, and then merge them into a single block.

Buffer? iterator_new()

FLAC__metadata_iterator_new()

Tries to create a new Metadata Iterator and returns a Buffer if succeeded, or null if it failed.

iterator_delete(Buffer iterator)

FLAC__metadata_iterator_delete()

Deletes an instance of a Metadata Iterator created by bindings.metadata2.iterator_new(). Passing an invalid object could crash node or make unexpected things.

iterator_init(Buffer iterator, Buffer chain)

FLAC__metadata_iterator_init()

Initializes the iterator with the contents of the chain. But previously you must called any read functions (bindings.metadata2.chain_read() or bindings.metadata2.chain_read_ogg()).

iterator_next(Buffer iterator)

FLAC__metadata_iterator_next()

Points the iterator to the next block, if there's more.

iterator_prev(Buffer iterator)

FLAC__metadata_iterator_prev()

Points the iterator to the previous block, if it's not in the beginning.

Number iterator_get_block_type(Buffer iterator)

FLAC__metadata_iterator_get_block_type()

Get the type of the metadata block at the current position. The value can be converted to string using bindings.metadata.MetadataTypeString.

Object iterator_get_block(Buffer iterator)

FLAC__metadata_iterator_get_block()

Returns the current metadata block. You can convert the reference to an js Object using bindings.metadata.convertToJsObject. But any changes you make on the js object will not be reflected in the chain, so you must save it with bindings.metadata2.iterator_set_block().

Boolean iterator_set_block(Buffer iterator, Object metadata)

FLAC__metadata_iterator_set_block()

Replaces the current block by the one passed in metadata. The object you pass must be created by this API, either by bindings.metadata2.iterator_get_block() or any functions in bindings.metadata section.

Boolean iterator_delete_block(Buffer iterator, Boolean replaceWithPadding)

FLAC__metadata_iterator_delete_block()

Removes the current block (either by delete it or by replacing it with padding), and points to the previous block. The metadata block you pass must be created by the bindings.metadata functions or get by bindings.metadata2.iterator_get_block().

Boolean iterator_insert_block_before(Buffer iterator, Object metadata)

FLAC__metadata_iterator_insert_block_before()

Insert a new block before the current block. The metadata block you pass must be created by the bindings.metadata functions or get by bindings.metadata2.iterator_get_block().

Boolean iterator_insert_block_after(Buffer iterator, Object metadata)

FLAC__metadata_iterator_insert_block_after()

Insert a new block after the current block. The metadata block you pass must be created by the bindings.metadata functions or get by bindings.metadata2.iterator_get_block().

Enums

get Number ChainStatus[]

FLAC__Metadata_ChainStatus

Given a String, returns the number value for the enum value for that string.

get String ChainStatusString[]

Given a Number, converts it into a String representation of the Chain Status.