1 /* 2 SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org> 3 SPDX-License-Identifier: GPL-2.0-or-later 4 */ 5 #ifndef _K3B_VERIFICATION_JOB_H_ 6 #define _K3B_VERIFICATION_JOB_H_ 7 8 #include "k3bjob.h" 9 10 #include <QByteArray> 11 12 namespace K3b { 13 namespace Device { 14 class Device; 15 class DeviceHandler; 16 } 17 18 19 /** 20 * Generic verification job. Add tracks to be verified via addTrack. 21 * The job will then verifiy the tracks set against the set checksums. 22 * 23 * The different track types are handled as follows: 24 * \li Data/DVD tracks: Read the track with a 2048 bytes sector size. 25 * Tracks length on DVD+RW media will be read from the iso9660 26 * descriptor. 27 * \li Audio tracks: Rip the track with a 2352 bytes sector size. 28 * In the case of audio tracks the job will not fail if the checksums 29 * differ because audio CD tracks do not contain error correction data. 30 * In this case only a warning will be emitted. 31 * 32 * Other sector sizes than 2048 bytes for data tracks are not supported yet, 33 * i.e. Video CDs cannot be verified. 34 * 35 * TAO written tracks have two run-out sectors that are not read. 36 */ 37 class VerificationJob : public Job 38 { 39 Q_OBJECT 40 41 public: 42 explicit VerificationJob( JobHandler*, QObject* parent = 0 ); 43 ~VerificationJob() override; 44 45 public Q_SLOTS: 46 void start() override; 47 void cancel() override; 48 void setDevice( Device::Device* dev ); 49 50 void clear(); 51 52 /** 53 * Add a track to be verified. 54 * \param tracknum The number of the track. If \a tracknum is 0 55 * the last track will be verified. 56 * \param length Set to override the track length from the TOC. This may be 57 * useful when writing to DVD+RW media and the iso descriptor does not 58 * contain the exact image size (as true for many commercial Video DVDs) 59 */ 60 void addTrack( int tracknum, const QByteArray& checksum, const Msf& length = Msf() ); 61 62 /** 63 * Handle the special case of iso session growing 64 */ 65 void setGrownSessionSize( const Msf& ); 66 67 private Q_SLOTS: 68 void slotMediaLoaded(); 69 void slotDiskInfoReady( K3b::Device::DeviceHandler* dh ); 70 void readTrack(); 71 void slotReaderProgress( int p ); 72 void slotReaderFinished( bool success ); 73 74 private: 75 class Private; 76 Private* d; 77 }; 78 } 79 80 #endif 81