QTfrontend/net/recorder.cpp
author alfadur
Fri, 05 Jul 2019 21:16:33 +0300
changeset 15214 58a0f2a6527b
parent 14629 8ffa0c27f434
child 15283 c4fd2813b127
permissions -rw-r--r--
optimize sqrts
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     1
/*
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
11046
47a8c19ecb60 more copyright fixes
sheepluva
parents: 10248
diff changeset
     3
 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     4
 *
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     8
 *
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    13
 *
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
10108
c68cf030eded update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents: 9998
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    17
 */
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    18
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    19
#include <QString>
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    20
#include <QByteArray>
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    21
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    22
#include "recorder.h"
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    23
#include "gameuiconfig.h"
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    24
#include "hwconsts.h"
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    25
#include "game.h"
14629
8ffa0c27f434 Show error message in frontend if video encoding failed in engine
Wuzzy <Wuzzy2@mail.ru>
parents: 14599
diff changeset
    26
#include "util/MessageDialog.h"
7897
5e7c0810f365 libav name refactor
koda
parents: 7868
diff changeset
    27
#include "LibavInteraction.h"
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    28
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
    29
// Encoding is memory expensive process, so we need to limit maximum number
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
    30
// of simultaneous encoders.
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
    31
static const int maxRecorders = 3;
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
    32
static int numRecorders = 0;
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
    33
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
    34
static QList<HWRecorder*> queue;
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
    35
7280
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    36
HWRecorder::HWRecorder(GameUIConfig * config, const QString &prefix) :
14599
b86e6e4f3c58 Make game engine load the user's locale correctly (bug 688)
Wuzzy <Wuzzy2@mail.ru>
parents: 13644
diff changeset
    37
    TCPBase(false, !config->language().isEmpty())
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    38
{
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    39
    this->config = config;
7280
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    40
    this->prefix = prefix;
10248
7b9b44a051f8 Fix some of issues found by coverity
unc0rr
parents: 10108
diff changeset
    41
    item = 0;
7280
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    42
    finished = false;
13644
1b536e268519 Fix frontend crash when rapidly aborting many active video encodings. Fixes bug 595
Wuzzy <Wuzzy2@mail.ru>
parents: 13492
diff changeset
    43
    aborted = false;
7897
5e7c0810f365 libav name refactor
koda
parents: 7868
diff changeset
    44
    name = prefix + "." + LibavInteraction::instance().getExtension(config->AVFormat());
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    45
}
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    46
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    47
HWRecorder::~HWRecorder()
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    48
{
7280
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    49
    emit encodingFinished(finished);
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
    50
    if (queue.empty())
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
    51
        numRecorders--;
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
    52
    else
8069
bb7671829935 - Only allow one engine instance running at the moment
unc0rr
parents: 7897
diff changeset
    53
        queue.takeFirst()->Start(false);
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    54
}
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    55
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    56
void HWRecorder::onClientDisconnect()
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    57
{
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    58
}
7235
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 7198
diff changeset
    59
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    60
void HWRecorder::onClientRead()
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    61
{
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    62
    quint8 msglen;
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    63
    quint32 bufsize;
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    64
    while (!readbuffer.isEmpty() && ((bufsize = readbuffer.size()) > 0) &&
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    65
            ((msglen = readbuffer.data()[0]) < bufsize))
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    66
    {
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    67
        QByteArray msg = readbuffer.left(msglen + 1);
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    68
        readbuffer.remove(0, msglen + 1);
7280
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    69
        switch (msg.at(1))
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    70
        {
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    71
        case '?':
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    72
            SendIPC("!");
7280
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    73
            break;
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    74
        case 'p':
7376
48b79b3ca592 rework saving of camera positions so there is no need to know framerate during prerecording.
Stepan777 <stepik-777@mail.ru>
parents: 7280
diff changeset
    75
            emit onProgress((quint8(msg.at(2))*256.0 + quint8(msg.at(3)))*0.0001);
7280
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    76
            break;
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    77
        case 'v':
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    78
            finished = true;
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    79
            break;
14629
8ffa0c27f434 Show error message in frontend if video encoding failed in engine
Wuzzy <Wuzzy2@mail.ru>
parents: 14599
diff changeset
    80
        case 'E':
8ffa0c27f434 Show error message in frontend if video encoding failed in engine
Wuzzy <Wuzzy2@mail.ru>
parents: 14599
diff changeset
    81
            int size = msg.size();
8ffa0c27f434 Show error message in frontend if video encoding failed in engine
Wuzzy <Wuzzy2@mail.ru>
parents: 14599
diff changeset
    82
            emit ErrorMessage(
8ffa0c27f434 Show error message in frontend if video encoding failed in engine
Wuzzy <Wuzzy2@mail.ru>
parents: 14599
diff changeset
    83
                tr("A fatal ERROR occured while processing the video recording! "
8ffa0c27f434 Show error message in frontend if video encoding failed in engine
Wuzzy <Wuzzy2@mail.ru>
parents: 14599
diff changeset
    84
                "The video could not be saved.\n\n"
8ffa0c27f434 Show error message in frontend if video encoding failed in engine
Wuzzy <Wuzzy2@mail.ru>
parents: 14599
diff changeset
    85
                "As a workaround, you could try to reset the Hedgewars video recorder settings to the defaults.\n\n"
8ffa0c27f434 Show error message in frontend if video encoding failed in engine
Wuzzy <Wuzzy2@mail.ru>
parents: 14599
diff changeset
    86
                "To report this error, please click the 'Feedback' button in the main menu!\n\n"
8ffa0c27f434 Show error message in frontend if video encoding failed in engine
Wuzzy <Wuzzy2@mail.ru>
parents: 14599
diff changeset
    87
                "Last engine message:\n%1")
8ffa0c27f434 Show error message in frontend if video encoding failed in engine
Wuzzy <Wuzzy2@mail.ru>
parents: 14599
diff changeset
    88
                .arg(QString::fromUtf8(msg.mid(2).left(size - 4))));
8ffa0c27f434 Show error message in frontend if video encoding failed in engine
Wuzzy <Wuzzy2@mail.ru>
parents: 14599
diff changeset
    89
            return;
7280
fd707afbc3a2 pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents: 7235
diff changeset
    90
        }
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    91
    }
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    92
}
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    93
7376
48b79b3ca592 rework saving of camera positions so there is no need to know framerate during prerecording.
Stepan777 <stepik-777@mail.ru>
parents: 7280
diff changeset
    94
