[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwintv
Subject:    [Kwintv] XRANDR
From:       Dirk Ziegelmeier <dziegel () gmx ! de>
Date:       2004-03-12 20:06:15
Message-ID: 200403122106.15596.dziegel () gmx ! de
[Download RAW message or body]

OK, for a better Quanta ;-)

Changing the screen resolution for fullscreen video display. Didn't commit it 
(yet) because:

1) I messed with kvideoio and want George to approve it
2) The TV widget is not centered at fullscreen (dunno why ATM)
3) The TV window size is messed after the resolution is changed back (if the 
tv window is resized due to the lower resolution (can this be fixed?)

If somebody likes to try anyway, it's attached.

Dirk

["xrandr.patch" (text/x-diff)]

Index: ChangeLog
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/ChangeLog,v
retrieving revision 1.7
diff -u -3 -p -r1.7 ChangeLog
--- ChangeLog	25 Feb 2004 20:08:27 -0000	1.7
+++ ChangeLog	12 Mar 2004 19:54:53 -0000
@@ -1,3 +1,39 @@
+2004-03-08 Monday 22:30  dziegel
+
+	The channel properties dialog should be modal
+
+2004-03-08 Monday 22:23  dziegel
+
+	Channelpropertiesdialog should not block video display
+
+2004-03-07 Sunday 14:51  dziegel
+
+	Display an error message when v4l grabbing or xv video playback fails.
+
+2004-03-07 Sunday 13:06  dziegel
+
+	Make ChannelScanner window smaller (did not fit on 800x600 screens)
+
+2004-03-07 Sunday 11:27  dziegel
+
+	Make overlay work on 15bitspp displays.
+
+2004-02-29 Sunday 08:18  scripty
+
+	CVS_SILENT made messages
+
+2004-02-27 Friday 23:41  dziegel
+
+	Bug workarounds belong in the appropriate plugin
+
+2004-02-26 Thursday 21:22  dziegel
+
+	Configurable snapshot size. Undo some of the last overlay "fixes" (=breakage).
+
+2004-02-25 Wednesday 21:08  dziegel
+
+	Overlay: reduce flicker, simplifications
+
 2004-02-24 Tuesday 21:25  dziegel
 
 	Reenable toolbar configurability, KDELIRC profile fixes, aspect ratio fixing
Index: kvideoio/v4ldev.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/kvideoio/v4ldev.cpp,v
retrieving revision 1.49
diff -u -3 -p -r1.49 v4ldev.cpp
--- kvideoio/v4ldev.cpp	8 Mar 2004 21:39:02 -0000	1.49
+++ kvideoio/v4ldev.cpp	12 Mar 2004 19:54:55 -0000
@@ -189,7 +189,6 @@ V4LDev::V4LDev(int fd, const QString &na
     displayrc = V4LUtil::findDisplayProperties(_fmt, depth, bitspp, _bpp);
 
     _mmapBuf = 0;
-    _capBuf  = 0;
     _grabBuf = 0;
     _readBuf = 0;
     _mmapCurrentFrame = 0;
@@ -287,17 +286,9 @@ V4LDev::~V4LDev()
     if (_mmapBuf)
         munmap(_mmapBuf, _mbuf.size);
 
-    if (_capBuf)
-        delete[] _capBuf;
-
-    if (_grabBuf)
-        delete[] _grabBuf;
-
-    if (_readBuf)
-        delete[] _readBuf;
-
-    if (_mmapData)
-        delete[] _mmapData;
+    delete[] _grabBuf;
+    delete[] _readBuf;
+    delete[] _mmapData;
 
     ioctl(_fd, VIDIOCCAPTURE, &zero);
     ::close(_fd);
@@ -418,11 +409,6 @@ int V4LDev::initGrabbing()
         _grabBuf = 0;
     }
     
-    if (_capBuf) {
-        delete[] _capBuf;
-        _capBuf = 0;
-    }
-    
     if (_mmapData) {
         delete[] _mmapData;
         _mmapData = 0;
@@ -430,7 +416,6 @@ int V4LDev::initGrabbing()
     
     _mmapCurrentFrame = 0;
     _grabBuf = new uchar[_grabW*_grabH*4];
-    _capBuf  = new uchar[_capW*_capH*4];
     
     if (_type & VID_TYPE_CAPTURE) {
         int rc = ioctl(_fd, VIDIOCGMBUF, &_mbuf);
@@ -489,15 +474,13 @@ int V4LDev::inputFormat() const
 }
 
 
-int V4LDev::grab(V4LImage *img, bool scale)
+int V4LDev::grab(V4LImage *img)
 {
     if (_grabNeedsInit) {
         initGrabbing();
     }
     
-    assert(!scale);
     assert(_grabBuf);
-    assert(_capBuf);
     
     if (_mmapBuf) {  ////////////////////////////////////   mmap() method
         int rc;
@@ -580,17 +563,6 @@ int V4LDev::grab(V4LImage *img, bool sca
         }
     }
 
-    if( scale ) {
-        //        scaleImage(_capBuf, _capW, _capH, _grabBuf, _grabW, _grabH, _bpp);
-        if (img->owner && img->buffer) {
-            delete[] img->buffer;
-        }
-        img->buffer = _capBuf;
-        img->owner  = false;
-        img->width  = _capW;
-        img->height = _capH;
-    }
-
     return 0;
 }
 
@@ -630,9 +602,6 @@ unsigned long V4LDev::colourKey() const
 
 int V4LDev::setImageSize(int w, int h)
 {
-    _capH = h;
-    _capW = w;
-    
     if (w < _minWidth)
         w = _minWidth;
     
Index: kvideoio/v4ldev.h
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/kvideoio/v4ldev.h,v
retrieving revision 1.23
diff -u -3 -p -r1.23 v4ldev.h
--- kvideoio/v4ldev.h	8 Mar 2004 21:39:02 -0000	1.23
+++ kvideoio/v4ldev.h	12 Mar 2004 19:54:55 -0000
@@ -26,6 +26,7 @@
 #include <qstring.h>
 #include <qstringlist.h>
 #include <qmap.h>
+#include <qsize.h>
 
 #ifdef __STRICT_ANSI__
 #define FOO__STRICT_ANSI__
@@ -80,7 +81,7 @@ public:
     virtual int startCapture(int x, int y);
     virtual int stopCapture();
     virtual bool overlayOn() const;
-    virtual int grab(V4LImage *buff, bool scale = true);
+    virtual int grab(V4LImage *buff);
     /**
      * Signal strength (usually for tuners)
      */
@@ -90,6 +91,9 @@ public:
     // this finds the largest video that is within the size specified.
     // -1 on error, and uses aspect ratio if h = -1
     virtual int setImageSize(int w, int h = -1);
+    virtual int setImageSize(const QSize& sz) { return setImageSize(sz.width(), \
sz.height()); }; +    virtual QSize getMaxImageSize() { return QSize(_maxWidth, \
_maxHeight); }; +    virtual QSize getMinImageSize() { return QSize(_minWidth, \
_minHeight); };  
     virtual QString name() const { return _name; }
 
@@ -171,14 +175,12 @@ protected:
     QStringList _encodings;
     int _source;
     QString _encoding;
-    int _capW, _capH;          // the scaled capture dimensions
     bool _hasAudio, _isTuner, _isCamera;
     struct video_mmap *_mmapData;
     struct video_mbuf _mbuf;
     int _mmapCurrentFrame;
     uchar *_mmapBuf;
     bool _grabNeedsInit;
-    uchar *_capBuf;
     uchar *_grabBuf;
     uchar *_readBuf;
     int _grabW, _grabH;        // the actual capture dimensions
Index: kvideoio/v4ldevtuner.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/kvideoio/v4ldevtuner.cpp,v
retrieving revision 1.17
diff -u -3 -p -r1.17 v4ldevtuner.cpp
--- kvideoio/v4ldevtuner.cpp	13 Feb 2004 19:42:58 -0000	1.17
+++ kvideoio/v4ldevtuner.cpp	12 Mar 2004 19:54:55 -0000
@@ -202,7 +202,7 @@ int V4LTuner::setEncoding(const QString 
             _maxWidth = 768;
         else if (_vt.mode == VIDEO_MODE_SECAM && vcap.maxheight == 576)
             _maxWidth = 768;
-        setImageSize(_capW, _capH);
+        setImageSize(_grabW, _grabH);
         kdDebug() << "Set tuner min/max to: " << _minWidth << "-" << _maxWidth
                   << " " << _minHeight << "-" << _maxHeight << endl;
     }
Index: qtvision/qvsrcplugin.h
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/qtvision/qvsrcplugin.h,v
retrieving revision 1.27
diff -u -3 -p -r1.27 qvsrcplugin.h
--- qtvision/qvsrcplugin.h	7 Mar 2004 13:51:42 -0000	1.27
+++ qtvision/qvsrcplugin.h	12 Mar 2004 19:54:55 -0000
@@ -137,6 +137,12 @@ public slots:
 
     virtual int setVideoDesktop(bool on) = 0;
 
+    /**
+     * Hint for the plugin to display video in fullscreen mode
+     * (e.g. to change resolution)
+     */
+    virtual void setFullscreen(bool) = 0;
+
 
 signals:
     void errorMessage(const QString& msg);
Index: qtvision/sourcemanager.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/qtvision/sourcemanager.cpp,v
retrieving revision 1.9
diff -u -3 -p -r1.9 sourcemanager.cpp
--- qtvision/sourcemanager.cpp	7 Mar 2004 13:51:42 -0000	1.9
+++ qtvision/sourcemanager.cpp	12 Mar 2004 19:54:55 -0000
@@ -44,6 +44,7 @@ SourceManager::SourceManager(PluginFacto
       _src(QString::null),
       _enc(QString::null),
       _vsrc(0L),
+      _lastViewModeHint(Windowed),
       _screen(screen),
       _pf(pf)
 {
@@ -237,6 +238,20 @@ bool SourceManager::stopVideo()
     return false;
 }
 
+void SourceManager::viewModeHint(ViewModeHint hint)
+{
+
+    if (hasDevice() && (hint != _lastViewModeHint)) {
+        if(hint == Fullscreen) {
+            _vsrc->setFullscreen(true);
+        } else {
+            _vsrc->setFullscreen(false);
+        }
+    }
+
+    _lastViewModeHint = hint;
+}
+
 void SourceManager::stopDevice()
 {
     kdDebug() << "Sourcemanager: stopDevice()" << endl;
Index: qtvision/sourcemanager.h
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/qtvision/sourcemanager.h,v
retrieving revision 1.8
diff -u -3 -p -r1.8 sourcemanager.h
--- qtvision/sourcemanager.h	7 Mar 2004 13:51:42 -0000	1.8
+++ qtvision/sourcemanager.h	12 Mar 2004 19:54:55 -0000
@@ -48,8 +48,14 @@ class SourceManager : public QObject
 {
     Q_OBJECT
 
-	
+
 public:
+    /// Viewmode hints
+    typedef enum {
+        Windowed,
+        Fullscreen
+    } ViewModeHint;
+
     /**
      * List of all available devices
      */
@@ -196,6 +202,12 @@ public slots:
     bool stopVideo();
 
     /**
+     * Hint for current video playback mode
+     * (e.g. to change resolution)
+     */
+    virtual void viewModeHint(ViewModeHint);
+
+    /**
      * Loads all enabled video plugins and scans for devices, sources and encodings.
      */
     void scanPlugins();
@@ -304,6 +316,8 @@ private:
     QString         _audioMode;
     QVSourcePlugin* _vsrc;
 
+    ViewModeHint    _lastViewModeHint;
+
     QTimer*         _audioModeTimer;
 
     QWidget*       _screen;
Index: qtvision/clients/mainwindow.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/qtvision/clients/mainwindow.cpp,v
retrieving revision 1.103
diff -u -3 -p -r1.103 mainwindow.cpp
--- qtvision/clients/mainwindow.cpp	12 Mar 2004 14:43:24 -0000	1.103
+++ qtvision/clients/mainwindow.cpp	12 Mar 2004 19:54:55 -0000
@@ -770,14 +770,14 @@ void MainWindow::setShowTV( bool enable 
     if (enable) {
         hideGUIElements();
         setShowTrayIcon( true );
-        //	setWFlags( WStyle_Customize | WStyle_Tool );
+        //        setWFlags( WStyle_Customize | WStyle_Tool );
         move( _topLevelPos );
         resize( _topLevelSize );
         QTimer::singleShot(1, this, SLOT(bringToFront()));
         _viewMode = ViewTV;
         _actShowTV->setChecked( true );
     } else {
-        //	clearWFlags( WStyle_Customize | WStyle_Tool );
+        //        clearWFlags( WStyle_Customize | WStyle_Tool );
         setShowTrayIcon( false );
         restoreGUIElements();
         move( _pos );
@@ -795,8 +795,8 @@ void MainWindow::setShowFullScreen( bool
         if ( _icon.isNull() ) {
             _icon = KWin::icon( winId(), 32, 32, true );
         }
+        _screen->driver()->sourceManager()->viewModeHint(SourceManager::Fullscreen);
         hideGUIElements();
-        //	setWFlags( WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop );
         showFullScreen();
         _bgcol = paletteBackgroundColor();
         setPaletteBackgroundColor( QColor( 0, 0, 0 ) );
@@ -804,8 +804,8 @@ void MainWindow::setShowFullScreen( bool
         _viewMode = ViewFullScreen;
         _actShowFull->setChecked( true );
     } else {
-        //	clearWFlags( WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop );
         setPaletteBackgroundColor( _bgcol );
+        _screen->driver()->sourceManager()->viewModeHint(SourceManager::Windowed);
         restoreGUIElements();
         showNormal();
         KWin::setIcons( winId(), _icon, _miniIcon );
Index: qtvision/plugins/configure.in.in
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/qtvision/plugins/configure.in.in,v
retrieving revision 1.1
diff -u -3 -p -r1.1 configure.in.in
--- qtvision/plugins/configure.in.in	30 Oct 2003 19:04:18 -0000	1.1
+++ qtvision/plugins/configure.in.in	12 Mar 2004 19:54:56 -0000
@@ -79,3 +79,13 @@ else
 fi
 
 AM_CONDITIONAL(include_ZVBIDIR, [test -n "$ZVBIDIRS"])
+
+dnl ------------------------------------------------------------------------
+dnl Check for XRANDR
+KDE_CHECK_LIB(Xrandr, XRRConfigCurrentConfiguration, 
+    QTVISION_LIBS="-lXrandr $QTVISION_LIBS",,
+    -L/usr/X11R6/lib $X_LIBS $X_PRE_LIBS -lXrender -lXext -lX11 $X_EXTRA_LIBS)
+
+if test $ac_cv_lib_Xrandr_XRRConfigCurrentConfiguration = yes; then
+  AC_DEFINE(HAVE_XRANDR, 1, [If we have the X11 RANDR extension])
+fi
Index: qtvision/plugins/video/v4l/overlaycontroller.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/qtvision/plugins/video/v4l/overlaycontroller.cpp,v
 retrieving revision 1.4
diff -u -3 -p -r1.4 overlaycontroller.cpp
--- qtvision/plugins/video/v4l/overlaycontroller.cpp	26 Feb 2004 20:22:03 -0000	1.4
+++ qtvision/plugins/video/v4l/overlaycontroller.cpp	12 Mar 2004 19:54:56 -0000
@@ -118,14 +118,14 @@ bool OverlayController::eventFilter(QObj
         if(e->type() == QEvent::Resize) {
             // The widget has changed its size
             // and maybe as a consequence its position (-> aspect ratio)
-            kdDebug() << "Overlay: View resized" << endl;
+            //            kdDebug() << "Overlay: View resized" << endl;
             emit resized();
             emit moved();
             scheduleRepaintScreen();
 
         } else if(e->type() == QEvent::Paint) {
             // The widget is being unobscured (unmap, expose)
-            kdDebug() << "Overlay: Paint (expose)" << endl;
+            //            kdDebug() << "Overlay: Paint (expose)" << endl;
             scheduleReclip();
         }
     }
@@ -135,7 +135,7 @@ bool OverlayController::eventFilter(QObj
 
 void OverlayController::scheduleRepaintScreen()
 {
-    kdDebug() << "Overlay: Schedule Repaint" << endl;
+    //    kdDebug() << "Overlay: Schedule Repaint" << endl;
 
     _filterRefresh = true;
     _repaintTimer->start(0, true);
@@ -143,14 +143,14 @@ void OverlayController::scheduleRepaintS
 
 void OverlayController::scheduleReclip()
 {
-    kdDebug() << "Overlay: Schedule Reclip" << endl;
+    //    kdDebug() << "Overlay: Schedule Reclip" << endl;
 
     _reclipTimer->start(0, true);
 }
 
 void OverlayController::doRepaintScreen()
 {
-    kdDebug() << "Overlay: Repaint Screen" << endl;
+    //    kdDebug() << "Overlay: Repaint Screen" << endl;
 
     _filterRefresh = true;
     emit updateClipping();
@@ -159,7 +159,7 @@ void OverlayController::doRepaintScreen(
 
 void OverlayController::doReclip()
 {
-    kdDebug() << "Overlay: Reclip" << endl;
+    //    kdDebug() << "Overlay: Reclip" << endl;
 
     emit updateClipping();
 }
Index: qtvision/plugins/video/v4l/qtvision_v4l.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/qtvision/plugins/video/v4l/qtvision_v4l.cpp,v
retrieving revision 1.87
diff -u -3 -p -r1.87 qtvision_v4l.cpp
--- qtvision/plugins/video/v4l/qtvision_v4l.cpp	10 Mar 2004 07:38:56 -0000	1.87
+++ qtvision/plugins/video/v4l/qtvision_v4l.cpp	12 Mar 2004 19:54:56 -0000
@@ -22,10 +22,6 @@
 
 #include <kapplication.h>
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "qtvision_v4l.h"
 
 #include <qwidget.h>
@@ -171,7 +167,7 @@ void V4LGrabber::run()
 	// skip the first n frames for syncing
 	while ( !_stop && (skip-- > 0) ) {
 		_devMtx.lock();
-		_d->grab(0, false);
+		_d->grab(0);
 		_devMtx.unlock();
 	}
 	
@@ -182,7 +178,7 @@ void V4LGrabber::run()
 		    _devMtx.unlock();
 		    break;
 		}
-		int rc = _d->grab(&_image, false);
+		int rc = _d->grab(&_image);
 		_devMtx.unlock();
 
 		if (rc == 0) {
@@ -262,6 +258,7 @@ QtVisionV4L::QtVisionV4L(QtVision *qtv, 
         } else {
             _useOverlay = false;
         }
+        _changeRes = true;
     } else {
         _qvsMethod = _cfg->readNumEntry("GD Method", bestAvailable);
 
@@ -277,6 +274,8 @@ QtVisionV4L::QtVisionV4L(QtVision *qtv, 
         } else {
             _useOverlay = _cfg->readBoolEntry("Use Overlay", false);
         }
+
+        _changeRes = _cfg->readBoolEntry("Change Screen Resolution", false);
     }
 
     _vs->setMethod(_qvsMethod);
@@ -758,7 +757,7 @@ bool QtVisionV4L::grabStill(QImage *img)
         int newrc   = -1;
         int timeout = 20;
         do {
-            newrc = dev->grab(&im, false);
+            newrc = dev->grab(&im);
             if ((lastrc == 0) && (newrc == 0)) {
                 rc = 0;
             }
@@ -840,7 +839,7 @@ void QtVisionV4L::updateClipping()
         geom = QApplication::desktop()->screenGeometry(QRect(wattrs.x, wattrs.y, \
wattrs.width, wattrs.height).center());  wattrs.x -= geom.x();
         wattrs.y -= geom.y();
-        printf("Found a sibling of the view: %d %d %dx%d\n", wattrs.x, wattrs.y, \
wattrs.width, wattrs.height); +        //        printf("Found a sibling of the view: \
%d %d %dx%d\n", wattrs.x, wattrs.y, wattrs.width, wattrs.height);  
         dev->addClip(QRect(wattrs.x, wattrs.y, wattrs.width, wattrs.height));
     }
@@ -867,7 +866,7 @@ void QtVisionV4L::updateClipping()
             geom = QApplication::desktop()->screenGeometry(QRect(wattrs.x, wattrs.y, \
wattrs.width, wattrs.height).center());  wattrs.x -= geom.x();
             wattrs.y -= geom.y();
-            printf("Found a child of the view: %d %d %dx%d\n", wattrs.x, wattrs.y, \
wattrs.width, wattrs.height); +            //            printf("Found a child of the \
view: %d %d %dx%d\n", wattrs.x, wattrs.y, wattrs.width, wattrs.height);  
             dev->addClip(QRect(wattrs.x, wattrs.y, wattrs.width, wattrs.height));
         }
@@ -959,6 +958,7 @@ QWidget *QtVisionV4L::configWidget(QWidg
     
     _cfgWidget->_autoConfig->setChecked(_autoConfig);
     _cfgWidget->_overlay->setChecked(_useOverlay);
+    _cfgWidget->_changeRes->setChecked(_changeRes);
     //    _cfgWidget->_mirror->setChecked(_mirror);
     //    _cfgWidget->_frameRate->setValue(_frameRate);
     //#ifdef HAVE_DVBS
@@ -974,6 +974,7 @@ QWidget *QtVisionV4L::configWidget(QWidg
 
 void QtVisionV4L::saveConfig()
 {
+    _changeRes  = _cfgWidget->_changeRes->isChecked();
     _useOverlay = _cfgWidget->_overlay->isChecked();
     _autoConfig = _cfgWidget->_autoConfig->isChecked();
     //    _dvbs = _cfgWidget->_dvbs->isChecked();
@@ -991,6 +992,7 @@ void QtVisionV4L::saveConfig()
         _qvsMethod = QVIDEO_METHOD_X11;
     }
 
+    _cfg->writeEntry("Change Screen Resolution", _changeRes);
     _cfg->writeEntry("Use Overlay", _useOverlay);
     _cfg->writeEntry("GD Method", _qvsMethod);
     _cfg->writeEntry("Autoconfigure", _autoConfig);
@@ -1032,6 +1034,72 @@ int QtVisionV4L::getGrabFormat(int qvsMe
     return fmt;
 }
 
+void QtVisionV4L::setFullscreen(bool fs)
+{
+    if ( !dev || !dev->overlayOn() || !_changeRes)
+        return;
+
+    if(fs) {
+        _previousSize = setScreenResolution(dev->getMaxImageSize());
+    } else {
+        setScreenResolution(_previousSize);
+    }
+}
+
+#ifdef HAVE_XRANDR
+QSize QtVisionV4L::setScreenResolution(const QSize& size)
+#else
+QSize QtVisionV4L::setScreenResolution(const QSize&)
+#endif
+{
+#ifdef HAVE_XRANDR
+    Display* dpy  = qt_xdisplay();
+    int      scn  = QApplication::desktop()->screenNumber(_w);
+    Window   root = QApplication::desktop()->screen(scn)->winId();
+
+    // First check for XRANDR extension and refresh sizes array
+    int foo, bar;
+    int nrandr = 0;
+    XRRScreenSize* randr;
+
+    if (XRRQueryExtension(dpy, &foo, &bar)) {
+        randr = XRRSizes(dpy, scn, &nrandr);
+	}
+    if (nrandr == 0) {
+        kdDebug() << "QtVisionV4L: No XRANDR available. Cannot change resolution." \
<< endl; +        return QSize();
+    }
+
+    XRRScreenConfiguration* sc = XRRGetScreenInfo(dpy, root);
+    Rotation rotation;
+    SizeID current = XRRConfigCurrentConfiguration(sc, &rotation);
+    SizeID newRes = current;
+
+    // Find closest match for the desired size
+    int mindist = 1000000;
+    for (SizeID i=0; i<nrandr; i++) {
+        int d1   = randr[i].width  - size.width();
+        int d2   = randr[i].height - size.height();
+        int dist = d1 + d2;
+
+        if( (d1>=0) && (d2>=0) && (dist<mindist) ) {
+            mindist = dist;
+            newRes  = i;
+        }
+    }
+    if (newRes != current) {
+        kdDebug() << "QtVisionV4L: XRANDR: switch to " << randr[newRes].width << "x" \
<< randr[newRes].height << endl; +        XRRSetScreenConfig(dpy, sc, root, newRes, \
rotation, CurrentTime); +    }
+
+    XRRFreeScreenConfigInfo(sc);
+
+    return QSize(randr[current].width, randr[current].height);
+#else
+    return QSize();
+#endif
+}
+
 extern "C" {
     QtVisionV4L* create_v4l(QtVision *qtv, QWidget *w) {
 		return new QtVisionV4L(qtv, w, "v4l plugin");
Index: qtvision/plugins/video/v4l/qtvision_v4l.h
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/qtvision/plugins/video/v4l/qtvision_v4l.h,v
retrieving revision 1.36
diff -u -3 -p -r1.36 qtvision_v4l.h
--- qtvision/plugins/video/v4l/qtvision_v4l.h	7 Mar 2004 13:51:42 -0000	1.36
+++ qtvision/plugins/video/v4l/qtvision_v4l.h	12 Mar 2004 19:54:56 -0000
@@ -24,6 +24,10 @@
 #ifndef __QVV4L_PLUGIN_H
 #define __QVV4L_PLUGIN_H
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <qvsrcplugin.h>
 #include <qmutex.h>
 #include <qmap.h>
@@ -37,6 +41,13 @@ class V4LDev;
 class V4LGrabber;
 class OverlayController;
 
+#ifdef HAVE_XRANDR
+// qdir.h clashes with xlib.h
+#include <qdir.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/Xrandr.h>
+#endif
+
 /**
  * Video source plugin for Video4Linux.
  */
@@ -116,6 +127,8 @@ public slots:
     virtual QWidget *configWidget(QWidget*, const char *);
     virtual void saveConfig();
 
+    virtual void setFullscreen(bool);
+
 
 private:
     int getGrabFormat(int qvsMethod);
@@ -135,13 +148,19 @@ private:
     V4LPluginCfg *_cfgWidget;
     int _gsn;  // grabber sequence number
 
+#ifdef HAVE_XRANDR
+    QSize setScreenResolution(const QSize&);
+    QSize _previousSize;
+#endif
+
     // Config options
     bool _autoConfig;
     int  _qvsMethod;
     bool _useOverlay;
     bool _dvbs;
     bool _mirror;
-    int _frameRate;
+    int  _frameRate;
+    bool _changeRes;
 
     
 private slots:
Index: qtvision/plugins/video/v4l/v4lplugincfg.ui
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/qtvision/plugins/video/v4l/v4lplugincfg.ui,v
retrieving revision 1.8
diff -u -3 -p -r1.8 v4lplugincfg.ui
--- qtvision/plugins/video/v4l/v4lplugincfg.ui	21 Feb 2004 21:07:23 -0000	1.8
+++ qtvision/plugins/video/v4l/v4lplugincfg.ui	12 Mar 2004 19:54:56 -0000
@@ -8,8 +8,8 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>327</width>
-            <height>301</height>
+            <width>378</width>
+            <height>339</height>
         </rect>
     </property>
     <property name="caption">
@@ -25,27 +25,6 @@
         <property name="spacing">
             <number>6</number>
         </property>
-        <widget class="QGroupBox" row="2" column="0">
-            <property name="name">
-                <cstring>advanced</cstring>
-            </property>
-            <property name="title">
-                <string>&amp;Advanced</string>
-            </property>
-            <grid>
-                <property name="name">
-                    <cstring>unnamed</cstring>
-                </property>
-                <widget class="QCheckBox" row="0" column="0">
-                    <property name="name">
-                        <cstring>_overlay</cstring>
-                    </property>
-                    <property name="text">
-                        <string>Prefer video overlay if available</string>
-                    </property>
-                </widget>
-            </grid>
-        </widget>
         <widget class="QButtonGroup" row="1" column="0">
             <property name="name">
                 <cstring>GDMethods</cstring>
@@ -134,10 +113,39 @@
             <property name="sizeHint">
                 <size>
                     <width>21</width>
-                    <height>31</height>
+                    <height>16</height>
                 </size>
             </property>
         </spacer>
+        <widget class="QGroupBox" row="2" column="0">
+            <property name="name">
+                <cstring>advanced</cstring>
+            </property>
+            <property name="title">
+                <string>&amp;Advanced</string>
+            </property>
+            <grid>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <widget class="QCheckBox" row="0" column="0">
+                    <property name="name">
+                        <cstring>_overlay</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Prefer video overlay if available</string>
+                    </property>
+                </widget>
+                <widget class="QCheckBox" row="1" column="0">
+                    <property name="name">
+                        <cstring>_changeRes</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Adjust display resolution for fullscreen \
overlay</string> +                    </property>
+                </widget>
+            </grid>
+        </widget>
     </grid>
 </widget>
 <connections>
Index: qtvision/plugins/video/xv/qtvision_xv.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/qtvision/plugins/video/xv/qtvision_xv.cpp,v
retrieving revision 1.36
diff -u -3 -p -r1.36 qtvision_xv.cpp
--- qtvision/plugins/video/xv/qtvision_xv.cpp	7 Mar 2004 13:51:42 -0000	1.36
+++ qtvision/plugins/video/xv/qtvision_xv.cpp	12 Mar 2004 19:54:56 -0000
@@ -478,6 +478,11 @@ int QtVisionXv::setVideoDesktop(bool on)
 }
 
 
+void QtVisionXv::setFullscreen(bool)
+{
+}
+
+
 bool QtVisionXv::videoPlaying() const
 {
 	if (xvDevice)
Index: qtvision/plugins/video/xv/qtvision_xv.h
===================================================================
RCS file: /home/kde/kdenonbeta/kwintv3/qtvision/plugins/video/xv/qtvision_xv.h,v
retrieving revision 1.18
diff -u -3 -p -r1.18 qtvision_xv.h
--- qtvision/plugins/video/xv/qtvision_xv.h	26 Feb 2004 20:22:03 -0000	1.18
+++ qtvision/plugins/video/xv/qtvision_xv.h	12 Mar 2004 19:54:56 -0000
@@ -105,6 +105,8 @@ public slots:
     virtual int setVideoDesktop(bool on);
     virtual bool canVideoDesktop() const;
 
+    virtual void setFullscreen(bool fs);
+
     virtual bool canGrabStill() const;
     virtual bool grabStill( QImage *pix );
 



_______________________________________________
kwintv mailing list
kwintv@kde.org
https://mail.kde.org/mailman/listinfo/kwintv


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic