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

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