1 /***************************************************************************
2     copyright            : (C) 2002 - 2008 by Scott Wheeler
3     email                : wheeler@kde.org
4  ***************************************************************************/
5 
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.                     *
10  *                                                                         *
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.                       *
15  *                                                                         *
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., 51 Franklin Street, Fifth Floor, Boston, MA         *
19  *   02110-1301  USA                                                       *
20  *                                                                         *
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  ***************************************************************************/
25 
26 #ifndef TAGLIB_VORBISPROPERTIES_H
27 #define TAGLIB_VORBISPROPERTIES_H
28 
29 #include "taglib_export.h"
30 #include "audioproperties.h"
31 
32 namespace TagLib {
33 
34 /*
35  * This is just to make this appear to be in the Ogg namespace in the
36  * documentation.  The typedef below will make this work with the current code.
37  * In the next BIC version of TagLib this will be really moved into the Ogg
38  * namespace.
39  */
40 
41 #ifdef DOXYGEN
42   namespace Ogg {
43 #endif
44 
45   namespace Vorbis {
46 
47     class File;
48 
49     //! An implementation of audio property reading for Ogg Vorbis
50 
51     /*!
52      * This reads the data from an Ogg Vorbis stream found in the AudioProperties
53      * API.
54      */
55 
56     class TAGLIB_EXPORT Properties : public AudioProperties
57     {
58     public:
59       /*!
60        * Create an instance of Vorbis::Properties with the data read from the
61        * Vorbis::File \a file.
62        */
63       Properties(File *file, ReadStyle style = Average);
64 
65       /*!
66        * Destroys this VorbisProperties instance.
67        */
68       virtual ~Properties();
69 
70       /*!
71        * Returns the length of the file in seconds.  The length is rounded down to
72        * the nearest whole second.
73        *
74        * \note This method is just an alias of lengthInSeconds().
75        *
76        * \deprecated
77        */
78       TAGLIB_DEPRECATED virtual int length() const;
79 
80       /*!
81        * Returns the length of the file in seconds.  The length is rounded down to
82        * the nearest whole second.
83        *
84        * \see lengthInMilliseconds()
85        */
86       // BIC: make virtual
87       int lengthInSeconds() const;
88 
89       /*!
90        * Returns the length of the file in milliseconds.
91        *
92        * \see lengthInSeconds()
93        */
94       // BIC: make virtual
95       int lengthInMilliseconds() const;
96 
97       /*!
98        * Returns the average bit rate of the file in kb/s.
99        */
100       virtual int bitrate() const;
101 
102       /*!
103        * Returns the sample rate in Hz.
104        */
105       virtual int sampleRate() const;
106 
107       /*!
108        * Returns the number of audio channels.
109        */
110       virtual int channels() const;
111 
112       /*!
113        * Returns the Vorbis version, currently "0" (as specified by the spec).
114        */
115       int vorbisVersion() const;
116 
117       /*!
118        * Returns the maximum bitrate as read from the Vorbis identification
119        * header.
120        */
121       int bitrateMaximum() const;
122 
123       /*!
124        * Returns the nominal bitrate as read from the Vorbis identification
125        * header.
126        */
127       int bitrateNominal() const;
128 
129       /*!
130        * Returns the minimum bitrate as read from the Vorbis identification
131        * header.
132        */
133       int bitrateMinimum() const;
134 
135     private:
136       Properties(const Properties &);
137       Properties &operator=(const Properties &);
138 
139       void read(File *file);
140 
141       class PropertiesPrivate;
142       PropertiesPrivate *d;
143     };
144   }
145 
146 /*
147  * To keep compatibility with the current version put Vorbis in the Ogg namespace
148  * only in the docs and provide a typedef to make it work.  In the next BIC
149  * version this will be removed and it will only exist in the Ogg namespace.
150  */
151 
152 #ifdef DOXYGEN
153   }
154 #else
155   namespace Ogg { namespace Vorbis { typedef TagLib::AudioProperties AudioProperties; } }
156 #endif
157 
158 }
159 
160 #endif
161