| synopsis || return value || arguments || prev || next |
Overload navigation: 1, 2
virtual bool open( jp2_family_src * src, jp2_locator locator=jp2_locator())
Java: boolean Open( Jp2_family_src src, Jp2_locator locator)
[Declared in "../apps/compressed_io/jp2.h"]
Opens the box to read from the src object. If src was opened using a seekable file, seekable compressed data source, or a dynamic cache ( kdu_cache) object, multiple boxes may be simultaneously opened using the same jp2_family_src object. Moreover, they may be read in any order, or in interleaved fashion. The internal machinery maintains information about the current read state and manages all required context switching, but for multi-threaded applications you should consider supplying implementing the synchronization funcions, jp2_family_src::acquire_lock and jp2_family_src::release_lock in a class derived from jp2_family_src.
Every open box has a unique locator value. If you have visited a box before (e.g., during an initial pass through the file), you may open the box again using the locator you found at that time by invoking jp2_input_box::get_locator. Using a locator, you may open any box using this function, not just top level boxes. You may think of the locator as the address of the box within its file, even though the information source might be a kdu_cache object which has no linear file structure. Even in this case, a mechanism is provided (behind the scenes) for maintaining the association between each JP2 box and a location in an original file. These locations are managed by the jp2_locator::get_file_pos and jp2_locator::set_file_pos functions.
An error may be generated through kdu_error if a fundamental problem is detected. If the jp2_family_src object is using a cache as its data source, however, it is possible that the cache may not yet have sufficient information to open the box. In this case, the function returns false, leaving the box closed ( exists remains false). Any of the following conditions may cause this to happen:
If any of the above occurs, the function returns false with the box still closed. Trying again later, however, once the cache contents have been augmented, may result in success ( exists becomes true).
True if a new box was opened, else false.
Must point to an open jp2_family_src object, which must not be closed until after the present object is closed (or destroyed).
To open the very first box in the JP2 source, you may supply the empty (or null) locator, which is created by the jp2_locator object's constructor. Other values for this argument may be obtained by invoking get_locator on this or another jp2_input_box object, or by using jp2_locator::set_file_pos. The same box (or sub-box) may be opened as often as desired, by different jp2_input_box objects if you like, simply by passing the relevant locator to this function.
| top || synopsis || return value || arguments || prev || next |