1/***************************************************************************
2 copyright : (C) 2010 by Alex Novichkov
3 email : novichko@atnet.ru
4
5 copyright : (C) 2006 by Lukáš Lalinský
6 email : lalinsky@gmail.com
7 (original WavPack implementation)
8 ***************************************************************************/
9
10/***************************************************************************
11 * This library is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU Lesser General Public License version *
13 * 2.1 as published by the Free Software Foundation. *
14 * *
15 * This library is distributed in the hope that it will be useful, but *
16 * WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
18 * Lesser General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU Lesser General Public *
21 * License along with this library; if not, write to the Free Software *
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
23 * 02110-1301 USA *
24 * *
25 * Alternatively, this file is available under the Mozilla Public *
26 * License Version 1.1. You may obtain a copy of the License at *
27 * http://www.mozilla.org/MPL/ *
28 ***************************************************************************/
29
30#ifndef TAGLIB_APEPROPERTIES_H
31#define TAGLIB_APEPROPERTIES_H
32
33#include "taglib_export.h"
34#include "audioproperties.h"
35
36namespace TagLib {
37
38 namespace APE {
39
40 class File;
41
42 //! An implementation of audio property reading for APE
43
44 /*!
45 * This reads the data from an APE stream found in the AudioProperties
46 * API.
47 */
48
49 class TAGLIB_EXPORT Properties : public AudioProperties
50 {
51 public:
52 /*!
53 * Create an instance of APE::Properties with the data read from the
54 * APE::File \a file.
55 *
56 * \deprecated
57 */
58 Properties(File *file, ReadStyle style = Average);
59
60 /*!
61 * Create an instance of APE::Properties with the data read from the
62 * APE::File \a file.
63 */
64 Properties(File *file, long streamLength, ReadStyle style = Average);
65
66 /*!
67 * Destroys this APE::Properties instance.
68 */
69 virtual ~Properties();
70
71 /*!
72 * Returns the length of the file in seconds. The length is rounded down to
73 * the nearest whole second.
74 *
75 * \note This method is just an alias of lengthInSeconds().
76 *
77 * \deprecated
78 */
79 virtual int length() const;
80
81 /*!
82 * Returns the length of the file in seconds. The length is rounded down to
83 * the nearest whole second.
84 *
85 * \see lengthInMilliseconds()
86 */
87 // BIC: make virtual
88 int lengthInSeconds() const;
89
90 /*!
91 * Returns the length of the file in milliseconds.
92 *
93 * \see lengthInSeconds()
94 */
95 // BIC: make virtual
96 int lengthInMilliseconds() const;
97
98 /*!
99 * Returns the average bit rate of the file in kb/s.
100 */
101 virtual int bitrate() const;
102
103 /*!
104 * Returns the sample rate in Hz.
105 */
106 virtual int sampleRate() const;
107
108 /*!
109 * Returns the number of audio channels.
110 */
111 virtual int channels() const;
112
113 /*!
114 * Returns the number of bits per audio sample.
115 */
116 int bitsPerSample() const;
117
118 /*!
119 * Returns the total number of audio samples in file.
120 */
121 unsigned int sampleFrames() const;
122
123 /*!
124 * Returns APE version.
125 */
126 int version() const;
127
128 private:
129 Properties(const Properties &);
130 Properties &operator=(const Properties &);
131
132 void read(File *file, long streamLength);
133
134 void analyzeCurrent(File *file);
135 void analyzeOld(File *file);
136
137 class PropertiesPrivate;
138 PropertiesPrivate *d;
139 };
140 }
141}
142
143#endif
144