File indexing completed on 2024-05-12 04:51:33

0001 /*
0002     SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 
0008 #ifndef _K3B_OGGVORBIS_DECODER_H_
0009 #define _K3B_OGGVORBIS_DECODER_H_
0010 
0011 
0012 #include "k3baudiodecoder.h"
0013 
0014 class K3bOggVorbisDecoderFactory : public K3b::AudioDecoderFactory
0015 {
0016     Q_OBJECT
0017 
0018 public:
0019     K3bOggVorbisDecoderFactory( QObject* parent, const QVariantList& );
0020     ~K3bOggVorbisDecoderFactory() override;
0021 
0022     bool canDecode( const QUrl& filename ) override;
0023 
0024     int pluginSystemVersion() const override { return K3B_PLUGIN_SYSTEM_VERSION; }
0025 
0026     K3b::AudioDecoder* createDecoder( QObject* parent = 0) const override;
0027 };
0028 
0029 
0030 /**
0031  *@author Sebastian Trueg
0032  */
0033 class K3bOggVorbisDecoder : public K3b::AudioDecoder
0034 {
0035     Q_OBJECT
0036 
0037 public: 
0038     explicit K3bOggVorbisDecoder( QObject* parent = 0 );
0039     ~K3bOggVorbisDecoder() override;
0040 
0041     void cleanup() override;
0042 
0043     QString fileType() const override;
0044 
0045 protected:
0046     bool analyseFileInternal( K3b::Msf& frames, int& samplerate, int& ch ) override;
0047     bool initDecoderInternal() override;
0048     bool seekInternal( const K3b::Msf& ) override;
0049 
0050     int decodeInternal( char* _data, int maxLen ) override;
0051 
0052 private:
0053     bool openOggVorbisFile();
0054 
0055     class Private;
0056     Private* d;
0057 };
0058 
0059 #endif