Xvideo::Xvideo()
{
m_nAdaptor = ~0; // equals -1
m_pDisplay = NULL;
m_pAdaptorInfo = NULL;
m_nPort = 0;
m_nColorkey = 0;
// --- start initialization ---
//alternatively: m_pDisplay = XOpenDisplay ( NULL );
// get version and release information about X video extension
unsigned int nVersion, nRelease, nRequest_base, nEvent_base, nError_base;
XvQueryExtension ( m_pDisplay, &nVersion, &nRelease, &nRequest_base,
&nEvent_base, &nError_base );
// get video adaptor list for default display
unsigned int nAdaptors;
XvQueryAdaptors ( m_pDisplay, DefaultRootWindow ( m_pDisplay ), &nAdaptors,
&m_pAdaptorInfo );
// search list for Xv-capable adaptor and try to grab a port
for ( unsigned int i=0; i<nAdaptors; i++ )
{
// call XvGrabPort in some loop until its successfull...
...
XvGrabPort ( m_pDisplay, p, CurrentTime )
...
}
// get and set ColorKey data/config
XvGetPortAttribute ( m_pDisplay, m_nPort,... );
XvSetPortAttribute ( m_pDisplay, m_nPort, ...);
}
bool Xvideo::setup ( Drawable window, int width, int height )
{
unsigned int formats;
XvImageFormatValues *fo;
// next call ends in segmentation fault
fo = XvListImageFormats ( m_pDisplay, m_nPort, ( int * ) &formats );
...
}
Xvideo::Xvideo()
{
m_nAdaptor = ~0; // equals -1
m_pDisplay = NULL;
m_pAdaptorInfo = NULL;
m_nPort = 0;
m_nColorkey = 0;
// --- start initialization ---
m_pDisplay = QX11Info::display () ;
//alternatively: m_pDisplay = XOpenDisplay ( NULL );
// get version and release information about X video extension
unsigned int nVersion, nRelease, nRequest_base, nEvent_base, nError_base;
XvQueryExtension ( m_pDisplay, &nVersion, &nRelease, &nRequest_base,
&nEvent_base, &nError_base );
// get video adaptor list for default display
unsigned int nAdaptors;
XvQueryAdaptors ( m_pDisplay, DefaultRootWindow ( m_pDisplay ), &nAdaptors,
&m_pAdaptorInfo );
// search list for Xv-capable adaptor and try to grab a port
for ( unsigned int i=0; i<nAdaptors; i++ )
{
// call XvGrabPort in some loop until its successfull...
...
XvGrabPort ( m_pDisplay, p, CurrentTime )
...
}
// get and set ColorKey data/config
XvGetPortAttribute ( m_pDisplay, m_nPort,... );
XvSetPortAttribute ( m_pDisplay, m_nPort, ...);
}
bool Xvideo::setup ( Drawable window, int width, int height )
{
unsigned int formats;
XvImageFormatValues *fo;
// next call ends in segmentation fault
fo = XvListImageFormats ( m_pDisplay, m_nPort, ( int * ) &formats );
...
}
To copy to clipboard, switch view to plain text mode
{
setupUi ( this );
Xvideo *m_pXvPort = NULL;
try
{
m_pXvPort = new Xvideo();
}
{
}
}
CamWindow() : QWidget()
{
setupUi ( this );
Xvideo *m_pXvPort = NULL;
try
{
m_pXvPort = new Xvideo();
}
catch ( QString strErr )
{
QMessageBox::warning(this, tr("x video extension"),
strErr, QMessageBox::Ok);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks