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

0001 /*
0002     SPDX-FileCopyrightText: 2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "k3brawaudiodatasource.h"
0009 #include "k3brawaudiodatareader.h"
0010 #include "k3b_i18n.h"
0011 
0012 #include <QFileInfo>
0013 
0014 
0015 class K3b::RawAudioDataSource::Private
0016 {
0017 public:
0018     QString path;
0019 };
0020 
0021 
0022 K3b::RawAudioDataSource::RawAudioDataSource()
0023     : AudioDataSource(),
0024       d( new Private() )
0025 {
0026 }
0027 
0028 
0029 K3b::RawAudioDataSource::RawAudioDataSource( const QString& path )
0030     : AudioDataSource(),
0031       d( new Private() )
0032 {
0033     d->path = path;
0034 }
0035 
0036 
0037 K3b::RawAudioDataSource::RawAudioDataSource( const RawAudioDataSource& other )
0038     : AudioDataSource( other ),
0039       d( new Private() )
0040 {
0041     d->path = other.d->path;
0042 }
0043 
0044 
0045 K3b::RawAudioDataSource::~RawAudioDataSource()
0046 {
0047     delete d;
0048 }
0049 
0050 
0051 QString K3b::RawAudioDataSource::path() const
0052 {
0053     return d->path;
0054 }
0055 
0056 
0057 K3b::Msf K3b::RawAudioDataSource::originalLength() const
0058 {
0059     return Msf::fromAudioBytes( QFileInfo( d->path ).size() );
0060 }
0061 
0062 
0063 QString K3b::RawAudioDataSource::type() const
0064 {
0065     return i18n( "Raw Audio CD Image" );
0066 }
0067 
0068 
0069 QString K3b::RawAudioDataSource::sourceComment() const
0070 {
0071     return type();
0072 }
0073 
0074 
0075 K3b::AudioDataSource* K3b::RawAudioDataSource::copy() const
0076 {
0077     return new RawAudioDataSource( *this );
0078 }
0079 
0080 
0081 QIODevice* K3b::RawAudioDataSource::createReader( QObject* parent )
0082 {
0083     return new RawAudioDataReader( *this, parent );
0084 }