-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFFMpegForm.bas
More file actions
73 lines (64 loc) · 1.79 KB
/
FFMpegForm.bas
File metadata and controls
73 lines (64 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
B4J=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=10
@EndOfDesignText@
Sub Class_Globals
Private fx As JFX
Private frm As Form
Private ArgumentsTextArea As TextArea
Private OutputTextArea As TextArea
Private sh As Shell
Private StatusLabel As Label
Private th As Thread
Private WorkDirTextField As TextField
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
frm.Initialize("frm",600,400)
frm.RootPane.LoadLayout("FFmpeg")
Main.loc.LocalizeForm(frm)
WorkDirTextField.Text = File.DirApp
th.Initialise("th")
End Sub
Public Sub SetArguments(arguments As String)
ArgumentsTextArea.Text = arguments
End Sub
Public Sub SetWorkdir(dir As String)
WorkDirTextField.Text = dir
End Sub
Public Sub Show
frm.Show
End Sub
Private Sub Button1_MouseClicked (EventData As MouseEvent)
Run
End Sub
Private Sub Run As ResumableSub
StatusLabel.Text = Main.loc.Localize("Processing...")
Dim args As List = Regex.Split(" ",ArgumentsTextArea.Text)
Dim sh As Shell
sh.Initialize("sh",FFMpeg.GetFFMpegPath,args)
sh.WorkingDirectory = WorkDirTextField.Text
sh.RunWithOutputEvents(-1)
wait for sh_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Log(StdOut)
Log(StdErr)
StatusLabel.Text = Main.loc.Localize("Done")
Return Success
End Sub
Private Sub sh_StdOut (Buffer() As Byte, Length As Int)
Dim bc As ByteConverter
Dim s As String = bc.StringFromBytes(Buffer,"UTF-8")
Log(s)
th.RunOnGuiThread("update",Array As String(s))
End Sub
Private Sub sh_StdErr (Buffer() As Byte, Length As Int)
Dim bc As ByteConverter
Dim s As String = bc.StringFromBytes(Buffer,"UTF-8")
Log(s)
th.RunOnGuiThread("update",Array As String(s))
End Sub
Private Sub update(s As String)
OutputTextArea.Text = s
End Sub