Package javaforce.media
Class Media
java.lang.Object
javaforce.media.Media
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanOpen existing file to writing.booleanclose()If file was created or appended an index table is written at end of file for fast seeking.booleanCreate new file for writing.booleanCreate new file for writing.intReturn # of all frames.Returns codec info that describes the media (optional).intReturn # of key frames.int[]Return stream IDs.longReturns timestamp of first frame.static voidUnit testing.booleanOpen existing file for reading.Read next Frame.booleanseekFrame(int frame) Seek to frame #.booleanseekTime(long ts) Seek to frame closest to timestamp.booleanwriteFrame(int stream, byte[] data, int offset, int length, long ts, boolean keyFrame) Write next frame.
-
Field Details
-
debug
public static boolean debug
-
-
Constructor Details
-
Media
public Media()
-
-
Method Details
-
open
Open existing file for reading. -
create
Create new file for writing. If file exists it is truncated. CodecInfo should contain information about audio/video format. -
create
Create new file for writing. If file exists it is truncated. -
append
Open existing file to writing. -
close
public boolean close()If file was created or appended an index table is written at end of file for fast seeking. -
getStreamIDs
public int[] getStreamIDs()Return stream IDs. -
getKeyFrameCount
public int getKeyFrameCount()Return # of key frames. -
getAllFrameCount
public int getAllFrameCount()Return # of all frames. -
getTimeBase
public long getTimeBase()Returns timestamp of first frame. -
getCodecInfo
Returns codec info that describes the media (optional). -
seekFrame
public boolean seekFrame(int frame) Seek to frame #. Seeking is not supported on files opened for writing (create() or append()). -
seekTime
public boolean seekTime(long ts) Seek to frame closest to timestamp. -
readFrame
Read next Frame. Do not modify fields in Packet.- Returns:
- frame = next frame or null at end of file or error
-
writeFrame
public boolean writeFrame(int stream, byte[] data, int offset, int length, long ts, boolean keyFrame) Write next frame.- Parameters:
stream- = stream indexdata- = raw codec dataoffset- = offset into datalength- = length of datats- = timestamp of framekeyFrame- = is frame a key frame?
-
main
Unit testing.
-