📄 format.h
字号:
* present in a stream. */typedef struct { unsigned num_points; FLAC__StreamMetadata_SeekPoint *points;} FLAC__StreamMetadata_SeekTable;/** Vorbis comment entry structure used in VORBIS_COMMENT blocks. (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>) * * For convenience, the APIs maintain a trailing NUL character at the end of * \a entry which is not counted toward \a length, i.e. * \code strlen(entry) == length \endcode */typedef struct { FLAC__uint32 length; FLAC__byte *entry;} FLAC__StreamMetadata_VorbisComment_Entry;extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN; /**< == 32 (bits) *//** FLAC VORBIS_COMMENT structure. (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>) */typedef struct { FLAC__StreamMetadata_VorbisComment_Entry vendor_string; FLAC__uint32 num_comments; FLAC__StreamMetadata_VorbisComment_Entry *comments;} FLAC__StreamMetadata_VorbisComment;extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN; /**< == 32 (bits) *//** FLAC CUESHEET track index structure. (See the * <A HREF="../format.html#cuesheet_track_index">format specification</A> for * the full description of each field.) */typedef struct { FLAC__uint64 offset; /**< Offset in samples, relative to the track offset, of the index * point. */ FLAC__byte number; /**< The index point number. */} FLAC__StreamMetadata_CueSheet_Index;extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN; /**< == 64 (bits) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN; /**< == 8 (bits) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN; /**< == 3*8 (bits) *//** FLAC CUESHEET track structure. (See the * <A HREF="../format.html#cuesheet_track">format specification</A> for * the full description of each field.) */typedef struct { FLAC__uint64 offset; /**< Track offset in samples, relative to the beginning of the FLAC audio stream. */ FLAC__byte number; /**< The track number. */ char isrc[13]; /**< Track ISRC. This is a 12-digit alphanumeric code plus a trailing '\0' */ unsigned type:1; /**< The track type: 0 for audio, 1 for non-audio. */ unsigned pre_emphasis:1; /**< The pre-emphasis flag: 0 for no pre-emphasis, 1 for pre-emphasis. */ FLAC__byte num_indices; /**< The number of track index points. */ FLAC__StreamMetadata_CueSheet_Index *indices; /**< NULL if num_indices == 0, else pointer to array of index points. */} FLAC__StreamMetadata_CueSheet_Track;extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN; /**< == 64 (bits) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN; /**< == 8 (bits) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN; /**< == 12*8 (bits) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN; /**< == 1 (bit) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN; /**< == 1 (bit) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN; /**< == 6+13*8 (bits) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN; /**< == 8 (bits) *//** FLAC CUESHEET structure. (See the * <A HREF="../format.html#metadata_block_cuesheet">format specification</A> * for the full description of each field.) */typedef struct { char media_catalog_number[129]; /**< Media catalog number, in ASCII printable characters 0x20-0x7e. In * general, the media catalog number may be 0 to 128 bytes long; any * unused characters should be right-padded with NUL characters. */ FLAC__uint64 lead_in; /**< The number of lead-in samples. */ FLAC__bool is_cd; /**< \c true if CUESHEET corresponds to a Compact Disc, else \c false */ unsigned num_tracks; /**< The number of tracks. */ FLAC__StreamMetadata_CueSheet_Track *tracks; /**< NULL if num_tracks == 0, else pointer to array of tracks. */} FLAC__StreamMetadata_CueSheet;extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN; /**< == 128*8 (bits) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN; /**< == 64 (bits) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN; /**< == 1 (bit) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN; /**< == 7+258*8 (bits) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN; /**< == 8 (bits) *//** Structure that is used when a metadata block of unknown type is loaded. * The contents are opaque. The structure is used only internally to * correctly handle unknown metadata. */typedef struct { FLAC__byte *data;} FLAC__StreamMetadata_Unknown;/** FLAC metadata block structure. (c.f. <A HREF="../format.html#metadata_block">format specification</A>) */typedef struct { FLAC__MetadataType type; /**< The type of the metadata block; used determine which member of the * \a data union to dereference. If type >= FLAC__METADATA_TYPE_UNDEFINED * then \a data.unknown must be used. */ FLAC__bool is_last; /**< \c true if this metadata block is the last, else \a false */ unsigned length; /**< Length, in bytes, of the block data as it appears in the stream. */ union { FLAC__StreamMetadata_StreamInfo stream_info; FLAC__StreamMetadata_Padding padding; FLAC__StreamMetadata_Application application; FLAC__StreamMetadata_SeekTable seek_table; FLAC__StreamMetadata_VorbisComment vorbis_comment; FLAC__StreamMetadata_CueSheet cue_sheet; FLAC__StreamMetadata_Unknown unknown; } data; /**< Polymorphic block data; use the \a type value to determine which * to use. */} FLAC__StreamMetadata;extern FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN; /**< == 1 (bit) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN; /**< == 7 (bits) */extern FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bits) *//** The total stream length of a metadata block header in bytes. */#define FLAC__STREAM_METADATA_HEADER_LENGTH (4u)/*****************************************************************************//***************************************************************************** * * Utility functions * *****************************************************************************//** Tests that a sample rate is valid for FLAC. Since the rules for valid * sample rates are slightly complex, they are encapsulated in this function. * * \param sample_rate The sample rate to test for compliance. * \retval FLAC__bool * \c true if the given sample rate conforms to the specification, else * \c false. */FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate);/** Check a Vorbis comment entry name to see if it conforms to the Vorbis * comment specification. * * Vorbis comment names must be composed only of characters from * [0x20-0x3C,0x3E-0x7D]. * * \param name A NUL-terminated string to be checked. * \assert * \code name != NULL \endcode * \retval FLAC__bool * \c false if entry name is illegal, else \c true. */FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *name);/** Check a Vorbis comment entry value to see if it conforms to the Vorbis * comment specification. * * Vorbis comment values must be valid UTF-8 sequences. * * \param value A string to be checked. * \param length A the length of \a value in bytes. May be * \c (unsigned)(-1) to indicate that \a value is a plain * UTF-8 NUL-terminated string. * \assert * \code value != NULL \endcode * \retval FLAC__bool * \c false if entry name is illegal, else \c true. */FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length);/** Check a Vorbis comment entry to see if it conforms to the Vorbis * comment specification. * * Vorbis comment entries must be of the form 'name=value', and 'name' and * 'value' must be legal according to * FLAC__format_vorbiscomment_entry_name_is_legal() and * FLAC__format_vorbiscomment_entry_value_is_legal() respectively. * * \param value A string to be checked. * \assert * \code value != NULL \endcode * \retval FLAC__bool * \c false if entry name is illegal, else \c true. */FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length);/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests *//** Check a seek table to see if it conforms to the FLAC specification. * See the format specification for limits on the contents of the * seek table. * * \param seek_table A pointer to a seek table to be checked. * \assert * \code seek_table != NULL \endcode * \retval FLAC__bool * \c false if seek table is illegal, else \c true. */FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table);/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests *//** Sort a seek table's seek points according to the format specification. * This includes a "unique-ification" step to remove duplicates, i.e. * seek points with identical \a sample_number values. Duplicate seek * points are converted into placeholder points and sorted to the end of * the table. * * \param seek_table A pointer to a seek table to be sorted. * \assert * \code seek_table != NULL \endcode * \retval unsigned * The number of duplicate seek points converted into placeholders. */FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table);/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests *//** Check a cue sheet to see if it conforms to the FLAC specification. * See the format specification for limits on the contents of the * cue sheet. * * \param cue_sheet A pointer to an existing cue sheet to be checked. * \param check_cd_da_subset If \c true, check CUESHEET against more * stringent requirements for a CD-DA (audio) disc. * \param violation Address of a pointer to a string. If there is a * violation, a pointer to a string explanation of the * violation will be returned here. \a violation may be * \c NULL if you don't need the returned string. Do not * free the returned string; it will always point to static * data. * \assert * \code cue_sheet != NULL \endcode * \retval FLAC__bool * \c false if cue sheet is illegal, else \c true. */FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation);/* \} */#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -