VedaLibSoundMP3/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.17 2004/01/23 09:41:32 rob 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_sync{
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 {
00053     long pid;
00054     int in;
00055     int out;
00056   } async;
00057 
00058   struct mad_decoder_sync *sync;
00059 
00060   void *cb_data;
00061 
00062   enum mad_flow (*input_func)(void *, struct mad_stream *);
00063   enum mad_flow (*header_func)(void *, struct mad_header const *);
00064   enum mad_flow (*filter_func)(void *,
00065                    struct mad_stream const *, struct mad_frame *);
00066   enum mad_flow (*output_func)(void *,
00067                    struct mad_header const *, struct mad_pcm *);
00068   enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
00069   enum mad_flow (*message_func)(void *, void *, unsigned int *);
00070 };
00071 
00072 void mad_decoder_init(struct mad_decoder *, void *,
00073               enum mad_flow (*)(void *, struct mad_stream *),
00074               enum mad_flow (*)(void *, struct mad_header const *),
00075               enum mad_flow (*)(void *,
00076                     struct mad_stream const *,
00077                     struct mad_frame *),
00078               enum mad_flow (*)(void *,
00079                     struct mad_header const *,
00080                     struct mad_pcm *),
00081               enum mad_flow (*)(void *,
00082                     struct mad_stream *,
00083                     struct mad_frame *),
00084               enum mad_flow (*)(void *, void *, unsigned int *));
00085 int mad_decoder_finish(struct mad_decoder *);
00086 
00087 # define mad_decoder_options(decoder, opts)  \
00088     ((void) ((decoder)->options = (opts)))
00089 
00090 int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
00091 int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
00092 
00093 # endif

      /\/\        4         N         k         !         N         D
                      _______  _ __ ___  _____            ___ _ _  ____
     ___________  __//___   /________  |/    / ___________\_______/    \
    /   _   _   \/   _     /    _   /      _/_/____/    _       __     /
   /    /   /       /     /    /    \      \/     /    /    \   \     /
  \\___/___/___/    ¯    _____/_____/       ______\___/_____/\________\\
               \________/_ ___ __ l____\      /elD!  
                 http://www.m4nkind.com \____/