Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Subclassing a QVideoWidget
Forum Updated to NodeBB v4.3 + New Features

Subclassing a QVideoWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 968 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tomatoketchup
    wrote on last edited by
    #1

    Hello everyone!

    I am using a QVideoWidget as a QCamera viewfinder and I need to access all the frames displayed on the video widget.
    In order to do that, I'd like to subclass the QVideoWidget and catch the frames before they are painted on the window.
    The QCameraViewfinder is a subclass of QVideoWidget, but it doesn't do any painting. QCameraViewfinder source code
    Also, it seems like the video frames are not accessible (see here), so subclassing the widget would not solve the problem. Maybe I could implement the paintEvent like this:

    VideoWidgetSubclass::paintEvent(QPaintEvent *event)
    {
        QVideoWidget::paintEvent(event); // let's the QVideoWidget do the painting stuff
    
        // obtain the current frame by getting the surface of the widget?
    }
    

    Is there a better solution? I even tried to implement a QAbstractVideoSurface, but the image I get is underexposed. That's why I want to use a QVideoWidget, because it automatically adjusts the exposure of the image (and allows changing the saturation, hue, etc.).

    Any help would be greatly appreciated.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What exactly is your goal with these frames ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tomatoketchup
        wrote on last edited by
        #3

        I am writing a video conferencing app.
        I need a preview widget in which the frames will be displayed (I can do it with a QVideoWidget/QCameraViewfinder) but I also need to send each frame through the network.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          It's very similar to your other thread here, isn't it ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tomatoketchup
            wrote on last edited by
            #5

            It is, but in this one, I asked for a way to get the frames from a QVideoWidget and also display them at the same time.
            I'm sorry if I created two distinct threads, maybe I should have put all this in a single one.
            But this one is more important to me, do you think there's a way to get the frames from a QVideoWidget? As I told you, I need to preview them in a widget and also send them over the network (using UDP sockets), because I am making a video conferencing app.
            Skype, for instance, has a preview area so that users can see their own video, and the video is also sent using UDP sockets. That's what I want to achieve. My network protocol is ready for sending the data, but I need to get those video frames.

            Thank you for replying!

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              See my answer to your other thread. For the network part, it looks like you are re-inventing the wheel by using a custom network protocol.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved