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

0001 /*
0002     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 #ifndef _K3B_VERIFICATION_JOB_H_
0006 #define _K3B_VERIFICATION_JOB_H_
0007 
0008 #include "k3bjob.h"
0009 
0010 #include <QByteArray>
0011 
0012 namespace K3b {
0013     namespace Device {
0014         class Device;
0015         class DeviceHandler;
0016     }
0017 
0018 
0019     /**
0020      * Generic verification job. Add tracks to be verified via addTrack.
0021      * The job will then verifiy the tracks set against the set checksums.
0022      *
0023      * The different track types are handled as follows:
0024      * \li Data/DVD tracks: Read the track with a 2048 bytes sector size.
0025      *     Tracks length on DVD+RW media will be read from the iso9660
0026      *     descriptor.
0027      * \li Audio tracks: Rip the track with a 2352 bytes sector size.
0028      *     In the case of audio tracks the job will not fail if the checksums
0029      *     differ because audio CD tracks do not contain error correction data.
0030      *     In this case only a warning will be emitted.
0031      *
0032      * Other sector sizes than 2048 bytes for data tracks are not supported yet,
0033      * i.e. Video CDs cannot be verified.
0034      *
0035      * TAO written tracks have two run-out sectors that are not read.
0036      */
0037     class VerificationJob : public Job
0038     {
0039         Q_OBJECT
0040 
0041     public:
0042         explicit VerificationJob( JobHandler*, QObject* parent = 0 );
0043         ~VerificationJob() override;
0044 
0045     public Q_SLOTS:
0046         void start() override;
0047         void cancel() override;
0048         void setDevice( Device::Device* dev );
0049 
0050         void clear();
0051 
0052         /**
0053          * Add a track to be verified.
0054          * \param tracknum The number of the track. If \a tracknum is 0
0055          *        the last track will be verified.
0056          * \param length Set to override the track length from the TOC. This may be
0057          *        useful when writing to DVD+RW media and the iso descriptor does not
0058          *        contain the exact image size (as true for many commercial Video DVDs)
0059          */
0060         void addTrack( int tracknum, const QByteArray& checksum, const Msf& length = Msf() );
0061 
0062         /**
0063          * Handle the special case of iso session growing
0064          */
0065         void setGrownSessionSize( const Msf& );
0066 
0067     private Q_SLOTS:
0068         void slotMediaLoaded();
0069         void slotDiskInfoReady( K3b::Device::DeviceHandler* dh );
0070         void readTrack();
0071         void slotReaderProgress( int p );
0072         void slotReaderFinished( bool success );
0073 
0074     private:
0075         class Private;
0076         Private* d;
0077     };
0078 }
0079 
0080 #endif