About
The maxon::FileFormatHandlerInterface provides functionality to access files of a given type. It is typically used to create specific handlers using CreateHandler().
FileFormatHandlerInterface
The FileFormatHandler for a given file is typically obtained with maxon::FileFormatDetectionInterface::Detect().
The maxon::FileFormatHandlerInterface provides these functions:
Registered Handlers
The following maxon::FileFormatHandler implementations are registered at the maxon::FileFormatHandlers registry and are accessible at these published objects:
- maxon::FileFormatHandlers::GenericFile: Returns no handler because it indicates just a regular file
- maxon::FileFormatHandlers::Browsable: Returns maxon::IoBrowseRef for directories.
- maxon::FileFormatHandlers::MaxonDocumentBinaryHandler: Returns maxon::DataFormatReaderRef.
- maxon::FileFormatHandlers::MaxonDocumentJsonHandler: Returns maxon::DataFormatReaderRef.
- maxon::FileFormatHandlers::MaxonDocumentXmlHandler: Returns maxon::DataFormatReaderRef.
Archive files. See also Archives Manual.
- maxon::FileFormatHandlers::ZipDirectoryBrowser: Returns maxon::IoBrowseRef for directories.
- maxon::FileFormatHandlers::ZipArchiveHandler: Returns maxon::ReadArchiveRef for directories.
- maxon::FileFormatHandlers::GZipDirectoryBrowser: Returns maxon::IoBrowseRef for directories.
const maxon::FileFormatHandler& handler = maxon::FileFormatHandlers::ZipArchiveHandler();
const maxon::ReadArchiveRef zipArchive = handler.CreateHandler<maxon::ReadArchiveRef>(
maxon::Url())
iferr_return;
These handlers access image and video files and return a maxon::MediaInputRef. See Images Manual and Media Sessions Manual.
- maxon::FileFormatHandlers::ImageLoaderJpg
- maxon::FileFormatHandlers::ImageLoaderBmp
- maxon::FileFormatHandlers::ImageLoaderIff
- maxon::FileFormatHandlers::ImageLoaderIco
- maxon::FileFormatHandlers::ImageLoaderPng
- maxon::FileFormatHandlers::ImageLoaderTiff
- maxon::FileFormatHandlers::ImageLoaderHdr
- maxon::FileFormatHandlers::ImageLoaderPict
- maxon::FileFormatHandlers::ImageLoaderPsd
- maxon::FileFormatHandlers::ImageLoaderPsb
- maxon::FileFormatHandlers::MovieImageSequence
- maxon::FileFormatHandlers::MovieWinMF
- maxon::FileFormatHandlers::AudioWinMF
Audio files are handled with these handler which also return a maxon::MediaInputRef:
- maxon::FileFormatHandlers::AudioLoaderWav
- maxon::FileFormatHandlers::AudioLoaderAiff
{
if (url.IsEmpty())
const maxon::FileFormatHandler importFileFormat = maxon::FileFormatDetectionInterface::Detect<maxon::MediaInputRef>(url)
iferr_return;
const maxon::MediaInputRef source = importFileFormat.CreateHandler<maxon::MediaInputRef>(url)
iferr_return;
const maxon::MediaOutputTextureRef destination = maxon::MediaOutputTextureClass().Create()
iferr_return;
destination.SetOutputTexture(targetTexture, maxon::ImagePixelStorageClasses::Normal())
iferr_return;
const maxon::MediaSessionRef session = maxon::MediaSessionObject().Create()
iferr_return;
session.ConnectMediaConverter(source, destination)
iferr_return;
}
{
if (folder.IsEmpty() || images.
IsEmpty())
name += "@{2'0'}.png"_s;
sequenceURL.
Set(maxon::URLFLAGS::IMAGESEQUENCE_FIRSTFRAME, firstFrame)
iferr_return;
sequenceURL.
Set(maxon::URLFLAGS::IMAGESEQUENCE_LASTFRAME, lastFrame)
iferr_return;
const maxon::FileFormatHandler imageSequence = maxon::FileFormatHandlers::MovieImageSequence();
const maxon::MediaInputRef source = imageSequence.CreateHandler<maxon::MediaInputRef>(sequenceURL)
iferr_return;
const maxon::ImageTextureRef texture = maxon::ImageTextureClasses::TEXTURE().Create()
iferr_return;
const maxon::MediaOutputTextureRef destination = maxon::MediaOutputTextureClass().Create()
iferr_return;
destination.SetOutputTexture(texture, maxon::ImagePixelStorageClasses::Normal())
iferr_return;
const maxon::MediaSessionRef session = maxon::MediaSessionObject().Create()
iferr_return;
session.ConnectMediaConverter(source, destination)
iferr_return;
for (
maxon::Int frame = 0; frame <= lastFrame; ++frame)
{
currentTime += frameDuration;
}
return session.Close();
}
Further Reading