Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. X11 Error when running embedded mplayer in QWidget
Forum Update on Monday, May 27th 2025

X11 Error when running embedded mplayer in QWidget

Scheduled Pinned Locked Moved QtonPi
mplayer embedde
6 Posts 2 Posters 3.1k Views
  • 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.
  • W Offline
    W Offline
    WilczurZnahor
    wrote on 16 Sept 2015, 17:56 last edited by WilczurZnahor
    #1

    Hello,
    I am trying to run mplayer from qt application. My code is :

    void owindow::on_pushButton_clicked()
    {
        QStringList arguments;
        ui->widget->show();
        WId winid = ui->widget->winId();
        arguments << "-wid" << QString::number(winid) << "-fs" << "-vo"<<"gl"<<"/root/grafix/mov.mp4";
        QProcess* m_process = new QProcess();
        m_process->setProgram("mplayer");
        m_process->setArguments(arguments);
        qDebug() << arguments;
        m_process->start();
        m_process->waitForFinished();
        QString output(m_process->readAllStandardOutput());
        qDebug() << output;
       delete m_process;
    

    }

    When i click the button, there is no movie, but there are

    X11 error: BadWindow (invalid Window parameter)
    X11 error: BadDrawable (invalid Pixmap or Window parameter)
    ....
    

    I also tried to pass -vo x11 but the result is almost the same (there are more errors X11 Bad Window errors)
    When i run mplayer with those parameters (without -wid of coure) mplayer runs ok, so i am guessing that problem is with winId.

    Any advices?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 16 Sept 2015, 20:35 last edited by
      #2

      Hi and welcome to devnet,

      Did you try with effectiveWinId ?

      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
      • W Offline
        W Offline
        WilczurZnahor
        wrote on 16 Sept 2015, 21:19 last edited by WilczurZnahor
        #3

        Hi and thanks for Your reply.
        effectiveWinId returns different number than winId (effectiveWinId - 9 winId -12)
        But still there are x11 errors:

        ("-wid", "9", "-fs", "-vo", "gl", "-slave", "/root/grafix/mov.mp4")
        "MPlayer2 UNKNOWN (C) 2000-2012 MPlayer Team
        Cannot open file '/root/.mplayer2/input.conf': No such file or directory
        Failed to open /root/.mplayer2/input.conf.
        Cannot open file '/etc/mplayer2/input.conf': No such file or directory
        Failed to open /etc/mplayer2/input.conf.

        Playing /root/grafix/mov.mp4.
        Detected file format: QuickTime / MOV (libavformat)
        [lavf] stream 0: video (h264), -vid 0
        [lavf] stream 1: audio (aac), -aid 0, -alang und
        Clip info:
        major_brand: mp42
        minor_version: 0
        compatible_brands: isommp42
        creation_time: 2015-03-25 07:40:02
        Load subtitles in /root/grafix/
        X11 error: BadWindow (invalid Window parameter)
        X11 error: BadWindow (invalid Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadWindow (invalid Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadWindow (invalid Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadDrawable (invalid Pixmap or Window parameter)
        X11 error: BadWindow (invalid Window parameter)
        X11 error: BadGC (invalid GC parameter)
        X11 error: BadGC (invalid GC parameter)

        But maybe i am doing something wrong, because when i print:

        WId winid = ui->widget->effectiveWinId();//QString::number((ui->widget->effectiveWinId()))
        qDebug() << "winid "<<ui->widget->effectiveWinId() << " " << ui->widget->winId() << " " << winid;
        arguments << "-wid" << QString::number((ui->widget->effectiveWinId())) <<"-fs" << "-vo"<<"gl"<< "-slave" <<"/root/grafix/mov.mp4";
        QProcess* m_process = new QProcess();
        m_process->setProgram("mplayer");
        m_process->setArguments(arguments);
        qDebug() << arguments;
        

        On the console there is:

        winid  9   12   9 
        ("-wid", "12", "-fs", "-vo", "gl", "-slave", "/root/grafix/mov.mp4")
        

        looks like in arguments there are still number 12, so i passed it directly

          arguments << "-wid" << "9" <<"-fs" << "-vo"<<"gl"<< "-slave" <<"/root/grafix/mov.mp4";
        

        and this argument produced this errors like above.

        W 1 Reply Last reply 17 Sept 2015, 23:06
        0
        • W WilczurZnahor
          16 Sept 2015, 21:19

          Hi and thanks for Your reply.
          effectiveWinId returns different number than winId (effectiveWinId - 9 winId -12)
          But still there are x11 errors:

          ("-wid", "9", "-fs", "-vo", "gl", "-slave", "/root/grafix/mov.mp4")
          "MPlayer2 UNKNOWN (C) 2000-2012 MPlayer Team
          Cannot open file '/root/.mplayer2/input.conf': No such file or directory
          Failed to open /root/.mplayer2/input.conf.
          Cannot open file '/etc/mplayer2/input.conf': No such file or directory
          Failed to open /etc/mplayer2/input.conf.

          Playing /root/grafix/mov.mp4.
          Detected file format: QuickTime / MOV (libavformat)
          [lavf] stream 0: video (h264), -vid 0
          [lavf] stream 1: audio (aac), -aid 0, -alang und
          Clip info:
          major_brand: mp42
          minor_version: 0
          compatible_brands: isommp42
          creation_time: 2015-03-25 07:40:02
          Load subtitles in /root/grafix/
          X11 error: BadWindow (invalid Window parameter)
          X11 error: BadWindow (invalid Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadWindow (invalid Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadWindow (invalid Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadDrawable (invalid Pixmap or Window parameter)
          X11 error: BadWindow (invalid Window parameter)
          X11 error: BadGC (invalid GC parameter)
          X11 error: BadGC (invalid GC parameter)

          But maybe i am doing something wrong, because when i print:

          WId winid = ui->widget->effectiveWinId();//QString::number((ui->widget->effectiveWinId()))
          qDebug() << "winid "<<ui->widget->effectiveWinId() << " " << ui->widget->winId() << " " << winid;
          arguments << "-wid" << QString::number((ui->widget->effectiveWinId())) <<"-fs" << "-vo"<<"gl"<< "-slave" <<"/root/grafix/mov.mp4";
          QProcess* m_process = new QProcess();
          m_process->setProgram("mplayer");
          m_process->setArguments(arguments);
          qDebug() << arguments;
          

          On the console there is:

          winid  9   12   9 
          ("-wid", "12", "-fs", "-vo", "gl", "-slave", "/root/grafix/mov.mp4")
          

          looks like in arguments there are still number 12, so i passed it directly

            arguments << "-wid" << "9" <<"-fs" << "-vo"<<"gl"<< "-slave" <<"/root/grafix/mov.mp4";
          

          and this argument produced this errors like above.

          W Offline
          W Offline
          WilczurZnahor
          wrote on 17 Sept 2015, 23:06 last edited by
          #4

          I noticed that effectiveWinId is the id of main window where i have qwidget, butI think that this ID which effectiveWinId and WinId returns are not correct IDs for mplayer. I suppose that i have to use X11Info and create display with this, but when i try to add:

          QT += x11extras
          

          Qt creator reports that this is unknown module. How to add this module?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 17 Sept 2015, 23:17 last edited by
            #5

            How did you install Qt ?

            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
            • W Offline
              W Offline
              WilczurZnahor
              wrote on 17 Sept 2015, 23:53 last edited by
              #6

              I downloaded qt-everywhere-opensource-src-5.2.1, configured it, and cross-compiled
              This is my config:

                 Configure summary
              
              Building for:  devices/linux-bananapi-g++ (arm, CPU features: neon)
              Platform notes:
              
                          - Also available for Linux: linux-kcc linux-icc linux-cxx
              
              qmake vars .......... styles += mac fusion windows QT_CFLAGS_DBUS = -I/home/LINUX/projekty/hydroxy/mnt/usr/include/dbus-1.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/lib/dbus-1.0/include   QT_LIBS_DBUS = -ldbus-1   QT_CFLAGS_GLIB = -pthread -I/home/LINUX/projekty/hydroxy/mnt/usr/include/glib-2.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/lib/glib-2.0/include   QT_LIBS_GLIB = -pthread -lgthread-2.0 -lglib-2.0   QT_CFLAGS_QGTKSTYLE = -pthread -I/home/LINUX/projekty/hydroxy/mnt/usr/include/gtk-2.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/lib/gtk-2.0/include -I/home/LINUX/projekty/hydroxy/mnt/usr/include/atk-1.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/cairo -I/home/LINUX/projekty/hydroxy/mnt/usr/include/gdk-pixbuf-2.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/pango-1.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/glib-2.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/lib/glib-2.0/include -I/home/LINUX/projekty/hydroxy/mnt/usr/include/pixman-1 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/freetype2 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/libpng16 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/harfbuzz -I/home/LINUX/projekty/hydroxy/mnt/usr/include/libdrm   QT_LIBS_QGTKSTYLE = -lgobject-2.0 -lglib-2.0   QT_CFLAGS_QGTK2 = -pthread -I/home/LINUX/projekty/hydroxy/mnt/usr/include/gtk-2.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/lib/gtk-2.0/include -I/home/LINUX/projekty/hydroxy/mnt/usr/include/atk-1.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/cairo -I/home/LINUX/projekty/hydroxy/mnt/usr/include/gdk-pixbuf-2.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/pango-1.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/glib-2.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/lib/glib-2.0/include -I/home/LINUX/projekty/hydroxy/mnt/usr/include/pixman-1 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/freetype2 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/libpng16 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/harfbuzz -I/home/LINUX/projekty/hydroxy/mnt/usr/include/libdrm   QT_LIBS_QGTK2 = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype   QT_CFLAGS_PULSEAUDIO = -D_REENTRANT -I/home/LINUX/projekty/hydroxy/mnt/usr/include/glib-2.0 -I/home/LINUX/projekty/hydroxy/mnt/usr/lib/glib-2.0/include   QT_LIBS_PULSEAUDIO = -lpulse-mainloop-glib -lpulse -lglib-2.0   QMAKE_INCDIR_OPENGL_ES2 =  QMAKE_LIBDIR_OPENGL_ES2 =  QMAKE_LIBS_OPENGL_ES2 =  "-lGLESv2" QMAKE_CFLAGS_FONTCONFIG = -I/home/LINUX/projekty/hydroxy/mnt/usr/include/freetype2 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/libpng16 -I/home/LINUX/projekty/hydroxy/mnt/usr/include/harfbuzz   QMAKE_LIBS_FONTCONFIG = -lfontconfig -lfreetype   QMAKE_INCDIR_LIBUDEV =   QMAKE_LIBS_LIBUDEV = -ludev   DEFINES += QT_NO_XCB QMAKE_CFLAGS_XKBCOMMON =   QMAKE_LIBS_XKBCOMMON = -lxkbcommon   QMAKE_VERSION_XKBCOMMON = 0.5.0 QMAKE_INCDIR_EGL = /home/LINUX/projekty/hydroxy/mnt/usr/include/libdrm   QMAKE_LIBS_EGL = -lEGL   QMAKE_CFLAGS_EGL =   sql-drivers =  sql-plugins =  sqlite qmake switches .........
              
              Build options:
                Configuration .......... accessibility alsa audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile cups dbus egl eglfs evdev eventfd fontconfig full-config getaddrinfo getifaddrs glib gtk2 gtkstyle iconv icu inotify ipv6ifname large-config largefile libudev linuxfb medium-config minimal-config mremap mtdev neon nis no-harfbuzz opengl opengles2 openssl png posix_fallocate pulseaudio qpa qpa reduce_exports reduce_relocations release rpath shared small-config system-freetype system-jpeg system-png system-zlib xlib
                Build parts ............  libs
                Mode ................... release
                Using C++11 ............ yes
                Using PCH .............. no
                Target compiler supports:
                  iWMMXt/Neon .......... no/yes
              
              Qt modules and options:
                Qt D-Bus ............... yes (loading dbus-1 at runtime)
                Qt Concurrent .......... yes
                Qt GUI ................. yes
                Qt Widgets ............. yes
                Qt GUI ................. yes
                Qt Widgets ............. yes
                JavaScriptCore JIT ..... yes (To be decided by JavaScriptCore)
                QML debugging .......... yes
                Use system proxies ..... no
              
              Support enabled for:
                Accessibility .......... yes
                ALSA ................... yes
                CUPS ................... yes
                FontConfig ............. yes
                FreeType ............... system
                Iconv .................. yes
                ICU .................... yes
                Image formats:
                  GIF .................. yes (plugin, using bundled copy)
                  JPEG ................. yes (plugin, using system library)
                  PNG .................. yes (in QtGui, using system library)
                Glib ................... yes
                GTK theme .............. yes
                Large File ............. yes
                mtdev .................. yes (system library)
                Networking:
                  getaddrinfo .......... yes
                  getifaddrs ........... yes
                  IPv6 ifname .......... yes
                  OpenSSL .............. yes (loading libraries at run-time)
                NIS .................... yes
                OpenGL ................. yes (OpenGL ES 2.x)
                OpenVG ................. no
                PCRE ................... system
                pkg-config ............. yes
                PulseAudio ............. yes
                QPA backends:
                  DirectFB ............. no
                  EGLFS ................ yes
                  KMS .................. no
                  LinuxFB .............. yes
                  XCB .................. no
                Session management ..... yes
                SQL drivers:
                  DB2 .................. no
                  InterBase ............ no
                  DB2 .................. no
                  InterBase ............ no
                  MySQL ................ no
                  OCI .................. no
                  ODBC ................. no
                  PostgreSQL ........... no
                  SQLite 2 ............. no
                  SQLite ............... yes (plugin, using bundled copy)
                  TDS .................. no
                udev ................... yes
                xkbcommon .............. yes (system library)
                zlib ................... yes (system library)
              
              NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1.
              Configure with '-qreal float' to create a build that is binary compatible with 5.1.
                  DB2 .................. no
                  InterBase ............ no
                  MySQL ................ no
                  OCI .................. no
                  ODBC ................. no
                  PostgreSQL ........... no
                  SQLite 2 ............. no
                  SQLite ............... yes (plugin, using bundled copy)
                  TDS .................. no
                udev ................... yes
                xkbcommon .............. yes (system library)
                zlib ................... yes (system library)
              
              NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1.
              Configure with '-qreal float' to create a build that is binary compatible with 5.1.
              1 Reply Last reply
              0

              1/6

              16 Sept 2015, 17:56

              • Login

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