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 {
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