1 /*
2     SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org>
3 
4     SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 
8 #ifndef _K3B_OGGVORBIS_DECODER_H_
9 #define _K3B_OGGVORBIS_DECODER_H_
10 
11 
12 #include "k3baudiodecoder.h"
13 
14 class K3bOggVorbisDecoderFactory : public K3b::AudioDecoderFactory
15 {
16     Q_OBJECT
17 
18 public:
19     K3bOggVorbisDecoderFactory( QObject* parent, const QVariantList& );
20     ~K3bOggVorbisDecoderFactory() override;
21 
22     bool canDecode( const QUrl& filename ) override;
23 
pluginSystemVersion()24     int pluginSystemVersion() const override { return K3B_PLUGIN_SYSTEM_VERSION; }
25 
26     K3b::AudioDecoder* createDecoder( QObject* parent = 0) const override;
27 };
28 
29 
30 /**
31  *@author Sebastian Trueg
32  */
33 class K3bOggVorbisDecoder : public K3b::AudioDecoder
34 {
35     Q_OBJECT
36 
37 public:
38     explicit K3bOggVorbisDecoder( QObject* parent = 0 );
39     ~K3bOggVorbisDecoder() override;
40 
41     void cleanup() override;
42 
43     QString fileType() const override;
44 
45 protected:
46     bool analyseFileInternal( K3b::Msf& frames, int& samplerate, int& ch ) override;
47     bool initDecoderInternal() override;
48     bool seekInternal( const K3b::Msf& ) override;
49 
50     int decodeInternal( char* _data, int maxLen ) override;
51 
52 private:
53     bool openOggVorbisFile();
54 
55     class Private;
56     Private* d;
57 };
58 
59 #endif
60