File indexing completed on 2024-05-19 04:52:39

0001 /*
0002     SPDX-FileCopyrightText: 2010 Michal Malek <michalm@jabster.pl>
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_SOX_ENCODER_H_
0009 #define _K3B_SOX_ENCODER_H_
0010 
0011 #include "k3bprocess.h"
0012 
0013 #include "k3baudioencoder.h"
0014 
0015 
0016 class K3bSoxEncoder : public K3b::AudioEncoder
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     K3bSoxEncoder( QObject* parent, const QVariantList& );
0022     ~K3bSoxEncoder() override;
0023 
0024     QStringList extensions() const override;
0025 
0026     QString fileTypeComment( const QString& ) const override;
0027 
0028     long long fileSize( const QString&, const K3b::Msf& msf ) const override;
0029 
0030     int pluginSystemVersion() const override { return K3B_PLUGIN_SYSTEM_VERSION; }
0031 
0032     /**
0033      * reimplemented since sox writes the file itself
0034      */
0035     bool openFile( const QString& extension, const QString& filename, const K3b::Msf& length, const MetaData& metaData ) override;
0036     bool isOpen() const override;
0037     void closeFile() override;
0038 
0039 private Q_SLOTS:
0040     void slotSoxFinished( int, QProcess::ExitStatus );
0041     void slotSoxOutputLine( const QString& );
0042 
0043 private:
0044     bool initEncoderInternal( const QString& extension, const K3b::Msf& length, const MetaData& metaData ) override;
0045     void finishEncoderInternal() override;
0046     qint64 encodeInternal( const char* data, qint64 len ) override;
0047 
0048     class Private;
0049     Private* d;
0050 };
0051 
0052 #endif