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. No video window when started from another process

No video window when started from another process

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 852 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
    Trino
    wrote on last edited by
    #1

    Hello all,

    I'm not sure if the problem is in my code or in VLC mediaplayer.

    I have been strugling for a few days with the following problem.
    I'm using windows 7 pro 64-bit and VLC mediaplayer 3.02.

    I open a command prompt and enter the following commands:

    "C:\Program Files\VideoLAN\VLC\vlc.exe" -I rc --rc-host localhost:3000 --rc-quiet --video-on-top --width 150 --height 150

    telnet localhost 3000

    clear

    add C:\Users<username>\Documents\testfiles\test_video.mp4

    The video will start in a new window without any buttons, exactly as I want.

    I stop the video by entering "quit" in the telnet session window.

    So fa so good.

    The problem is the following. I want to do this from within another program I wrote using the Qt framework.

    Here's a part of the code (some pieces are omitted for clarity):

    video_process = new QProcess(0);
    
    arguments << "--video-on-top" << "-I" << "rc" << "--rc-host" << "localhost:3000" << "--rc-quiet" << "--width" << "150" << "--height" << "150";
    
    video_process->start("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe", arguments);
    
    if(video_process->waitForStarted(5000) == false)
    {
    msgbox.setText(" \n Cannot start VLC mediaplayer. \n"
    " \n Check if VLC is installed in C:\\Program Files\\VideoLAN\\VLC\\ \n" );
    msgbox.exec();
    return;
    }
    
    wait here for a couple of seconds to give it time to startup
    
    vlc_sock = new QTcpSocket;
    
    vlc_sock->connectToHost(QHostAddress("127.0.0.1"), port);
    
    if(vlc_sock->waitForConnected(5000) == false)
    {
    err = vlc_sock->error();
    
    do some cleanup here
    }
    
    vlc_sock->write("clear");
    
    vlc_sock->waitForBytesWritten(200);
    
    wait 100 milliSecs here
    
    vlc_sock->write("add C:\\Users\\<username>\\Documents\\testfiles\\test_video.mp4\n");
    
    vlc_sock->waitForBytesWritten(200);
    

    When I run the program, VLC starts and it connects via the socket to VLC.
    Also, VLC responds to every command, but.... there's no video window!
    Also, when sending the command get_time after loading the video, get_time returns always 0.
    But the command "add C:\Users<username>\Documents\testfiles\test_video.mp4" returns "vlc: add: returned 0 (no error)"

    So, why it doesn't show a video when VLC is started from another process?

    Any ideas?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Trino
      wrote on last edited by
      #2

      Solved. The problem was, I used slashes instead of backslashes in the path to the video file...
      Sorry for bothering.

      aha_1980A 1 Reply Last reply
      1
      • T Trino

        Solved. The problem was, I used slashes instead of backslashes in the path to the video file...
        Sorry for bothering.

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @Trino thanks for reporting back.

        so please mark this topic as SOLVED.

        Qt has to stay free or it will die.

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

          Hi,

          To avoid having to switch between forward and backward slashes, you can use QDir::toNativeSeparators when having to pass path to native APIs.

          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