Make repeat mode/shuffle work in the sbs also
[maemo-rb.git] / apps / codecs / libmusepack / reader.h
blobc46844cd59f1e213adfb52fc43c1718f2adcf885
1 /*
2 Copyright (c) 2005-2009, 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.
34 /// \file reader.h
35 #ifndef _MPCDEC_READER_H_
36 #define _MPCDEC_READER_H_
37 #ifdef WIN32
38 #pragma once
39 #endif
41 #include "mpc_types.h"
42 #include <stdio.h>
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
49 /// \brief Stream reader interface structure.
50 ///
51 /// This is the structure you must supply to the musepack decoding library
52 /// to feed it with raw data. Implement the five member functions to provide
53 /// a functional reader.
54 typedef struct mpc_reader_t mpc_reader;
55 struct mpc_reader_t {
56 /// Reads size bytes of data into buffer at ptr.
57 mpc_int32_t (*read)(mpc_reader *p_reader, void *ptr, mpc_int32_t size);
59 /// Seeks to byte position offset.
60 mpc_bool_t (*seek)(mpc_reader *p_reader, mpc_int32_t offset);
62 /// Returns the current byte offset in the stream.
63 mpc_int32_t (*tell)(mpc_reader *p_reader);
65 /// Returns the total length of the source stream, in bytes.
66 mpc_int32_t (*get_size)(mpc_reader *p_reader);
68 /* rockbox: not used
69 /// True if the stream is a seekable stream.
70 mpc_bool_t (*canseek)(mpc_reader *p_reader);
72 /// Field that can be used to identify a particular instance of
73 /// reader or carry along data associated with that reader.
74 void *data;
77 /* rockbox: not used
78 /// Initializes reader with default stdio file reader implementation. Use
79 /// this if you're just reading from a plain file.
80 ///
81 /// \param r p_reader handle to initialize
82 /// \param filename input filename to attach to the reader
83 MPC_API mpc_status mpc_reader_init_stdio(mpc_reader *p_reader, const char *filename);
85 /// Initializes reader with default stdio file reader implementation. Use
86 /// this if you prefer to open the file yourself.
87 ///
88 /// \param r p_reader handle to initialize
89 /// \param p_file input file handle (already open)
90 MPC_API mpc_status mpc_reader_init_stdio_stream(mpc_reader * p_reader, FILE * p_file);
92 /// Release reader with default stdio file reader implementation.
93 ///
94 /// \param r reader handle to release
95 MPC_API void mpc_reader_exit_stdio(mpc_reader *p_reader);
97 #ifdef __cplusplus
99 #endif
100 #endif