OpenGLVideoSync Class Reference

#include <vsync.h>

Inheritance diagram for OpenGLVideoSync:

VideoSync

List of all members.


Detailed Description

Video synchronization class employing SGI_video_sync OpenGL extension.

Uses glXWaitVideoSyncSGI() to wait for retrace. Phase-maintaining, meaning WaitForFrame should always return approximately the same time after a vertical retrace.

This works with version 50 or later of the nVidia vendor drivers.

Special care must be taken with this video sync method due to a bad interaction between some pthread implementations and OpenGL. OpenGL DIRECT contexts can not be shared between processes. And some pthread implementations, notably a common one on Linux, treat each thread as a seperate process. Hence Start(void), Stop(void) and WaitForFrame(void) must all be called from the same thread.

See also:
http://osgcvs.no-ip.com/osgarchiver/archives/June2002/0022.html

http://www.ac3.edu.au/SGI_Developer/books/OpenGLonSGI/sgi_html/ch10.html#id37188

http://www.inb.mu-luebeck.de/~boehme/xvideo_sync.html

Definition at line 205 of file vsync.h.


Public Member Functions

 OpenGLVideoSync (VideoOutput *, int frame_interval, int refresh_interval, bool interlaced)
 ~OpenGLVideoSync ()
QString getName (void) const
 Returns name of instanciated VSync method.
bool TryInit (void)
 Try to create an OpenGL surface so we can use glXWaitVideoSyncSGI:.
void Start (void)
 Start VSync; must be called from main thread.
void WaitForFrame (int sync_delay)
 Waits for next a frame or field.
void AdvanceTrigger (void)
 Use the next frame or field for CalcDelay(void) and WaitForFrame(int).

Private Attributes

GLXDrawable m_drawable
GLXContext m_context
QMutex m_lock

Constructor & Destructor Documentation

OpenGLVideoSync::OpenGLVideoSync ( VideoOutput video_output,
int  frame_interval,
int  refresh_interval,
bool  interlaced 
)

Definition at line 446 of file vsync.cpp.

OpenGLVideoSync::~OpenGLVideoSync (  ) 

Definition at line 455 of file vsync.cpp.


Member Function Documentation

QString OpenGLVideoSync::getName ( void   )  const [inline, virtual]

Returns name of instanciated VSync method.

Implements VideoSync.

Definition at line 212 of file vsync.h.

bool OpenGLVideoSync::TryInit ( void   )  [virtual]

Try to create an OpenGL surface so we can use glXWaitVideoSyncSGI:.

Returns:
true if this method can be employed, false if it can not.

Implements VideoSync.

Definition at line 479 of file vsync.cpp.

void OpenGLVideoSync::Start ( void   )  [virtual]

Start VSync; must be called from main thread.

Start(void), WaitForFrame(void), and Stop(void) should always be called from same thread, to prevent bad interactions with pthreads.

Reimplemented from VideoSync.

Definition at line 627 of file vsync.cpp.

void OpenGLVideoSync::WaitForFrame ( int  sync_delay  )  [virtual]

Waits for next a frame or field.

Start(void), WaitForFrame(void), and Stop(void) should always be called from same thread, to prevent bad interactions with pthreads.

Parameters:
sync_delay time until the desired frame or field
See also:
CalcDelay(void), KeepPhase(void)

Implements VideoSync.

Definition at line 660 of file vsync.cpp.

void OpenGLVideoSync::AdvanceTrigger ( void   )  [virtual]

Use the next frame or field for CalcDelay(void) and WaitForFrame(int).

Implements VideoSync.

Definition at line 699 of file vsync.cpp.


Member Data Documentation

Definition at line 219 of file vsync.h.

Referenced by Start(), TryInit(), WaitForFrame(), and ~OpenGLVideoSync().

Definition at line 220 of file vsync.h.

Referenced by Start(), TryInit(), WaitForFrame(), and ~OpenGLVideoSync().

QMutex OpenGLVideoSync::m_lock [private]

Definition at line 223 of file vsync.h.

Referenced by AdvanceTrigger(), Start(), TryInit(), WaitForFrame(), and ~OpenGLVideoSync().


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

Generated on Sat Dec 18 05:16:08 2010 for MythTV by  doxygen 1.5.5