MythTV  master
VideoOutput Class Reference

This class serves as the base class for all video output methods. More...

Detailed Description

This class serves as the base class for all video output methods.

The basic use is:

VideoOutputType type = kVideoOutput_Default;
vo = VideoOutput::InitVideoOut(type);
vo->Init(width, height, aspect ...);
// Then create two threads.
// In the decoding thread
while (decoding)
{
if (vo->WaitForAvailable(1000)
{
frame = vo->GetNextFreeFrame(); // remove frame from "available"
av_lib_process(frame); // do something to fill it.
// call DrawSlice() // if you need piecemeal processing
// by VideoOutput use DrawSlice
vo->ReleaseFrame(frame); // enqueues frame in "used" queue
}
}
// In the displaying thread
while (playing)
{
if (vo->EnoughPrebufferedFrames())
{
// Sets "Last Shown Frame" to head of "used" queue
vo->StartDisplayingFrame();
// Get pointer to "Last Shown Frame"
frame = vo->GetLastShownFrame();
// add OSD, do any filtering, etc.
vo->ProcessFrame(frame, osd, filters, pict-in-pict, scan);
// tells show what frame to be show, do other last minute stuff
vo->PrepareFrame(frame, scan);
// here you wait until it's time to show the frame
// Show blits the last prepared frame to the screen
// as quickly as possible.
vo->Show(scan);
// remove frame from the head of "used",
// vo must get it into "available" eventually.
vo->DoneDisplayingFrame();
}
}
delete vo;

Note: Show() may be called multiple times between PrepareFrame() and DoneDisplayingFrame(). But if a frame is ever removed from available via GetNextFreeFrame(), you must either call DoneDisplayFrame() or call DiscardFrame(VideoFrame*) on it.

Note: ProcessFrame() may be called multiple times on a frame, to update an OSD for example.

The VideoBuffers class handles the buffer tracking, see it for more details on the states a buffer can take before it becomes available for reuse.

See also
VideoBuffers, MythPlayer

The documentation for this class was generated from the following file: