QTfrontend/net/recorder.cpp
branchphysfslayer
changeset 7928 88fde28bbda6
parent 7897 5e7c0810f365
child 8069 bb7671829935
equal deleted inserted replaced
7778:3331b30e4ef1 7928:88fde28bbda6
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  */
    17  */
    18 
    18 
    19 #include <QString>
    19 #include <QString>
    20 #include <QByteArray>
    20 #include <QByteArray>
    21 //#include <QMessageBox>
       
    22 
    21 
    23 #include "recorder.h"
    22 #include "recorder.h"
    24 #include "gameuiconfig.h"
    23 #include "gameuiconfig.h"
    25 #include "hwconsts.h"
    24 #include "hwconsts.h"
    26 #include "game.h"
    25 #include "game.h"
    27 #include "libav_iteraction.h"
    26 #include "LibavInteraction.h"
    28 
    27 
    29 // Encoding is memory expensive process, so we need to limit maximum number
    28 // Encoding is memory expensive process, so we need to limit maximum number
    30 // of simultaneous encoders.
    29 // of simultaneous encoders.
    31 static const int maxRecorders = 3;
    30 static const int maxRecorders = 3;
    32 static int numRecorders = 0;
    31 static int numRecorders = 0;
    37     TCPBase(false)
    36     TCPBase(false)
    38 {
    37 {
    39     this->config = config;
    38     this->config = config;
    40     this->prefix = prefix;
    39     this->prefix = prefix;
    41     finished = false;
    40     finished = false;
    42     name = prefix + "." + LibavIteraction::instance().getExtension(config->AVFormat());
    41     name = prefix + "." + LibavInteraction::instance().getExtension(config->AVFormat());
    43 }
    42 }
    44 
    43 
    45 HWRecorder::~HWRecorder()
    44 HWRecorder::~HWRecorder()
    46 {
    45 {
    47     emit encodingFinished(finished);
    46     emit encodingFinished(finished);
   109     arguments << "0"; // sound
   108     arguments << "0"; // sound
   110     arguments << "0"; // music
   109     arguments << "0"; // music
   111     arguments << "0"; // sound volume
   110     arguments << "0"; // sound volume
   112     arguments << QString::number(config->timerInterval());
   111     arguments << QString::number(config->timerInterval());
   113     arguments << datadir->absolutePath();
   112     arguments << datadir->absolutePath();
   114     arguments << (config->isShowFPSEnabled() ? "1" : "0");
   113     arguments << "0"; // fps
   115     arguments << (config->isAltDamageEnabled() ? "1" : "0");
   114     arguments << (config->isAltDamageEnabled() ? "1" : "0");
   116     arguments << config->netNick().toUtf8().toBase64();
   115     arguments << config->netNick().toUtf8().toBase64();
   117     arguments << QString::number(config->translateQuality());
   116     arguments << QString::number(config->translateQuality());
   118     arguments << QString::number(config->stereoMode());
   117     arguments << QString::number(config->stereoMode());
   119     arguments << HWGame::tr("en.txt");
   118     arguments << HWGame::tr("en.txt");
   123     arguments << config->AVFormat();
   122     arguments << config->AVFormat();
   124     arguments << config->videoCodec();
   123     arguments << config->videoCodec();
   125 // Could use a field to use quality instead. maybe quality could override bitrate - or just pass (and set) both. 
   124 // Could use a field to use quality instead. maybe quality could override bitrate - or just pass (and set) both. 
   126 // The library does support using both at once after all.
   125 // The library does support using both at once after all.
   127     arguments << QString::number(config->rec_Bitrate()*1024);
   126     arguments << QString::number(config->rec_Bitrate()*1024);
   128     arguments << (config->recordAudio()? config->audioCodec() : "no");
   127     arguments << (config->recordAudio() ? config->audioCodec() : "no");
   129 
   128 
   130     return arguments;
   129     return arguments;
   131 }
   130 }