Results 1 to 4 of 4

Thread: QProcess & Lame

  1. #1
    Join Date
    Mar 2007
    Posts
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Angry QProcess & Lame

    I am having a problem when running lame as a QProcess.
    I have tried using the standard method of placing the commandline params in a QStringList but have moved onto a plain line of text to simplify things for now.
    Qt Code:
    1. QProcess * lame = new QProcess(this);
    2.  
    3. connect(lame, SIGNAL(readyReadStandardOutput()), this, SLOT(lameDataAvailable()));
    4. connect(lame, SIGNAL(readyReadStandardError()), this, SLOT(lameErrorAvailable()));
    5. connect(lame, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(lameFinished(int, QProcess::ExitStatus)));
    6.  
    7. QString tmp = "lame \"-b 112\" \"-m j\" -f \"-V 2\" \"-B 320\" \"" + inFile + "\" \"" + outFile + "\"";
    8.  
    9. lame->start(tmp);
    To copy to clipboard, switch view to plain text mode 
    lame reports this...
    lame: -m mode must be s/d/j/f/m not j

    if I remove the space between the -m and j thus.. -mj then lame accepts it.

    But if I put a --lowpass 18 in the string then lame says it is an unrecognised switch.

    But if I use all and any of the lame switches in a terminal they are always accepted okay.

    I am running Lame version 3.97 but the problem was the same with an earlier version.

    After numerous tests I have come to the conclusion that it is something to do with an environment setting for the QProcess.
    I tried setting a TERM=xterm environment setting but it doesn't make any difference.

    Does anyone have any idea about what is happening?
    Thanks

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess & Lame

    I don't think it has something to do with the environment.
    It should work though... What happens if you use a QString list instead?
    Maybe all the quotes confuse lame...

    Regards

  3. #3
    Join Date
    Mar 2007
    Posts
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QProcess & Lame

    I was originally using a QStringList, I reverted to this simplified method to try to find where the problem is.... the problem is just the same using the QStringList method.
    The quotes are required when a command line switch has a space in it.

  4. #4
    Join Date
    Mar 2007
    Posts
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Thumbs up Re: QProcess & Lame

    Well it has taken me all day and the solution turns out to be rather simple.

    It CANNOT be done with a QStringList because the strings in a QStringList are 16bit per character just as they are in a QString........ Ahhhh... the penny drops.

    So the way I have solved it is to create the complete lame command line in a QString....
    QString tmp = "lame -b 128 -m j ....... etc etc

    Then start the QProcess like this

    lame->start(tmp.toUtf8());

    and it works fine.

Similar Threads

  1. Questions about kill() and start() of QProcess
    By mp33919 in forum Qt Programming
    Replies: 5
    Last Post: 23rd June 2007, 13:00
  2. QProcess and Pipes
    By KaptainKarl in forum Qt Programming
    Replies: 1
    Last Post: 9th April 2007, 23:11
  3. QProcess extremely slow on Windows?
    By Pepe in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2007, 00:25
  4. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 13:30
  5. QProcess in a QThread
    By chombium in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 15:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.