Compare commits

...

2 Commits

Author SHA1 Message Date
orestonce 4e02c29b59 fix6 2023-11-19 23:46:27 +08:00
orestonce b82cc35649 fix5 2023-11-19 23:05:24 +08:00
3 changed files with 17 additions and 9 deletions

23
api.go
View File

@ -21,15 +21,20 @@ type MergeTsDir_Resp struct {
var gMergeIsRunning bool
var gMergeIsRunningLocker sync.Mutex
func MergeTsDir(InputTsDir string, OutputMp4Name string) (resp MergeTsDir_Resp) {
{
gMergeIsRunningLocker.Lock()
defer gMergeIsRunningLocker.Unlock()
func beginMerge() bool {
gMergeIsRunningLocker.Lock()
defer gMergeIsRunningLocker.Unlock()
if gMergeIsRunning != false {
return resp
}
gMergeIsRunning = true
if gMergeIsRunning != false {
return false
}
gMergeIsRunning = true
return true
}
func MergeTsDir(InputTsDir string, OutputMp4Name string) (resp MergeTsDir_Resp) {
if !beginMerge() {
return resp
}
defer func() {
@ -56,6 +61,8 @@ func MergeTsDir(InputTsDir string, OutputMp4Name string) (resp MergeTsDir_Resp)
sort.Strings(tsFileList) // 按照字典顺序排序
if OutputMp4Name == "" {
OutputMp4Name = filepath.Join(InputTsDir, "all.mp4")
} else if !filepath.IsAbs(OutputMp4Name) {
OutputMp4Name = filepath.Join(InputTsDir, OutputMp4Name)
}
ctx, cancelFn := context.WithCancel(context.Background())
defer cancelFn()

View File

@ -206,6 +206,7 @@ void MainWindow::updateMergeUi(bool runing)
ui->lineEdit_mergeDir->setEnabled(!runing);
ui->toolButton_selectMergeDir->setEnabled(!runing);
ui->pushButton_stopMerge->setEnabled(runing);
ui->pushButton_startMerge->setEnabled(!runing);
ui->lineEdit_mergeFileName->setEnabled(!runing);
ui->pushButton_returnDownload->setEnabled(!runing);
}

View File

@ -18,7 +18,7 @@
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_2">