1 /*************************************************************************** 2 copyright : (C) 2012 by Lukáš Lalinský 3 email : lalinsky@gmail.com 4 5 copyright : (C) 2002 - 2008 by Scott Wheeler 6 email : wheeler@kde.org 7 (original Vorbis 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_OPUSPROPERTIES_H 31 #define TAGLIB_OPUSPROPERTIES_H 32 33 #include "audioproperties.h" 34 35 namespace TagLib { 36 37 namespace Ogg { 38 39 namespace Opus { 40 41 class File; 42 43 //! An implementation of audio property reading for Ogg Opus 44 45 /*! 46 * This reads the data from an Ogg Opus stream found in the AudioProperties 47 * API. 48 */ 49 50 class TAGLIB_EXPORT Properties : public AudioProperties 51 { 52 public: 53 /*! 54 * Create an instance of Opus::Properties with the data read from the 55 * Opus::File \a file. 56 */ 57 Properties(File *file, ReadStyle style = Average); 58 59 /*! 60 * Destroys this Opus::Properties instance. 61 */ 62 virtual ~Properties(); 63 64 /*! 65 * Returns the length of the file in seconds. The length is rounded down to 66 * the nearest whole second. 67 * 68 * \note This method is just an alias of lengthInSeconds(). 69 * 70 * \deprecated 71 */ 72 virtual int length() const; 73 74 /*! 75 * Returns the length of the file in seconds. The length is rounded down to 76 * the nearest whole second. 77 * 78 * \see lengthInMilliseconds() 79 */ 80 // BIC: make virtual 81 int lengthInSeconds() const; 82 83 /*! 84 * Returns the length of the file in milliseconds. 85 * 86 * \see lengthInSeconds() 87 */ 88 // BIC: make virtual 89 int lengthInMilliseconds() const; 90 91 /*! 92 * Returns the average bit rate of the file in kb/s. 93 */ 94 virtual int bitrate() const; 95 96 /*! 97 * Returns the sample rate in Hz. 98 * 99 * \note Always returns 48000, because Opus can decode any stream at a 100 * sample rate of 8, 12, 16, 24, or 48 kHz, 101 */ 102 virtual int sampleRate() const; 103 104 /*! 105 * Returns the number of audio channels. 106 */ 107 virtual int channels() const; 108 109 /*! 110 * The Opus codec supports decoding at multiple sample rates, there is no 111 * single sample rate of the encoded stream. This returns the sample rate 112 * of the original audio stream. 113 */ 114 int inputSampleRate() const; 115 116 /*! 117 * Returns the Opus version, in the range 0...255. 118 */ 119 int opusVersion() const; 120 121 private: 122 Properties(const Properties &); 123 Properties &operator=(const Properties &); 124 125 void read(File *file); 126 127 class PropertiesPrivate; 128 PropertiesPrivate *d; 129 }; 130 } 131 } 132 } 133 134 #endif 135