| 12 | |
| 13 | static Q_LOGGING_CATEGORY(log, "Parameter.Record.UI") |
| 14 | CParameterRecordUI::CParameterRecordUI(QWidget *parent) |
| 15 | : CParameterUI(parent) |
| 16 | , ui(new Ui::CParameterRecordUI) |
| 17 | , m_pParameters(nullptr) |
| 18 | { |
| 19 | ui->setupUi(this); |
| 20 | setWindowTitle(tr("Record")); |
| 21 | setWindowIcon(QIcon::fromTheme("media-record")); |
| 22 | #if HAVE_QT6_MULTIMEDIA |
| 23 | QMediaRecorder recorder; |
| 24 | auto formats = recorder.mediaFormat().supportedFileFormats(QMediaFormat::Encode); |
| 25 | foreach(auto f, formats) { |
| 26 | qDebug(log) << "File format name:" << f; |
| 27 | ui->cmbFileFormat->addItem(QMediaFormat::fileFormatName(f), f); |
| 28 | } |
| 29 | auto video = recorder.mediaFormat().supportedVideoCodecs(QMediaFormat::Encode); |
| 30 | foreach (auto v, video) { |
| 31 | qDebug(log) << "Video codec:" << v; |
| 32 | ui->cmbVideoEncode->addItem(QMediaFormat::videoCodecName(v), (int)v); |
| 33 | } |
| 34 | ui->dsbFrameRate->setToolTip(tr("A value of 0 indicates the recorder should make an optimal choice based on what is available from the video source and the limitations of the codec.") + "\n" + |
| 35 | tr("If record remote desktop, recommended options: 24, 50, 60")); |
| 36 | auto audio = recorder.mediaFormat().supportedAudioCodecs(QMediaFormat::Encode); |
| 37 | foreach(auto a, audio) { |
| 38 | qDebug(log) << "Audio codec:" << a; |
| 39 | ui->cmbAudioEncode->addItem(QMediaFormat::audioCodecName(a), (int)a); |
| 40 | } |
| 41 | ui->sbSampleRate->setToolTip(tr("A value of -1 indicates the recorder should make an optimal choice based on what is available from the audio source, and the limitations of the codec. options: 8kHz, 11.025kHz, 22.05kHz, 16kHz, 37.8kHz, 44.1kHz, 48kHz, 96kHz, 192kHz etc")); |
| 42 | |
| 43 | ui->cmbQuality->addItem(tr("Very high"), QMediaRecorder::Quality::VeryHighQuality); |
| 44 | ui->cmbQuality->addItem(tr("High"), QMediaRecorder::Quality::HighQuality); |
| 45 | ui->cmbQuality->addItem(tr("Normal"), QMediaRecorder::Quality::NormalQuality); |
| 46 | ui->cmbQuality->addItem(tr("Low"), QMediaRecorder::Quality::LowQuality); |
| 47 | ui->cmbQuality->addItem(tr("Very low"), QMediaRecorder::Quality::VeryLowQuality); |
| 48 | |
| 49 | ui->cmbEncodingMode->addItem(tr("Constant quality"), QMediaRecorder::EncodingMode::ConstantQualityEncoding); |
| 50 | ui->cmbEncodingMode->setItemData( |
| 51 | QMediaRecorder::EncodingMode::ConstantQualityEncoding, |
| 52 | tr("Encoding will aim to have a constant quality, adjusting bitrate to fit."), |
| 53 | Qt::ToolTipRole); |
| 54 | ui->cmbEncodingMode->addItem(tr("Constant bit rate"), QMediaRecorder::EncodingMode::ConstantBitRateEncoding); |
| 55 | ui->cmbEncodingMode->setItemData( |
| 56 | QMediaRecorder::EncodingMode::ConstantBitRateEncoding, |
| 57 | tr("Encoding will use a constant bit rate, adjusting quality to fit."), |
| 58 | Qt::ToolTipRole); |
| 59 | ui->cmbEncodingMode->addItem(tr("Average bit rate"), QMediaRecorder::EncodingMode::AverageBitRateEncoding); |
| 60 | ui->cmbEncodingMode->setItemData( |
| 61 | QMediaRecorder::EncodingMode::AverageBitRateEncoding, |
| 62 | tr("Encoding will try to keep an average bitrate setting, but will use more or less as needed."), |
| 63 | Qt::ToolTipRole); |
| 64 | ui->cmbEncodingMode->addItem(tr("Two pass"), QMediaRecorder::EncodingMode::TwoPassEncoding); |
| 65 | ui->cmbEncodingMode->setItemData( |
| 66 | QMediaRecorder::EncodingMode::TwoPassEncoding, |
| 67 | tr("The media will first be processed to determine the characteristics, and then processed a second time allocating more bits to the areas that need it."), |
| 68 | Qt::ToolTipRole); |
| 69 | on_cmbEncodingMode_currentIndexChanged(ui->cmbEncodingMode->currentIndex()); |
| 70 | #endif |
| 71 | } |