1 /***************************************************************************
2 copyright : (C) 2002 - 2008 by Scott Wheeler
3 email : wheeler@kde.org
4 ***************************************************************************/
6 /***************************************************************************
7 * This library is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU Lesser General Public License version *
9 * 2.1 as published by the Free Software Foundation. *
11 * This library is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the Free Software *
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
21 * Alternatively, this file is available under the Mozilla Public *
22 * License Version 1.1. You may obtain a copy of the License at *
23 * http://www.mozilla.org/MPL/ *
24 ***************************************************************************/
26 #ifndef TAGLIB_AUDIOPROPERTIES_H
27 #define TAGLIB_AUDIOPROPERTIES_H
29 #include "taglib_export.h"
33 //! A simple, abstract interface to common audio properties
36 * The values here are common to most audio formats. For more specific, codec
37 * dependant values, please see see the subclasses APIs. This is meant to
38 * compliment the TagLib::File and TagLib::Tag APIs in providing a simple
39 * interface that is sufficient for most applications.
42 class TAGLIB_EXPORT AudioProperties
47 * Reading audio properties from a file can sometimes be very time consuming
48 * and for the most accurate results can often involve reading the entire
49 * file. Because in many situations speed is critical or the accuracy of the
50 * values is not particularly important this allows the level of desired
54 //! Read as little of the file as possible
56 //! Read more of the file and make better values guesses
58 //! Read as much of the file as needed to report accurate values
63 * Destroys this AudioProperties instance.
65 virtual ~AudioProperties();
68 * Returns the length of the file in seconds.
70 virtual int length() const = 0;
73 * Returns the most appropriate bit rate for the file in kb/s. For constant
74 * bitrate formats this is simply the bitrate of the file. For variable
75 * bitrate formats this is either the average or nominal bitrate.
77 virtual int bitrate() const = 0;
80 * Returns the sample rate in Hz.
82 virtual int sampleRate() const = 0;
85 * Returns the number of audio channels.
87 virtual int channels() const = 0;
92 * Construct an audio properties instance. This is protected as this class
93 * should not be instantiated directly, but should be instantiated via its
94 * subclasses and can be fetched from the FileRef or File APIs.
98 AudioProperties(ReadStyle style);
101 AudioProperties(const AudioProperties &);
102 AudioProperties &operator=(const AudioProperties &);
104 class AudioPropertiesPrivate;
105 AudioPropertiesPrivate *d;