package cn.i2edu.dubbing_lib.audioUtils;

import java.io.IOException;

/**
 * -��Ƶ������
 */
public abstract class AudioDecoder {

    final String mEncodeFile;

    OnAudioDecoderListener mOnAudioDecoderListener;

    AudioDecoder(String encodefile) {
        this.mEncodeFile = encodefile;
    }

    public static AudioDecoder createDefualtDecoder(String encodefile) {
        return new AndroidAudioDecoder(encodefile);
    }

    public void setOnAudioDecoderListener(OnAudioDecoderListener l) {
        this.mOnAudioDecoderListener = l;
    }

    public abstract RawAudioInfo decodeToFile(String outFile)
            throws IOException;

    public static class RawAudioInfo {
        public String tempRawFile;
        public int size;
        public long sampleRate;
        public int channel;
    }

    public interface OnAudioDecoderListener {
        void onDecode(byte[] decodedBytes, double progress) throws IOException;
    }
}
