Class MediaInput
java.lang.Object
javaforce.media.MediaCoder
javaforce.media.MediaFormat
javaforce.media.MediaInput
- All Implemented Interfaces:
MediaIO
-
Field Summary
Fields inherited from class MediaCoder
AUDIO_FRAME, AV_CODEC_ID_AAC, AV_CODEC_ID_AC3, AV_CODEC_ID_DEFAULT, AV_CODEC_ID_FLAC, AV_CODEC_ID_GSM_MS, AV_CODEC_ID_H263, AV_CODEC_ID_H264, AV_CODEC_ID_H265, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3, AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO, AV_CODEC_ID_MPEG4, AV_CODEC_ID_NONE, AV_CODEC_ID_OPUS, AV_CODEC_ID_PCM_S16LE, AV_CODEC_ID_SPEEX, AV_CODEC_ID_THEORA, AV_CODEC_ID_VORBIS, AV_CODEC_ID_VP8, AV_CODEC_ID_VP9, AV_FORMAT_ID_AVI, AV_FORMAT_ID_MKV, AV_FORMAT_ID_MOV, AV_FORMAT_ID_MP1, AV_FORMAT_ID_MP2, AV_FORMAT_ID_MP4, AV_FORMAT_ID_OGG, AV_FORMAT_ID_WAV, AV_FORMAT_ID_WEBM, ctx, debug, END_FRAME, NULL_FRAME, PROFILE_BASELINE, PROFILE_HIGH, PROFILE_MAIN, SEEK_CUR, SEEK_END, SEEK_SET, shared, VIDEO_FRAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanclose()Closes media file and frees resources.Create audio decoder.createAudioDecoder(int chs, int freq) Create audio decoder.Create video decoder.createVideoDecoder(int width, int height) Create video decoder.intgetAudioChannels(long ctx) intgetAudioSampleRate(long ctx) Returns media video/audio codec info.longgetDuration(long ctx) intgetPacketData(long ctx, byte[] data, int offset, int length) Copies next packet into data and returns stream.booleangetPacketKeyFrame(long ctx) Returns next packet key frame flag.floatgetVideoFrameRate(long ctx) intgetVideoHeight(long ctx) intgetVideoKeyFrameInterval(long ctx) intgetVideoWidth(long ctx) booleanOpens media file for decoding.booleanOpens media using user supplied MediaIO for decoding.intread(byte[] data) Request to read data.intread(long ctx) Reads next packet and returns size.Reads next packet.booleanseek(long seconds) Seek media to time in seconds.longseek(long pos, int how) Request to seek file.intwrite(byte[] data) Request to write data.Methods inherited from class MediaFormat
getAudioBitRate, getAudioCodecID, getAudioStream, getVideoBitRate, getVideoCodecID, getVideoStreamMethods inherited from class MediaCoder
getStream, init, isRunning, setLogging, setStream
-
Constructor Details
-
MediaInput
public MediaInput()
-
-
Method Details
-
open
-
read
-
write
-
seek
-
open
Opens media using user supplied MediaIO for decoding. -
getDuration
public long getDuration(long ctx) -
getVideoWidth
public int getVideoWidth(long ctx) -
getVideoHeight
public int getVideoHeight(long ctx) -
getVideoFrameRate
public float getVideoFrameRate(long ctx) -
getVideoKeyFrameInterval
public int getVideoKeyFrameInterval(long ctx) -
getAudioChannels
public int getAudioChannels(long ctx) -
getAudioSampleRate
public int getAudioSampleRate(long ctx) -
getCodecInfo
Returns media video/audio codec info. -
close
public boolean close()Closes media file and frees resources. -
createVideoDecoder
Create video decoder.- Parameters:
width- = desired width (-1 = no conversion)height- = desired height (-1 = no conversion)
-
createVideoDecoder
Create video decoder. -
createAudioDecoder
Create audio decoder.- Parameters:
chs- = desired channels (-1 = no conversion)freq- = desired sample rate (-1 = no conversion)
-
createAudioDecoder
Create audio decoder. -
read
public int read(long ctx) Reads next packet and returns size. Used internally by readPacket(). -
getPacketKeyFrame
public boolean getPacketKeyFrame(long ctx) Returns next packet key frame flag. Used internally by readPacket(). -
getPacketData
public int getPacketData(long ctx, byte[] data, int offset, int length) Copies next packet into data and returns stream. Used internally by readPacket(). -
readPacket
Reads next packet. Packet.stream will indicate which stream it is. -
seek
public boolean seek(long seconds) Seek media to time in seconds.
-