File indexing completed on 2024-06-16 07:42:04

0001 /*
0002     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 #ifndef _K3B_CDDA2WAV_READER_H_
0006 #define _K3B_CDDA2WAV_READER_H_
0007 
0008 #include "k3bjob.h"
0009 #include <QProcess>
0010 
0011 namespace K3b {
0012     namespace Device {
0013         class Device;
0014     }
0015 
0016 
0017     /**
0018      * An Audio CD reader completely based on cdda2wav.
0019      * It does not use Device::Device but parses the track offsets
0020      * from the cdda2wav output.
0021      */
0022     class Cdda2wavReader : public Job
0023     {
0024         Q_OBJECT
0025 
0026     public:
0027         explicit Cdda2wavReader( QObject* parent = 0 );
0028         ~Cdda2wavReader();
0029 
0030         bool active() const;
0031 
0032     public Q_SLOTS:
0033         void start();
0034         void start( bool onlyReadInfo );
0035         void cancel();
0036 
0037         void setReadDevice( K3b::Device::Device* dev ) { m_device = dev; }
0038         void setImagePath( const QString& p ) { m_imagePath = p; }
0039 
0040         /**
0041          * the data gets written directly into fd instead of the imagefile.
0042          * Be aware that this only makes sense before starting the job.
0043          * To disable just set fd to -1
0044          */
0045         void writeToFd( int fd );
0046 
0047     private Q_SLOTS:
0048         void slotProcessLine( const QString& );
0049         void slotProcessExited( int, QProcess::ExitStatus );
0050 
0051     private:
0052         Device::Device* m_device;
0053 
0054         QString m_imagePath;
0055 
0056         class Private;
0057         Private* d;
0058     };
0059 }
0060 
0061 #endif