void HWRecorder::EncodeVideo(const QByteArray & record)
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    95
{
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    96
    toSendBuf = record;
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    97
    toSendBuf.replace(QByteArray("\x02TD"), QByteArray("\x02TV"));
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    98
    toSendBuf.replace(QByteArray("\x02TL"), QByteArray("\x02TV"));
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    99
    toSendBuf.replace(QByteArray("\x02TN"), QByteArray("\x02TV"));
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   100
    toSendBuf.replace(QByteArray("\x02TS"), QByteArray("\x02TV"));
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   101
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
   102
    if (numRecorders < maxRecorders)
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
   103
    {
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
   104
        numRecorders++;
8069
bb7671829935 - Only allow one engine instance running at the moment
unc0rr
parents: 7897
diff changeset
   105
        Start(false); // run engine
7507
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
   106
    }
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
   107
    else
3032a5739fe1 improve video uploading
Stepan777 <stepik-777@mail.ru>
parents: 7376
diff changeset
   108
        queue.push_back(this);
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   109
}
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   110
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   111
QStringList HWRecorder::getArguments()
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   112
{
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   113
    QStringList arguments;
7235
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 7198
diff changeset
   114
    QRect resolution = config->rec_Resolution();
8325
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   115
    QString nick = config->netNick().toUtf8().toBase64();
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   116
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   117
    arguments << "--internal";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   118
    arguments << "--port";
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   119
    arguments << QString("%1").arg(ipc_port);
8325
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   120
    arguments << "--prefix";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   121
    arguments << datadir->absolutePath();
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   122
    arguments << "--user-prefix";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   123
    arguments << cfgdir->absolutePath();
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   124
    arguments << "--locale";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   125
    arguments << HWGame::tr("en.txt");
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   126
    arguments << "--frame-interval";
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   127
    arguments << QString::number(config->timerInterval());
8325
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   128
    arguments << "--width";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   129
    arguments << QString::number(resolution.width());
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   130
    arguments << "--height";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   131
    arguments << QString::number(resolution.height());
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   132
    arguments << "--nosound";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   133
    arguments << "--raw-quality";
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   134
    arguments << QString::number(config->translateQuality());
8325
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   135
    arguments << "--stereo";
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   136
    arguments << QString::number(config->stereoMode());
8325
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   137
    arguments << "--nomusic";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   138
    arguments << "--volume";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   139
    arguments << "0";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   140
    if (config->isAltDamageEnabled())
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   141
        arguments << "--altdmg";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   142
    if (!nick.isEmpty()) {
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   143
        arguments << "--nick";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   144
        arguments << nick;
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   145
    }
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   146
    arguments << "--recorder";
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   147
    arguments << QString::number(config->rec_Framerate()); //cVideoFramerateNum
ecd51650d5d8 GCI2012: Change Argument Passing Between Frontend and Engine
RowanD
parents: 8069
diff changeset
   148
    arguments << "1"; //cVideoFramerateDen
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   149
    arguments << prefix;
7235
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 7198
diff changeset
   150
    arguments << config->AVFormat();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 7198
diff changeset
   151
    arguments << config->videoCodec();
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8325
diff changeset
   152
// Could use a field to use quality instead. maybe quality could override bitrate - or just pass (and set) both.
7633
d4251e519062 Allow adjusting bitrate so that I can get a somewhat usable webm video. The audio is still tinny and unlistenable. Configuration option for that might be helpful, or just adjusting defaults in the wrapper.
nemo
parents: 7507
diff changeset
   153
// The library does support using both at once after all.
d4251e519062 Allow adjusting bitrate so that I can get a somewhat usable webm video. The audio is still tinny and unlistenable. Configuration option for that might be helpful, or just adjusting defaults in the wrapper.
nemo
parents: 7507
diff changeset
   154
    arguments << QString::number(config->rec_Bitrate()*1024);
13492
c7df0d96da81 Fix video recorder not working if sound disabled (fixes bug 200)
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
   155
    if (config->recordAudio() && (config->isSoundEnabled() || config->isMusicEnabled()))
c7df0d96da81 Fix video recorder not working if sound disabled (fixes bug 200)
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
   156
        arguments << config->audioCodec();
c7df0d96da81 Fix video recorder not working if sound disabled (fixes bug 200)
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
   157
    else
c7df0d96da81 Fix video recorder not working if sound disabled (fixes bug 200)
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
   158
        arguments << "no";
7180
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   159
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   160
    return arguments;
53ffc8853008 here it is
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   161
}
9800
169fbb968bb3 No idea what this is doing, seems to allow recorder instance to not block further engine starts while it is doing its job.
unc0rr
parents: 9080
diff changeset
   162
