Package org.robolectric.shadows
Class ShadowMediaMuxer
java.lang.Object
org.robolectric.shadows.ShadowMediaMuxer
@Implements(value=android.media.MediaMuxer.class, minSdk=21) public class ShadowMediaMuxer extends Object
Implementation of
MediaMuxer which directly passes input bytes to the
specified file, with no modification.-
Constructor Summary
Constructors Constructor Description ShadowMediaMuxer() -
Method Summary
Modifier and Type Method Description protected void__constructor__(String path, int format)Opens a FileOutputStream for the given path, and sets muxer state.protected static intnativeAddTrack(long nativeObject, String[] keys, Object[] values)Returns an incremented track id for the associated muxer.protected static longnativeSetup(FileDescriptor fd, int format)Generates and returns an internal id to track the FileOutputStream corresponding to individual MediaMuxer instances.protected static voidnativeStop(long nativeObject)Closes the FileOutputStream for the associated muxer.protected static voidnativeWriteSampleData(long nativeObject, int trackIndex, ByteBuffer byteBuf, int offset, int size, long presentationTimeUs, int flags)Writes the given data to the FileOutputStream for the associated muxer.
-
Constructor Details
-
ShadowMediaMuxer
public ShadowMediaMuxer()
-
-
Method Details
-
__constructor__
Opens a FileOutputStream for the given path, and sets muxer state.This needs to be shadowed, because the current MediaMuxer constructor opens a RandomAccessFile, passes only the FileDescriptor along, and then closes the file. Since there does not appear to be an easy way to go from FileDescriptor to a writeable stream in Java, this method overrides that behavior to instead open and maintain a FileOutputStream.
- Throws:
IOException
-
nativeSetup
@Implementation protected static long nativeSetup(FileDescriptor fd, int format) throws IOExceptionGenerates and returns an internal id to track the FileOutputStream corresponding to individual MediaMuxer instances.- Throws:
IOException
-
nativeAddTrack
@Implementation protected static int nativeAddTrack(long nativeObject, String[] keys, Object[] values)Returns an incremented track id for the associated muxer. -
nativeWriteSampleData
@Implementation protected static void nativeWriteSampleData(long nativeObject, int trackIndex, ByteBuffer byteBuf, int offset, int size, long presentationTimeUs, int flags)Writes the given data to the FileOutputStream for the associated muxer. -
nativeStop
Closes the FileOutputStream for the associated muxer.
-