kwave  18.07.70
OpusDecoder.h
Go to the documentation of this file.
1 /*************************************************************************
2  OpusDecoder.h - sub decoder for Opus in an Ogg container
3  -------------------
4  begin : Wed Dec 26 2012
5  copyright : (C) 2012 by Thomas Eschenbacher
6  email : Thomas.Eschenbacher@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef OPUS_DECODER_H
19 #define OPUS_DECODER_H
20 
21 #ifdef HAVE_OGG_OPUS
22 #include "config.h"
23 
24 #include <ogg/ogg.h>
25 #include <opus/opus.h>
26 #include <opus/opus_multistream.h>
27 
28 #include "libkwave/FileInfo.h"
30 #include "libkwave/Sample.h"
33 
34 #include "OggSubDecoder.h"
35 #include "OpusHeader.h"
36 
37 class QIODevice;
38 class QWidget;
39 
40 namespace Kwave
41 {
42  class MultiWriter;
43  class StreamObject;
44 
46  {
47  public:
57  OpusDecoder(QIODevice *source,
58  ogg_sync_state &oy,
59  ogg_stream_state &os,
60  ogg_page &og,
61  ogg_packet &op);
62 
64  virtual ~OpusDecoder() Q_DECL_OVERRIDE {}
65 
72  virtual int open(QWidget *widget, Kwave::FileInfo &info) Q_DECL_OVERRIDE;
73 
79  virtual int decode(Kwave::MultiWriter &dst) Q_DECL_OVERRIDE;
80 
82  virtual void reset() Q_DECL_OVERRIDE;
83 
88  virtual void close(Kwave::FileInfo &info) Q_DECL_OVERRIDE;
89 
90  protected:
91 
99  void parseComment(Kwave::FileInfo &info, const QString &comment);
100 
107  virtual int parseOpusHead(QWidget *widget, Kwave::FileInfo &info);
108 
115  virtual int parseOpusTags(QWidget *widget, Kwave::FileInfo &info);
116 
117  private:
119  QIODevice *m_source;
120 
123 
126 
128  ogg_sync_state &m_oy;
129 
131  ogg_stream_state &m_os;
132 
134  ogg_page &m_og;
135 
137  ogg_packet &m_op;
138 
140  Kwave::opus_header_t m_opus_header;
141 
143  OpusMSDecoder *m_opus_decoder;
144 
147 
149  float *m_raw_buffer;
150 
153 
156 
162 
164  unsigned int m_packet_count;
165 
170  quint64 m_samples_raw;
171 
173  quint64 m_bytes_count;
174 
177 
180 
183 
186 
189 
192 
195 
198  };
199 }
200 
201 #endif /* HAVE_OGG_OPUS */
202 
203 #endif /* OPUS_DECODER_H */
204 
205 //***************************************************************************
206 //***************************************************************************
Kwave::StreamObject * m_rate_converter
Definition: OpusDecoder.h:155
qint64 m_stream_start_pos
Definition: OpusDecoder.h:122
Definition: App.h:33
unsigned int m_packet_count
Definition: OpusDecoder.h:164
QIODevice * m_source
Definition: OpusDecoder.h:119
virtual int decode(Kwave::MultiWriter &dst) Q_DECL_OVERRIDE
Kwave::opus_header_t m_opus_header
Definition: OpusDecoder.h:140
OpusMSDecoder * m_opus_decoder
Definition: OpusDecoder.h:143
virtual int parseOpusTags(QWidget *widget, Kwave::FileInfo &info)
void parseComment(Kwave::FileInfo &info, const QString &comment)
Definition: OpusDecoder.cpp:74
quint64 sample_index_t
Definition: Sample.h:28
virtual ~OpusDecoder() Q_DECL_OVERRIDE
Definition: OpusDecoder.h:64
Kwave::VorbisCommentMap m_comments_map
Definition: OpusDecoder.h:146
Kwave::MultiTrackSink< Kwave::SampleBuffer, true > * m_buffer
Definition: OpusDecoder.h:152
virtual void close(Kwave::FileInfo &info) Q_DECL_OVERRIDE
sample_index_t m_samples_written
Definition: OpusDecoder.h:125
OpusDecoder(QIODevice *source, ogg_sync_state &oy, ogg_stream_state &os, ogg_page &og, ogg_packet &op)
Definition: OpusDecoder.cpp:55
ogg_sync_state & m_oy
Definition: OpusDecoder.h:128
virtual int parseOpusHead(QWidget *widget, Kwave::FileInfo &info)
ogg_stream_state & m_os
Definition: OpusDecoder.h:131
virtual void reset() Q_DECL_OVERRIDE
ogg_packet & m_op
Definition: OpusDecoder.h:137
virtual int open(QWidget *widget, Kwave::FileInfo &info) Q_DECL_OVERRIDE