File indexing completed on 2024-05-12 04:51:02

0001 /*
0002     SPDX-FileCopyrightText: 2010 Michal Malek <michalm@jabster.pl>
0003     SPDX-FileCopyrightText: 1998-2010 Sebastian Trueg <trueg@k3b.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef _K3B_AUDIO_TRACK_READER_H_
0009 #define _K3B_AUDIO_TRACK_READER_H_
0010 
0011 #include "k3b_export.h"
0012 
0013 #include <QIODevice>
0014 #include <QScopedPointer>
0015 
0016 namespace K3b {
0017 
0018     class AudioTrack;
0019 
0020     class LIBK3B_EXPORT AudioTrackReader : public QIODevice
0021     {
0022         Q_OBJECT
0023 
0024     public:
0025         explicit AudioTrackReader( AudioTrack& track, QObject* parent = 0 );
0026         ~AudioTrackReader() override;
0027 
0028         const AudioTrack& track() const;
0029         AudioTrack& track();
0030 
0031         bool open( OpenMode mode = QIODevice::ReadOnly ) override;
0032         void close() override;
0033         bool isSequential() const override;
0034         qint64 size() const override;
0035         bool seek( qint64 pos ) override;
0036 
0037     protected:
0038         qint64 writeData( const char* data, qint64 len ) override;
0039         qint64 readData( char* data, qint64 maxlen ) override;
0040 
0041     private Q_SLOTS:
0042         void slotTrackChanged();
0043 
0044     private:
0045         class Private;
0046         QScopedPointer<Private> d;
0047         Q_DISABLE_COPY(AudioTrackReader)
0048         Q_PRIVATE_SLOT( d, void slotSourceAdded( int position ) )
0049         Q_PRIVATE_SLOT( d, void slotSourceAboutToBeRemoved( int position ) )
0050     };
0051 
0052 } // namespace K3b
0053 
0054 #endif // _K3B_AUDIO_TRACK_READER_H_