FileDocCategorySizeDatePackage
NativeDecoder.javaAPI DocFobs4JMF API 0.4.13930Wed Jan 10 11:08:36 GMT 2007com.omnividea.media.codec.audio

NativeDecoder

public class NativeDecoder extends AudioCodec
FOBS Java CrossPlatform JMF PlugIn Copyright (c) 2004 Omnividea Multimedia S.L Coded by Jose San Pedro Wandelmer This file is part of FOBS. FOBS is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. FOBS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with FOBS; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Fields Summary
Constructors Summary
public NativeDecoder()

    inputFormats = new Format[] { new AudioFormat("FFMPEG_AUDIO") };
  
Methods Summary
public voidclose()


     
public java.lang.StringgetName()

    return "NULL Fobs Audio Codec";
  
public javax.media.Format[]getSupportedOutputFormats(javax.media.Format in)


       if (in == null)
           return new Format[] { new AudioFormat(AudioFormat.LINEAR) };

       AudioFormat af =(AudioFormat) in;

       return new Format[] {
           new WavAudioFormat(AudioFormat.LINEAR,
                              af.getSampleRate(),
                              af.getSampleSizeInBits(),
                              af.getChannels(),
                              af.getFrameSizeInBits(),
                              (int)(af.getFrameSizeInBits() * af.getSampleRate()/8),
                              af.getEndian(),
                              af.getSigned(),
                              (float)af.getFrameRate(), // No FRAME_RATE specified
                              af.getDataType(),
                              new byte[0])
       };
     
public voidopen()


     
public intprocess(javax.media.Buffer inputBuffer, javax.media.Buffer outputBuffer)

         if (!checkInputBuffer(inputBuffer) ) {
             return BUFFER_PROCESSED_FAILED;
         }

         if (isEOM(inputBuffer) ) {
             propagateEOM(outputBuffer);
             return BUFFER_PROCESSED_OK;
         }

         Object outData = outputBuffer.getData();
         outputBuffer.setData(inputBuffer.getData());
         inputBuffer.setData(outData);
         outputBuffer.setLength(inputBuffer.getLength());
         outputBuffer.setFormat(outputFormat);
         outputBuffer.setOffset(inputBuffer.getOffset());
         return BUFFER_PROCESSED_OK;


     
public javax.media.FormatsetInputFormat(javax.media.Format format)


      if (super.setInputFormat(format) != null) {

        AudioFormat af =(AudioFormat)format;

        outputFormat =            new WavAudioFormat(AudioFormat.LINEAR,
                              af.getSampleRate(),
                              af.getSampleSizeInBits(),
                              af.getChannels(),
                              af.getFrameSizeInBits(),
                              (int)(af.getFrameSizeInBits() * af.getSampleRate()/8),
                              af.getEndian(),
                              af.getSigned(),
                              (float)af.getFrameRate(), // No FRAME_RATE specified
                              af.getDataType(),
                              new byte[0]);

        return format;
      }
      else
      {
        return null;
      }