1/***************************************************************************
2 copyright : (C) 2006 by Lukáš Lalinský
3 email : lalinsky@gmail.com
4
5 copyright : (C) 2004 by Allan Sandfeld Jensen
6 email : kde@carewolf.org
7 (original MPC 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_WVPROPERTIES_H
31#define TAGLIB_WVPROPERTIES_H
32
33#include "taglib_export.h"
34#include "audioproperties.h"
35
36namespace TagLib {
37
38 namespace WavPack {
39
40 class File;
41
42 static const unsigned int HeaderSize = 32;
43
44 //! An implementation of audio property reading for WavPack
45
46 /*!
47 * This reads the data from an WavPack stream found in the AudioProperties
48 * API.
49 */
50
51 class TAGLIB_EXPORT Properties : public AudioProperties
52 {
53 public:
54 /*!
55 * Create an instance of WavPack::Properties with the data read from the
56 * ByteVector \a data.
57 *
58 * \deprecated This constructor will be dropped in favor of the one below
59 * in a future version.
60 */
61 Properties(const ByteVector &data, long streamLength, ReadStyle style = Average);
62
63 /*!
64 * Create an instance of WavPack::Properties.
65 */
66 // BIC: merge with the above constructor
67 Properties(File *file, long streamLength, ReadStyle style = Average);
68
69 /*!
70 * Destroys this WavPack::Properties instance.
71 */
72 virtual ~Properties();
73
74 /*!
75 * Returns the length of the file in seconds. The length is rounded down to
76 * the nearest whole second.
77 *
78 * \note This method is just an alias of lengthInSeconds().
79 *
80 * \deprecated
81 */
82 virtual int length() const;
83
84 /*!
85 * Returns the length of the file in seconds. The length is rounded down to
86 * the nearest whole second.
87 *
88 * \see lengthInMilliseconds()
89 */
90 // BIC: make virtual
91 int lengthInSeconds() const;
92
93 /*!
94 * Returns the length of the file in milliseconds.
95 *
96 * \see lengthInSeconds()
97 */
98 // BIC: make virtual
99 int lengthInMilliseconds() const;
100
101 /*!
102 * Returns the average bit rate of the file in kb/s.
103 */
104 virtual int bitrate() const;
105
106 /*!
107 * Returns the sample rate in Hz. 0 means unknown or custom.
108 */
109 virtual int sampleRate() const;
110
111 /*!
112 * Returns the number of audio channels.
113 */
114 virtual int channels() const;
115
116 /*!
117 * Returns the number of bits per audio sample.
118 */
119 int bitsPerSample() const;
120
121 /*!
122 * Returns whether or not the file is lossless encoded.
123 */
124 bool isLossless() const;
125
126 /*!
127 * Returns the total number of audio samples in file.
128 */
129 unsigned int sampleFrames() const;
130
131 /*!
132 * Returns WavPack version.
133 */
134 int version() const;
135
136 private:
137 Properties(const Properties &);
138 Properties &operator=(const Properties &);
139
140 void read(File *file, long streamLength);
141 unsigned int seekFinalIndex(File *file, long streamLength);
142
143 class PropertiesPrivate;
144 PropertiesPrivate *d;
145 };
146 }
147}
148
149#endif
150