Skip to content

Commit

Permalink
開発用ブランチをマージ
Browse files Browse the repository at this point in the history
  • Loading branch information
takahiro-itou committed Sep 2, 2024
2 parents 5af9c3d + 1d3dd6d commit cb8a7cd
Show file tree
Hide file tree
Showing 25 changed files with 2,698 additions and 1,070 deletions.
18 changes: 1 addition & 17 deletions SampleView.sln → AsfEditor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 17.2.32630.192
MinimumVisualStudioVersion = 10.0.40219.1

Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "ViewVb", "ViewVb\ViewVb.vbproj", "{3446924D-6058-4767-B215-8FDBAEF1756C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ViewCs", "ViewCs\ViewCs.csproj", "{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}"
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "AsfEditor", "AsfEditor\AsfEditor.vbproj", "{3446924D-6058-4767-B215-8FDBAEF1756C}"
EndProject

Global
Expand All @@ -32,20 +30,6 @@ Global
{3446924D-6058-4767-B215-8FDBAEF1756C}.Release|x64.Build.0 = Release|x64
{3446924D-6058-4767-B215-8FDBAEF1756C}.Release|x86.ActiveCfg = Release|Win32
{3446924D-6058-4767-B215-8FDBAEF1756C}.Release|x86.Build.0 = Release|Win32

{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}.Debug|Any CPU.ActiveCfg = Debug|x64
{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}.Debug|Any CPU.Build.0 = Debug|x64
{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}.Debug|x64.ActiveCfg = Debug|x64
{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}.Debug|x64.Build.0 = Debug|x64
{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}.Debug|x86.ActiveCfg = Debug|Win32
{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}.Debug|x86.Build.0 = Debug|Win32
{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}.Release|Any CPU.ActiveCfg = Release|x64
{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}.Release|Any CPU.Build.0 = Release|x64
{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}.Release|x64.ActiveCfg = Release|x64
{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}.Release|x64.Build.0 = Release|x64
{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}.Release|x86.ActiveCfg = Release|Win32
{4486E20D-9A2C-4F4A-9B63-B5CC3F32DBDC}.Release|x86.Build.0 = Release|Win32

EndGlobalSection

GlobalSection(SolutionProperties) = preSolution
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion ViewVb/ViewVb.vbproj → AsfEditor/AsfEditor.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
<OutputType>WinExe</OutputType>
<TargetFrameworks>
net6.0-windows;
net35;
net48;
</TargetFrameworks>
<StartupObject>ViewVb.My.MyApplication</StartupObject>
<StartupObject>AsfEditor.My.MyApplication</StartupObject>
<UseWindowsForms>true</UseWindowsForms>
<MyType>WindowsForms</MyType>
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Update="Form1.cs">
<Compile Update="MainView.vb">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
Expand Down
156 changes: 156 additions & 0 deletions AsfEditor/BackEndRunner.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
Public Module BackEndRunner


Public Function launchProcess(
ByVal sCommand As String,
ByVal sArguments As String,
ByVal workDir As String) As Boolean
''--------------------------------------------------------------------
''
''--------------------------------------------------------------------
Dim readerOut As System.IO.StreamReader
Dim readerErr As System.IO.StreamReader
Dim textOut As String
Dim textErr As String
Dim bResult As Boolean

Using process As New System.Diagnostics.Process()
With process
With .StartInfo
.Arguments = sArguments
.CreateNoWindow = False
.FileName = sCommand
.RedirectStandardInput = False
.RedirectStandardError = False
.RedirectStandardOutput = False
.UseShellExecute = False
.WorkingDirectory = workDir
End With

.Start()

' readerOut = .StandardOutput
' readerErr = .StandardError
' textOut = readerOut.ReadToEnd()
' textErr = readerErr.ReadToEnd()
textOut = ""
textErr = ""

.WaitForExit()
textErr = textErr & .ExitCode & vbCrLf

If .ExitCode <> 0 Then
MessageBox.Show(
sCommand & vbCrLf & sArguments & vbCrLf &
"ERR: " & vbCrLf & textErr)
bResult = False
Else
bResult = True
End If
.Close()
End With
End Using

launchProcess = bResult
End Function


Public Function performVideoEdit(
ByVal viInputs() As InputInfo,
ByVal outFile As String,
ByVal workDir As String) As Boolean
''--------------------------------------------------------------------
''
''--------------------------------------------------------------------
Dim i As Integer, lastInputs As Integer
Dim outWork As String
Dim workFiles() as String
Dim bResult As Boolean

workDir = uniformDirName(workDir)

lastInputs = viInputs.Length - 1
ReDim workFiles(lastInputs)
For i = 0 To lastInputs
outWork = workDir & String.Format("Part{0:000}.wmv", i)
runSegmentCommand(viInputs(i), outWork, workDir)
workFiles(i) = outWork
Next

bResult = runConcatCommand(workFiles, lastInputs, outFile, workDir)
performVideoEdit = bResult
End Function


Public Function runConcatCommand(
ByVal workFiles() As String,
ByVal lastInputs As Integer,
ByVal outFile As String,
ByVal workDir As String) As Boolean
''--------------------------------------------------------------------
''
''--------------------------------------------------------------------
Dim i As Integer
Dim sbArgs As System.Text.StringBuilder
Dim str2 As String
Dim enc As System.Text.Encoding
Dim workCatFile As String
Dim bResult As Boolean

enc = New System.Text.UTF8Encoding(False)
workCatFile = workDir & "workconcatlist.txt"

Using sw As New System.IO.StreamWriter(workCatFile, False, enc)
For i = 0 To lastInputs
sw.WriteLine("file '" & workFiles(i) & "'")
Next i
End Using

sbArgs = New System.Text.StringBuilder()
With sbArgs
.Append("-f concat -accurate_seek -safe 0 -i """)
.Append(workCatFile)
.Append(""" -c:v copy -c:a copy -map 0:v -map 0:a")
.Append(" -y -loglevel verbose """)
.Append(outFile)
.Append("""")
End With

str2 = sbArgs.ToString()
bResult = launchProcess("ffmpeg", str2, workDir)
runConcatCommand = bResult
End Function


Public Function runSegmentCommand(
ByVal viSrcInfo As InputInfo, _
ByVal workOutFile As String, _
ByVal workDir As String) As Boolean
''--------------------------------------------------------------------
''
''--------------------------------------------------------------------
Dim sbArgs As System.Text.StringBuilder
Dim str2 As String
Dim bResult As Boolean

sbArgs = New System.Text.StringBuilder()
With sbArgs
.Append(" -ss ")
.Append(viSrcInfo.sStartTime)
.Append(" -t ")
.Append(viSrcInfo.sTimeDuration)
.Append(" -accurate_seek -i """)
.Append(viSrcInfo.sFileName)
.Append(""" -c:v copy -c:a copy -avoid_negative_ts make_zero")
.Append(" -y -loglevel verbose """)
.Append(workOutFile)
.Append("""")
End With

str2 = sbArgs.ToString()
bResult = launchProcess("ffmpeg", str2, workDir)
runSegmentCommand = bResult
End Function


End Module
Loading

0 comments on commit cb8a7cd

Please sign in to comment.