-
-
Notifications
You must be signed in to change notification settings - Fork 1
bindings.decoder
Contains all the functions and objects for FLAC/stream_decoder 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.
Creates an instance of a FLAC decoder. If return null, then an error has occurred, probably with memory.
Deletes an instance of a FLAC decoder freeing all the native resources.
FLAC__stream_decoder_set_ogg_serial_number()
Sets the serial number of an ogg stream. Only useful if the stream will be an ogg one.
FLAC__stream_decoder_set_md5_checking()
Set the MD5 signature check flag.
FLAC__stream_decoder_set_metadata_respond()
Tells the decoder to pass all metadata blocks of this type to the metadata callback. See bindings.format.MetadataType for values accepted in metadataType argument.
FLAC__stream_decoder_set_metadata_respond_application()
Tells the decoder to pass all APPLICATION metadata blocks that matches the id to the metadata callback. id has to be an array of characters, that is, ['f'.charCodeAt(0), 'l'.charCodeAt(0), 'a'.charCodeAt(0), 'c'.charCodeAt(0)] as an example.
FLAC__stream_decoder_set_metadata_respond_all()
Tells the decoder to pass all metadata blocks to the metadatata callback.
FLAC__stream_decoder_set_metadata_ignore()
Tells the decoder to ignore all metadata blocks that matches metadataType type. See bindings.type.MetadataType for all valid values.
FLAC__stream_decoder_set_metadata_ignore_application()
Tells the decoder to ignore all APPLICATION metadata blocks that matches the given id. The format of id is the same as in set_metadata_respond_application.
FLAC__stream_decoder_set_metadata_ignore_all()
Tells the decoder to ignore all metadata blocks.
FLAC__stream_decoder_get_state()
Gets the current decoder status. See bindings.decoder.State and bindings.decoder.StateString.
FLAC__stream_decoder_get_resolved_state_string()
Gets a string representation of the decoder status.
FLAC__stream_decoder_get_md5_checking()
Gets if md5 checking is enabled or not.
FLAC__stream_decoder_get_total_samples()
Gets the total number of samples. Will return 0 if is undefined. Will return a valid value only after the decoder read the STREAMINFO block.
This value can be truncated due to Number precision. This function returns a value of 64 bits but Number has only 48 bits.
FLAC__stream_decoder_get_channels()
Gets the number of channels from the last decoded frame. Will return a valid value only after the decoder had decoded at least one frame.
FLAC__stream_decoder_get_channel_assignment()
Gets the channel assignment from the last decoded frame. Will return a valid value only after the decoder had decoded at least one frame. Return values are from bindings.format.ChannelAssignment.
FLAC__stream_decoder_get_bits_per_sample()
Gets the bits per sample from the last decoded frame. Will return a valid value only after the decoder had decoded at least one frame.
FLAC__stream_decoder_get_sample_rate()
Gets the sample rate from the last decoded frame in Hz. Will return a valid value only after the decoder had decoded at least one frame.
FLAC__stream_decoder_get_blocksize()
Gets the current block size of the stream. Will return a valid value only after the decoder had decoded at least one frame.
FLAC__stream_decoder_get_decode_position()
Returns the current byte offset from the start of the stream.
This value can be truncated due to Number bits precision. This function returns a 64 bit integer, but Number only stores 48 bits or less.
Number init_stream(Buffer dec, Function readCbk, Function? seekCbk, Function? tellCbk, Function? lengthCbk, Function? eofCbk, Function writeCbk, Function? metadataCbk, Function errorCbk)
FLAC__stream_decoder_init_stream()
Initializes the decoder and prepares to start decoding. Returned values are of type bindings.decoder.InitStatus. client_data is not needed.
Number init_ogg_stream(Buffer dec, Function readCbk, Function? seekCbk, Function? tellCbk, Function? lengthCbk, Function? eofCbk, Function writeCbk, Function? metadataCbk, Function errorCbk)
FLAC__stream_decoder_init_ogg_stream()
Initializes the decoder and prepares to start decoding an OGG stream. Returned values are of type bindings.decoder.InitStatus. client_data is not needed.
Both are functions that are imposible to implement on node.js because require a FILE* form the C API.
Number init_file(Buffer dec, String filename, Function writeCbk, Function? metadataCbk, Function error Cbk)
FLAC__stream_decoder_init_file()
Initializes the decoder and prepares to start decoding the file. Returned values are of type bindings.decoder.InitStatus. client_data is not needed.
Number init_ogg_file(Buffer dec, String filename, Function writeCbk, Function? metadataCbk, Function error Cbk)
FLAC__stream_decoder_init_ogg_file()
Initializes the decoder and prepares to start decoding the OGG file. Returned values are of type bindings.decoder.InitStatus. client_data is not needed.
Finish the decoder process, flushing the decoding buffer, releasing some resources and setting the decoder to initial state.
Flushes decoder's buffers. This will deactivate md5 checking if was enabled.
Resets the decoding process to the beginning.
FLAC__stream_decoder_process_single()
Process one metadata block or audio frame.
FLAC__stream_decoder_process_until_end_of_metadata()
Process all metadata blocks, and stops when there's no more metadata blocks.
FLAC__stream_decoder_process_until_end_of_stream()
Process all the metadata blocks and audio frames from the current position until the end of stream.
FLAC__stream_decoder_skip_single_frame()
Skip one audio frame.
FLAC__stream_decoder_seek_absolute()
Seek to the absolute sample given and continues decoding from there.
Represents the above enum as a associative array. For example bindings.decoder.State.ABORTED will return a Number that represents this enum value. An invalid enum value will return undefined.
Represents the above enum as a associative array. For example bindings.decoder.InitStatus.OK will return a Number that represents this enum value. An invalid enum value will return undefined.
Represents the above enum as a associative array. For example bindings.decoder.ReadStatus.CONTINUE will return a Number that represents this enum value. An invalid enum value will return undefined.
Represents the above enum as a associative array. For example bindings.decoder.SeekStatus.OK will return a Number that represents this enum value. An invalid enum value will return undefined.
Represents the above enum as a associative array. For example bindings.decoder.TellStatus.OK will return a Number that represents this enum value. An invalid enum value will return undefined.
FLAC__StreamDecoderLengthStatus
Represents the above enum as a associative array. For example bindings.decoder.LengthStatus.OK will return a Number that represents this enum value. An invalid enum value will return undefined.
FLAC__StreamDecoderWriteStatus
Represents the above enum as a associative array. For example bindings.decoder.WriteStatus.CONTINUE will return a Number that represents this enum value. An invalid enum value will return undefined.
FLAC__StreamDecoderErrorStatus
Represents the above enum as a associative array. For example bindings.decoder.ErrorStatus.LOST_SYNC will return a Number that represents this enum value. An invalid enum value will return undefined.
FLAC__StreamDecoderStateString
Represents the above const char* array as a JavaScript array. Returns a String representation for enum bindings.decoder.State.
FLAC__StreamDecoderInitStatusString
Represents the above const char* array as a JavaScript array. Returns a String representation for enum bindings.decoder.InitStatus.
FLAC__StreamDecoderReadStatusString
Represents the above const char* array as a JavaScript array. Returns a String representation for enum bindings.decoder.ReadStatus.
FLAC__StreamDecoderSeekStatusString
Represents the above const char* array as a JavaScript array. Returns a String representation for enum bindings.decoder.SeekStatus.
FLAC__StreamDecoderTellStatusString
Represents the above const char* array as a JavaScript array. Returns a String representation for enum bindings.decoder.TellStatus.
FLAC__StreamDecoderLengthStatusString
Represents the above const char* array as a JavaScript array. Returns a String representation for enum bindings.decoder.LengthStatus.
FLAC__StreamDecoderWriteStatusString
Represents the above const char* array as a JavaScript array. Returns a String representation for enum bindings.decoder.WriteStatus.
FLAC__StreamDecoderErrorStatusString
Represents the above const char* array as a JavaScript array. Returns a String representation for enum bindings.decoder.ErrorStatus.
Object read_callback(Buffer buffer)
Called when the decoder needs some data. Fill the data into the buffer and return an object with bytes set to the bytes read and a valid return value from bindings.decoder.ReadStatus in returnValue field. {bytes: ..., returnValue: ...}
Number seek_callback(Number offset)
Called when the decoder requests seeking on the stream. The value of offset could be truncated due to Number precision. Return a valid value from bindings.decoder.SeekStatus.
Object tell_callback()
Called when the decoder wants to know the offset in bytes from the beginning of the stream. Return an object with offset value as the offset in bytes and returnValue as the valid return value from bindings.decoder.TellStatus. {offset: ..., returnValue: ...}
Object length_callback()
Called when the decoder wants to know the length of the stream. Return an object with length set to the length value and returnValue as a valid return value from bindings.decoder.LengthStatus.
Boolean eof_callback()
Called when the decoder wants to know if the stream has no more data, has arrived to its end of file. Return true if have arrived the EOF, or false otherwise.
Number read_callback(Object frame, [Buffer] buffers)
Called when the decoder decoded some data. frame contain a FLAC__Frame representation in JavaScript. buffers are the array of buffers (one per channel). Return a valid value from bindings.decoder.WriteStatus.
read_callback(Object metadata)
Called when the decoder read a metadata block, and you requested that block to be passed here. metadata is a JavaScript representation of a FLAC__StreamMetadata struct.
error_callback(Number error)
Called when the decoder had an error. See bindings.decoder.ErrorStatus and bindings.decoder.ErrorStatusString to know what's going on.