JP2K_EssenceSubParser Class Reference

#include <esp_jp2k.h>

Inheritance diagram for JP2K_EssenceSubParser:

EssenceSubParser RefCount IRefCount List of all members.

Public Member Functions

 JP2K_EssenceSubParser ()
virtual EssenceSubParserPtr NewParser (void) const
 Build a new parser of this type and return a pointer to it.
virtual StringList HandledExtensions (void)
 Report the extensions of files this sub-parser is likely to handle.
virtual EssenceStreamDescriptorList IdentifyEssence (FileHandle InFile)
 Examine the open file and return a list of essence descriptors.
virtual WrappingOptionList IdentifyWrappingOptions (FileHandle InFile, EssenceStreamDescriptor &Descriptor)
 Examine the open file and return the wrapping options known by this parser.
virtual void Use (UInt32 Stream, WrappingOptionPtr UseWrapping)
 Set a wrapping option for future Read and Write calls.
virtual bool SetEditRate (Rational EditRate)
 Set a non-native edit rate.
virtual Rational GetEditRate (void)
 Get the current edit rate.
virtual Rational GetPreferredEditRate (void)
 Get the preferred edit rate.
virtual Position GetCurrentPosition (void)
 Get the current position in SetEditRate() sized edit units.
virtual DataChunkPtr Read (FileHandle InFile, UInt32 Stream, UInt64 Count=1)
 Read a number of wrapping items from the specified stream and return them in a data chunk.
virtual EssenceSourcePtr GetEssenceSource (FileHandle InFile, UInt32 Stream, UInt64 Count=1)
 Build an EssenceSource to read a number of wrapping items from the specified stream.
virtual Length Write (FileHandle InFile, UInt32 Stream, MXFFilePtr OutFile, UInt64 Count=1)
 Write a number of wrapping items from the specified stream to an MXF file.
virtual std::string GetParserName (void) const
 Get a unique name for this sub-parser.

Protected Types

typedef std::multimap< std::string,
DataChunkPtr
HeaderType
 Type for multimap holding contents of the jp2 file header.

Protected Member Functions

bool CalcWrappingSequence (Rational EditRate)
 Work out wrapping sequence.
MDObjectPtr BuildDescriptorFromCodeStream (FileHandle InFile, Position Offset=0)
 Read the essence information from the codestream at the specified position in the source file and build an essence descriptor.
MDObjectPtr BuildDescriptorFromJP2 (FileHandle InFile)
 Read the essence information at the start of the "JP2" format source file and build an essence descriptor.
size_t ReadInternal (FileHandle InFile, UInt32 Stream, Length Count)
 Scan the essence to calculate how many bytes to transfer for the given edit unit count.
bool ParseJP2Header (FileHandle InFile)
 Parse a JP2 header at the start of the specified file into items in the Header multimap.
bool ParseJP2KCodestreamHeader (FileHandle InFile, Position Offset)
 Parse a JPEG 2000 header at the specified offset in a file into items in the Header multimap.
UInt32 GreatestCommonDivisor (UInt32 Large, UInt32 Small)
 Return the greatest common divisor of two numbers.
void ReduceRational (UInt32 &Numerator, UInt32 &Denominator)
 Reduce the complexity of a given rational made from a pair of UInt32s.

Protected Attributes

UInt32 SampleRate
 The sample rate of this essence.
Rational UseEditRate
 The edit rate to use for wrapping this essence.
Position PictureNumber
 The picture number of the last picture read, zero before any read.
Position DataStart
 Start of essence data within the file.
Length DataSize
 Total size of the essence data within the file.
Position CurrentPos
 Current position in the input file (in bytes).
size_t CachedDataSize
 The size of the next data to be read, or (size_t)-1 if not known.
MDObjectParent CurrentDescriptor
 Pointer to the last essence descriptor we built.
HeaderType Header
 Multimap holding contents of the jp2 file header.

Friends

class JP2K_EssenceSubParser::ESP_EssenceSource

Classes

class  ESP_EssenceSource
 Class for EssenceSource objects for parsing/sourcing <Type> essence. More...

Member Typedef Documentation

typedef std::multimap<std::string, DataChunkPtr> HeaderType [protected]

Type for multimap holding contents of the jp2 file header.


Constructor & Destructor Documentation

JP2K_EssenceSubParser (  )  [inline]


Member Function Documentation

virtual EssenceSubParserPtr NewParser ( void   )  const [inline, virtual]

Build a new parser of this type and return a pointer to it.

Implements EssenceSubParser.

virtual StringList HandledExtensions ( void   )  [inline, virtual]

Report the extensions of files this sub-parser is likely to handle.

Reimplemented from EssenceSubParser.

EssenceStreamDescriptorList IdentifyEssence ( FileHandle  InFile  )  [virtual]

Examine the open file and return a list of essence descriptors.

Note:
This call will modify properties SampleRate, DataStart and DataSize

Reimplemented from EssenceSubParser.

WrappingOptionList IdentifyWrappingOptions ( FileHandle  InFile,
EssenceStreamDescriptor Descriptor 
) [virtual]

Examine the open file and return the wrapping options known by this parser.

Parameters:
InFile The open file to examine (if the descriptor does not contain enough info)
Descriptor An essence stream descriptor (as produced by function IdentifyEssence) of the essence stream requiring wrapping
Note:
The options should be returned in an order of preference as the caller is likely to use the first that it can support

