File indexing completed on 2024-05-05 04:50:54

0001 /*
0002     SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #include "k3baudiofileanalyzerjob.h"
0007 #include "k3baudiodecoder.h"
0008 
0009 class K3b::AudioFileAnalyzerJob::Private
0010 {
0011 public:
0012     K3b::AudioDecoder* decoder;
0013 };
0014 
0015 
0016 K3b::AudioFileAnalyzerJob::AudioFileAnalyzerJob( K3b::JobHandler* hdl, QObject* parent )
0017     : K3b::ThreadJob( hdl, parent ),
0018       d( new Private() )
0019 {
0020     d->decoder = 0;
0021 }
0022 
0023 
0024 K3b::AudioFileAnalyzerJob::~AudioFileAnalyzerJob()
0025 {
0026     delete d;
0027 }
0028 
0029 
0030 void K3b::AudioFileAnalyzerJob::setDecoder( K3b::AudioDecoder* decoder )
0031 {
0032     d->decoder = decoder;
0033 }
0034 
0035 
0036 K3b::AudioDecoder* K3b::AudioFileAnalyzerJob::decoder() const
0037 {
0038     return d->decoder;
0039 }
0040 
0041 
0042 bool K3b::AudioFileAnalyzerJob::run()
0043 {
0044     if ( !d->decoder ) {
0045         emit infoMessage( "Internal error: no decoder set. This is a bug.", MessageError );
0046         return false;
0047     }
0048 
0049     return d->decoder->analyseFile();
0050 }
0051 
0052 #include "moc_k3baudiofileanalyzerjob.cpp"