|
kwave
18.07.70
|
#include <OpusDecoder.h>


Public Member Functions | |
| OpusDecoder (QIODevice *source, ogg_sync_state &oy, ogg_stream_state &os, ogg_page &og, ogg_packet &op) | |
| virtual | ~OpusDecoder () Q_DECL_OVERRIDE |
| virtual int | open (QWidget *widget, Kwave::FileInfo &info) Q_DECL_OVERRIDE |
| virtual int | decode (Kwave::MultiWriter &dst) Q_DECL_OVERRIDE |
| virtual void | reset () Q_DECL_OVERRIDE |
| virtual void | close (Kwave::FileInfo &info) Q_DECL_OVERRIDE |
Public Member Functions inherited from Kwave::OggSubDecoder | |
| virtual | ~OggSubDecoder () |
Protected Member Functions | |
| void | parseComment (Kwave::FileInfo &info, const QString &comment) |
| virtual int | parseOpusHead (QWidget *widget, Kwave::FileInfo &info) |
| virtual int | parseOpusTags (QWidget *widget, Kwave::FileInfo &info) |
Private Attributes | |
| QIODevice * | m_source |
| qint64 | m_stream_start_pos |
| sample_index_t | m_samples_written |
| ogg_sync_state & | m_oy |
| ogg_stream_state & | m_os |
| ogg_page & | m_og |
| ogg_packet & | m_op |
| Kwave::opus_header_t | m_opus_header |
| OpusMSDecoder * | m_opus_decoder |
| Kwave::VorbisCommentMap | m_comments_map |
| float * | m_raw_buffer |
| Kwave::MultiTrackSink< Kwave::SampleBuffer, true > * | m_buffer |
| Kwave::StreamObject * | m_rate_converter |
| bool | m_output_is_connected |
| unsigned int | m_packet_count |
| quint64 | m_samples_raw |
| quint64 | m_bytes_count |
| int | m_packet_len_min |
| int | m_packet_len_max |
| int | m_packet_size_min |
| int | m_packet_size_max |
| qint64 | m_granule_first |
| qint64 | m_granule_last |
| qint64 | m_granule_offset |
| int | m_preskip |
Definition at line 45 of file OpusDecoder.h.
| Kwave::OpusDecoder::OpusDecoder | ( | QIODevice * | source, |
| ogg_sync_state & | oy, | ||
| ogg_stream_state & | os, | ||
| ogg_page & | og, | ||
| ogg_packet & | op | ||
| ) |
Constructor
| source | pointer to a QIODevice to read from, must not be null |
| oy | sync and verify incoming physical bitstream |
| os | take physical pages, weld into a logical stream of packets |
| og | one Ogg bitstream page, Opus packets are inside |
| op | one raw packet of data for decode |
Definition at line 55 of file OpusDecoder.cpp.
|
inlinevirtual |
destructor
Definition at line 64 of file OpusDecoder.h.
References close(), decode(), open(), parseComment(), parseOpusHead(), parseOpusTags(), and reset().

|
virtual |
finish the decoding, last chance to fix up some file info
| info | reference to a FileInfo to fill |
Implements Kwave::OggSubDecoder.
Definition at line 644 of file OpusDecoder.cpp.
References Kwave::MultiTrackSink< SINK, INITIALIZE >::at(), Kwave::BITRATE_MODE_CBR_HARD, Kwave::BITRATE_MODE_VBR, Kwave::SampleBuffer::finished(), Kwave::INF_BITRATE_MODE, Kwave::INF_BITRATE_NOMINAL, Kwave::INF_OPUS_FRAME_LEN, m_buffer, m_bytes_count, m_opus_header, m_output_is_connected, m_packet_count, m_packet_len_max, m_packet_len_min, m_packet_size_max, m_packet_size_min, m_rate_converter, m_samples_raw, m_samples_written, Kwave::opus_next_sample_rate(), reset(), Kwave::FileInfo::set(), and Kwave::toInt().
Referenced by ~OpusDecoder().


|
virtual |
decode received ogg data
| dst | a MultiWriter to be used as sink |
Implements Kwave::OggSubDecoder.
Definition at line 503 of file OpusDecoder.cpp.
References Kwave::MultiTrackSink< SINK, INITIALIZE >::at(), Kwave::connect(), DBG, double2sample(), m_buffer, m_bytes_count, m_granule_first, m_granule_last, m_granule_offset, m_og, m_op, m_opus_decoder, m_opus_header, m_output_is_connected, m_packet_count, m_packet_len_max, m_packet_len_min, m_packet_size_max, m_packet_size_min, m_preskip, m_rate_converter, m_raw_buffer, m_samples_raw, m_samples_written, MAX_FRAME_SIZE, Kwave::opus_error(), Kwave::SampleBuffer::put(), SAMPLE_MAX, SAMPLE_MIN, and Kwave::toInt().
Referenced by ~OpusDecoder().


