annotate src/flac-1.2.1/doc/html/api/decoder_8h-source.html @ 86:98c1576536ae

Bring in flac, ogg, vorbis
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 19 Mar 2013 17:37:49 +0000
parents
children
rev   line source
cannam@86 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
cannam@86 2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
cannam@86 3 <title>FLAC: include/FLAC++/decoder.h Source File</title>
cannam@86 4 <link href="doxygen.css" rel="stylesheet" type="text/css">
cannam@86 5 </head><body>
cannam@86 6 <!-- Generated by Doxygen 1.4.2 -->
cannam@86 7 <div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
cannam@86 8 <div class="nav">
cannam@86 9 <a class="el" href="dir_000000.html">include</a>&nbsp;/&nbsp;<a class="el" href="dir_000001.html">FLAC++</a></div>
cannam@86 10 <h1>decoder.h</h1><a href="decoder_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/* libFLAC++ - Free Lossless Audio Codec library</span>
cannam@86 11 00002 <span class="comment"> * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson</span>
cannam@86 12 00003 <span class="comment"> *</span>
cannam@86 13 00004 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
cannam@86 14 00005 <span class="comment"> * modification, are permitted provided that the following conditions</span>
cannam@86 15 00006 <span class="comment"> * are met:</span>
cannam@86 16 00007 <span class="comment"> *</span>
cannam@86 17 00008 <span class="comment"> * - Redistributions of source code must retain the above copyright</span>
cannam@86 18 00009 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span>
cannam@86 19 00010 <span class="comment"> *</span>
cannam@86 20 00011 <span class="comment"> * - Redistributions in binary form must reproduce the above copyright</span>
cannam@86 21 00012 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span>
cannam@86 22 00013 <span class="comment"> * documentation and/or other materials provided with the distribution.</span>
cannam@86 23 00014 <span class="comment"> *</span>
cannam@86 24 00015 <span class="comment"> * - Neither the name of the Xiph.org Foundation nor the names of its</span>
cannam@86 25 00016 <span class="comment"> * contributors may be used to endorse or promote products derived from</span>
cannam@86 26 00017 <span class="comment"> * this software without specific prior written permission.</span>
cannam@86 27 00018 <span class="comment"> *</span>
cannam@86 28 00019 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span>
cannam@86 29 00020 <span class="comment"> * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span>
cannam@86 30 00021 <span class="comment"> * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR</span>
cannam@86 31 00022 <span class="comment"> * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR</span>
cannam@86 32 00023 <span class="comment"> * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,</span>
cannam@86 33 00024 <span class="comment"> * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,</span>
cannam@86 34 00025 <span class="comment"> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR</span>
cannam@86 35 00026 <span class="comment"> * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</span>
cannam@86 36 00027 <span class="comment"> * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING</span>
cannam@86 37 00028 <span class="comment"> * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span>
cannam@86 38 00029 <span class="comment"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
cannam@86 39 00030 <span class="comment"> */</span>
cannam@86 40 00031
cannam@86 41 00032 <span class="preprocessor">#ifndef FLACPP__DECODER_H</span>
cannam@86 42 00033 <span class="preprocessor"></span><span class="preprocessor">#define FLACPP__DECODER_H</span>
cannam@86 43 00034 <span class="preprocessor"></span>
cannam@86 44 00035 <span class="preprocessor">#include "<a class="code" href="+_2export_8h.html">export.h</a>"</span>
cannam@86 45 00036
cannam@86 46 00037 <span class="preprocessor">#include &lt;string&gt;</span>
cannam@86 47 00038 <span class="preprocessor">#include "<a class="code" href="stream__decoder_8h.html">FLAC/stream_decoder.h</a>"</span>
cannam@86 48 00039
cannam@86 49 00040
cannam@86 50 00077 <span class="keyword">namespace </span>FLAC {
cannam@86 51 00078 <span class="keyword">namespace </span>Decoder {
cannam@86 52 00079
cannam@86 53 <a name="l00099"></a><a class="code" href="classFLAC_1_1Decoder_1_1Stream.html">00099</a> <span class="keyword">class </span>FLACPP_API Stream {
cannam@86 54 00100 <span class="keyword">public</span>:
cannam@86 55 <a name="l00103"></a><a class="code" href="classFLAC_1_1Decoder_1_1Stream_1_1State.html">00103</a> <span class="keyword">class </span>FLACPP_API State {
cannam@86 56 00104 <span class="keyword">public</span>:
cannam@86 57 00105 <span class="keyword">inline</span> State(::<a class="code" href="group__flac__stream__decoder.html#ga50">FLAC__StreamDecoderState</a> state): state_(state) { }
cannam@86 58 00106 <span class="keyword">inline</span> <a class="code" href="group__flac__stream__decoder.html#ga50">operator ::FLAC__StreamDecoderState</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; }
cannam@86 59 00107 <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *as_cstring()<span class="keyword"> const </span>{ <a class="code" href="group__flac__stream__decoder.html#ga0">return ::FLAC__StreamDecoderStateString</a>[state_]; }
cannam@86 60 00108 <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *resolved_as_cstring(<span class="keyword">const</span> Stream &amp;decoder)<span class="keyword"> const </span>{ <a class="code" href="group__flac__stream__decoder.html#ga27">return ::FLAC__stream_decoder_get_resolved_state_string</a>(decoder.<a class="code" href="classFLAC_1_1Decoder_1_1Stream.html#FLAC_1_1Decoder_1_1Streamp0">decoder_</a>); }
cannam@86 61 00109 <span class="keyword">protected</span>:<a class="code" href="group__flac__stream__decoder.html#ga50"></a>
cannam@86 62 00110 <a class="code" href="group__flac__stream__decoder.html#ga50"> ::FLAC__StreamDecoderState</a> state_;
cannam@86 63 00111 };
cannam@86 64 00112
cannam@86 65 00113 Stream();
cannam@86 66 00114 <span class="keyword">virtual</span> ~Stream();
cannam@86 67 00115
cannam@86 68 00117
cannam@86 69 00120 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> is_valid() <span class="keyword">const</span>;
cannam@86 70 <a name="l00121"></a><a class="code" href="classFLAC_1_1Decoder_1_1Stream.html#FLAC_1_1Decoder_1_1Streama3">00121</a> <span class="keyword">inline</span> operator bool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> is_valid(); }
cannam@86 71 00122
cannam@86 72 00123
cannam@86 73 00124 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> set_ogg_serial_number(<span class="keywordtype">long</span> value);
cannam@86 74 00125 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> set_md5_checking(<span class="keywordtype">bool</span> value);
cannam@86 75 00126 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> set_metadata_respond(::<a class="code" href="group__flac__format.html#ga113">FLAC__MetadataType</a> type);
cannam@86 76 00127 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> set_metadata_respond_application(<span class="keyword">const</span> FLAC__byte <span class="keywordtype">id</span>[4]);
cannam@86 77 00128 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> set_metadata_respond_all();
cannam@86 78 00129 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> set_metadata_ignore(::<a class="code" href="group__flac__format.html#ga113">FLAC__MetadataType</a> type);
cannam@86 79 00130 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> set_metadata_ignore_application(<span class="keyword">const</span> FLAC__byte <span class="keywordtype">id</span>[4]);
cannam@86 80 00131 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> set_metadata_ignore_all();
cannam@86 81 00132
cannam@86 82 00133 <span class="comment">/* get_state() is not virtual since we want subclasses to be able to return their own state */</span>
cannam@86 83 00134 State get_state() <span class="keyword">const</span>;
cannam@86 84 00135 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> get_md5_checking() <span class="keyword">const</span>;
cannam@86 85 00136 <span class="keyword">virtual</span> FLAC__uint64 get_total_samples() <span class="keyword">const</span>;
cannam@86 86 00137 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> get_channels() <span class="keyword">const</span>;
cannam@86 87 00138 <a class="code" href="group__flac__format.html#ga111">virtual ::FLAC__ChannelAssignment</a> get_channel_assignment() <span class="keyword">const</span>;
cannam@86 88 00139 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> get_bits_per_sample() <span class="keyword">const</span>;
cannam@86 89 00140 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> get_sample_rate() <span class="keyword">const</span>;
cannam@86 90 00141 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> get_blocksize() <span class="keyword">const</span>;
cannam@86 91 00142 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> get_decode_position(FLAC__uint64 *position) <span class="keyword">const</span>;
cannam@86 92 00143
cannam@86 93 00144 <a class="code" href="group__flac__stream__decoder.html#ga51">virtual ::FLAC__StreamDecoderInitStatus</a> init();
cannam@86 94 00145 <a class="code" href="group__flac__stream__decoder.html#ga51">virtual ::FLAC__StreamDecoderInitStatus</a> init_ogg();
cannam@86 95 00146
cannam@86 96 00147 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> finish();
cannam@86 97 00148
cannam@86 98 00149 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> flush();
cannam@86 99 00150 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> reset();
cannam@86 100 00151
cannam@86 101 00152 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> process_single();
cannam@86 102 00153 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> process_until_end_of_metadata();
cannam@86 103 00154 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> process_until_end_of_stream();
cannam@86 104 00155 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> skip_single_frame();
cannam@86 105 00156
cannam@86 106 00157 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> seek_absolute(FLAC__uint64 sample);
cannam@86 107 00158 <span class="keyword">protected</span>:
cannam@86 108 00160 <a class="code" href="group__flac__stream__decoder.html#ga52">virtual ::FLAC__StreamDecoderReadStatus</a> read_callback(FLAC__byte buffer[], size_t *bytes) = 0;
cannam@86 109 00161
cannam@86 110 00163 <a class="code" href="group__flac__stream__decoder.html#ga53">virtual ::FLAC__StreamDecoderSeekStatus</a> seek_callback(FLAC__uint64 absolute_byte_offset);
cannam@86 111 00164
cannam@86 112 00166 <a class="code" href="group__flac__stream__decoder.html#ga54">virtual ::FLAC__StreamDecoderTellStatus</a> tell_callback(FLAC__uint64 *absolute_byte_offset);
cannam@86 113 00167
cannam@86 114 00169 <a class="code" href="group__flac__stream__decoder.html#ga55">virtual ::FLAC__StreamDecoderLengthStatus</a> length_callback(FLAC__uint64 *stream_length);
cannam@86 115 00170
cannam@86 116 00172 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> eof_callback();
cannam@86 117 00173
cannam@86 118 00175 <a class="code" href="group__flac__stream__decoder.html#ga56">virtual ::FLAC__StreamDecoderWriteStatus</a> write_callback(<span class="keyword">const</span> ::<a class="code" href="structFLAC____Frame.html">FLAC__Frame</a> *frame, <span class="keyword">const</span> FLAC__int32 * <span class="keyword">const</span> buffer[]) = 0;
cannam@86 119 00176
cannam@86 120 00178 <span class="keyword">virtual</span> <span class="keywordtype">void</span> metadata_callback(<span class="keyword">const</span> ::<a class="code" href="structFLAC____StreamMetadata.html">FLAC__StreamMetadata</a> *metadata);
cannam@86 121 00179
cannam@86 122 00181 <span class="keyword">virtual</span> <span class="keywordtype">void</span> error_callback(::<a class="code" href="group__flac__stream__decoder.html#ga57">FLAC__StreamDecoderErrorStatus</a> status) = 0;
cannam@86 123 00182
cannam@86 124 00183 <span class="preprocessor">#if (defined _MSC_VER) || (defined __BORLANDC__) || (defined __GNUG__ &amp;&amp; (__GNUG__ &lt; 2 || (__GNUG__ == 2 &amp;&amp; __GNUC_MINOR__ &lt; 96))) || (defined __SUNPRO_CC)</span>
cannam@86 125 00184 <span class="preprocessor"></span> <span class="comment">// lame hack: some MSVC/GCC versions can't see a protected decoder_ from nested State::resolved_as_cstring()</span>
cannam@86 126 00185 <span class="keyword">friend</span> State;
cannam@86 127 00186 <span class="preprocessor">#endif</span>
cannam@86 128 00187 <span class="preprocessor"></span> ::FLAC__StreamDecoder *decoder_;
cannam@86 129 00188
cannam@86 130 00189 <a class="code" href="group__flac__stream__decoder.html#ga52">static ::FLAC__StreamDecoderReadStatus</a> read_callback_(<span class="keyword">const</span> ::<a class="code" href="structFLAC____StreamDecoder.html">FLAC__StreamDecoder</a> *decoder, FLAC__byte buffer[], size_t *bytes, <span class="keywordtype">void</span> *client_data);
cannam@86 131 00190 <a class="code" href="group__flac__stream__decoder.html#ga53">static ::FLAC__StreamDecoderSeekStatus</a> seek_callback_(<span class="keyword">const</span> ::<a class="code" href="structFLAC____StreamDecoder.html">FLAC__StreamDecoder</a> *decoder, FLAC__uint64 absolute_byte_offset, <span class="keywordtype">void</span> *client_data);
cannam@86 132 00191 <a class="code" href="group__flac__stream__decoder.html#ga54">static ::FLAC__StreamDecoderTellStatus</a> tell_callback_(<span class="keyword">const</span> ::<a class="code" href="structFLAC____StreamDecoder.html">FLAC__StreamDecoder</a> *decoder, FLAC__uint64 *absolute_byte_offset, <span class="keywordtype">void</span> *client_data);
cannam@86 133 00192 <a class="code" href="group__flac__stream__decoder.html#ga55">static ::FLAC__StreamDecoderLengthStatus</a> length_callback_(<span class="keyword">const</span> ::<a class="code" href="structFLAC____StreamDecoder.html">FLAC__StreamDecoder</a> *decoder, FLAC__uint64 *stream_length, <span class="keywordtype">void</span> *client_data);
cannam@86 134 00193 <span class="keyword">static</span> FLAC__bool eof_callback_(<span class="keyword">const</span> ::<a class="code" href="structFLAC____StreamDecoder.html">FLAC__StreamDecoder</a> *decoder, <span class="keywordtype">void</span> *client_data);
cannam@86 135 00194 <a class="code" href="group__flac__stream__decoder.html#ga56">static ::FLAC__StreamDecoderWriteStatus</a> write_callback_(<span class="keyword">const</span> ::<a class="code" href="structFLAC____StreamDecoder.html">FLAC__StreamDecoder</a> *decoder, <span class="keyword">const</span> ::<a class="code" href="structFLAC____Frame.html">FLAC__Frame</a> *frame, <span class="keyword">const</span> FLAC__int32 * <span class="keyword">const</span> buffer[], <span class="keywordtype">void</span> *client_data);
cannam@86 136 00195 <span class="keyword">static</span> <span class="keywordtype">void</span> metadata_callback_(<span class="keyword">const</span> ::<a class="code" href="structFLAC____StreamDecoder.html">FLAC__StreamDecoder</a> *decoder, <span class="keyword">const</span> ::<a class="code" href="structFLAC____StreamMetadata.html">FLAC__StreamMetadata</a> *metadata, <span class="keywordtype">void</span> *client_data);
cannam@86 137 00196 <span class="keyword">static</span> <span class="keywordtype">void</span> error_callback_(<span class="keyword">const</span> ::<a class="code" href="structFLAC____StreamDecoder.html">FLAC__StreamDecoder</a> *decoder, ::<a class="code" href="group__flac__stream__decoder.html#ga57">FLAC__StreamDecoderErrorStatus</a> status, <span class="keywordtype">void</span> *client_data);
cannam@86 138 00197 <span class="keyword">private</span>:
cannam@86 139 00198 <span class="comment">// Private and undefined so you can't use them:</span>
cannam@86 140 00199 Stream(<span class="keyword">const</span> Stream &amp;);
cannam@86 141 00200 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> Stream &amp;);
cannam@86 142 00201 };
cannam@86 143 00202
cannam@86 144 <a name="l00222"></a><a class="code" href="classFLAC_1_1Decoder_1_1File.html">00222</a> <span class="keyword">class </span>FLACPP_API File: <span class="keyword">public</span> Stream {
cannam@86 145 00223 <span class="keyword">public</span>:
cannam@86 146 00224 File();
cannam@86 147 00225 <span class="keyword">virtual</span> ~File();
cannam@86 148 00226
cannam@86 149 00227 <a class="code" href="group__flac__stream__decoder.html#ga51">virtual ::FLAC__StreamDecoderInitStatus</a> init(FILE *file);
cannam@86 150 00228 <a class="code" href="group__flac__stream__decoder.html#ga51">virtual ::FLAC__StreamDecoderInitStatus</a> init(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename);
cannam@86 151 00229 <a class="code" href="group__flac__stream__decoder.html#ga51">virtual ::FLAC__StreamDecoderInitStatus</a> init(<span class="keyword">const</span> std::string &amp;filename);
cannam@86 152 00230 <a class="code" href="group__flac__stream__decoder.html#ga51">virtual ::FLAC__StreamDecoderInitStatus</a> init_ogg(FILE *file);
cannam@86 153 00231 <a class="code" href="group__flac__stream__decoder.html#ga51">virtual ::FLAC__StreamDecoderInitStatus</a> init_ogg(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename);
cannam@86 154 00232 <a class="code" href="group__flac__stream__decoder.html#ga51">virtual ::FLAC__StreamDecoderInitStatus</a> init_ogg(<span class="keyword">const</span> std::string &amp;filename);
cannam@86 155 00233 <span class="keyword">protected</span>:
cannam@86 156 00234 <span class="comment">// this is a dummy implementation to satisfy the pure virtual in Stream that is actually supplied internally by the C layer</span>
cannam@86 157 00235 <a class="code" href="group__flac__stream__decoder.html#ga52">virtual ::FLAC__StreamDecoderReadStatus</a> read_callback(FLAC__byte buffer[], size_t *bytes);
cannam@86 158 00236 <span class="keyword">private</span>:
cannam@86 159 00237 <span class="comment">// Private and undefined so you can't use them:</span>
cannam@86 160 00238 File(<span class="keyword">const</span> File &amp;);
cannam@86 161 00239 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> File &amp;);
cannam@86 162 00240 };
cannam@86 163 00241
cannam@86 164 00242 }
cannam@86 165 00243 }
cannam@86 166 00244
cannam@86 167 00245 <span class="preprocessor">#endif</span>
cannam@86 168 </pre></div>
cannam@86 169 <hr size="1">
cannam@86 170 <div class="copyright">
cannam@86 171 <!-- @@@ oh so hacky -->
cannam@86 172 <table>
cannam@86 173 <tr>
cannam@86 174 <td align="left">
cannam@86 175 Copyright (c) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
cannam@86 176 </td>
cannam@86 177 <td width="1%" align="right">
cannam@86 178 <a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=13478&amp;type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
cannam@86 179 </td>
cannam@86 180 </tr>
cannam@86 181 </table>
cannam@86 182 </div>
cannam@86 183 <!-- Copyright (c) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -->
cannam@86 184 <!-- Permission is granted to copy, distribute and/or modify this document -->
cannam@86 185 <!-- under the terms of the GNU Free Documentation License, Version 1.1 -->
cannam@86 186 <!-- or any later version published by the Free Software Foundation; -->
cannam@86 187 <!-- with no invariant sections. -->
cannam@86 188 <!-- A copy of the license can be found at http://www.gnu.org/copyleft/fdl.html -->
cannam@86 189 </body>
cannam@86 190 </html>