MovieLoader Manual

About

The MovieLoader class is used to load image data from a movie file.

Warning
For Maxon API media input and output see Media Sessions Manual.

Allocation/Deallocation

A MovieLoader can be created with the usual tools:

  • MovieLoader::Alloc(): Creates a new MovieLoader object.
  • MovieLoader::Free(): Deletes the given MovieLoader object.

Functionality

A MovieLoader object simply opens a movie file to read its content:

  • MovieLoader::Open(): Opens the given movie file.
  • MovieLoader::GetInfo(): Gets the movie's frame rate and frame count.
  • MovieLoader::Read(): Returns the frame with the given index as a BaseBitmap.
  • MovieLoader::Close(): Closes the currently open movie file.
Note
See also GeGetMovieInfo().
// This example loads the given movie file and displays
// each frame of the movie in the Picture Viewer.
AutoAlloc<MovieLoader> movieLoader;
if (movieLoader == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
// load movie file
const IMAGERESULT res = movieLoader->Open(selectedMovieFile);
return maxon::IoError(MAXON_SOURCE_LOCATION, MaxonConvert(selectedMovieFile, MAXONCONVERTMODE::NONE), "Could not open movie file."_s);
// get movie info
Float fps = 0.0;
const Int32 frames = movieLoader->GetInfo(&fps);
// load and display each frame
for (Int32 i = 0; i < frames; ++i)
{
// load frame
Int32 frameResult;
BaseBitmap* const frameContent = movieLoader->Read(i, &frameResult);
// check if frame could been loaded
const Int32 imageOK = Int32(IMAGERESULT::OK);
if (frameResult != imageOK)
return maxon::UnknownError(MAXON_SOURCE_LOCATION);
if (frameContent == nullptr)
return maxon::UnknownError(MAXON_SOURCE_LOCATION);
// show frame
ShowBitmap(frameContent);
}
movieLoader->Close();
Py_ssize_t i
Definition: abstract.h:645
NONE
Definition: asset_browser.h:1
Py_UCS4 * res
Definition: unicodeobject.h:1113
OK
User has selected a font.
Definition: customgui_fontchooser.h:0
IMAGERESULT
Definition: ge_prepass.h:3947
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
Bool ShowBitmap(const Filename &fn)
maxon::Int32 Int32
Definition: ge_sys_math.h:51
maxon::Float Float
Definition: ge_sys_math.h:57
maxon::Url MaxonConvert(const Filename &fn, MAXONCONVERTMODE convertMode)

Further Reading