00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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,
00036 MAD_FLOW_STOP = 0x0010,
00037 MAD_FLOW_BREAK = 0x0011,
00038 MAD_FLOW_IGNORE = 0x0020
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