decoder.h

00001 /*
00002  * libmad - MPEG audio decoder library
00003  * Copyright (C) 2000-2003 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 2003/08/31 18:59:46 gabest 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_decoder {
00042   enum mad_decoder_mode mode;
00043 
00044   int options;
00045 
00046   struct {
00047     long pid;
00048     int in;
00049     int out;
00050   } async;
00051 
00052   struct {
00053     struct mad_stream stream;
00054     struct mad_frame frame;
00055     struct mad_synth synth;
00056   } *sync;
00057 
00058   void *cb_data;
00059 
00060   enum mad_flow (*input_func)(void *, struct mad_stream *);
00061   enum mad_flow (*header_func)(void *, struct mad_header const *);
00062   enum mad_flow (*filter_func)(void *,
00063                                struct mad_stream const *, struct mad_frame *);
00064   enum mad_flow (*output_func)(void *,
00065                                struct mad_header const *, struct mad_pcm *);
00066   enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
00067   enum mad_flow (*message_func)(void *, void *, unsigned int *);
00068 };
00069 
00070 void mad_decoder_init(struct mad_decoder *, void *,
00071                       enum mad_flow (*)(void *, struct mad_stream *),
00072                       enum mad_flow (*)(void *, struct mad_header const *),
00073                       enum mad_flow (*)(void *,
00074                                         struct mad_stream const *,
00075                                         struct mad_frame *),
00076                       enum mad_flow (*)(void *,
00077                                         struct mad_header const *,
00078                                         struct mad_pcm *),
00079                       enum mad_flow (*)(void *,
00080                                         struct mad_stream *,
00081                                         struct mad_frame *),
00082                       enum mad_flow (*)(void *, void *, unsigned int *));
00083 int mad_decoder_finish(struct mad_decoder *);
00084 
00085 # define mad_decoder_options(decoder, opts)  \
00086     ((void) ((decoder)->options = (opts)))
00087 
00088 int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
00089 int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
00090 
00091 # endif

Generated on Tue Dec 13 14:47:30 2005 for guliverkli by  doxygen 1.4.5