Commit 71b909b7 authored by Erik de Castro Lopo's avatar Erik de Castro Lopo

Yet more purging of `unsigned` type

parent 588689b1
......@@ -36,9 +36,9 @@
#include "share/compat.h"
static FLAC__uint64 total_samples = 0;
static unsigned sample_rate = 0;
static unsigned channels = 0;
static unsigned bps = 0;
static uint32_t sample_rate = 0;
static uint32_t channels = 0;
static uint32_t bps = 0;
static bool write_little_endian_uint16(FILE *f, FLAC__uint16 x)
{
......
......@@ -43,12 +43,12 @@ class OurEncoder: public FLAC::Encoder::File {
public:
OurEncoder(): FLAC::Encoder::File() { }
protected:
virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate);
virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate);
};
#define READSIZE 1024
static unsigned total_samples = 0; /* can use a 32-bit number due to WAVE size limitations */
static uint32_t total_samples = 0; /* can use a 32-bit number due to WAVE size limitations */
static FLAC__byte buffer[READSIZE/*samples*/ * 2/*bytes_per_sample*/ * 2/*channels*/]; /* we read the WAVE data into here */
static FLAC__int32 pcm[READSIZE/*samples*/ * 2/*channels*/];
......@@ -60,9 +60,9 @@ int main(int argc, char *argv[])
FLAC__StreamMetadata *metadata[2];
FLAC__StreamMetadata_VorbisComment_Entry entry;
FILE *fin;
unsigned sample_rate = 0;
unsigned channels = 0;
unsigned bps = 0;
uint32_t sample_rate = 0;
uint32_t channels = 0;
uint32_t bps = 0;
if(argc != 3) {
fprintf(stderr, "usage: %s infile.wav outfile.flac\n", argv[0]);
......@@ -85,10 +85,10 @@ int main(int argc, char *argv[])
fclose(fin);
return 1;
}
sample_rate = ((((((unsigned)buffer[27] << 8) | buffer[26]) << 8) | buffer[25]) << 8) | buffer[24];
sample_rate = ((((((uint32_t)buffer[27] << 8) | buffer[26]) << 8) | buffer[25]) << 8) | buffer[24];
channels = 2;
bps = 16;
total_samples = (((((((unsigned)buffer[43] << 8) | buffer[42]) << 8) | buffer[41]) << 8) | buffer[40]) / 4;
total_samples = (((((((uint32_t)buffer[43] << 8) | buffer[42]) << 8) | buffer[41]) << 8) | buffer[40]) / 4;
/* check the encoder */
if(!encoder) {
......@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
return 0;
}
void OurEncoder::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate)
void OurEncoder::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate)
{
fprintf(stderr, "wrote %" PRIu64 " bytes, %" PRIu64 "/%u samples, %u/%u frames\n", bytes_written, samples_written, total_samples, frames_written, total_frames_estimate);
}
......@@ -135,11 +135,11 @@ namespace FLAC {
State get_state() const; ///< See FLAC__stream_decoder_get_state()
virtual bool get_md5_checking() const; ///< See FLAC__stream_decoder_get_md5_checking()
virtual FLAC__uint64 get_total_samples() const; ///< See FLAC__stream_decoder_get_total_samples()
virtual unsigned get_channels() const; ///< See FLAC__stream_decoder_get_channels()
virtual uint32_t get_channels() const; ///< See FLAC__stream_decoder_get_channels()
virtual ::FLAC__ChannelAssignment get_channel_assignment() const; ///< See FLAC__stream_decoder_get_channel_assignment()
virtual unsigned get_bits_per_sample() const; ///< See FLAC__stream_decoder_get_bits_per_sample()
virtual unsigned get_sample_rate() const; ///< See FLAC__stream_decoder_get_sample_rate()
virtual unsigned get_blocksize() const; ///< See FLAC__stream_decoder_get_blocksize()
virtual uint32_t get_bits_per_sample() const; ///< See FLAC__stream_decoder_get_bits_per_sample()
virtual uint32_t get_sample_rate() const; ///< See FLAC__stream_decoder_get_sample_rate()
virtual uint32_t get_blocksize() const; ///< See FLAC__stream_decoder_get_blocksize()
virtual bool get_decode_position(FLAC__uint64 *position) const; ///< See FLAC__stream_decoder_get_decode_position()
virtual ::FLAC__StreamDecoderInitStatus init(); ///< Seek FLAC__stream_decoder_init_stream()
......
......@@ -128,46 +128,46 @@ namespace FLAC {
virtual bool set_ogg_serial_number(long value); ///< See FLAC__stream_encoder_set_ogg_serial_number()
virtual bool set_verify(bool value); ///< See FLAC__stream_encoder_set_verify()
virtual bool set_streamable_subset(bool value); ///< See FLAC__stream_encoder_set_streamable_subset()
virtual bool set_channels(unsigned value); ///< See FLAC__stream_encoder_set_channels()
virtual bool set_bits_per_sample(unsigned value); ///< See FLAC__stream_encoder_set_bits_per_sample()
virtual bool set_sample_rate(unsigned value); ///< See FLAC__stream_encoder_set_sample_rate()
virtual bool set_compression_level(unsigned value); ///< See FLAC__stream_encoder_set_compression_level()
virtual bool set_blocksize(unsigned value); ///< See FLAC__stream_encoder_set_blocksize()
virtual bool set_channels(uint32_t value); ///< See FLAC__stream_encoder_set_channels()
virtual bool set_bits_per_sample(uint32_t value); ///< See FLAC__stream_encoder_set_bits_per_sample()
virtual bool set_sample_rate(uint32_t value); ///< See FLAC__stream_encoder_set_sample_rate()
virtual bool set_compression_level(uint32_t value); ///< See FLAC__stream_encoder_set_compression_level()
virtual bool set_blocksize(uint32_t value); ///< See FLAC__stream_encoder_set_blocksize()
virtual bool set_do_mid_side_stereo(bool value); ///< See FLAC__stream_encoder_set_do_mid_side_stereo()
virtual bool set_loose_mid_side_stereo(bool value); ///< See FLAC__stream_encoder_set_loose_mid_side_stereo()
virtual bool set_apodization(const char *specification); ///< See FLAC__stream_encoder_set_apodization()
virtual bool set_max_lpc_order(unsigned value); ///< See FLAC__stream_encoder_set_max_lpc_order()
virtual bool set_qlp_coeff_precision(unsigned value); ///< See FLAC__stream_encoder_set_qlp_coeff_precision()
virtual bool set_max_lpc_order(uint32_t value); ///< See FLAC__stream_encoder_set_max_lpc_order()
virtual bool set_qlp_coeff_precision(uint32_t value); ///< See FLAC__stream_encoder_set_qlp_coeff_precision()
virtual bool set_do_qlp_coeff_prec_search(bool value); ///< See FLAC__stream_encoder_set_do_qlp_coeff_prec_search()
virtual bool set_do_escape_coding(bool value); ///< See FLAC__stream_encoder_set_do_escape_coding()
virtual bool set_do_exhaustive_model_search(bool value); ///< See FLAC__stream_encoder_set_do_exhaustive_model_search()
virtual bool set_min_residual_partition_order(unsigned value); ///< See FLAC__stream_encoder_set_min_residual_partition_order()
virtual bool set_max_residual_partition_order(unsigned value); ///< See FLAC__stream_encoder_set_max_residual_partition_order()
virtual bool set_rice_parameter_search_dist(unsigned value); ///< See FLAC__stream_encoder_set_rice_parameter_search_dist()
virtual bool set_min_residual_partition_order(uint32_t value); ///< See FLAC__stream_encoder_set_min_residual_partition_order()
virtual bool set_max_residual_partition_order(uint32_t value); ///< See FLAC__stream_encoder_set_max_residual_partition_order()
virtual bool set_rice_parameter_search_dist(uint32_t value); ///< See FLAC__stream_encoder_set_rice_parameter_search_dist()
virtual bool set_total_samples_estimate(FLAC__uint64 value); ///< See FLAC__stream_encoder_set_total_samples_estimate()
virtual bool set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks); ///< See FLAC__stream_encoder_set_metadata()
virtual bool set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks); ///< See FLAC__stream_encoder_set_metadata()
virtual bool set_metadata(::FLAC__StreamMetadata **metadata, uint32_t num_blocks); ///< See FLAC__stream_encoder_set_metadata()
virtual bool set_metadata(FLAC::Metadata::Prototype **metadata, uint32_t num_blocks); ///< See FLAC__stream_encoder_set_metadata()
/* get_state() is not virtual since we want subclasses to be able to return their own state */
State get_state() const; ///< See FLAC__stream_encoder_get_state()
virtual Decoder::Stream::State get_verify_decoder_state() const; ///< See FLAC__stream_encoder_get_verify_decoder_state()
virtual void get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got); ///< See FLAC__stream_encoder_get_verify_decoder_error_stats()
virtual void get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, uint32_t *frame_number, uint32_t *channel, uint32_t *sample, FLAC__int32 *expected, FLAC__int32 *got); ///< See FLAC__stream_encoder_get_verify_decoder_error_stats()
virtual bool get_verify() const; ///< See FLAC__stream_encoder_get_verify()
virtual bool get_streamable_subset() const; ///< See FLAC__stream_encoder_get_streamable_subset()
virtual bool get_do_mid_side_stereo() const; ///< See FLAC__stream_encoder_get_do_mid_side_stereo()
virtual bool get_loose_mid_side_stereo() const; ///< See FLAC__stream_encoder_get_loose_mid_side_stereo()
virtual unsigned get_channels() const; ///< See FLAC__stream_encoder_get_channels()
virtual unsigned get_bits_per_sample() const; ///< See FLAC__stream_encoder_get_bits_per_sample()
virtual unsigned get_sample_rate() const; ///< See FLAC__stream_encoder_get_sample_rate()
virtual unsigned get_blocksize() const; ///< See FLAC__stream_encoder_get_blocksize()
virtual unsigned get_max_lpc_order() const; ///< See FLAC__stream_encoder_get_max_lpc_order()
virtual unsigned get_qlp_coeff_precision() const; ///< See FLAC__stream_encoder_get_qlp_coeff_precision()
virtual uint32_t get_channels() const; ///< See FLAC__stream_encoder_get_channels()
virtual uint32_t get_bits_per_sample() const; ///< See FLAC__stream_encoder_get_bits_per_sample()
virtual uint32_t get_sample_rate() const; ///< See FLAC__stream_encoder_get_sample_rate()
virtual uint32_t get_blocksize() const; ///< See FLAC__stream_encoder_get_blocksize()
virtual uint32_t get_max_lpc_order() const; ///< See FLAC__stream_encoder_get_max_lpc_order()
virtual uint32_t get_qlp_coeff_precision() const; ///< See FLAC__stream_encoder_get_qlp_coeff_precision()
virtual bool get_do_qlp_coeff_prec_search() const; ///< See FLAC__stream_encoder_get_do_qlp_coeff_prec_search()
virtual bool get_do_escape_coding() const; ///< See FLAC__stream_encoder_get_do_escape_coding()
virtual bool get_do_exhaustive_model_search() const; ///< See FLAC__stream_encoder_get_do_exhaustive_model_search()
virtual unsigned get_min_residual_partition_order() const; ///< See FLAC__stream_encoder_get_min_residual_partition_order()
virtual unsigned get_max_residual_partition_order() const; ///< See FLAC__stream_encoder_get_max_residual_partition_order()
virtual unsigned get_rice_parameter_search_dist() const; ///< See FLAC__stream_encoder_get_rice_parameter_search_dist()
virtual uint32_t get_min_residual_partition_order() const; ///< See FLAC__stream_encoder_get_min_residual_partition_order()
virtual uint32_t get_max_residual_partition_order() const; ///< See FLAC__stream_encoder_get_max_residual_partition_order()
virtual uint32_t get_rice_parameter_search_dist() const; ///< See FLAC__stream_encoder_get_rice_parameter_search_dist()
virtual FLAC__uint64 get_total_samples_estimate() const; ///< See FLAC__stream_encoder_get_total_samples_estimate()
virtual ::FLAC__StreamEncoderInitStatus init(); ///< See FLAC__stream_encoder_init_stream()
......@@ -175,14 +175,14 @@ namespace FLAC {
virtual bool finish(); ///< See FLAC__stream_encoder_finish()
virtual bool process(const FLAC__int32 * const buffer[], unsigned samples); ///< See FLAC__stream_encoder_process()
virtual bool process_interleaved(const FLAC__int32 buffer[], unsigned samples); ///< See FLAC__stream_encoder_process_interleaved()
virtual bool process(const FLAC__int32 * const buffer[], uint32_t samples); ///< See FLAC__stream_encoder_process()
virtual bool process_interleaved(const FLAC__int32 buffer[], uint32_t samples); ///< See FLAC__stream_encoder_process_interleaved()
protected:
/// See FLAC__StreamEncoderReadCallback
virtual ::FLAC__StreamEncoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes);
/// See FLAC__StreamEncoderWriteCallback
virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame) = 0;
virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame) = 0;
/// See FLAC__StreamEncoderSeekCallback
virtual ::FLAC__StreamEncoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset);
......@@ -200,7 +200,7 @@ namespace FLAC {
::FLAC__StreamEncoder *encoder_;
static ::FLAC__StreamEncoderReadStatus read_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
static ::FLAC__StreamEncoderWriteStatus write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
static ::FLAC__StreamEncoderWriteStatus write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data);
static ::FLAC__StreamEncoderSeekStatus seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data);
static ::FLAC__StreamEncoderTellStatus tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
static void metadata_callback_(const ::FLAC__StreamEncoder *encoder, const ::FLAC__StreamMetadata *metadata, void *client_data);
......@@ -245,12 +245,12 @@ namespace FLAC {
virtual ::FLAC__StreamEncoderInitStatus init_ogg(const std::string &filename); ///< See FLAC__stream_encoder_init_ogg_file()
protected:
/// See FLAC__StreamEncoderProgressCallback
virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate);
virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate);
/// This is a dummy implementation to satisfy the pure virtual in Stream that is actually supplied internally by the C layer
virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame);
virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame);
private:
static void progress_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data);
static void progress_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate, void *client_data);
// Private and undefined so you can't use them:
File(const Stream &);
......
......@@ -199,7 +199,7 @@ namespace FLAC {
* \assert
* \code is_valid() \endcode
*/
unsigned get_length() const;
uint32_t get_length() const;
/** Sets the "is_last" flag for the block. When using the iterators
* it is not necessary to set this flag; they will do it for you.
......@@ -315,23 +315,23 @@ namespace FLAC {
//@{
/** See <A HREF="../format.html#metadata_block_streaminfo">format specification</A>. */
unsigned get_min_blocksize() const;
unsigned get_max_blocksize() const;
unsigned get_min_framesize() const;
unsigned get_max_framesize() const;
unsigned get_sample_rate() const;
unsigned get_channels() const;
unsigned get_bits_per_sample() const;
uint32_t get_min_blocksize() const;
uint32_t get_max_blocksize() const;
uint32_t get_min_framesize() const;
uint32_t get_max_framesize() const;
uint32_t get_sample_rate() const;
uint32_t get_channels() const;
uint32_t get_bits_per_sample() const;
FLAC__uint64 get_total_samples() const;
const FLAC__byte *get_md5sum() const;
void set_min_blocksize(unsigned value);
void set_max_blocksize(unsigned value);
void set_min_framesize(unsigned value);
void set_max_framesize(unsigned value);
void set_sample_rate(unsigned value);
void set_channels(unsigned value);
void set_bits_per_sample(unsigned value);
void set_min_blocksize(uint32_t value);
void set_max_blocksize(uint32_t value);
void set_min_framesize(uint32_t value);
void set_max_framesize(uint32_t value);
void set_sample_rate(uint32_t value);
void set_channels(uint32_t value);
void set_bits_per_sample(uint32_t value);
void set_total_samples(FLAC__uint64 value);
void set_md5sum(const FLAC__byte value[16]);
//@}
......@@ -361,7 +361,7 @@ namespace FLAC {
/** Constructs an object with the given length.
*/
Padding(unsigned length);
Padding(uint32_t length);
~Padding();
......@@ -393,7 +393,7 @@ namespace FLAC {
/** Sets the length in bytes of the padding block.
*/
void set_length(unsigned length);
void set_length(uint32_t length);
};
/** APPLICATION metadata block.
......@@ -451,8 +451,8 @@ namespace FLAC {
void set_id(const FLAC__byte value[4]);
//! This form always copies \a data
bool set_data(const FLAC__byte *data, unsigned length);
bool set_data(FLAC__byte *data, unsigned length, bool copy);
bool set_data(const FLAC__byte *data, uint32_t length);
bool set_data(FLAC__byte *data, uint32_t length, bool copy);
};
/** SEEKTABLE metadata block.
......@@ -505,38 +505,38 @@ namespace FLAC {
inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
//@}
unsigned get_num_points() const;
::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const;
uint32_t get_num_points() const;
::FLAC__StreamMetadata_SeekPoint get_point(uint32_t index) const;
//! See FLAC__metadata_object_seektable_resize_points()
bool resize_points(unsigned new_num_points);
bool resize_points(uint32_t new_num_points);
//! See FLAC__metadata_object_seektable_set_point()
void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
void set_point(uint32_t index, const ::FLAC__StreamMetadata_SeekPoint &point);
//! See FLAC__metadata_object_seektable_insert_point()
bool insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
bool insert_point(uint32_t index, const ::FLAC__StreamMetadata_SeekPoint &point);
//! See FLAC__metadata_object_seektable_delete_point()
bool delete_point(unsigned index);
bool delete_point(uint32_t index);
//! See FLAC__metadata_object_seektable_is_legal()
bool is_legal() const;
//! See FLAC__metadata_object_seektable_template_append_placeholders()
bool template_append_placeholders(unsigned num);
bool template_append_placeholders(uint32_t num);
//! See FLAC__metadata_object_seektable_template_append_point()
bool template_append_point(FLAC__uint64 sample_number);
//! See FLAC__metadata_object_seektable_template_append_points()
bool template_append_points(FLAC__uint64 sample_numbers[], unsigned num);
bool template_append_points(FLAC__uint64 sample_numbers[], uint32_t num);
//! See FLAC__metadata_object_seektable_template_append_spaced_points()
bool template_append_spaced_points(unsigned num, FLAC__uint64 total_samples);
bool template_append_spaced_points(uint32_t num, FLAC__uint64 total_samples);
//! See FLAC__metadata_object_seektable_template_append_spaced_points_by_samples()
bool template_append_spaced_points_by_samples(unsigned samples, FLAC__uint64 total_samples);
bool template_append_spaced_points_by_samples(uint32_t samples, FLAC__uint64 total_samples);
//! See FLAC__metadata_object_seektable_template_sort()
bool template_sort(bool compact);
......@@ -581,10 +581,10 @@ namespace FLAC {
public:
Entry();
Entry(const char *field, unsigned field_length);
Entry(const char *field, uint32_t field_length);
Entry(const char *field); // assumes \a field is NUL-terminated
Entry(const char *field_name, const char *field_value, unsigned field_value_length);
Entry(const char *field_name, const char *field_value, uint32_t field_value_length);
Entry(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
Entry(const Entry &entry);
......@@ -595,36 +595,36 @@ namespace FLAC {
virtual bool is_valid() const; ///< Returns \c true iff object was properly constructed.
unsigned get_field_length() const;
unsigned get_field_name_length() const;
unsigned get_field_value_length() const;
uint32_t get_field_length() const;
uint32_t get_field_name_length() const;
uint32_t get_field_value_length() const;
::FLAC__StreamMetadata_VorbisComment_Entry get_entry() const;
const char *get_field() const;
const char *get_field_name() const;
const char *get_field_value() const;
bool set_field(const char *field, unsigned field_length);
bool set_field(const char *field, uint32_t field_length);
bool set_field(const char *field); // assumes \a field is NUL-terminated
bool set_field_name(const char *field_name);
bool set_field_value(const char *field_value, unsigned field_value_length);
bool set_field_value(const char *field_value, uint32_t field_value_length);
bool set_field_value(const char *field_value); // assumes \a field_value is NUL-terminated
protected:
bool is_valid_;
::FLAC__StreamMetadata_VorbisComment_Entry entry_;
char *field_name_;
unsigned field_name_length_;
uint32_t field_name_length_;
char *field_value_;
unsigned field_value_length_;
uint32_t field_value_length_;
private:
void zero();
void clear();
void clear_entry();
void clear_field_name();
void clear_field_value();
void construct(const char *field, unsigned field_length);
void construct(const char *field, uint32_t field_length);
void construct(const char *field); // assumes \a field is NUL-terminated
void construct(const char *field_name, const char *field_value, unsigned field_value_length);
void construct(const char *field_name, const char *field_value, uint32_t field_value_length);
void construct(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
void compose_field();
void parse_field();
......@@ -674,21 +674,21 @@ namespace FLAC {
inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
//@}
unsigned get_num_comments() const;
uint32_t get_num_comments() const;
const FLAC__byte *get_vendor_string() const; // NUL-terminated UTF-8 string
Entry get_comment(unsigned index) const;
Entry get_comment(uint32_t index) const;
//! See FLAC__metadata_object_vorbiscomment_set_vendor_string()
bool set_vendor_string(const FLAC__byte *string); // NUL-terminated UTF-8 string
//! See FLAC__metadata_object_vorbiscomment_resize_comments()
bool resize_comments(unsigned new_num_comments);
bool resize_comments(uint32_t new_num_comments);
//! See FLAC__metadata_object_vorbiscomment_set_comment()
bool set_comment(unsigned index, const Entry &entry);
bool set_comment(uint32_t index, const Entry &entry);
//! See FLAC__metadata_object_vorbiscomment_insert_comment()
bool insert_comment(unsigned index, const Entry &entry);
bool insert_comment(uint32_t index, const Entry &entry);
//! See FLAC__metadata_object_vorbiscomment_append_comment()
bool append_comment(const Entry &entry);
......@@ -697,10 +697,10 @@ namespace FLAC {
bool replace_comment(const Entry &entry, bool all);
//! See FLAC__metadata_object_vorbiscomment_delete_comment()
bool delete_comment(unsigned index);
bool delete_comment(uint32_t index);
//! See FLAC__metadata_object_vorbiscomment_find_entry_from()
int find_entry_from(unsigned offset, const char *field_name);
int find_entry_from(uint32_t offset, const char *field_name);
//! See FLAC__metadata_object_vorbiscomment_remove_entry_matching()
int remove_entry_matching(const char *field_name);
......@@ -738,21 +738,21 @@ namespace FLAC {
inline FLAC__uint64 get_offset() const { return object_->offset; }
inline FLAC__byte get_number() const { return object_->number; }
inline const char *get_isrc() const { return object_->isrc; }
inline unsigned get_type() const { return object_->type; }
inline uint32_t get_type() const { return object_->type; }
inline bool get_pre_emphasis() const { return object_->pre_emphasis; }
inline FLAC__byte get_num_indices() const { return object_->num_indices; }
::FLAC__StreamMetadata_CueSheet_Index get_index(unsigned i) const;
::FLAC__StreamMetadata_CueSheet_Index get_index(uint32_t i) const;
inline const ::FLAC__StreamMetadata_CueSheet_Track *get_track() const { return object_; }
inline void set_offset(FLAC__uint64 value) { object_->offset = value; }
inline void set_number(FLAC__byte value) { object_->number = value; }
void set_isrc(const char value[12]);
void set_type(unsigned value);
void set_type(uint32_t value);
inline void set_pre_emphasis(bool value) { object_->pre_emphasis = value? 1 : 0; }
void set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index);
void set_index(uint32_t i, const ::FLAC__StreamMetadata_CueSheet_Index &index);
//@@@ It's awkward but to insert/delete index points
//@@@ you must use the routines in the CueSheet class.
};
......@@ -805,41 +805,41 @@ namespace FLAC {
FLAC__uint64 get_lead_in() const;
bool get_is_cd() const;
unsigned get_num_tracks() const;
Track get_track(unsigned i) const;
uint32_t get_num_tracks() const;
Track get_track(uint32_t i) const;
void set_media_catalog_number(const char value[128]);
void set_lead_in(FLAC__uint64 value);
void set_is_cd(bool value);
void set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
void set_index(uint32_t track_num, uint32_t index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
//! See FLAC__metadata_object_cuesheet_track_resize_indices()
bool resize_indices(unsigned track_num, unsigned new_num_indices);
bool resize_indices(uint32_t track_num, uint32_t new_num_indices);
//! See FLAC__metadata_object_cuesheet_track_insert_index()
bool insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
bool insert_index(uint32_t track_num, uint32_t index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
//! See FLAC__metadata_object_cuesheet_track_insert_blank_index()
bool insert_blank_index(unsigned track_num, unsigned index_num);
bool insert_blank_index(uint32_t track_num, uint32_t index_num);
//! See FLAC__metadata_object_cuesheet_track_delete_index()
bool delete_index(unsigned track_num, unsigned index_num);
bool delete_index(uint32_t track_num, uint32_t index_num);
//! See FLAC__metadata_object_cuesheet_resize_tracks()
bool resize_tracks(unsigned new_num_tracks);
bool resize_tracks(uint32_t new_num_tracks);
//! See FLAC__metadata_object_cuesheet_set_track()
bool set_track(unsigned i, const Track &track);
bool set_track(uint32_t i, const Track &track);
//! See FLAC__metadata_object_cuesheet_insert_track()
bool insert_track(unsigned i, const Track &track);
bool insert_track(uint32_t i, const Track &track);
//! See FLAC__metadata_object_cuesheet_insert_blank_track()
bool insert_blank_track(unsigned i);
bool insert_blank_track(uint32_t i);
//! See FLAC__metadata_object_cuesheet_delete_track()
bool delete_track(unsigned i);
bool delete_track(uint32_t i);
//! See FLAC__metadata_object_cuesheet_is_legal()
bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const;
......@@ -983,8 +983,8 @@ namespace FLAC {
const FLAC__byte *get_data() const;
//! This form always copies \a data
bool set_data(const FLAC__byte *data, unsigned length);
bool set_data(FLAC__byte *data, unsigned length, bool copy);
bool set_data(const FLAC__byte *data, uint32_t length);
bool set_data(FLAC__byte *data, uint32_t length, bool copy);
};
/* \} */
......@@ -1010,8 +1010,8 @@ namespace FLAC {
FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet); ///< See FLAC__metadata_get_cuesheet().
FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet); ///< See FLAC__metadata_get_cuesheet().
FLACPP_API bool get_picture(const char *filename, Picture *&picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors); ///< See FLAC__metadata_get_picture().
FLACPP_API bool get_picture(const char *filename, Picture &picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors); ///< See FLAC__metadata_get_picture().
FLACPP_API bool get_picture(const char *filename, Picture *&picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, uint32_t max_width, uint32_t max_height, uint32_t max_depth, uint32_t max_colors); ///< See FLAC__metadata_get_picture().
FLACPP_API bool get_picture(const char *filename, Picture &picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, uint32_t max_width, uint32_t max_height, uint32_t max_depth, uint32_t max_colors); ///< See FLAC__metadata_get_picture().
/* \} */
......@@ -1079,7 +1079,7 @@ namespace FLAC {
off_t get_block_offset() const; ///< See FLAC__metadata_simple_iterator_get_block_offset().
::FLAC__MetadataType get_block_type() const; ///< See FLAC__metadata_simple_iterator_get_block_type().
unsigned get_block_length() const; ///< See FLAC__metadata_simple_iterator_get_block_length().
uint32_t get_block_length() const; ///< See FLAC__metadata_simple_iterator_get_block_length().
bool get_application_id(FLAC__byte *id); ///< See FLAC__metadata_simple_iterator_get_application_id().
Prototype *get_block(); ///< See FLAC__metadata_simple_iterator_get_block().
bool set_block(Prototype *block, bool use_padding = true); ///< See FLAC__metadata_simple_iterator_set_block().
......
......@@ -34,14 +34,14 @@
typedef struct {
FLAC__int32 residual;
unsigned count;
uint32_t count;
} pair_t;
typedef struct {
pair_t buckets[FLAC__MAX_BLOCK_SIZE];
int peak_index;
unsigned nbuckets;
unsigned nsamples;
uint32_t nbuckets;
uint32_t nsamples;
double sum, sos;
double variance;
double mean;
......@@ -51,7 +51,7 @@ typedef struct {
static subframe_stats_t all_;
static void init_stats(subframe_stats_t *stats);
static void update_stats(subframe_stats_t *stats, FLAC__int32 residual, unsigned incr);
static void update_stats(subframe_stats_t *stats, FLAC__int32 residual, uint32_t incr);
static void compute_stats(subframe_stats_t *stats);
static FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename);
......@@ -62,19 +62,19 @@ void flac__analyze_init(analysis_options aopts)
}
}
void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__uint64 frame_offset, unsigned frame_bytes, analysis_options aopts, FILE *fout)
void flac__analyze_frame(const FLAC__Frame *frame, uint32_t frame_number, FLAC__uint64 frame_offset, uint32_t frame_bytes, analysis_options aopts, FILE *fout)
{
const unsigned channels = frame->header.channels;
const uint32_t channels = frame->header.channels;
char outfilename[1024];
subframe_stats_t stats;
unsigned i, channel, partitions;
uint32_t i, channel, partitions;
/* do the human-readable part first */
fprintf(fout, "frame=%u\toffset=%" PRIu64 "\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, frame_offset, frame_bytes*8, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]);
for(channel = 0; channel < channels; channel++) {
const FLAC__Subframe *subframe = frame->subframes+channel;
const FLAC__bool is_rice2 = subframe->data.fixed.entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2;
const unsigned pesc = is_rice2? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
const uint32_t pesc = is_rice2? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
fprintf(fout, "\tsubframe=%u\twasted_bits=%u\ttype=%s", channel, subframe->wasted_bits, FLAC__SubframeTypeString[subframe->type]);
switch(subframe->type) {
case FLAC__SUBFRAME_TYPE_CONSTANT:
......@@ -87,7 +87,7 @@ void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__
fprintf(fout, "\t\twarmup[%u]=%d\n", i, subframe->data.fixed.warmup[i]);
partitions = (1u << subframe->data.fixed.entropy_coding_method.data.partitioned_rice.order);
for(i = 0; i < partitions; i++) {
unsigned parameter = subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->parameters[i];
uint32_t parameter = subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->parameters[i];
if(parameter == pesc)
fprintf(fout, "\t\tparameter[%u]=ESCAPE, raw_bits=%u\n", i, subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->raw_bits[i]);
else
......@@ -107,7 +107,7 @@ void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__
fprintf(fout, "\t\twarmup[%u]=%d\n", i, subframe->data.lpc.warmup[i]);
partitions = (1u << subframe->data.lpc.entropy_coding_method.data.partitioned_rice.order);
for(i = 0; i < partitions; i++) {