kylin-recorder/0001-modify-kylin-recorder-running-errors.patch
2021-08-10 07:23:25 +08:00

224 lines
8.7 KiB
Diff

From 6e9fb93ea062a7bdcbb539c43554c9cfdcd4fb4a Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Thu, 19 Aug 2021 11:45:50 +0800
Subject: [PATCH] modify kylin-recorder running errors
---
debian/control | 4 ++--
kylin-recorder.pro | 9 +++++----
src/main.cpp | 4 ++--
src/mythread.cpp | 34 +++++++++++++++++-----------------
src/xatom-helper.h | 2 +-
5 files changed, 27 insertions(+), 26 deletions(-)
diff --git a/debian/control b/debian/control
index bf1110f..f5d1ea5 100644
--- a/debian/control
+++ b/debian/control
@@ -16,7 +16,7 @@ Build-Depends: debhelper,
libqt5x11extras5-dev,
libkf5windowsystem-dev,
pkgconf,
- libukui-log4qt-dev,
+# libukui-log4qt-dev,
libavdevice-dev,
libavfilter-dev,
libavformat-dev,
@@ -34,7 +34,7 @@ Depends: libburner-media3-1,
gstreamer1.0-plugins-good,
gstreamer1.0-plugins-bad,
gstreamer1.0-pulseaudio,
- libukui-log4qt-dev,
+# libukui-log4qt-dev,
${shlibs:Depends},
${misc:Depends}
Description: Recorder tool for UKUI
diff --git a/kylin-recorder.pro b/kylin-recorder.pro
index 2369046..ddda4b0 100644
--- a/kylin-recorder.pro
+++ b/kylin-recorder.pro
@@ -15,6 +15,7 @@ TRANSLATIONS += ./translations/kylin-recorder_zh_CN.ts
QT += multimedia multimediawidgets
TARGET = kylin-recorder
TEMPLATE = app
+INCLUDEPATH += /usr/include/ffmpeg/
#ffmpeg需要的东西都是
LIBS += -lmp3lame -lavformat -lavdevice -lavcodec -lavutil -lswscale -lswresample
@@ -40,12 +41,12 @@ icons.path = /usr/share/pixmaps/
# gsettings
schemes.files += \
- $$PWD/data/org.kylin-recorder-data.gschema.xml \
- $$PWD/data/org.ukui.log4qt.kylin-recorder.gschema.xml
+ $$PWD/data/org.kylin-recorder-data.gschema.xml
+# $$PWD/data/org.ukui.log4qt.kylin-recorder.gschema.xml
#schemes.files = data/org.kylin-recorder-data.gschema.xml
schemes.path = /usr/share/glib-2.0/schemas/
-LIBS += -L/usr/lib/libukui-log4qt.so.1.0.0 -lukui-log4qt
+#LIBS += -L/usr/lib/libukui-log4qt.so.1.0.0 -lukui-log4qt
INSTALLS += target desktop appdesktop icons schemes qm_files
@@ -107,7 +108,7 @@ RESOURCES += \
DISTFILES += \
data/org.kylin-recorder-data.gschema.xml \
- data/org.ukui.log4qt.kylin-recorder.gschema.xml \
+# data/org.ukui.log4qt.kylin-recorder.gschema.xml \
mypng.rc \
translations/kylin-recorder_zh_CN.qm \
translations/kylin-recorder_zh_CN.ts \
diff --git a/src/main.cpp b/src/main.cpp
index 4642e05..bcadd11 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -23,7 +23,7 @@
#include <QStandardPaths>
#include <fcntl.h>
#include <syslog.h>
-#include <ukui-log4qt.h>
+//#include <ukui-log4qt.h>
#define DOUBLE 2
#define MAX_FILE_SIZE 1024
@@ -105,7 +105,7 @@ void messageOutput(QtMsgType type, const QMessageLogContext &context, const QStr
int main(int argc, char *argv[])
{
// qInstallMessageHandler(messageOutput);//日志输出功能,穿版本之前务必解开
- initUkuiLog4qt("kylin-recorder");//日志功能,穿版本之前务必解开
+// initUkuiLog4qt("kylin-recorder");//日志功能,穿版本之前务必解开
printf("Program start ...\n");
/*
* 添加4K 屏幕支持。
diff --git a/src/mythread.cpp b/src/mythread.cpp
index 8b1b03f..d5ae492 100644
--- a/src/mythread.cpp
+++ b/src/mythread.cpp
@@ -110,7 +110,7 @@ qint64 MyThread::toConvertWAV(QString catheFileName , QString filename)
QTextCodec *code=QTextCodec::codecForName("gb2312");//解决中文路径保存
code->fromUnicode(endFileName).data();
QString cmd="ffmpeg -y -threads 2 -f s16le -ar 48k -ac 1 -i \""+catheFileName+"\" \""+endFileName+"\"";
-// process->start(cmd);//0609暂时去掉后期复原
+ process->start(cmd);//0609暂时去掉后期复原
cacheFile.close();
wavFile.close();
@@ -138,7 +138,7 @@ qint64 MyThread::toConvertMp3(QString catheFileName , QString mp3FileName)
QTextCodec *code=QTextCodec::codecForName("gb2312");//解决中文路径保存
code->fromUnicode(endFileName).data();
QString cmd="ffmpeg -y -threads 2 -f s16le -ar 48k -ac 2 -i \""+catheFileName+"\" \""+endFileName+"\"";
-// process->start(cmd);//0609暂时去掉后期复原
+ process->start(cmd);//0609暂时去掉后期复原
cacheFile.close();
mp3File.close();
@@ -169,7 +169,7 @@ qint64 MyThread::toConvertM4a(QString catheFileName , QString m4aFileName)
QString cmd="ffmpeg -y -f s16le -ar 48k -ac 2 -i \""+catheFileName+"\" \""+endFileName+"\"";
//qDebug()<<"******"<<catheFileName<<"*"<<cmd<<"******";
-// process->start(cmd);//0609暂时去掉后期复原
+ process->start(cmd);//0609暂时去掉后期复原
cacheFile.close();
@@ -470,30 +470,30 @@ void MyThread::stop_btnPressed()//停止录音
{
if(type==1)//1代表MP3
{
- // if( toConvertMp3( absolutionPath, (endFileName).toLocal8Bit().data())>0)
- // {
+ if( toConvertMp3( absolutionPath, (endFileName).toLocal8Bit().data())>0)
+ {
//如下5行代码后期重构时务必放入一个函数里...2021.01.15(重复使用的功能需放入同一函数中)
qDebug()<<"*********************mp3";
emit listItemAddSignal(endFileName,MainWindow::mutual->list->count()+1);
- // }
+ }
}
else if(type==2)//2代表M4a
{
- // if( toConvertM4a( absolutionPath, (endFileName).toLocal8Bit().data() ) > 0 )
- // {
+ if( toConvertM4a( absolutionPath, (endFileName).toLocal8Bit().data() ) > 0 )
+ {
//改变配置文件中的存储路径
emit listItemAddSignal(endFileName,MainWindow::mutual->list->count()+1);
- // }
+ }
}
else if(type==3)//3代表Wav
{
- // if( toConvertWAV( absolutionPath, (endFileName).toLocal8Bit().data() ) > 0 )
- // {
+ if( toConvertWAV( absolutionPath, (endFileName).toLocal8Bit().data() ) > 0 )
+ {
//改变配置文件中的存储路径
emit listItemAddSignal(endFileName,MainWindow::mutual->list->count()+1);
- // }
+ }
}
else
{
@@ -698,9 +698,9 @@ void MyThread::playRecord()//开始录制
{
audioInputFile->start(file);
-// inputDevSound = audioInputSound->start();
+ inputDevSound = audioInputSound->start();
audioRecorder->record();
-// connect(inputDevSound, SIGNAL(readyRead()),this,SLOT(OnReadMore()));//点击开始三角按钮时录制
+ connect(inputDevSound, SIGNAL(readyRead()),this,SLOT(OnReadMore()));//点击开始三角按钮时录制
// connect(audioProbe, SIGNAL(audioBufferProbed(QAudioBuffer)), this, SLOT(processBuffer(QAudioBuffer)));
}
@@ -732,7 +732,7 @@ void MyThread::InitMonitor()
int i=recordData->get("source").toInt();
monitorVoiceSource(i);
-// connect(inputDevSound, SIGNAL(readyRead()),this,SLOT(OnReadMore()));
+ connect(inputDevSound, SIGNAL(readyRead()),this,SLOT(OnReadMore()));
// connect(audioProbe, SIGNAL(audioBufferProbed(QAudioBuffer)), this, SLOT(processBuffer(QAudioBuffer)));
}
@@ -757,7 +757,7 @@ QAudioDeviceInfo MyThread::monitorVoiceSource(int i)
QAudioDeviceInfo inputDevice(deviceInfo);
mFormatSound = inputDevice.nearestFormat(mFormatSound);
audioInputSound = new QAudioInput(inputDevice, mFormatSound, this);
-// inputDevSound = audioInputSound->start();
+ inputDevSound = audioInputSound->start();
qDebug()<<"当前内部输入设备:"<<inputDevice.deviceName()<<mFormatSound;//可以判断当前输入设备
return inputDevice;
}
@@ -788,7 +788,7 @@ QAudioDeviceInfo MyThread::monitorVoiceSource(int i)
QAudioDeviceInfo inputDevice(QAudioDeviceInfo::defaultInputDevice());
mFormatSound = inputDevice.nearestFormat(mFormatSound);
audioInputSound = new QAudioInput(inputDevice, mFormatSound, this);
-// inputDevSound = audioInputSound->start();
+ inputDevSound = audioInputSound->start();
qDebug()<<"当前外部输入设备:"<<inputDevice.deviceName()<<mFormatSound;//可以判断当前输入设备
return inputDevice;
}
diff --git a/src/xatom-helper.h b/src/xatom-helper.h
index c8d1701..5c09893 100644
--- a/src/xatom-helper.h
+++ b/src/xatom-helper.h
@@ -23,10 +23,10 @@
#ifndef XATOMHELPER_H
#define XATOMHELPER_H
+#include <NETWM>
#include <QObject>
#include <X11/Xlib.h>
-#include <NETWM>
struct UnityCorners {
ulong topLeft = 0;
--
2.27.0