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: private:
static int GetSampleRate(int id); static int GetSampleRate(int id);
size_t SavePartial(uint8_t* packet, uint32_t frame_offset_bits, size_t frame_size_bits, bool append); size_t SavePartial(uint8_t* packet, uint32_t frame_offset_bits,
bool ValidFrameOffset(uint8_t* block, size_t size_bytes, size_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); void DecodePackets(XMA_CONTEXT_DATA* data);
uint32_t GetFramePacketNumber(uint8_t* block, size_t size, size_t bit_offset); uint32_t GetFramePacketNumber(uint8_t* block, size_t size, size_t bit_offset);
int PrepareDecoder(uint8_t* block, size_t size, int sample_rate, int PrepareDecoder(uint8_t* block, size_t size, int sample_rate,
@ -208,7 +210,8 @@ class XmaContext {
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_; 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; 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; uint8_t* current_frame_ = nullptr;

View File

@ -25,7 +25,8 @@ uint32_t GetPacketFrameCount(uint8_t* packet) {
// Get the first frame offset in bits // Get the first frame offset in bits
uint32_t GetPacketFrameOffset(uint8_t* packet) { 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) { if (val == 0x7FFF) {
return -1; return -1;
} else { } else {
@ -37,9 +38,7 @@ uint32_t GetPacketMetadata(uint8_t* packet) {
return (uint8_t)(packet[2] & 0x7); return (uint8_t)(packet[2] & 0x7);
} }
uint32_t GetPacketSkipCount(uint8_t* packet) { uint32_t GetPacketSkipCount(uint8_t* packet) { return (uint8_t)(packet[3]); }
return (uint8_t)(packet[3]);
}
} // namespace xma } // namespace xma
} // namespace apu } // namespace apu