X11 Error when running embedded mplayer in QWidget



  • 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?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Did you try with effectiveWinId ?



  • 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.



  • 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?


  • Lifetime Qt Champion

    How did you install Qt ?



  • 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.

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.