169fbb968bb3 No idea what this is doing, seems to allow recorder instance to not block further engine starts while it is doing its job.
unc0rr
parents: 9080
diff changeset
   163
bool HWRecorder::simultaneousRun()
169fbb968bb3 No idea what this is doing, seems to allow recorder instance to not block further engine starts while it is doing its job.
unc0rr
parents: 9080
diff changeset
   164
{
169fbb968bb3 No idea what this is doing, seems to allow recorder instance to not block further engine starts while it is doing its job.
unc0rr
parents: 9080
diff changeset
   165
    return true;
169fbb968bb3 No idea what this is doing, seems to allow recorder instance to not block further engine starts while it is doing its job.
unc0rr
parents: 9080
diff changeset
   166
}
13644
1b536e268519 Fix frontend crash when rapidly aborting many active video encodings. Fixes bug 595
Wuzzy <Wuzzy2@mail.ru>
parents: 13492
diff changeset
   167
1b536e268519 Fix frontend crash when rapidly aborting many active video encodings. Fixes bug 595
Wuzzy <Wuzzy2@mail.ru>
parents: 13492
diff changeset
   168
void HWRecorder::abort()
1b536e268519 Fix frontend crash when rapidly aborting many active video encodings. Fixes bug 595
Wuzzy <Wuzzy2@mail.ru>
parents: 13492
diff changeset
   169
{
1b536e268519 Fix frontend crash when rapidly aborting many active video encodings. Fixes bug 595
Wuzzy <Wuzzy2@mail.ru>
parents: 13492
diff changeset
   170
    queue.removeOne(this);
1b536e268519 Fix frontend crash when rapidly aborting many active video encodings. Fixes bug 595
Wuzzy <Wuzzy2@mail.ru>
parents: 13492
diff changeset
   171
    aborted = true;
1b536e268519 Fix frontend crash when rapidly aborting many active video encodings. Fixes bug 595
Wuzzy <Wuzzy2@mail.ru>
parents: 13492
diff changeset
   172
    deleteLater();
1b536e268519 Fix frontend crash when rapidly aborting many active video encodings. Fixes bug 595
Wuzzy <Wuzzy2@mail.ru>
parents: 13492
diff changeset
   173
}