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