Examples of FLACDecoder


Examples of org.kc7bfi.jflac.FLACDecoder

  private Object locked = new Object();
  private boolean seeking = false;

  public FLACFileDecoder(AudioStream in) {
    this.in = in;
    decoder = new FLACDecoder(in);
    try {
      streamInfo = decoder.readStreamInfo();
      //metaDataLength = streamInfo.getLength() + 8;
      Metadata metadata;
          do {
View Full Code Here

Examples of org.kc7bfi.jflac.FLACDecoder

    public void parse( final File file ) throws IOException {
       
        FileInputStream in = null;
        try {
            in = new FileInputStream( file );
            final FLACDecoder dec = new FLACDecoder( in );

            Metadata[] metadata = dec.readMetadata( dec.readStreamInfo() );

            // look for the vorbis comment
            for ( final Metadata item : metadata ) {

                if ( item.getClass().equals(VorbisComment.class) ) {
View Full Code Here

Examples of org.kc7bfi.jflac.FLACDecoder

    public int open(RandomAccessFile input) {
        this.input = input;
        oy.clear();
        oy.init();
        inputStream = new OggInputStream();
        decoder = new FLACDecoder(inputStream);
        long end = 0;
        try {
            end = input.length();
        } catch (IOException e) {
            e.printStackTrace();
View Full Code Here

Examples of org.kc7bfi.jflac.FLACDecoder

         frameRate = ((float) sampleRate)
         / ((mode == 0 ? 160f : (mode == 1 ? 320f : 640f)) * ((float) nframes));
         }
         */
        try {
            decoder = new FLACDecoder(bitStream);
            streamInfo = decoder.readStreamInfo();
            if (streamInfo == null) {
                if (DEBUG) {
                    System.out.println("FLAC file reader: no stream info found");
                }
View Full Code Here

Examples of org.kc7bfi.jflac.FLACDecoder

    public void decode(String inFileName, String outFileName) throws IOException {
        System.out.println("Decode [" + inFileName + "][" + outFileName + "]");
        FileInputStream is = new FileInputStream(inFileName);
        FileOutputStream os = new FileOutputStream(outFileName);
        wav = new WavWriter(os);
        FLACDecoder decoder = new FLACDecoder(is);
        decoder.addPCMProcessor(this);
        decoder.decode();
    }
View Full Code Here

Examples of org.kc7bfi.jflac.FLACDecoder

     * @throws IOException thrown if error reading file
     */
    public void test(String inFileName) throws IOException {
        System.out.println("FLAX Tester for " + inFileName);
        FileInputStream is = new FileInputStream(inFileName);
        FLACDecoder decoder = new FLACDecoder(is);
        decoder.addFrameListener(this);
        decoder.decode();
        System.out.println(errors + " errors found!");
    }
View Full Code Here

Examples of org.kc7bfi.jflac.FLACDecoder

        // process selected files
        for (int i = 0; i < flacFiles.size(); i++) {
            File file = (File) flacFiles.get(i);
            try {
                FileInputStream is = new FileInputStream(file);
                FLACDecoder decoder = new FLACDecoder(is);
                decoder.readMetadata();
                StreamInfo info = decoder.getStreamInfo();
                if (masterStreamInfo == null) {
                    masterStreamInfo = info;
                    masterStreamInfo.setTotalSamples(0);
                }
                if (!info.compatiable(masterStreamInfo)) {
                    appendMsg("Bad StreamInfo " + file + ": " + info);
                    continue;
                }
                masterStreamInfo.addTotalSamples(info.getTotalSamples());

                SeekPoint seekPoint = new SeekPoint(lastSampleNumber, lastStreamOffset, 0);
                //decoder.processMetadata();
                long frameStartOffs = decoder.getTotalBytesRead();
                PackerFile aFile = new PackerFile(file, seekPoint, frameStartOffs);
                albumFiles.add(aFile);
                //System.out.println("Do decode " +i);
                try {
                    decoder.decodeFrames();
                }
                catch (EOFException e) {
                    //appendMsg("File " + file + ": " + e);
                }
                //System.out.println("Done decode");
                long frameEndOffs = decoder.getTotalBytesRead();
                //appendMsg(frameStartOffs + " " + frameEndOffs + " " + decoder.getSamplesDecoded());
                lastSampleNumber += decoder.getSamplesDecoded();
                lastStreamOffset += frameEndOffs - frameStartOffs;
            }
            catch (FileNotFoundException e) {
                appendMsg("File " + file + ": " + e);
            }
View Full Code Here

Examples of org.kc7bfi.jflac.FLACDecoder

     */
    public void play(String inFileName, int fromSeekPoint, int toSeekPoint) throws IOException, LineUnavailableException {
        System.out.println("Play [" + inFileName + "]");
        RandomFileInputStream is = new RandomFileInputStream(inFileName);

        FLACDecoder decoder = new FLACDecoder(is);
        decoder.addPCMProcessor(this);
        decoder.addFrameListener(this);
        decoder.readMetadata();

        // see if SeekTbale exists
        if (seekTable == null) {
            System.out.println("Missing SeekTable!");
            return;
        }

        SeekPoint from = seekTable.getSeekPoint(fromSeekPoint);
        SeekPoint to = null;
        if (toSeekPoint + 1 < seekTable.numberOfPoints()) {
            to = seekTable.getSeekPoint(toSeekPoint + 1);
        }
        System.out.println("Seek From: " + from);
        System.out.println("Seek To  : " + to);
        decoder.decode(from, to);

        line.drain();
        line.close();
    }
View Full Code Here

Examples of org.kc7bfi.jflac.FLACDecoder

     */
    public void decode(String inFileName) throws IOException, LineUnavailableException {
//        System.out.println("Play [" + inFileName + "]");
        FileInputStream is = new FileInputStream(inFileName);

        FLACDecoder decoder = new FLACDecoder(is);
        decoder.addPCMProcessor(this);
        try {
            decoder.decode();
        }
        catch (EOFException e) {
            // skip
        }

View Full Code Here

Examples of org.kc7bfi.jflac.FLACDecoder

     * Initialize the Flac Decoder after reading the Header.
     *
     * @exception IOException
     */
    protected void initDecoder() throws IOException {
        decoder = new FLACDecoder(in);
        decoder.addPCMProcessor(this);
        metaData = decoder.readMetadata();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.