Reimplemented from EssenceSubParser.

virtual void Use ( UInt32  Stream,
WrappingOptionPtr  UseWrapping 
) [inline, virtual]

Set a wrapping option for future Read and Write calls.

Returns:
true if this EditRate is acceptable with this wrapping

virtual bool SetEditRate ( Rational  EditRate  )  [inline, virtual]

Set a non-native edit rate.

Must be called after Use()

Returns:
true if this rate is acceptable

Reimplemented from EssenceSubParser.

virtual Rational GetEditRate ( void   )  [inline, virtual]

Get the current edit rate.

Implements EssenceSubParser.

virtual Rational GetPreferredEditRate ( void   )  [inline, virtual]

Get the preferred edit rate.

Returns:
The prefered edit rate which is currently 24/1

Reimplemented from EssenceSubParser.

virtual Position GetCurrentPosition ( void   )  [inline, virtual]

Get the current position in SetEditRate() sized edit units.

Implements EssenceSubParser.

DataChunkPtr Read ( FileHandle  InFile,
UInt32  Stream,
UInt64  Count = 1 
) [virtual]

Read a number of wrapping items from the specified stream and return them in a data chunk.

If frame or line mapping is used the parameter Count is used to determine how many items are read. In frame wrapping it is in units of EditRate, as specified in the call to Use(), which may not be the frame rate of this essence

Note:
This is going to take a lot of memory in clip wrapping!

Implements EssenceSubParser.

virtual EssenceSourcePtr GetEssenceSource ( FileHandle  InFile,
UInt32  Stream,
UInt64  Count = 1 
) [inline, virtual]

Build an EssenceSource to read a number of wrapping items from the specified stream.

Implements EssenceSubParser.

Length Write ( FileHandle  InFile,
UInt32  Stream,
MXFFilePtr  OutFile,
UInt64  Count = 1 
) [virtual]

Write a number of wrapping items from the specified stream to an MXF file.

If frame or line mapping is used the parameter Count is used to determine how many items are read. In frame wrapping it is in units of EditRate, as specified in the call to Use(), which may not be the frame rate of this essence stream

Note:
This is the only safe option for clip wrapping
Returns:
Count of bytes transferred

Implements EssenceSubParser.

virtual std::string GetParserName ( void   )  const [inline, virtual]

Get a unique name for this sub-parser.

The name must be all lower case, and must be unique. The recommended name is the part of the filename of the parser header after "esp_" and before the ".h". If the parser has no name return "" (however this will prevent named wrapping option selection for this sub-parser)

Reimplemented from EssenceSubParser.

bool CalcWrappingSequence ( Rational  EditRate  )  [protected]

Work out wrapping sequence.

MDObjectPtr BuildDescriptorFromCodeStream ( FileHandle  InFile,
Position  Offset = 0 
) [protected]

Read the essence information from the codestream at the specified position in the source file and build an essence descriptor.

Note:
This call will modify properties SampleRate, DataStart and DataSize

MDObjectPtr BuildDescriptorFromJP2 ( FileHandle  InFile  )  [protected]

Read the essence information at the start of the "JP2" format source file and build an essence descriptor.

Note:
This call will modify properties SampleRate, DataStart and DataSize

size_t ReadInternal ( FileHandle  InFile,
UInt32  Stream,
Length  Count 
) [protected]

Scan the essence to calculate how many bytes to transfer for the given edit unit count.

Note:
The file position pointer is left at the start of the chunk at the end of this function

bool ParseJP2Header ( FileHandle  InFile  )  [protected]

Parse a JP2 header at the start of the specified file into items in the Header multimap.

bool ParseJP2KCodestreamHeader ( FileHandle  InFile,
Position  Offset 
) [protected]

Parse a JPEG 2000 header at the specified offset in a file into items in the Header multimap.

This parsing includes the first tile-part header

UInt32 GreatestCommonDivisor ( UInt32  Large,
UInt32  Small 
) [inline, protected]

Return the greatest common divisor of two numbers.

void ReduceRational ( UInt32 Numerator,
UInt32 Denominator 
) [inline, protected]

Reduce the complexity of a given rational made from a pair of UInt32s.


Friends And Related Function Documentation

friend class JP2K_EssenceSubParser::ESP_EssenceSource [friend]


Member Data Documentation

UInt32 SampleRate [protected]

The sample rate of this essence.

Rational UseEditRate [protected]

The edit rate to use for wrapping this essence.

Position PictureNumber [protected]

The picture number of the last picture read, zero before any read.

Position DataStart [protected]

Start of essence data within the file.

Length DataSize [protected]

Total size of the essence data within the file.

Position CurrentPos [protected]

Current position in the input file (in bytes).

A value of 0 means the start of the data chunk, any other value is that position within the whole file. This means that a full rewind can be achieved by setting CurrentPos = 0

Note:
Other functions may move the file pointer between calls to our functions

size_t CachedDataSize [protected]

The size of the next data to be read, or (size_t)-1 if not known.

MDObjectParent CurrentDescriptor [protected]

Pointer to the last essence descriptor we built.

This is used as a quick-and-dirty check that we know how to process this source

HeaderType Header [protected]

Multimap holding contents of the jp2 file header.


The documentation for this class was generated from the following files:
Generated on Mon Apr 2 15:20:58 2007 for MXFLib by  doxygen 1.5.1-p1