MP3 Player without external hardware MP3 Player without external hardware. A software based MP3 player based on a modified version of libmad. Mono output (at the moment) via AnalogOut. Files are read from an USB drive. This is a demo program, it plays only one file at the moment. Documentation is in "main.cpp" and "config.h"
decoder.h
00001 /* 00002 * libmad - MPEG audio decoder library 00003 * Copyright (C) 2000-2004 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: decoder.h,v 1.1 2010/11/23 20:12:57 andy Exp $ 00020 */ 00021 00022 # ifndef LIBMAD_DECODER_H 00023 # define LIBMAD_DECODER_H 00024 00025 # include "stream.h" 00026 # include "frame.h" 00027 # include "synth.h" 00028 00029 enum mad_decoder_mode { 00030 MAD_DECODER_MODE_SYNC = 0, 00031 MAD_DECODER_MODE_ASYNC 00032 }; 00033 00034 enum mad_flow { 00035 MAD_FLOW_CONTINUE = 0x0000, /* continue normally */ 00036 MAD_FLOW_STOP = 0x0010, /* stop decoding normally */ 00037 MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */ 00038 MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */ 00039 }; 00040 00041 struct mad_sync_s { 00042 struct mad_stream stream; 00043 struct mad_frame frame; 00044 struct mad_synth *synth; 00045 }; 00046 00047 struct mad_decoder { 00048 enum mad_decoder_mode mode; 00049 00050 int options; 00051 00052 struct mad_sync_s *sync; 00053 00054 void *cb_data; 00055 00056 enum mad_flow (*input_func)(void *, struct mad_stream *); 00057 enum mad_flow (*header_func)(void *, struct mad_header const *); 00058 enum mad_flow (*filter_func)(void *, 00059 struct mad_stream const *, struct mad_frame *); 00060 enum mad_flow (*output_func)(void *, 00061 struct mad_header const *, struct mad_pcm *); 00062 enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); 00063 enum mad_flow (*message_func)(void *, void *, unsigned int *); 00064 }; 00065 00066 void mad_decoder_init(struct mad_decoder *, void *, 00067 enum mad_flow (*)(void *, struct mad_stream *), 00068 enum mad_flow (*)(void *, struct mad_header const *), 00069 enum mad_flow (*)(void *, 00070 struct mad_stream const *, 00071 struct mad_frame *), 00072 enum mad_flow (*)(void *, 00073 struct mad_header const *, 00074 struct mad_pcm *), 00075 enum mad_flow (*)(void *, 00076 struct mad_stream *, 00077 struct mad_frame *), 00078 enum mad_flow (*)(void *, void *, unsigned int *)); 00079 int mad_decoder_finish(struct mad_decoder *); 00080 00081 # define mad_decoder_options(decoder, opts) \ 00082 ((void) ((decoder)->options = (opts))) 00083 00084 int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode); 00085 int mad_decoder_message(struct mad_decoder *, void *, unsigned int *); 00086 00087 # endif
Generated on Tue Jul 12 2022 23:11:09 by 1.7.2