-
-
Notifications
You must be signed in to change notification settings - Fork 1
bindings.format
Contains all the functions and objects for FLAC/format 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.
Read carefully this Wiki page because contains all the mappings between the C structs and Javascript objects.
This structs has different forms depending on its type. Each type will be mapped to a JS class, whose base is always Metadata
. Will contain the same attributes for its type:
- FLAC__StreamMetadata_StreamInfo
- FLAC__StreamMetadata_Padding
- FLAC__StreamMetadata_Application
- FLAC__StreamMetadata_SeekPoint
- FLAC__StreamMetadata_SeekTable
- FLAC__StreamMetadata_VorbisComment_Entry
- FLAC__StreamMetadata_VorbisComment
- FLAC__StreamMetadata_CueSheet_Index
- FLAC__StreamMetadata_CueSheet_Track
- FLAC__StreamMetadata_CueSheet
- FLAC__StreamMetadata_Picture
- FLAC__StreamMetadata_Unknown
They will contain these three attributes:
- Number
type
: Indicates the type as aNumber
- Boolean
isLast
: Indicates if this block is the last - Number
length
: Indicates the length in bytes of the data block
And this methods:
Tryies to clone the metadata object into a new one.
Returns true if both metadata objects are equals.
Metadata objects have associated the C counterpart inside the
this
object (V8 thing). You cannot access to the raw pointer directly, but rather you have access to each field which will then access (or modify) the C struct directly. The object will always be updated.
NOTE: Any operation of add or delete an item to all attributes that returns an
Array
won't affect the internal data. You must call their special methods for alter them.
- Number
minBlocksize
- Number
maxBlocksize
- Number
minFramesize
- Number
maxFramesize
- Number
channels
- Number
bitsPerSample
- Number
sampleRate
- Number
totalSamples
- Array
md5sum
buffer of 16 bytes, modify the buffer, modifies the underlying struct
Has nothing inside it. It's only a padding block :)
- Buffer
id
contains the 4 byte in the buffer. Any modifications on this will affect the real one. If you change the buffer, you will lost the access to the array. - Buffer
data
contains the data, its length is determined by the length attribute in the StreamMetadata object. You can also change the buffer, in this case the...set_data
function will be called for you
- Number | BigInt
sampleNumber
- Number | BigInt
streamOffset
- Number
frameSamples
- Array
points
an array of FLAC__StreamMetadata_SeekPoints. Adding or deleting elements on this array won't affect the C struct, but modifying the items inside will affect the internal data. Use the bindings.metadata functions to modify them. Modifications in the elements inside will, instead, modify the C struct.
FLAC__metadata_seektable_resize_points()
Changes the size of the seek points to the new one.
FLAC__metadata_seektable_set_point()
FLAC__metadata_seektable_insert_point()
FLAC__metadata_seektable_delete_point()
Deletes a point in the position pos
.
FLAC__metadata_seektable_is_legal()
Checks wether the Seek Table is valid or not.
FLAC__metadata_seektable_template_append_placeholders()
Appends a number of placeholders points into the Seek Table.
FLAC__metadata_seektable_template_append_point()
Append a specific seek point to the end of the table.
FLAC__metadata_seektable_template_append_points()
Append some seek points to the end of the table.
FLAC__metadata_seektable_template_append_spaced_points()
Append a set of evenly-spaced seek point templates to the end of a seek table.
FLAC__metadata_seektable_template_append_spaced_points_by_samples()
Append a set of evenly-spaced seek point templates to the end of a seek table.
FLAC__metadata_seektable_template_sort()
Sort a seek table's seek points according to the format specification, removing duplicates. After all calls of seektable_template_*
methods, you must call this one to make the table valid.
This is really a String. But is special. Has a format that follows this specification, but without the framing bit. Modify this String won't affect the C version of it. Never will do.
- String
vendorString
this really is a VorbisComment_Entry? - Array
comments
an array of VorbisComment_Entry, so an array of Strings. All changes to the items or the array must be done using the bindings.metadata. Changes to the array or its items will not affect the internal data.
- Number
offset
if the node version has no support forbigint
, then values will be truncated to 48 bit - Number
number
only can store values from 0 to 255
- Number
offset
if the node version has no support forbigint
, then values will be truncated to 48 bit - Number
number
only can store values from 0 to 255 - Number
type
only can store 0 or 1 - Number
preEmphasis
only can store 0 or 1 - String
isrc
always 12 alpha-numeric characters - Array
indices
an array of FLAC__StreamMetadata_CueSheet_Index. Adding or deleting elements on this array won't affect the internal data. Use the bindings.metadata functions to modify them. Modifications in inside items will, instead, modify the internal data.
See CueSheet functions.
- String
mediaCatalogNumber
a string from 0 to 128 bytes (not chars) - Number
leadIn
if the node version has no support forbigint
, then values will be truncated to 48 bit - Boolean
is_cd
- Array
tracks
an array of FLAC__StreamMetadata_CueSheet_Track. Adding or deleting elements on this array won't affect the internal data, but will modify the elements inside if are modified. Use the bindings.metadata functions to modify them. Modifications in inside items will, instead, modify the internal data.
See CueSheet functions.
- Number
pictureType
TODO - String
mime_type
you must use bindings.metadata.picture_set_mime_type to modify this field. - String
description
you must use bindings.metadata.picture_set_description to modify this field. - Number
width
- Number
height
- Number
depth
- Number
colors
- Buffer
data
See Picture functions.
- Buffer
data
length is determined in the StreamMetadata block. You are free to modify its contents, but you cannot change the pointer.
FLAC__format_sample_rate_is_valid()
FLAC__format_blocksize_is_subset()
FLAC__format_sample_rate_is_subset()
FLAC__format_vorbiscomment_entry_name_is_legal()
FLAC__format_vorbiscomment_entry_value_is_legal()
Only pass the value, the bindings will get the length for you.
FLAC__format_vorbiscomment_entry_is_legal()
Only pass the entry NAME=Value and it will get the length for you.
FLAC__format_seektable_is_legal()
The object seektable
must be created using the Metadata API.
The object seektable
must be created using the Metadata API. Returns the object reordered.
FLAC__format_cuesheet_is_legal()
The object cuesheet
must be created using the Metadata API. Returns true if its OK, or returns a String with an error message.
FLAC__format_picture_is_legal()
The object picutre
must be created using the Metadata API. Returns true if its OK, or returns a String with an error message.
{
STREAMINFO: 0, PADDING: 1, APPLICATION: 2, SEEKTABLE: 3,
VORBIS_COMMENT: 4, CUESHEET: 5, PICTURE: 6, UNDEFINED: 7
}
{
PARTITIONED_RICE: 0, PARTITIONED_RICE2: 1
}
{
CONSTANT: 0, VERBATIM: 1, FIXED: 2, LPC: 3
}
{
INDEPENDENT: 0, LEFT_SIDE: 1, RIGHT_SIDE: 2, MID_SIDE: 3
}
FLAC__StreamMetadata_Picture_Type
{
OTHER: 0,
FILE_ICON_STANDARD: 1,
FILE_ICON: 2,
FRONT_COVER: 3,
BACK_COVER: 4,
LEAFLET_PAGE: 5,
MEDIA: 6,
LEAD_ARTIST: 7,
ARTIST: 8,
CONDUCTOR: 9,
BAND: 10,
COMPOSER: 11,
LYRICIST: 12,
RECORDING_LOCATION: 13,
DURING_RECORDING: 14,
DURING_PERFORMANCE: 15,
VIDEO_SCREEN_CAPTURE: 16,
FISH: 17,
ILLUSTRATION: 18,
BAND_LOGOTYPE: 19,
PUBLISHER_LOGOTYPE: 20,
UNDEFINED: ?,
}
{
FRAME_NUMBER: 0, SAMPLE_NUMBER: 1
}