This commit is contained in:
Dr. Chat 2015-08-29 22:21:25 -05:00
parent 50535b07c3
commit f80e5fc98d
4 changed files with 17 additions and 15 deletions

View File

@ -167,8 +167,10 @@ class XmaContext {
private:
static int GetSampleRate(int id);
size_t SavePartial(uint8_t* packet, uint32_t frame_offset_bits, size_t frame_size_bits, bool append);
bool ValidFrameOffset(uint8_t* block, size_t size_bytes, size_t frame_offset_bits);
size_t SavePartial(uint8_t* packet, uint32_t frame_offset_bits,
size_t frame_size_bits, bool append);
bool ValidFrameOffset(uint8_t* block, size_t size_bytes,
size_t frame_offset_bits);
void DecodePackets(XMA_CONTEXT_DATA* data);
uint32_t GetFramePacketNumber(uint8_t* block, size_t size, size_t bit_offset);
int PrepareDecoder(uint8_t* block, size_t size, int sample_rate,
@ -205,12 +207,13 @@ class XmaContext {
bool partial_frame_size_known_ = false;
size_t partial_frame_total_size_bits_ = 0;
size_t partial_frame_start_offset_bits_ = 0;
size_t partial_frame_offset_bits_ = 0; // blah internal don't use this
size_t partial_frame_offset_bits_ = 0; // blah internal don't use this
std::vector<uint8_t> partial_frame_buffer_;
// If we didn't finish writing a frame to the output buffer, this is the offset.
// If we didn't finish writing a frame to the output buffer, this is the
// offset.
size_t current_frame_pos_ = 0;
uint32_t last_input_read_pos_ = 0; // Last seen read buffer pos
uint32_t last_input_read_pos_ = 0; // Last seen read buffer pos
uint8_t* current_frame_ = nullptr;
uint32_t frame_samples_size_ = 0;
};

View File

@ -137,8 +137,8 @@ void XmaDecoder::WorkerThreadMain() {
// TODO: Need thread safety to do this.
// Probably not too important though.
//registers_.current_context = n;
//registers_.next_context = (n + 1) % kContextCount;
// registers_.current_context = n;
// registers_.next_context = (n + 1) % kContextCount;
}
}
}

View File

@ -25,7 +25,8 @@ uint32_t GetPacketFrameCount(uint8_t* packet) {
// Get the first frame offset in bits
uint32_t GetPacketFrameOffset(uint8_t* packet) {
uint32_t val = (uint16_t)(((packet[0] & 0x3) << 13) | (packet[1] << 5) | (packet[2] >> 3));
uint32_t val = (uint16_t)(((packet[0] & 0x3) << 13) | (packet[1] << 5) |
(packet[2] >> 3));
if (val == 0x7FFF) {
return -1;
} else {
@ -37,12 +38,10 @@ uint32_t GetPacketMetadata(uint8_t* packet) {
return (uint8_t)(packet[2] & 0x7);
}
uint32_t GetPacketSkipCount(uint8_t* packet) {
return (uint8_t)(packet[3]);
}
uint32_t GetPacketSkipCount(uint8_t* packet) { return (uint8_t)(packet[3]); }
} // namespace xma
} // namespace apu
} // namespace xe
} // namespace xma
} // namespace apu
} // namespace xe
#endif // XENIA_APU_XMA_HELPERS_H_

View File

@ -30,7 +30,7 @@ class BitStream {
// Note: num_bits MUST be in the range 0-57 (inclusive)
uint64_t Peek(size_t num_bits);
uint64_t Read(size_t num_bits);
bool Write(uint64_t val, size_t num_bits); // TODO: Not tested!
bool Write(uint64_t val, size_t num_bits); // TODO: Not tested!
size_t Copy(uint8_t* dest_buffer, size_t num_bits);