mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
Changed the return value of the bit cursor get_bit* functions. They now return true if the operation was successfull to be more consistent with the rest of this code.
This commit is contained in:
parent
2b873f9129
commit
ed95388324
@ -45,7 +45,7 @@ int parse_aac_adif_header(unsigned char *buf, int size,
|
||||
bc.get_bit(b); // copyright_id_present
|
||||
if (b) {
|
||||
for (i = 0; i < 3; i++)
|
||||
eob = bc.get_bits(24, bits); // copyright_id
|
||||
eob = !bc.get_bits(24, bits); // copyright_id
|
||||
}
|
||||
bc.get_bit(b); // original_copy
|
||||
bc.get_bit(b); // home
|
||||
@ -74,7 +74,7 @@ int parse_aac_adif_header(unsigned char *buf, int size,
|
||||
bc.get_bit(b); // matrix_mixdown_idx_present
|
||||
if (b) {
|
||||
bc.get_bits(2, bits); // matrix_mixdown_idx
|
||||
eob = bc.get_bits(1, bits); // pseudo_surround_enable
|
||||
eob = !bc.get_bits(1, bits); // pseudo_surround_enable
|
||||
}
|
||||
channels = nfront_c_e + nside_c_e + nback_c_e;
|
||||
for (k = 0; k < (nfront_c_e + nside_c_e + nback_c_e); k++) {
|
||||
@ -91,9 +91,9 @@ int parse_aac_adif_header(unsigned char *buf, int size,
|
||||
bc.get_bits(4, bits); // valid_cc_e_tag_select
|
||||
}
|
||||
bc.byte_align();
|
||||
eob = bc.get_bits(8, bits);
|
||||
eob = !bc.get_bits(8, bits);
|
||||
for (k = 0; k < comment_field_bytes; k++)
|
||||
eob = bc.get_bits(8, bits);
|
||||
eob = !bc.get_bits(8, bits);
|
||||
}
|
||||
|
||||
if (eob)
|
||||
@ -139,9 +139,9 @@ static int is_adts_header(unsigned char *buf, int size, int bpos,
|
||||
bc.get_bit(b); // copyright_id_start
|
||||
bc.get_bits(13, frame_length);
|
||||
bc.get_bits(11, bits); // adts_buffer_fullness
|
||||
eob = bc.get_bits(2, bits); // no_raw_blocks_in_frame
|
||||
eob = !bc.get_bits(2, bits); // no_raw_blocks_in_frame
|
||||
if (!protection_absent)
|
||||
eob = bc.get_bits(16, bits);
|
||||
eob = !bc.get_bits(16, bits);
|
||||
|
||||
if (eob)
|
||||
return 0;
|
||||
|
16
src/common.h
16
src/common.h
@ -143,13 +143,13 @@ public:
|
||||
}
|
||||
|
||||
bool get_bits(unsigned int n, unsigned long &r) {
|
||||
// returns true if less bits are available than asked for
|
||||
// returns false if less bits are available than asked for
|
||||
r = 0;
|
||||
|
||||
while (n > 0) {
|
||||
if (byte_position >= end_of_data) {
|
||||
out_of_data = true;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int b = 8; // number of bits to extract from the current byte
|
||||
@ -172,7 +172,7 @@ public:
|
||||
n -= b;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool get_bits(unsigned int n, int &r) {
|
||||
@ -198,12 +198,12 @@ public:
|
||||
|
||||
bool byte_align() {
|
||||
if (out_of_data)
|
||||
return true;
|
||||
if (bits_valid == 8)
|
||||
return false;
|
||||
if (bits_valid == 8)
|
||||
return true;
|
||||
bits_valid = 0;
|
||||
byte_position += 1;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool set_bit_position(unsigned int pos) {
|
||||
@ -219,6 +219,10 @@ public:
|
||||
int get_bit_position() {
|
||||
return byte_position - start_of_data + 8 - bits_valid;
|
||||
}
|
||||
|
||||
bool skip_bits(unsigned int num) {
|
||||
return set_bit_position(get_bit_position() + num);
|
||||
}
|
||||
};
|
||||
|
||||
class byte_cursor_c {
|
||||
|
@ -241,7 +241,7 @@ int find_dts_header(const unsigned char *buf, unsigned int size,
|
||||
|
||||
bc.get_bit(dts_header->surround_sum_difference);
|
||||
|
||||
bool out_of_data = bc.get_bits(4, t);
|
||||
bool out_of_data = !bc.get_bits(4, t);
|
||||
if (dts_header->encoder_software_revision == 7) {
|
||||
dts_header->dialog_normalization_gain = -((int)t);
|
||||
} else if (dts_header->encoder_software_revision == 6) {
|
||||
|
Loading…
Reference in New Issue
Block a user