| Constructor and Description |
|---|
MXFFileImpl() |
| Modifier and Type | Method and Description |
|---|---|
BodyPartition |
addBodyPartition(boolean closed,
boolean complete,
long initialDataSize,
int bodySID,
int indexSID,
UL... containerFormats) |
FooterPartition |
addFooterPartition(boolean complete,
long initialSize,
int indexSID,
UL... containerFormats) |
HeaderPartition |
addHeaderPartition(boolean closed,
boolean complete,
long initialDataSize,
int bodySID,
int indexSID,
UL... containerFormats) |
long |
align(boolean forceBER4,
int kagSize) |
long |
align(boolean forceBER4,
int kagSize,
int minSize) |
long |
align(int kagSize) |
long |
align(int kagSize,
int minSize) |
boolean |
atEOF()
Determine if the internal file pointer at the end of the file?
|
boolean |
buildPartitionsBackwards(PartitionPack headerPartitionPack) |
boolean |
buildPartitionsTable()
Build a partition table from this MXF file containing all the byte offsets
of all the partitions in this MXF file.
|
boolean |
buildRIP() |
void |
clearRIP() |
MXFFile |
clone()
Returns a cloned copy of the MXF file representation.
|
boolean |
close()
Close this MXF file, preventing further access and releasing any associated
resources.
|
int |
countPartitions()
Count the number of partitions in this file.
|
int |
fillerSize(boolean forceeBER4,
long fillPosition,
int kagSize) |
int |
fillerSize(boolean forceeBER4,
long fillPosition,
int kagSize,
int minSize) |
int |
fillerSize(long fillPosition,
int kagSize) |
int |
fillerSize(long fillPosition,
int kagSize,
int minSize) |
void |
finalize() |
byte[] |
getDigestValue() |
long |
getFileSize() |
FooterPartition |
getFooterPartition()
Get access to the footer partition of this file.
|
HeaderPartition |
getHeaderPartition()
Get access to the header partition of this file.
|
String |
getName() |
Partition |
getNextPartition(Partition current) |
Partition |
getPartitionAt(int index)
Returns the partition at the given index in the partition table.
|
RandomIndexPack |
getRandomIndexPack()
Returns the random index pack from the end of the file, or
null if the
file does not have a random index pack. |
boolean |
getRIP(long maxScan) |
int |
getRunInSize()
Returns the length of any run in found in the file.
|
boolean |
hasRunIn()
Determines whether this file has an optional run-in.
|
boolean |
isBlockAligned() |
boolean |
isOpen()
Determines if this MXF file is open and therefore and ready to be read and written to.
|
boolean |
lock() |
boolean |
lockForward() |
static void |
main(String[] args)
Temporary application to test the reading of MXF files with MAJ.
|
boolean |
open(String fileName) |
boolean |
open(String fileName,
boolean readOnly)
Open the MXF file with the given name for read-only or read-write as required.
|
boolean |
openMemory() |
boolean |
openMemory(ByteBuffer buffer,
long offset) |
boolean |
openNew(String fileName) |
int |
read(byte[] buffer) |
ByteBuffer |
read(int size) |
long |
readBER() |
PartitionImpl |
readFooterPartition() |
PartitionImpl |
readFooterPartition(long maxScan) |
UL |
readKey() |
KLVObject |
readKLV() |
PartitionImpl |
readMasterPartition() |
PartitionImpl |
readMasterPartition(long maxScan) |
MetadataObject |
readObject() |
MetadataObject |
readObject(Primer primer) |
Partition |
readPartition() |
static Preface |
readPrefaceFromMXF(String fileName)
Reads an MXF file specified by filename and returns the preface object as stored in the
header of the file.
|
boolean |
readRIP() |
boolean |
readRunIn()
Read the internal pointer passed any run-in to the beginning of the
header partition.
|
boolean |
reWritePartition(PartitionImpl partition) |
boolean |
reWritePartition(PartitionImpl partition,
Primer primer) |
boolean |
reWritePartitionWithIndex(PartitionImpl partition,
ByteBuffer indexData) |
boolean |
reWritePartitionWithIndex(PartitionImpl partition,
ByteBuffer indexData,
Primer primer) |
boolean |
scanRIP() |
boolean |
scanRIP(long maxScan) |
int |
seek(long position) |
int |
seekEnd() |
void |
setBlockAlign(int size) |
void |
setBlockAlign(int size,
int essenceOffset,
int indexOffset) |
void |
setFileKAG(int kag) |
void |
setFileMXFByteLevelVersion(short major,
short minor) |
void |
setFileOperationalPattern(UL operationalPattern) |
void |
setMemoryBuffer(ByteBuffer buffer,
int offset) |
void |
startDigest(String digestType) |
long |
tell() |
void |
unlock() |
void |
updatePackSizes() |
int |
write(byte[] buffer) |
int |
write(ByteBuffer data) |
int |
writeBER(long length) |
int |
writeBER(long length,
int size) |
void |
writePartition(PartitionImpl partition) |
void |
writePartition(PartitionImpl partition,
boolean includeMetadata) |
void |
writePartition(PartitionImpl partition,
boolean includeMetadata,
Primer primer,
int padding,
int minPartitionSize) |
void |
writePartition(PartitionImpl partition,
int padding,
int minPartitionSize) |
void |
writePartition(PartitionImpl partition,
Primer primer) |
void |
writePartition(PartitionImpl partition,
Primer primer,
int padding,
int minPartitionSize) |
void |
writePartitionPack(PartitionImpl partition) |
void |
writePartitionPack(PartitionImpl partition,
Primer primer) |
void |
writePartitionWithIndex(PartitionImpl partition,
ByteBuffer indexData) |
void |
writePartitionWithIndex(PartitionImpl partition,
ByteBuffer indexData,
boolean includeMetadata) |
void |
writePartitionWithIndex(PartitionImpl partition,
ByteBuffer indexData,
boolean includeMetadata,
Primer primer,
int padding,
int minPartitionSize) |
void |
writePartitionWithIndex(PartitionImpl partition,
ByteBuffer indexData,
int padding,
int minPartitionSize) |
void |
writePartitionWithIndex(PartitionImpl partition,
ByteBuffer indexData,
Primer primer) |
void |
writePartitionWithIndex(PartitionImpl partition,
ByteBuffer indexData,
Primer primer,
int padding,
int minPartitionSize) |
boolean |
writeRIP() |
@UInt32 public int getRunInSize()
MXFFileReturns the length of any run in found in the file. A run-in is optional in an MXF file.
getRunInSize in interface MXFFileMXFFile.hasRunIn(),
MXFFile.readRunIn()public boolean hasRunIn()
MXFFileDetermines whether this file has an optional run-in.
hasRunIn in interface MXFFileMXFFile.getRunInSize(),
MXFFile.readRunIn()public boolean open(String fileName, boolean readOnly) throws IOException
MXFFileOpen the MXF file with the given name for read-only or read-write as required.
open in interface MXFFilefileName - Name of the file to open.readOnly - Open the file read-only? Set to true for read-only and
false for read-write.IOException - A problem occurred when trying to open the specified file.MXFFactory.readPartitions(String)public boolean open(String fileName) throws IOException
IOExceptionpublic boolean openNew(String fileName) throws IOException
IOExceptionpublic boolean openMemory(ByteBuffer buffer, @MXFPosition long offset)
public boolean openMemory()
public boolean close()
MXFFileClose this MXF file, preventing further access and releasing any associated resources. Applications should close MXF files as soon as they are finished reading or writing them.
public void finalize()
throws Throwable
public boolean readRunIn()
throws IOException
MXFFileRead the internal pointer passed any run-in to the beginning of the header partition.
readRunIn in interface MXFFileIOException - Problem reading the underlying MXF file.MXFFile.getRunInSize(),
MXFFile.hasRunIn()public boolean readRIP()
throws IOException
IOExceptionpublic RandomIndexPack getRandomIndexPack()
MXFFileReturns the random index pack from the end of the file, or null if the
file does not have a random index pack.
getRandomIndexPack in interface MXFFilenull.public void clearRIP()
public boolean buildPartitionsTable()
throws IOException,
EndOfDataException
MXFFileBuild a partition table from this MXF file containing all the byte offsets of all the partitions in this MXF file. It is necessary to call this method before calling any of the other methods that reference partitions.
buildPartitionsTable in interface MXFFileIOException - Problem occurred when trying to read the file.EndOfDataException - Unexpectedly reached the end of the file, for example
when reading through a partition table.public boolean buildPartitionsBackwards(PartitionPack headerPartitionPack) throws EndOfDataException
EndOfDataExceptionpublic int countPartitions()
MXFFileCount the number of partitions in this file. A value
of zero may indicate that the partitions table still needs to be built with
MXFFile.buildPartitionsTable().
countPartitions in interface MXFFileMXFFile.getPartitionAt(int),
MXFFile.buildPartitionsTable()public HeaderPartition addHeaderPartition(boolean closed, boolean complete, long initialDataSize, int bodySID, int indexSID, UL... containerFormats)
addHeaderPartition in interface MXFFilepublic void setFileOperationalPattern(UL operationalPattern) throws NullPointerException
setFileOperationalPattern in interface MXFFileNullPointerExceptionpublic void setFileKAG(@UInt32 int kag) throws IllegalArgumentException
setFileKAG in interface MXFFileIllegalArgumentExceptionpublic void setFileMXFByteLevelVersion(@UInt16 short major, @UInt16 short minor) throws IllegalArgumentException
setFileMXFByteLevelVersion in interface MXFFileIllegalArgumentExceptionpublic FooterPartition addFooterPartition(boolean complete, long initialSize, int indexSID, UL... containerFormats)
addFooterPartition in interface MXFFilepublic BodyPartition addBodyPartition(boolean closed, boolean complete, long initialDataSize, int bodySID, int indexSID, UL... containerFormats)
addBodyPartition in interface MXFFilepublic Partition getPartitionAt(int index) throws IndexOutOfBoundsException
MXFFileReturns the partition at the given index in the partition table. The partitions are ordered in the sequence they occur in the file, with the partition at index zero being the header partition.
getPartitionAt in interface MXFFileindex - Index of the partition table to retrieve.IndexOutOfBoundsException - No parition at the given index, or the partition table
has not yet been built with MXFFile.buildPartitionsTable().MXFFile.buildPartitionsTable()public void updatePackSizes()
updatePackSizes in interface MXFFilepublic HeaderPartition getHeaderPartition()
MXFFileGet access to the header partition of this file. Ensure that the partition
table has been built first with MXFFile.buildPartitionsTable().
getHeaderPartition in interface MXFFilenull if the file is invalid or
the partitions table has not yet been built.MXFFile.getHeaderPartition(),
MXFFile.buildPartitionsTable()public FooterPartition getFooterPartition()
MXFFileGet access to the footer partition of this file. Ensure that the partition
table has been built first with MXFFile.buildPartitionsTable() or a null
may be returned unexpectedly.
getFooterPartition in interface MXFFilenull if a footer partition is not
found.MXFFile.getFooterPartition(),
MXFFile.buildPartitionsTable()public boolean scanRIP(@MXFLength long maxScan)
public boolean scanRIP()
public boolean getRIP(@MXFLength long maxScan)
public PartitionImpl readMasterPartition(@Int64 long maxScan)
public PartitionImpl readMasterPartition()
public PartitionImpl readFooterPartition(@MXFLength long maxScan)
public PartitionImpl readFooterPartition()
@MXFPosition public long tell()
public int seek(@MXFPosition long position)
public int seekEnd()
public boolean atEOF()
MXFFileDetermine if the internal file pointer at the end of the file?
public ByteBuffer read(int size) throws IllegalArgumentException
IllegalArgumentExceptionpublic int read(byte[] buffer)
public MetadataObject readObject() throws BadParameterException
BadParameterExceptionpublic MetadataObject readObject(Primer primer)
public Partition readPartition() throws EndOfDataException
EndOfDataExceptionpublic KLVObject readKLV()
public void writePartitionPack(PartitionImpl partition, Primer primer)
public void writePartitionPack(PartitionImpl partition)
public void writePartition(PartitionImpl partition, @UInt32 int padding, @UInt32 int minPartitionSize)
public void writePartition(PartitionImpl partition)
public void writePartitionWithIndex(PartitionImpl partition, ByteBuffer indexData, @UInt32 int padding, @UInt32 int minPartitionSize)
public void writePartitionWithIndex(PartitionImpl partition, ByteBuffer indexData)
public void writePartition(PartitionImpl partition, Primer primer, @UInt32 int padding, @UInt32 int minPartitionSize)
public void writePartition(PartitionImpl partition, Primer primer)
public void writePartitionWithIndex(PartitionImpl partition, ByteBuffer indexData, Primer primer, @UInt32 int padding, @UInt32 int minPartitionSize)
public void writePartitionWithIndex(PartitionImpl partition, ByteBuffer indexData, Primer primer)
public void writePartition(PartitionImpl partition, boolean includeMetadata, Primer primer, @UInt32 int padding, @UInt32 int minPartitionSize)
public void writePartition(PartitionImpl partition, boolean includeMetadata)
public void writePartitionWithIndex(PartitionImpl partition, ByteBuffer indexData, boolean includeMetadata, Primer primer, @UInt32 int padding, @UInt32 int minPartitionSize)
public void writePartitionWithIndex(PartitionImpl partition, ByteBuffer indexData, boolean includeMetadata)
public boolean reWritePartition(PartitionImpl partition, Primer primer)
public boolean reWritePartition(PartitionImpl partition)
public boolean reWritePartitionWithIndex(PartitionImpl partition, ByteBuffer indexData, Primer primer)
public boolean reWritePartitionWithIndex(PartitionImpl partition, ByteBuffer indexData)
public boolean writeRIP()
throws IOException
writeRIP in interface MXFFileIOException@UInt32 public int fillerSize(@UInt64 long fillPosition, @UInt32 int kagSize, @UInt32 int minSize)
@UInt32 public int fillerSize(boolean forceeBER4, @UInt64 long fillPosition, @UInt32 int kagSize, @UInt32 int minSize)
@UInt32 public int fillerSize(boolean forceeBER4, @UInt64 long fillPosition, @UInt32 int kagSize)
public UL readKey()
@MXFLength public long readBER()
@UInt32 public int writeBER(@UInt64 long length, @UInt32 int size) throws IOException
IOException@UInt32 public int writeBER(@UInt64 long length) throws IOException
IOExceptionpublic int write(byte[] buffer)
public int write(ByteBuffer data) throws NullPointerException, IOException
NullPointerExceptionIOExceptionpublic void setMemoryBuffer(ByteBuffer buffer, @UInt32 int offset)
public void setBlockAlign(@UInt32 int size, @Int32 int essenceOffset, @Int32 int indexOffset)
public void setBlockAlign(@UInt32 int size)
public boolean isBlockAligned()
public boolean isOpen()
MXFFileDetermines if this MXF file is open and therefore and ready to be read and written to.
isOpen in interface MXFFileMXFFile.close()public String getName()
public boolean lockForward()
lockForward in interface MXFFilepublic void startDigest(String digestType) throws NoSuchAlgorithmException
startDigest in interface MXFFileNoSuchAlgorithmExceptionpublic byte[] getDigestValue()
getDigestValue in interface MXFFilepublic long getFileSize()
throws IOException
getFileSize in interface MXFFileIOExceptionpublic MXFFile clone()
MXFFileReturns a cloned copy of the MXF file representation. Note that the MXF file itself is not copied.
public static final Preface readPrefaceFromMXF(String fileName) throws Exception
Reads an MXF file specified by filename and returns the preface object as stored in the header of the file.
Errors from reading the file are currently directed to the system error stream.
Warning: This code has yet to be fully tested and you use it at your own risk!
fileName - Name of the MXF file to read.Exception - Any exception thrown when reading the MXF file.main(String[])public static final void main(String[] args)
Temporary application to test the reading of MXF files with MAJ. Use with caution! The application reads an MXF file, reports any warnings encountered when reading the file, reports the time taken to initialize and read the file and then dumps the preface as AAF XML (SMPTE registered data XML).
The first argument is an MXF filename. Following arguments provide the name of classes that should be ignored during parsing. This provides a means to read a file with bad data by listing classes to be skipped.
Example usage:
java -classpath maj.jar tv.amwa.maj.io.mxf.MXFFile MyFile.mxf
args - First argument is the filename of an MXF to read. The following arguments provide names of
classes to be ignored.readPrefaceFromMXF(String)(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.