File indexing completed on 2024-07-21 07:22: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 #ifndef _K3B_FFMPEG_DECODER_H_
0008 #define _K3B_FFMPEG_DECODER_H_
0009 
0010 #include "k3baudiodecoder.h"
0011 
0012 class K3bFFMpegFile;
0013 
0014 
0015 class K3bFFMpegDecoderFactory : public K3b::AudioDecoderFactory
0016 {
0017     Q_OBJECT
0018 
0019 public:
0020     K3bFFMpegDecoderFactory( QObject* parent, const QVariantList& args  );
0021     ~K3bFFMpegDecoderFactory() override;
0022 
0023     bool canDecode( const QUrl& filename ) override;
0024 
0025     int pluginSystemVersion() const override { return K3B_PLUGIN_SYSTEM_VERSION; }
0026 
0027     bool multiFormatDecoder() const override { return true; }
0028 
0029     K3b::AudioDecoder* createDecoder( QObject* parent = 0  ) const override;
0030 };
0031 
0032 
0033 class K3bFFMpegDecoder : public K3b::AudioDecoder
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038     explicit K3bFFMpegDecoder( QObject* parent = 0  );
0039     ~K3bFFMpegDecoder() override;
0040 
0041     QString fileType() const override;
0042 
0043     void cleanup() 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     K3bFFMpegFile* m_file;
0054     QString m_type;
0055 };
0056 
0057 #endif