streo mp3 player see: http://mbed.org/users/okini3939/notebook/I2S_AUDIO
Dependencies: FatFileSystemCpp I2SSlave TLV320 mbed
Fork of madplayer by
madplayer/decoder.h@5:50015f4868e2, 2013-07-26 (annotated)
- Committer:
- okini3939
- Date:
- Fri Jul 26 15:02:49 2013 +0000
- Revision:
- 5:50015f4868e2
- Parent:
- 4:30b2cf4a8ee2
fix
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Gruenfrosch | 0:7627c79db971 | 1 | /* |
Gruenfrosch | 0:7627c79db971 | 2 | * libmad - MPEG audio decoder library |
Gruenfrosch | 0:7627c79db971 | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
Gruenfrosch | 0:7627c79db971 | 4 | * |
Gruenfrosch | 0:7627c79db971 | 5 | * This program is free software; you can redistribute it and/or modify |
Gruenfrosch | 0:7627c79db971 | 6 | * it under the terms of the GNU General Public License as published by |
Gruenfrosch | 0:7627c79db971 | 7 | * the Free Software Foundation; either version 2 of the License, or |
Gruenfrosch | 0:7627c79db971 | 8 | * (at your option) any later version. |
Gruenfrosch | 0:7627c79db971 | 9 | * |
Gruenfrosch | 0:7627c79db971 | 10 | * This program is distributed in the hope that it will be useful, |
Gruenfrosch | 0:7627c79db971 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Gruenfrosch | 0:7627c79db971 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Gruenfrosch | 0:7627c79db971 | 13 | * GNU General Public License for more details. |
Gruenfrosch | 0:7627c79db971 | 14 | * |
Gruenfrosch | 0:7627c79db971 | 15 | * You should have received a copy of the GNU General Public License |
Gruenfrosch | 0:7627c79db971 | 16 | * along with this program; if not, write to the Free Software |
Gruenfrosch | 0:7627c79db971 | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Gruenfrosch | 0:7627c79db971 | 18 | * |
Gruenfrosch | 0:7627c79db971 | 19 | * $Id: decoder.h,v 1.1 2010/11/23 20:12:57 andy Exp $ |
Gruenfrosch | 0:7627c79db971 | 20 | */ |
Gruenfrosch | 0:7627c79db971 | 21 | |
Gruenfrosch | 0:7627c79db971 | 22 | # ifndef LIBMAD_DECODER_H |
Gruenfrosch | 0:7627c79db971 | 23 | # define LIBMAD_DECODER_H |
Gruenfrosch | 0:7627c79db971 | 24 | |
Gruenfrosch | 0:7627c79db971 | 25 | # include "stream.h" |
Gruenfrosch | 0:7627c79db971 | 26 | # include "frame.h" |
Gruenfrosch | 0:7627c79db971 | 27 | # include "synth.h" |
Gruenfrosch | 0:7627c79db971 | 28 | |
Gruenfrosch | 0:7627c79db971 | 29 | enum mad_decoder_mode { |
Gruenfrosch | 0:7627c79db971 | 30 | MAD_DECODER_MODE_SYNC = 0, |
Gruenfrosch | 0:7627c79db971 | 31 | MAD_DECODER_MODE_ASYNC |
Gruenfrosch | 0:7627c79db971 | 32 | }; |
Gruenfrosch | 0:7627c79db971 | 33 | |
Gruenfrosch | 0:7627c79db971 | 34 | enum mad_flow { |
Gruenfrosch | 0:7627c79db971 | 35 | MAD_FLOW_CONTINUE = 0x0000, /* continue normally */ |
Gruenfrosch | 0:7627c79db971 | 36 | MAD_FLOW_STOP = 0x0010, /* stop decoding normally */ |
Gruenfrosch | 0:7627c79db971 | 37 | MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */ |
Gruenfrosch | 0:7627c79db971 | 38 | MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */ |
Gruenfrosch | 0:7627c79db971 | 39 | }; |
Gruenfrosch | 0:7627c79db971 | 40 | |
Gruenfrosch | 0:7627c79db971 | 41 | struct mad_sync_s { |
Gruenfrosch | 0:7627c79db971 | 42 | struct mad_stream stream; |
Gruenfrosch | 0:7627c79db971 | 43 | struct mad_frame frame; |
Gruenfrosch | 0:7627c79db971 | 44 | struct mad_synth *synth; |
Gruenfrosch | 0:7627c79db971 | 45 | }; |
Gruenfrosch | 0:7627c79db971 | 46 | |
Gruenfrosch | 0:7627c79db971 | 47 | struct mad_decoder { |
Gruenfrosch | 0:7627c79db971 | 48 | enum mad_decoder_mode mode; |
Gruenfrosch | 0:7627c79db971 | 49 | |
Gruenfrosch | 0:7627c79db971 | 50 | int options; |
Gruenfrosch | 0:7627c79db971 | 51 | |
Gruenfrosch | 0:7627c79db971 | 52 | struct mad_sync_s *sync; |
Gruenfrosch | 0:7627c79db971 | 53 | |
Gruenfrosch | 0:7627c79db971 | 54 | void *cb_data; |
Gruenfrosch | 0:7627c79db971 | 55 | |
Gruenfrosch | 0:7627c79db971 | 56 | enum mad_flow (*input_func)(void *, struct mad_stream *); |
Gruenfrosch | 0:7627c79db971 | 57 | enum mad_flow (*header_func)(void *, struct mad_header const *); |
Gruenfrosch | 0:7627c79db971 | 58 | enum mad_flow (*filter_func)(void *, |
Gruenfrosch | 0:7627c79db971 | 59 | struct mad_stream const *, struct mad_frame *); |
Gruenfrosch | 0:7627c79db971 | 60 | enum mad_flow (*output_func)(void *, |
Gruenfrosch | 0:7627c79db971 | 61 | struct mad_header const *, struct mad_pcm *); |
Gruenfrosch | 0:7627c79db971 | 62 | enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); |
Gruenfrosch | 0:7627c79db971 | 63 | enum mad_flow (*message_func)(void *, void *, unsigned int *); |
Gruenfrosch | 0:7627c79db971 | 64 | }; |
Gruenfrosch | 0:7627c79db971 | 65 | |
Gruenfrosch | 0:7627c79db971 | 66 | void mad_decoder_init(struct mad_decoder *, void *, |
Gruenfrosch | 0:7627c79db971 | 67 | enum mad_flow (*)(void *, struct mad_stream *), |
Gruenfrosch | 0:7627c79db971 | 68 | enum mad_flow (*)(void *, struct mad_header const *), |
Gruenfrosch | 0:7627c79db971 | 69 | enum mad_flow (*)(void *, |
Gruenfrosch | 0:7627c79db971 | 70 | struct mad_stream const *, |
Gruenfrosch | 0:7627c79db971 | 71 | struct mad_frame *), |
Gruenfrosch | 0:7627c79db971 | 72 | enum mad_flow (*)(void *, |
Gruenfrosch | 0:7627c79db971 | 73 | struct mad_header const *, |
Gruenfrosch | 0:7627c79db971 | 74 | struct mad_pcm *), |
Gruenfrosch | 0:7627c79db971 | 75 | enum mad_flow (*)(void *, |
Gruenfrosch | 0:7627c79db971 | 76 | struct mad_stream *, |
Gruenfrosch | 0:7627c79db971 | 77 | struct mad_frame *), |
Gruenfrosch | 0:7627c79db971 | 78 | enum mad_flow (*)(void *, void *, unsigned int *)); |
Gruenfrosch | 0:7627c79db971 | 79 | int mad_decoder_finish(struct mad_decoder *); |
Gruenfrosch | 0:7627c79db971 | 80 | |
Gruenfrosch | 0:7627c79db971 | 81 | # define mad_decoder_options(decoder, opts) \ |
Gruenfrosch | 0:7627c79db971 | 82 | ((void) ((decoder)->options = (opts))) |
Gruenfrosch | 0:7627c79db971 | 83 | |
Gruenfrosch | 0:7627c79db971 | 84 | int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode); |
Gruenfrosch | 0:7627c79db971 | 85 | int mad_decoder_message(struct mad_decoder *, void *, unsigned int *); |
Gruenfrosch | 0:7627c79db971 | 86 | |
Gruenfrosch | 0:7627c79db971 | 87 | # endif |