libmpcdec  1.2.2
reader.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2005-2009, The Musepack Development Team
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are
7  met:
8 
9  * Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11 
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.
16 
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.
21 
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.
33 */
35 #ifndef _MPCDEC_READER_H_
36 #define _MPCDEC_READER_H_
37 #ifdef WIN32
38 #pragma once
39 #endif
40 
41 #include <mpc/mpc_types.h>
42 #include <stdio.h>
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 
54 typedef struct mpc_reader_t mpc_reader;
55 struct mpc_reader_t {
57  mpc_int32_t (*read)(mpc_reader *p_reader, void *ptr, mpc_int32_t size);
58 
60  mpc_bool_t (*seek)(mpc_reader *p_reader, mpc_int32_t offset);
61 
63  mpc_int32_t (*tell)(mpc_reader *p_reader);
64 
66  mpc_int32_t (*get_size)(mpc_reader *p_reader);
67 
69  mpc_bool_t (*canseek)(mpc_reader *p_reader);
70 
73  void *data;
74 };
75 
81 MPC_API mpc_status mpc_reader_init_stdio(mpc_reader *p_reader, const char *filename);
82 
88 MPC_API mpc_status mpc_reader_init_stdio_stream(mpc_reader * p_reader, FILE * p_file);
89 
93 MPC_API void mpc_reader_exit_stdio(mpc_reader *p_reader);
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 #endif
mpc_int32_t(* get_size)(mpc_reader *p_reader)
Returns the total length of the source stream, in bytes.
Definition: reader.h:66
void * data
Definition: reader.h:73
mpc_bool_t(* seek)(mpc_reader *p_reader, mpc_int32_t offset)
Seeks to byte position offset.
Definition: reader.h:60
MPC_API void mpc_reader_exit_stdio(mpc_reader *p_reader)
MPC_API mpc_status mpc_reader_init_stdio_stream(mpc_reader *p_reader, FILE *p_file)
mpc_int32_t(* read)(mpc_reader *p_reader, void *ptr, mpc_int32_t size)
Reads size bytes of data into buffer at ptr.
Definition: reader.h:57
MPC_API mpc_status mpc_reader_init_stdio(mpc_reader *p_reader, const char *filename)
mpc_int32_t(* tell)(mpc_reader *p_reader)
Returns the current byte offset in the stream.
Definition: reader.h:63
mpc_bool_t(* canseek)(mpc_reader *p_reader)
True if the stream is a seekable stream.
Definition: reader.h:69