diff options
Diffstat (limited to 'video/bink_decoder.cpp')
-rw-r--r-- | video/bink_decoder.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/video/bink_decoder.cpp b/video/bink_decoder.cpp index 45dec0887b..a228377a27 100644 --- a/video/bink_decoder.cpp +++ b/video/bink_decoder.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -108,20 +108,18 @@ bool BinkDecoder::loadStream(Common::SeekableReadStream *stream) { uint32 audioTrackCount = _bink->readUint32LE(); if (audioTrackCount > 0) { - _audioTracks.reserve(audioTrackCount); + _audioTracks.resize(audioTrackCount); _bink->skip(4 * audioTrackCount); // Reading audio track properties for (uint32 i = 0; i < audioTrackCount; i++) { - AudioInfo track; + AudioInfo &track = _audioTracks[i]; track.sampleRate = _bink->readUint16LE(); track.flags = _bink->readUint16LE(); - _audioTracks.push_back(track); - - initAudioTrack(_audioTracks[i]); + initAudioTrack(track); } _bink->skip(4 * audioTrackCount); @@ -214,6 +212,16 @@ void BinkDecoder::readNextPacket() { frame.bits = 0; } +VideoDecoder::AudioTrack *BinkDecoder::getAudioTrack(int index) { + // Bink audio track indexes are relative to the first audio track + Track *track = getTrack(index + 1); + + if (!track || track->getTrackType() != Track::kTrackTypeAudio) + return 0; + + return (AudioTrack *)track; +} + BinkDecoder::VideoFrame::VideoFrame() : bits(0) { } |