godot/thirdparty/libsimplewebm/OpusVorbisDecoder.hpp
20kdc 006f6f5ba1 Sync libsimplewebm with fe57fd3 (but not the libwebm sub-lib)
This is to get the colourspace information commit in,
 but it also performs a bit of cleanup regarding the entry in the thirdparty README.

The reason libwebm wasn't synced is because it has a bunch of unmarked changes,
 and it'd be better if the person responsible untangled that as
 they may know what they did and why they did it.

Given this, it might be a good idea to disconnect libwebm from the libsimplewebm code.
2019-02-21 20:43:41 +00:00

66 lines
1.9 KiB
C++

/*
MIT License
Copyright (c) 2016 Błażej Szczygieł
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef OPUSVORBISDECODER_HPP
#define OPUSVORBISDECODER_HPP
#include "WebMDemuxer.hpp"
struct VorbisDecoder;
struct OpusDecoder;
class OpusVorbisDecoder
{
OpusVorbisDecoder(const OpusVorbisDecoder &);
void operator =(const OpusVorbisDecoder &);
public:
OpusVorbisDecoder(const WebMDemuxer &demuxer);
~OpusVorbisDecoder();
bool isOpen() const;
inline int getBufferSamples() const
{
return m_numSamples;
}
bool getPCMS16(WebMFrame &frame, short *buffer, int &numOutSamples);
// -- GODOT begin --
bool getPCMF(WebMFrame &frame, float *buffer, int &numOutSamples);
// -- GODOT end --
private:
bool openVorbis(const WebMDemuxer &demuxer);
bool openOpus(const WebMDemuxer &demuxer);
void close();
VorbisDecoder *m_vorbis;
OpusDecoder *m_opus;
int m_numSamples;
int m_channels;
};
#endif // OPUSVORBISDECODER_HPP