|
virtual |
parse the header of the stream and initialize the decoder
| widget | a QWidget to be used as parent for error messages |
| info | reference to a FileInfo to fill |
Implements Kwave::OggSubDecoder.
Definition at line 373 of file OpusDecoder.cpp.
References Kwave::connect(), Kwave::FileInfo::dump(), Kwave::MessageBox::error(), Kwave::INF_ESTIMATED_LENGTH, m_buffer, m_bytes_count, m_granule_first, m_granule_last, m_granule_offset, m_opus_decoder, m_opus_header, m_packet_count, m_packet_len_max, m_packet_len_min, m_packet_size_max, m_packet_size_min, m_preskip, m_rate_converter, m_raw_buffer, m_samples_raw, m_samples_written, m_source, m_stream_start_pos, MAX_FRAME_SIZE, Kwave::opus_error(), Kwave::opus_next_sample_rate(), parseOpusHead(), parseOpusTags(), Kwave::FileInfo::set(), and Kwave::StreamObject::setAttribute().
Referenced by ~OpusDecoder().


|
protected |
Parses an Ogg comment into a into Kwave FileInfo. If more than one occurrence is found, they are concatenated as a semicolon separated list.
| info | the file info object to add the value |
| comment | string with the full comment, assumed "tag=value" |
Definition at line 74 of file OpusDecoder.cpp.
References _, Kwave::FileInfo::contains(), DBG, Kwave::FileInfo::get(), m_comments_map, m_opus_header, Kwave::FileInfo::set(), and Kwave::toInt().
Referenced by parseOpusTags(), and ~OpusDecoder().


|
protectedvirtual |
parse the "OpusHeader" header of the stream
| widget | a QWidget to be used as parent for error messages |
| info | reference to a FileInfo to fill |
Definition at line 245 of file OpusDecoder.cpp.
References Kwave::MessageBox::error(), Kwave::INF_COMPRESSION, m_op, m_opus_header, Kwave::Compression::OGG_OPUS, Kwave::FileInfo::set(), Kwave::FileInfo::setRate(), and Kwave::FileInfo::setTracks().
Referenced by open(), and ~OpusDecoder().


|
protectedvirtual |
parse the "OpusTags" header of the stream
| widget | a QWidget to be used as parent for error messages |
| info | reference to a FileInfo to fill |
Definition at line 132 of file OpusDecoder.cpp.
References DBG, Kwave::MessageBox::error(), m_og, m_op, m_os, m_oy, m_source, and parseComment().
Referenced by open(), and ~OpusDecoder().


|
virtual |
reset the stream info
Implements Kwave::OggSubDecoder.
Definition at line 631 of file OpusDecoder.cpp.
References m_opus_decoder, and m_raw_buffer.
Referenced by close(), and ~OpusDecoder().

|
private |
multi track buffer, for blockwise writing to the destination
Definition at line 152 of file OpusDecoder.h.
|
private |
total number of bytes, without overhead
Definition at line 173 of file OpusDecoder.h.
|
private |
map for translating Opus comments to Kwave FileInfo
Definition at line 146 of file OpusDecoder.h.
Referenced by parseComment().
|
private |
first detected granule pos (minimum)
Definition at line 188 of file OpusDecoder.h.
|
private |
last detected granule pos (maximum)
Definition at line 191 of file OpusDecoder.h.
|
private |
number of samples missing at the start (in first granule)
Definition at line 194 of file OpusDecoder.h.
|
private |
one Ogg bitstream page. Opus packets are inside
Definition at line 134 of file OpusDecoder.h.
Referenced by decode(), and parseOpusTags().
|
private |
one raw packet of data for decode
Definition at line 137 of file OpusDecoder.h.
Referenced by decode(), parseOpusHead(), and parseOpusTags().
|
private |
Opus multistream decoder object
Definition at line 143 of file OpusDecoder.h.
|
private |
the Opus stream header
Definition at line 140 of file OpusDecoder.h.
Referenced by close(), decode(), open(), parseComment(), and parseOpusHead().
|
private |
take physical pages, weld into a logical stream of packets
Definition at line 131 of file OpusDecoder.h.
Referenced by parseOpusTags().
|
private |
if true, the output of the rate converter or sample buffer has been connected to the decoder's sink
Definition at line 161 of file OpusDecoder.h.
|
private |
sync and verify incoming physical bitstream
Definition at line 128 of file OpusDecoder.h.
Referenced by parseOpusTags().
|
private |
total number of packets
Definition at line 164 of file OpusDecoder.h.
|
private |
maximum detected length of a packet [samples]
Definition at line 179 of file OpusDecoder.h.
|
private |
minimum detected length of a packet [samples]
Definition at line 176 of file OpusDecoder.h.
|
private |
maximum detected size of a packet [bytes]
Definition at line 185 of file OpusDecoder.h.
|
private |
minimum detected size of a packet [bytes]
Definition at line 182 of file OpusDecoder.h.
|
private |
number of samples to skip at start
Definition at line 197 of file OpusDecoder.h.
|
private |
sample rate converter (when needed)
Definition at line 155 of file OpusDecoder.h.
|
private |
buffer for decoded raw audio data
Definition at line 149 of file OpusDecoder.h.
|
private |
total number of raw samples, at the input of the decoder, before rate conversion
Definition at line 170 of file OpusDecoder.h.
|
private |
last known position in the output stream [samples]
Definition at line 125 of file OpusDecoder.h.
|
private |
IO device to read from
Definition at line 119 of file OpusDecoder.h.
Referenced by open(), and parseOpusTags().
|
private |