
public class Muxer extends Container
| Modifier and Type | Class and Description |
|---|---|
static class |
Muxer.State
Muxers can only be in one of these states.
|
Container.Flag| Modifier and Type | Method and Description |
|---|---|
MuxerStream |
addNewStream(Coder coder)
Adds a new stream that will have packets written to it.
Note on thread safety: Callers must ensure that the coder is not encoding or decoding packets at the same time that Muxer#open or Muxer#close is being called. |
void |
close()
Close the muxer and write any trailers.
Note: Calls MUST call this method -- it will not automatically be called when the object is finalized as some muxers struggle when you write trailers on a different thread (the finalizer thread) than the header was written on. |
Muxer |
copyReference()
Create a new Muxer object that is actually referring to the
exact same underlying native object.
|
boolean |
equals(Object obj)
Compares two values, returning true if the underlying objects in native code are the same object.
|
MuxerFormat |
getFormat()
Get the MuxerFormat associated with this Muxer
or null if unknown. |
int |
getNumStreams()
Get the number of streams in this container.
|
int |
getOutputBufferLength()
Return the output buffer length.
|
Muxer.State |
getState()
Get the current state of the Muxer.
|
MuxerStream |
getStream(int position)
Get the MuxerStream at the given position.
|
String |
getURL()
Get the URL the Muxer was opened with.
May return null if unknown. |
int |
hashCode()
Get a hashable value for this object.
|
static Muxer |
make(String filename,
MuxerFormat format,
String formatName)
Creates a new muxer.
One of the three passed in parameter must be non-null. |
void |
open(KeyValueBag inputOptions,
KeyValueBag outputOptions)
Open the Muxer and write any headers.
|
void |
setOutputBufferLength(int size)
Set the buffer length Humble Video will suggest to FFMPEG for writing output data.
If called when a Container is open, the call is ignored and -1 is returned. |
String |
toString() |
boolean |
write(MediaPacket packet,
boolean forceInterleave)
Writes the given packet to the Muxer.
|
getNumProperties, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsInt, getPropertyAsLong, getPropertyAsRational, getPropertyAsString, getPropertyMetaData, getPropertyMetaData, setProperty, setProperty, setProperty, setProperty, setProperty, setPropertydelete, getCurrentRefCountpublic Muxer copyReference()
copyReference in class Containerpublic boolean equals(Object obj)
public int hashCode()
public static Muxer make(String filename, MuxerFormat format, String formatName)
format - If non null, this will be the format this muxer assumes it is writting packets in.filename - The filename/url to open. If format is null, this will also be examined to guess actual format.formatName - The formatname of the muxer to use. This will only be examined if format is null.InvalidArgument - if all parameters are null.public String getURL()
public MuxerFormat getFormat()
public Muxer.State getState()
public void open(KeyValueBag inputOptions, KeyValueBag outputOptions) throws InterruptedException, IOException
inputOptions - muxer-specific options to set before opening the muxer. Can be null.outputOptions - if non null, the passed in bag will be emptied, and the filledInterruptedExceptionIOExceptionpublic void close()
public int getNumStreams()
throws InterruptedException,
IOException
getNumStreams in class ContainerInterruptedExceptionIOExceptionpublic void setOutputBufferLength(int size)
size - The suggested buffer size.InvalidArgument - if size <= 0public int getOutputBufferLength()
public MuxerStream addNewStream(Coder coder)
coder - The coder that will be used for packets written to this stream.InvalidArgument - if encoder is null.InvalidArgument - if encoder is not open.public MuxerStream getStream(int position) throws InterruptedException, IOException
InterruptedExceptionIOExceptionpublic boolean write(MediaPacket packet, boolean forceInterleave)
packet - The packet to write.forceInterleave - If true, this Muxer will ensure that all packets are interleaved across streamsInvalidArgument - if packet is null.InvalidArgument - if packet is not complete.RuntimeException - for other errors.Copyright © 2018 Humble Software. All rights reserved.