Call the oddly labelled button on the gigabeat remote "Menu" in the
[kugel-rb.git] / apps / codecs / libmusepack / reader.h
blob397319b2920898295632184c9b4c3ade0a5b044f
1 /*
2 Copyright (c) 2005, The Musepack Development Team
3 All rights reserved.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
9 * Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
12 * Redistributions in binary form must reproduce the above
13 copyright notice, this list of conditions and the following
14 disclaimer in the documentation and/or other materials provided
15 with the distribution.
17 * Neither the name of the The Musepack Development Team nor the
18 names of its contributors may be used to endorse or promote
19 products derived from this software without specific prior
20 written permission.
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 /// \file reader.h
37 #ifndef _mpcdec_reader_h_
38 #define _mpcdec_reader_h_
40 /// \brief Stream reader interface structure.
41 ///
42 /// This is the structure you must supply to the musepack decoding library
43 /// to feed it with raw data. Implement the five member functions to provide
44 /// a functional reader.
45 typedef struct mpc_reader_t {
46 /// Reads size bytes of data into buffer at ptr.
47 mpc_int32_t (*read)(void *t, void *ptr, mpc_int32_t size);
49 /// Seeks to byte position offset.
50 mpc_bool_t (*seek)(void *t, mpc_int32_t offset);
52 /// Returns the current byte offset in the stream.
53 mpc_int32_t (*tell)(void *t);
55 /// Returns the total length of the source stream, in bytes.
56 mpc_int32_t (*get_size)(void *t);
58 /// True if the stream is a seekable stream.
59 mpc_bool_t (*canseek)(void *t);
61 /// Field that can be used to identify a particular instance of
62 /// reader or carry along data associated with that reader.
63 void *data;
65 } mpc_reader;
66 /* No standard STDIO based reader in Rockbox
67 typedef struct mpc_reader_file_t {
68 mpc_reader reader;
70 FILE *file;
71 long file_size;
72 mpc_bool_t is_seekable;
73 } mpc_reader_file;
75 /// Initializes reader with default stdio file reader implementation. Use
76 /// this if you're just reading from a plain file.
77 ///
78 /// \param r reader struct to initalize
79 /// \param input input stream to attach to the reader
80 /* void mpc_reader_setup_file_reader(mpc_reader_file *r, FILE *input); */
82 #endif // _mpcdec_reader_h_