Chris@0: /* Chris@0: * libmad - MPEG audio decoder library Chris@0: * Copyright (C) 2000-2004 Underbit Technologies, Inc. Chris@0: * Chris@0: * This program is free software; you can redistribute it and/or modify Chris@0: * it under the terms of the GNU General Public License as published by Chris@0: * the Free Software Foundation; either version 2 of the License, or Chris@0: * (at your option) any later version. Chris@0: * Chris@0: * This program is distributed in the hope that it will be useful, Chris@0: * but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Chris@0: * GNU General Public License for more details. Chris@0: * Chris@0: * You should have received a copy of the GNU General Public License Chris@0: * along with this program; if not, write to the Free Software Chris@0: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Chris@0: * Chris@0: * $Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp $ Chris@0: */ Chris@0: Chris@0: # ifndef LIBMAD_DECODER_H Chris@0: # define LIBMAD_DECODER_H Chris@0: Chris@0: # include "stream.h" Chris@0: # include "frame.h" Chris@0: # include "synth.h" Chris@0: Chris@0: enum mad_decoder_mode { Chris@0: MAD_DECODER_MODE_SYNC = 0, Chris@0: MAD_DECODER_MODE_ASYNC Chris@0: }; Chris@0: Chris@0: enum mad_flow { Chris@0: MAD_FLOW_CONTINUE = 0x0000, /* continue normally */ Chris@0: MAD_FLOW_STOP = 0x0010, /* stop decoding normally */ Chris@0: MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */ Chris@0: MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */ Chris@0: }; Chris@0: Chris@0: struct mad_decoder { Chris@0: enum mad_decoder_mode mode; Chris@0: Chris@0: int options; Chris@0: Chris@0: struct { Chris@0: long pid; Chris@0: int in; Chris@0: int out; Chris@0: } async; Chris@0: Chris@0: struct { Chris@0: struct mad_stream stream; Chris@0: struct mad_frame frame; Chris@0: struct mad_synth synth; Chris@0: } *sync; Chris@0: Chris@0: void *cb_data; Chris@0: Chris@0: enum mad_flow (*input_func)(void *, struct mad_stream *); Chris@0: enum mad_flow (*header_func)(void *, struct mad_header const *); Chris@0: enum mad_flow (*filter_func)(void *, Chris@0: struct mad_stream const *, struct mad_frame *); Chris@0: enum mad_flow (*output_func)(void *, Chris@0: struct mad_header const *, struct mad_pcm *); Chris@0: enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); Chris@0: enum mad_flow (*message_func)(void *, void *, unsigned int *); Chris@0: }; Chris@0: Chris@0: void mad_decoder_init(struct mad_decoder *, void *, Chris@0: enum mad_flow (*)(void *, struct mad_stream *), Chris@0: enum mad_flow (*)(void *, struct mad_header const *), Chris@0: enum mad_flow (*)(void *, Chris@0: struct mad_stream const *, Chris@0: struct mad_frame *), Chris@0: enum mad_flow (*)(void *, Chris@0: struct mad_header const *, Chris@0: struct mad_pcm *), Chris@0: enum mad_flow (*)(void *, Chris@0: struct mad_stream *, Chris@0: struct mad_frame *), Chris@0: enum mad_flow (*)(void *, void *, unsigned int *)); Chris@0: int mad_decoder_finish(struct mad_decoder *); Chris@0: Chris@0: # define mad_decoder_options(decoder, opts) \ Chris@0: ((void) ((decoder)->options = (opts))) Chris@0: Chris@0: int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode); Chris@0: int mad_decoder_message(struct mad_decoder *, void *, unsigned int *); Chris@0: Chris@0: # endif