00001 /* 00002 * libmad - MPEG audio decoder library 00003 * Copyright (C) 2000-2008 Underbit Technologies, Inc. 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * $Id: bit.h 88 2008-06-09 11:59:11Z mich $ 00020 */ 00026 # ifndef LIBMAD_BIT_H 00027 # define LIBMAD_BIT_H 00028 00029 struct mad_bitptr { 00030 unsigned char const *byte; 00031 unsigned short cache; 00032 unsigned short left; 00033 }; 00034 00035 void mad_bit_init(struct mad_bitptr *, unsigned char const *); 00036 00037 # define mad_bit_finish(bitptr) 00039 unsigned int mad_bit_length(struct mad_bitptr const *, 00040 struct mad_bitptr const *); 00041 00042 # define mad_bit_bitsleft(bitptr) ((bitptr)->left) 00043 unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); 00044 00045 void mad_bit_skip(struct mad_bitptr *, unsigned int); 00046 unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); 00047 void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long); 00048 00049 unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); 00050 00051 # endif