File indexing completed on 2024-05-12 04:51:00
0001 /* 0002 SPDX-FileCopyrightText: 2005-2009 Sebastian Trueg <trueg@k3b.org> 0003 SPDX-FileCopyrightText: 2010 Michal Malek <michalm@jabster.pl> 0004 SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef _K3B_AUDIO_CD_TRACK_SOURCE_H_ 0010 #define _K3B_AUDIO_CD_TRACK_SOURCE_H_ 0011 0012 #include "k3baudiodatasource.h" 0013 #include "k3b_export.h" 0014 0015 #include <QScopedPointer> 0016 0017 0018 namespace K3b { 0019 namespace Device { 0020 class Device; 0021 class Toc; 0022 } 0023 0024 /** 0025 * Audio data source which reads it's data directly from an audio CD. 0026 * 0027 * Be aware that since GUI elements are not allowed in sources (other thread) 0028 * the source relies on the audio CD being inserted before any read operations. 0029 * It will search all available devices for the CD starting with the last used drive. 0030 */ 0031 class LIBK3B_EXPORT AudioCdTrackSource : public AudioDataSource 0032 { 0033 public: 0034 /** 0035 * Default constructor to create a new source. 0036 */ 0037 AudioCdTrackSource( const Device::Toc& toc, 0038 int cdTrackNumber, 0039 const QString& artist, const QString& title, 0040 const QString& cdartist, const QString& cdtitle, 0041 Device::Device* dev = 0 ); 0042 0043 /** 0044 * Constructor to create sources when loading from a project file without toc information 0045 */ 0046 AudioCdTrackSource( unsigned int discid, const Msf& length, int cdTrackNumber, 0047 const QString& artist, const QString& title, 0048 const QString& cdartist, const QString& cdtitle ); 0049 AudioCdTrackSource( const AudioCdTrackSource& ); 0050 ~AudioCdTrackSource() override; 0051 0052 unsigned int discId() const; 0053 int cdTrackNumber() const; 0054 0055 QString artist() const; 0056 QString title() const; 0057 QString cdArtist() const; 0058 QString cdTitle() const; 0059 0060 Msf originalLength() const override; 0061 QString type() const override; 0062 QString sourceComment() const override; 0063 AudioDataSource* copy() const override; 0064 QIODevice* createReader( QObject* parent = 0 ) override; 0065 0066 /** 0067 * Searches for the corresponding Audio CD and returns the device in which it has 0068 * been found or 0 if it could not be found. 0069 */ 0070 Device::Device* searchForAudioCD() const; 0071 0072 /** 0073 * Set the device the source should start to look for the CD. 0074 */ 0075 void setDevice( Device::Device* dev ); 0076 0077 const Device::Toc& toc() const; 0078 void setToc( const Device::Toc& toc ); 0079 0080 private: 0081 class Private; 0082 QScopedPointer<Private> d; 0083 }; 0084 } 0085 0086 #endif