Class MediaFFM

java.lang.Object
javaforce.ffm.MediaFFM
All Implemented Interfaces:
MediaAPI

public class MediaFFM extends Object implements MediaAPI
  • Constructor Details

    • MediaFFM

      public MediaFFM()
  • Method Details

    • getInstance

      public static MediaFFM getInstance()
    • mediaLoadLibs

      public boolean mediaLoadLibs(String codec, String device, String filter, String format, String util, String scale, String postproc, String resample)
      Specified by:
      mediaLoadLibs in interface MediaAPI
    • mediaSetLogging

      public void mediaSetLogging(boolean state)
      Specified by:
      mediaSetLogging in interface MediaAPI
    • getVideoStream

      public int getVideoStream(long ctx)
      Specified by:
      getVideoStream in interface MediaAPI
    • getAudioStream

      public int getAudioStream(long ctx)
      Specified by:
      getAudioStream in interface MediaAPI
    • getVideoCodecID

      public int getVideoCodecID(long ctx)
      Specified by:
      getVideoCodecID in interface MediaAPI
    • getAudioCodecID

      public int getAudioCodecID(long ctx)
      Specified by:
      getAudioCodecID in interface MediaAPI
    • getVideoBitRate

      public int getVideoBitRate(long ctx)
      Specified by:
      getVideoBitRate in interface MediaAPI
    • getAudioBitRate

      public int getAudioBitRate(long ctx)
      Specified by:
      getAudioBitRate in interface MediaAPI
    • inputOpenFile

      public long inputOpenFile(String file, String format)
      Specified by:
      inputOpenFile in interface MediaAPI
    • inputOpenIO

      public long inputOpenIO(MediaIO io)
      Specified by:
      inputOpenIO in interface MediaAPI
    • getDuration

      public long getDuration(long ctx)
      Specified by:
      getDuration in interface MediaAPI
    • getVideoWidth

      public int getVideoWidth(long ctx)
      Specified by:
      getVideoWidth in interface MediaAPI
    • getVideoHeight

      public int getVideoHeight(long ctx)
      Specified by:
      getVideoHeight in interface MediaAPI
    • getVideoFrameRate

      public float getVideoFrameRate(long ctx)
      Specified by:
      getVideoFrameRate in interface MediaAPI
    • getVideoKeyFrameInterval

      public int getVideoKeyFrameInterval(long ctx)
      Specified by:
      getVideoKeyFrameInterval in interface MediaAPI
    • getAudioChannels

      public int getAudioChannels(long ctx)
      Specified by:
      getAudioChannels in interface MediaAPI
    • getAudioSampleRate

      public int getAudioSampleRate(long ctx)
      Specified by:
      getAudioSampleRate in interface MediaAPI
    • inputClose

      public boolean inputClose(long ctx)
      Specified by:
      inputClose in interface MediaAPI
    • inputOpenVideo

      public boolean inputOpenVideo(long ctx, int width, int height)
      Specified by:
      inputOpenVideo in interface MediaAPI
    • inputOpenAudio

      public boolean inputOpenAudio(long ctx, int chs, int freq)
      Specified by:
      inputOpenAudio in interface MediaAPI
    • inputRead

      public int inputRead(long ctx)
      Specified by:
      inputRead in interface MediaAPI
    • getPacketKeyFrame

      public boolean getPacketKeyFrame(long ctx)
      Specified by:
      getPacketKeyFrame in interface MediaAPI
    • getPacketData

      public int getPacketData(long ctx, byte[] data, int offset, int length)
      Specified by:
      getPacketData in interface MediaAPI
    • inputSeek

      public boolean inputSeek(long ctx, long seconds)
      Specified by:
      inputSeek in interface MediaAPI
    • outputCreateFile

      public long outputCreateFile(String file, String format)
      Specified by:
      outputCreateFile in interface MediaAPI
    • outputCreateIO

      public long outputCreateIO(MediaIO io, String format)
      Specified by:
      outputCreateIO in interface MediaAPI
    • addVideoStream

      public int addVideoStream(long ctx, int codec_id, int bit_rate, int width, int height, float fps, int keyFrameInterval)
      Specified by:
      addVideoStream in interface MediaAPI
    • addAudioStream

      public int addAudioStream(long ctx, int codec_id, int bit_rate, int chs, int freq)
      Specified by:
      addAudioStream in interface MediaAPI
    • outputClose

      public boolean outputClose(long ctx)
      Specified by:
      outputClose in interface MediaAPI
    • writeHeader

      public boolean writeHeader(long ctx)
      Specified by:
      writeHeader in interface MediaAPI
    • writePacket

      public boolean writePacket(long ctx, int stream, byte[] data, int offset, int length, boolean keyFrame)
      Specified by:
      writePacket in interface MediaAPI
    • audioDecoderStart

      public long audioDecoderStart(int codec_id, int new_chs, int new_freq)
      Specified by:
      audioDecoderStart in interface MediaAPI
    • audioDecoderStop

      public void audioDecoderStop(long ctx)
      Specified by:
      audioDecoderStop in interface MediaAPI
    • audioDecoderDecode

      public short[] audioDecoderDecode(long ctx, byte[] data, int offset, int length)
      Specified by:
      audioDecoderDecode in interface MediaAPI
    • audioDecoderGetChannels

      public int audioDecoderGetChannels(long ctx)
      Specified by:
      audioDecoderGetChannels in interface MediaAPI
    • audioDecoderGetSampleRate

      public int audioDecoderGetSampleRate(long ctx)
      Specified by:
      audioDecoderGetSampleRate in interface MediaAPI
    • audioDecoderChange

      public boolean audioDecoderChange(long ctx, int chs, int freq)
      Specified by:
      audioDecoderChange in interface MediaAPI
    • audioEncoderStart

      public long audioEncoderStart(int codec_id, int bit_rate, int chs, int freq)
      Specified by:
      audioEncoderStart in interface MediaAPI
    • audioEncoderStop

      public void audioEncoderStop(long ctx)
      Specified by:
      audioEncoderStop in interface MediaAPI
    • audioEncoderEncode

      public byte[] audioEncoderEncode(long ctx, short[] samples, int offset, int length)
      Specified by:
      audioEncoderEncode in interface MediaAPI
    • audioEncoderGetAudioFramesize

      public int audioEncoderGetAudioFramesize(long ctx)
      Specified by:
      audioEncoderGetAudioFramesize in interface MediaAPI
    • videoDecoderStart

      public long videoDecoderStart(int codec_id, int new_width, int new_height)
      Specified by:
      videoDecoderStart in interface MediaAPI
    • videoDecoderStop

      public void videoDecoderStop(long ctx)
      Specified by:
      videoDecoderStop in interface MediaAPI
    • videoDecoderDecode

      public int[] videoDecoderDecode(long ctx, byte[] data, int offset, int length)
      Specified by:
      videoDecoderDecode in interface MediaAPI
    • videoDecoderGetWidth

      public int videoDecoderGetWidth(long ctx)
      Specified by:
      videoDecoderGetWidth in interface MediaAPI
    • videoDecoderGetHeight

      public int videoDecoderGetHeight(long ctx)
      Specified by:
      videoDecoderGetHeight in interface MediaAPI
    • videoDecoderGetFrameRate

      public float videoDecoderGetFrameRate(long ctx)
      Specified by:
      videoDecoderGetFrameRate in interface MediaAPI
    • videoDecoderChange

      public boolean videoDecoderChange(long ctx, int width, int height)
      Specified by:
      videoDecoderChange in interface MediaAPI
    • videoEncoderStart

      public long videoEncoderStart(int codec_id, int bit_rate, int width, int height, float fps, int keyFrameInterval)
      Specified by:
      videoEncoderStart in interface MediaAPI
    • videoEncoderStop

      public void videoEncoderStop(long ctx)
      Specified by:
      videoEncoderStop in interface MediaAPI
    • videoEncoderEncode

      public byte[] videoEncoderEncode(long ctx, int[] px, int offset, int length)
      Specified by:
      videoEncoderEncode in interface MediaAPI
    • compareFrames

      public float compareFrames(int[] frame1, int[] frame2, int width, int height)
      Specified by:
      compareFrames in interface MediaAPI