I'm working on a website where we'll be getting a lot of videos to be uploaded. To keep things simple and secure, I'm just writing VB.net windows app to suck all the files in a directory in, allow you to set some options, and start the encode by spawning a new FFMpeg process.
I have a working version, but I'm trying to amp it up, one, to help me learn .net, and two, well, that's it.
I don't know much about threads and delegates, but I would think this would give me an error as I've run into a cross thread exception when trying this before... but my debugging says that InvokeRequired is false.
Chain of events:
Form loads
Grabs the last saved input directory from My.Settings
Populates a listview with the file names
What I'd like to do from here is have ffmpeg fire up without any params to get the Stream #0 and #0.1 (Audio/Video). I have it set up to grab that information, but I just can't get it back into the main form.
PreviewFileData() : Resides in a Module
It outputs:
So it works just great, but I can't for the life of me figure out why I can't send this information back to Main (the main form). I've tried Getters/Setters, Good ol functions passing by value, nada. It just get's stuck.
I've tried every scope modifier too so stuff like Run() being a Friend is just me trying everything.
Any ideas?
I have a working version, but I'm trying to amp it up, one, to help me learn .net, and two, well, that's it.
I don't know much about threads and delegates, but I would think this would give me an error as I've run into a cross thread exception when trying this before... but my debugging says that InvokeRequired is false.
Chain of events:
Form loads
Grabs the last saved input directory from My.Settings
Populates a listview with the file names
What I'd like to do from here is have ffmpeg fire up without any params to get the Stream #0 and #0.1 (Audio/Video). I have it set up to grab that information, but I just can't get it back into the main form.
VB.NET:
Private Sub MainLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Startup.populateDefaults()
Utilities.PreviewFileData()
End Sub
PreviewFileData() : Resides in a Module
VB.NET:
Public Sub PreviewFileData()
If Not String.IsNullOrEmpty(Main.InputDir) Then
'
' Irrelevant code populating a List(Of String)
'
' Spawn thread and capture info
Dim emptyThread As Thread = New Thread(AddressOf Run)
emptyThread.IsBackground = True
emptyThread.Start()
End If 'Empty
End Sub
Friend Sub Run()
Dim outList As New List(Of String)
Debug.WriteLine(Main.InvokeRequired)
For Each l As String In Utilities.list
Dim fullPath As String = My.Settings.InputDirectory & "\" & l
Debug.WriteLine(FFMpeg.GetStreamInfo(fullPath))
Next
End Sub
It outputs:
VB.NET:
Stream #0.1(und): Audio: aac, 44100 Hz, mono, s16, 51 kb/s
Stream #0.1(eng): Audio: aac, 22050 Hz, stereo, s16, 30 kb/s
So it works just great, but I can't for the life of me figure out why I can't send this information back to Main (the main form). I've tried Getters/Setters, Good ol functions passing by value, nada. It just get's stuck.
I've tried every scope modifier too so stuff like Run() being a Friend is just me trying everything.
Any ideas?
Last edited: