00001 /* 00002 Copyright (c) 2005-2009, The Musepack Development Team 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions are 00007 met: 00008 00009 * Redistributions of source code must retain the above copyright 00010 notice, this list of conditions and the following disclaimer. 00011 00012 * Redistributions in binary form must reproduce the above 00013 copyright notice, this list of conditions and the following 00014 disclaimer in the documentation and/or other materials provided 00015 with the distribution. 00016 00017 * Neither the name of the The Musepack Development Team nor the 00018 names of its contributors may be used to endorse or promote 00019 products derived from this software without specific prior 00020 written permission. 00021 00022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00025 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00026 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00027 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00028 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00029 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00030 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00031 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00032 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 */ 00035 #ifndef _MPCDEC_READER_H_ 00036 #define _MPCDEC_READER_H_ 00037 #ifdef WIN32 00038 #pragma once 00039 #endif 00040 00041 #include <mpc/mpc_types.h> 00042 #include <stdio.h> 00043 00044 #ifdef __cplusplus 00045 extern "C" { 00046 #endif 00047 00048 00054 typedef struct mpc_reader_t mpc_reader; 00055 struct mpc_reader_t { 00057 mpc_int32_t (*read)(mpc_reader *p_reader, void *ptr, mpc_int32_t size); 00058 00060 mpc_bool_t (*seek)(mpc_reader *p_reader, mpc_int32_t offset); 00061 00063 mpc_int32_t (*tell)(mpc_reader *p_reader); 00064 00066 mpc_int32_t (*get_size)(mpc_reader *p_reader); 00067 00069 mpc_bool_t (*canseek)(mpc_reader *p_reader); 00070 00073 void *data; 00074 }; 00075 00081 MPC_API mpc_status mpc_reader_init_stdio(mpc_reader *p_reader, const char *filename); 00082 00088 MPC_API mpc_status mpc_reader_init_stdio_stream(mpc_reader * p_reader, FILE * p_file); 00089 00093 MPC_API void mpc_reader_exit_stdio(mpc_reader *p_reader); 00094 00095 #ifdef __cplusplus 00096 } 00097 #endif 00098 #endif