public class FLVWriter extends Object implements ITagWriter
| Constructor and Description |
|---|
FLVWriter(File file,
boolean append)
Creates writer implementation with given file and flag indicating whether or not to append.
|
FLVWriter(String filePath)
Creates writer implementation with for a given file
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPostProcessor(IPostProcessor postProcessor)
Adds a post-process for execution once the instance completes.
|
void |
close()
Ends the writing process, then merges the data file with the flv file header and metadata.
|
long |
getBytesWritten()
Return the bytes written
|
IStreamableFile |
getFile()
Return the file that is written.
|
int |
getOffset()
Return the offset
|
static void |
main(String[] args)
Exposed to allow repair of flv files if .info and .ser files still exist.
|
static boolean |
repair(String path,
Integer audioId,
Integer videoId)
Allows repair of flv files if .info and .ser files still exist.
|
void |
setAudioCodecId(int audioCodecId) |
void |
setAudioDataSize(int audioDataSize) |
void |
setDuration(int duration) |
void |
setFLV(IFLV flv)
Setter for FLV object
|
void |
setOffset(int offset)
Setter for offset
|
void |
setSoundRate(int soundRate) |
void |
setSoundSize(int soundSize) |
void |
setSoundType(boolean soundType) |
void |
setVideoCodecId(int videoCodecId) |
void |
setVideoDataSize(int videoDataSize) |
void |
writeHeader()
Writes the header bytes
|
boolean |
writeStream(byte[] b)
Write a Stream to disk using bytes
|
boolean |
writeTag(byte dataType,
org.apache.mina.core.buffer.IoBuffer data)
Write a Tag using bytes
|
boolean |
writeTag(ITag tag)
Writes a Tag object
|
public FLVWriter(String filePath)
filePath - path to existing filepublic FLVWriter(File file, boolean append)
file - File output streamappend - true if append to existing filepublic void writeHeader()
throws IOException
writeHeader in interface ITagWriterIOException - Any I/O exceptionpublic boolean writeTag(ITag tag) throws IOException
writeTag in interface ITagWritertag - Tag to writetrue on success, false otherwiseIOException - I/O exceptionpublic boolean writeTag(byte dataType,
org.apache.mina.core.buffer.IoBuffer data)
throws IOException
writeTag in interface ITagWriterdataType - Tag typedata - Byte datatrue on success, false otherwiseIOException - I/O exceptionpublic boolean writeStream(byte[] b)
writeStream in interface ITagWriterb - Array of bytes to writetrue on success, false otherwisepublic void close()
close in interface ITagWriterpublic void addPostProcessor(IPostProcessor postProcessor)
addPostProcessor in interface ITagWriterpublic IStreamableFile getFile()
getFile in interface ITagWriterpublic void setFLV(IFLV flv)
flv - FLV sourcepublic int getOffset()
getOffset in interface ITagWriterpublic void setOffset(int offset)
offset - Value to set for offsetpublic long getBytesWritten()
getBytesWritten in interface ITagWriterpublic void setVideoCodecId(int videoCodecId)
public void setAudioCodecId(int audioCodecId)
public void setSoundRate(int soundRate)
public void setSoundSize(int soundSize)
public void setSoundType(boolean soundType)
public void setDuration(int duration)
public void setVideoDataSize(int videoDataSize)
public void setAudioDataSize(int audioDataSize)
public static boolean repair(String path, Integer audioId, Integer videoId) throws InterruptedException
path - path to .ser fileaudioId - audio codec idvideoId - video codec idInterruptedException - Exception on interruptionpublic static void main(String[] args) throws InterruptedException
args - 0: path to .ser file 1: audio codec id 2: video codec idInterruptedException - Exception on interruptionCopyright © 2005–2017 Red5. All rights reserved.