VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0"; "mscomctl.ocx"
Begin VB.Form frmDemux 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "AVStoDVD Demux Tool"
   ClientHeight    =   8070
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   11130
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   HelpContextID   =   81
   Icon            =   "frmDemux.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   8070
   ScaleWidth      =   11130
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame corOperations 
      Caption         =   "Operations"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000007&
      Height          =   1695
      Left            =   120
      TabIndex        =   15
      Top             =   6240
      Width           =   10875
      Begin MSComctlLib.ListView lViewOper 
         Height          =   1335
         Left            =   120
         TabIndex        =   16
         Top             =   240
         Width           =   10575
         _ExtentX        =   18653
         _ExtentY        =   2355
         View            =   3
         LabelEdit       =   1
         LabelWrap       =   0   'False
         HideSelection   =   -1  'True
         HideColumnHeaders=   -1  'True
         FullRowSelect   =   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   3
         BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            Object.Width           =   564
         EndProperty
         BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            SubItemIndex    =   1
            Text            =   "Time"
            Object.Width           =   1501
         EndProperty
         BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            SubItemIndex    =   2
            Text            =   "Log"
            Object.Width           =   1764
         EndProperty
      End
   End
   Begin VB.Frame corSelectFile 
      Caption         =   "Select Container File"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   795
      Left            =   120
      OLEDropMode     =   1  'Manual
      TabIndex        =   0
      Top             =   120
      Width           =   10875
      Begin VB.TextBox txtPathname 
         Height          =   315
         Left            =   180
         Locked          =   -1  'True
         OLEDragMode     =   1  'Automatic
         TabIndex        =   1
         Top             =   300
         Width           =   9975
      End
      Begin VB.CommandButton plsPathname 
         Caption         =   "..."
         Height          =   285
         Left            =   10200
         Picture         =   "frmDemux.frx":0E42
         TabIndex        =   2
         Top             =   300
         Width           =   435
      End
   End
   Begin VB.Frame corSelectTracks 
      Caption         =   "Select Tracks to Demux"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   4575
      Left            =   120
      TabIndex        =   3
      Top             =   1020
      Width           =   10875
      Begin VB.ListBox lstVideo 
         Height          =   510
         Left            =   180
         Style           =   1  'Checkbox
         TabIndex        =   5
         Top             =   600
         Width           =   10455
      End
      Begin VB.ListBox lstAudio 
         Height          =   960
         Left            =   180
         Style           =   1  'Checkbox
         TabIndex        =   7
         Top             =   1440
         Width           =   10455
      End
      Begin VB.ListBox lstSubs 
         Height          =   960
         Left            =   180
         Style           =   1  'Checkbox
         TabIndex        =   11
         Top             =   3120
         Width           =   10455
      End
      Begin VB.Label lblSubsNone 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H80000013&
         BackStyle       =   0  'Transparent
         BorderStyle     =   1  'Fixed Single
         Caption         =   "None"
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   780
         TabIndex        =   13
         Top             =   4140
         Width           =   555
      End
      Begin VB.Label lblSubsAll 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H80000013&
         BackStyle       =   0  'Transparent
         BorderStyle     =   1  'Fixed Single
         Caption         =   "All"
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   240
         TabIndex        =   12
         Top             =   4140
         Width           =   495
      End
      Begin VB.Label lblAudioNone 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H80000013&
         BackStyle       =   0  'Transparent
         BorderStyle     =   1  'Fixed Single
         Caption         =   "None"
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   780
         TabIndex        =   9
         Top             =   2460
         Width           =   555
      End
      Begin VB.Label lblAudioAll 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H80000013&
         BackStyle       =   0  'Transparent
         BorderStyle     =   1  'Fixed Single
         Caption         =   "All"
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   240
         TabIndex        =   8
         Top             =   2460
         Width           =   495
      End
      Begin VB.Label lblVideo 
         Caption         =   "Video Info:"
         Height          =   195
         Left            =   240
         TabIndex        =   4
         Top             =   360
         Width           =   1635
      End
      Begin VB.Label lblAudio 
         Caption         =   "Audio Info:"
         Height          =   195
         Left            =   240
         TabIndex        =   6
         Top             =   1200
         Width           =   1635
      End
      Begin VB.Label lblSubs 
         Caption         =   "Subtitles Info:"
         Height          =   195
         Left            =   240
         TabIndex        =   10
         Top             =   2880
         Width           =   1635
      End
   End
   Begin VB.Label lblProcess 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000013&
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Demux Selected Tracks"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000007&
      Height          =   315
      Left            =   120
      TabIndex        =   14
      Top             =   5760
      Width           =   10875
   End
End
Attribute VB_Name = "frmDemux"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' -------------------------------------------------------------------------------
'
'   AVStoDVD - by MrC
'   File: frmDemux.frm
'   Purpose: AVStoDVD Demux File form
'
' -------------------------------------------------------------------------------


Option Explicit
Option Compare Binary
Option Base 0


Private Sub Form_Load()

    ' Load Skin Font settings
    Call modMain.Load_Skin_Font(Me)
    
    ' Load Language
    Call Populate_Form_Language

    ' Initialize controls
    Set Me.lViewOper.SmallIcons = frmMain.ImageList16

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

    Select Case UnloadMode
    Case 0
        '
    End Select
    
    'frmMain.Show
    
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Call Reset_Labels_Font

End Sub

Private Sub corSelectTracks_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Call Reset_Labels_Font

End Sub

Private Sub lstAudio_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Call Reset_Labels_Font
    
End Sub

Private Sub lblAudioAll_Click()

    Dim jj As Integer
    
    For jj = 0 To Me.lstAudio.ListCount - 1
        Me.lstAudio.Selected(jj) = True
    Next jj
    
End Sub

Private Sub lblAudioAll_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Call Reset_Labels_Font
    Me.lblAudioAll.FontBold = True

End Sub

Private Sub lblAudioNone_Click()

    Dim jj As Integer
    
    For jj = 0 To Me.lstAudio.ListCount - 1
        Me.lstAudio.Selected(jj) = False
    Next jj
    
End Sub

Private Sub lblAudioNone_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Call Reset_Labels_Font
    Me.lblAudioNone.FontBold = True

End Sub

Private Sub lstsubs_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Call Reset_Labels_Font
    
End Sub

Private Sub lblSubsAll_Click()

    Dim jj As Integer
    
    For jj = 0 To Me.lstSubs.ListCount - 1
        Me.lstSubs.Selected(jj) = True
    Next jj
    
End Sub

Private Sub lblSubsAll_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Call Reset_Labels_Font
    Me.lblSubsAll.FontBold = True

End Sub

Private Sub lblSubsNone_Click()

    Dim jj As Integer
    
    For jj = 0 To Me.lstSubs.ListCount - 1
        Me.lstSubs.Selected(jj) = False
    Next jj
    
End Sub

Private Sub lblSubsNone_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Call Reset_Labels_Font
    Me.lblSubsNone.FontBold = True

End Sub

Private Sub corSelectFile_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    Dim FileExt As String
    Dim bFlag As Boolean
    
    With Data
        If .GetFormat(vbCFFiles) = True Then
            Me.SetFocus
            FileExt = LCase(modFS.ExtOf(.Files(1)))
            If InStr(1, FilterList.VideoContainerFiles, "*." & FileExt) <> 0 Then
                bFlag = True
            Else
                If MsgBox("Warning! Unrecognized or unsupported file format for file:" & vbCrLf & vbCrLf & .Files(1) & vbCrLf & vbCrLf & _
                          "AVStoDVD supports following Video formats:" & vbCrLf & vbCrLf & FilterList.SupportedVideoContainerFormats & vbCrLf & vbCrLf & _
                          "Do you want to continue anyway?", vbQuestion + vbYesNo, App.Title) = vbYes Then
                    bFlag = True
                End If
            End If
            If bFlag = True Then
                Call Add_Container(.Files(1))
            End If
        End If
    End With

End Sub

Private Sub plsPathname_Click()

    Call Add_Container

End Sub

Private Sub lblProcess_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Call Reset_Labels_Font
    Me.lblProcess.FontBold = True
    
End Sub

Private Sub lblProcess_Click()

    Dim ctr As Control
    Dim bFlag As Boolean
    Dim jj As Integer
    Dim PathName As String
    Dim PathnameSave As String
    Dim MInfo As New clsMediaInfo
    Dim VideoInfo As New clsTitleVideoInfo
    Dim AudioInfo As New clsTitleAudioInfo
    Dim SubsInfo As New clsTitleSubsInfo
    Dim sEXE As String
    Dim sCL As String
    Dim sLog As String
    Dim sErr As String
    
    On Error GoTo Err_Handling
    
    If Me.txtPathname.Text <> "" Then
        For Each ctr In Me.Controls
            If LCase(Left(ctr.Name, 3)) = "lst" Then
                For jj = 0 To ctr.ListCount - 1
                    If ctr.Selected(jj) = True Then bFlag = True
                Next jj
            End If
        Next ctr
    End If
    
    If bFlag = True Then
    
        PathName = modFS.PathOf(Me.txtPathname.Text)
        PathName = modDialog.BrowseForFolder(Me, "Select 'Output' folder", PathName)
        
        If PathName <> "" Then
            'Me.lViewOper.ListItems.Clear
            If Me.lstVideo.Selected(0) = True Then
                bFlag = False
                Do
                    MInfo.ReadMediaInfo Me.txtPathname.Text, , False, , False, False
                    With VideoInfo
                        .Initialize MInfo
                        PathnameSave = PathName & "\" & modFS.NameOf(Me.txtPathname.Text) & "_" & .ID
                        If LCase(modFS.ExtOf(PathnameSave)) <> .Extension Then
                            PathnameSave = PathnameSave & "." & .Extension
                        End If
                    End With
                    If modFS.EsisteFile(PathnameSave) = True Then
                        If MsgBox(PathnameSave & vbCrLf & vbCrLf & Msgs.FileExistsOverwrite, vbQuestion + vbYesNo, App.Title) = vbYes Then
                            modFS.DeleteIfExist PathnameSave
                            bFlag = True
                        Else
                            Exit Do
                        End If
                    Else
                        bFlag = True
                    End If
                Loop Until bFlag = True
                If bFlag = True Then
                    sEXE = ""
                    sCL = ""
                    If LCase(MInfo.Format) = "matroska" And Preferences.FFmpegDemuxMatroska = False Then
                        sEXE = App.Path & "\MKVtoolNix\mkvextract.exe"
                        sCL = "tracks """ & Me.txtPathname.Text & """ " & VideoInfo.StreamOrder & ":""" & PathnameSave & """"
                    End If
                    If sCL = "" Then
                        sEXE = App.Path & "\FFmpeg\ffmpeg.exe"
                        sCL = "-i """ & Me.txtPathname.Text & """ -c:v copy -an -sn -y " & """" & PathnameSave & """"
                    End If
                    modShellEx.Execute sEXE, sCL, SW_DEFAULT, True, False
                                
                    'Load frmMessage
                    'With frmMessage
                    '    .DisableClose = True
                    '    .Caption = Me.Caption
                    '    .Lbl_Message.Caption = "Demuxing Video Track." & vbCrLf & "Initializing ..."
                    '    .ProgressBar.Visible = False
                    '    .Lbl_Message.Height = .Height
                    '    .Show 0, Me
                    '    DoEvents
                    '    modUtil.Sleep 1000
                    '    modShellEx.Execute sEXE, sCL, SW_HIDE, False
                    '    Do
                    '        DoEvents
                    '        .Lbl_Message.Caption = "Demuxing Video Tracks" & vbCrLf & "Please wait ..." & vbCrLf & vbCrLf & _
                    '                               "Processed " & Round(CSng(modUtil.GetFileSize(PathnameSave)) / 1024 / 1024, 0) & " MB"
                    '    Loop Until modUtil.FindRunningProcess(sEXE) = 0
                    '    .Lbl_Message.Caption = "Video Demuxing completed!"
                    '    DoEvents
                    '    modUtil.Sleep 1000
                    'End With
                    'Unload frmMessage
                    
                    If modFS.EsisteFile(PathnameSave) = True Then
                        sLog = "Demuxed Video Track #" & VideoInfo.ID & " to file: '" & PathnameSave & "' (" & _
                               Round(modUtil.GetFileSize(PathnameSave) / 1024 / 1024, 1) & " MB)"
                    Else
                        sLog = "Warning! Errors found during demuxing Video Track #" & VideoInfo.ID
                    End If
                    Call Update_ListViewOper(sLog)
                End If
                Set VideoInfo = Nothing
                Set MInfo = Nothing
            End If
            
            For jj = 0 To Me.lstAudio.ListCount - 1
                bFlag = False
                If Me.lstAudio.Selected(jj) = True Then
                    Do
                        MInfo.ReadMediaInfo Me.txtPathname.Text, , False, False, True, False
                        With AudioInfo
                            .Initialize MInfo, jj
                            PathnameSave = PathName & "\" & modFS.NameOf(Me.txtPathname.Text) & "_" & .ID & IIf(.LanguageCode <> "", "_" & .LanguageCode, "")
                            If LCase(modFS.ExtOf(PathnameSave)) <> .Extension Then
                                PathnameSave = PathnameSave & "." & .Extension
                            End If
                        End With
                        If modFS.EsisteFile(PathnameSave) = True Then
                            If MsgBox(PathnameSave & vbCrLf & vbCrLf & Msgs.FileExistsOverwrite, vbQuestion + vbYesNo, App.Title) = vbYes Then
                                modFS.DeleteIfExist PathnameSave
                                bFlag = True
                            Else
                                Exit Do
                            End If
                        Else
                            bFlag = True
                        End If
                    Loop Until bFlag = True
                    If bFlag = True Then
                        sEXE = ""
                        sCL = ""
                        If LCase(MInfo.Format) = "matroska" And Preferences.FFmpegDemuxMatroska = False Then
                            sEXE = App.Path & "\MKVtoolNix\mkvextract.exe"
                            sCL = "tracks """ & Me.txtPathname.Text & """ " & AudioInfo.StreamOrder & ":""" & PathnameSave & """"
                        End If
                        If sCL = "" Then
                            sEXE = App.Path & "\FFmpeg\ffmpeg.exe"
                            sCL = "-i """ & Me.txtPathname.Text & """ -c:a copy -vn -sn -y" & modExtSW.FFmpegAudioTracksMapping(Me.txtPathname.Text, Val(AudioInfo.StreamOrder)) & " """ & PathnameSave & """"
                        End If
                        modShellEx.Execute sEXE, sCL, SW_DEFAULT, True, False
                        
                        If modFS.EsisteFile(PathnameSave) = True Then
                            sLog = "Demuxed Audio Track #" & AudioInfo.ID & " to file: '" & PathnameSave & "' (" & _
                                   Round(modUtil.GetFileSize(PathnameSave) / 1024 / 1024, 1) & " MB)"
                        Else
                            sLog = "Warning! Errors found during demuxing Audio Track #" & AudioInfo.ID
                        End If
                        Call Update_ListViewOper(sLog)
                    End If
                    Set AudioInfo = Nothing
                    Set MInfo = Nothing
                End If
            Next jj
            
            For jj = 0 To Me.lstSubs.ListCount - 1
                bFlag = False
                sErr = "Errors found during subtitles demuxing!"
                If Me.lstSubs.Selected(jj) = True Then
                    Do
                        MInfo.ReadMediaInfo Me.txtPathname.Text, , False, False, False, True
                        With SubsInfo
                            .Initialize MInfo, jj
                            PathnameSave = PathName & "\" & modFS.NameOf(Me.txtPathname.Text) & "_" & .ID & IIf(.LanguageCode <> "", "_" & .LanguageCode, "")
                            If LCase(modFS.ExtOf(PathnameSave)) <> .Extension Then
                                PathnameSave = PathnameSave & "." & .Extension
                            End If
                        End With
                        If modFS.EsisteFile(PathnameSave) = True Then
                            If MsgBox(PathnameSave & vbCrLf & vbCrLf & Msgs.FileExistsOverwrite, vbQuestion + vbYesNo, App.Title) = vbYes Then
                                modFS.DeleteIfExist PathnameSave
                                bFlag = True
                            Else
                                Exit Do
                            End If
                        Else
                            bFlag = True
                        End If
                    Loop Until bFlag = True
                    If bFlag = True Then
                        sEXE = ""
                        sCL = ""
                        If LCase(MInfo.Format) = "matroska" Then
                            sEXE = App.Path & "\MKVtoolNix\mkvextract.exe"
                            sCL = "tracks """ & Me.txtPathname.Text & """ " & SubsInfo.StreamOrder & ":""" & PathnameSave & """"
                            If Preferences.FFmpegDemuxMatroska = True Then
                                Select Case SubsInfo.Format
                                Case "SubRip", "SubStation Alpha", "Advanced SubStation"
                                    sEXE = App.Path & "\FFmpeg\ffmpeg.exe"
                                    If Val(MInfo.TextTracksCount) > 1 Then
                                        sCL = "-map 0:" & SubsInfo.StreamOrder & " "
                                    End If
                                    sCL = "-i """ & Me.txtPathname.Text & """ -scodec copy -vn -an -y " & sCL & """" & PathnameSave & """"
                                End Select
                            End If
                            modShellEx.Execute sEXE, sCL, SW_DEFAULT, True, False
                        Else
                            Err.Raise 10000, , "Subtitles demuxing is only possible from Matroska (MKV) containers!"
                            Exit For
                        End If
                        If modFS.EsisteFile(PathnameSave) = True Then
                            sLog = "Demuxed Subtitles Track #" & SubsInfo.ID & " to file: '" & PathnameSave & "' (" & _
                                   Round(modUtil.GetFileSize(PathnameSave) / 1024, 1) & " KB)"
                        Else
                            sLog = "Warning! Errors found during demuxing Subtitles Track #" & SubsInfo.ID
                        End If
                        Call Update_ListViewOper(sLog)
                    End If
                    Set SubsInfo = Nothing
                    Set MInfo = Nothing
                End If
            Next jj
            
            If sLog <> "" Then
                MsgBox "Demux completed!", vbInformation, App.Title
            End If
        
        End If
    
    End If
    
    Exit Sub
    
Err_Handling:
Select Case Err.Number
Case 9999
    Resume
Case 10000
    MsgBox "Warning! " & Err.Description, vbCritical, App.Title
    Resume Next
Case 10001
    MsgBox "Warning! " & Err.Description, vbCritical, App.Title
Case Else
    MsgBox "Warning! " & Err.Description & vbCrLf & vbCrLf & "Error number: " & Err.Number, vbCritical, App.Title
End Select
Set MInfo = Nothing
Set VideoInfo = Nothing
Set AudioInfo = Nothing
Set SubsInfo = Nothing

End Sub


Private Sub Add_Container(Optional PathName As String)

    Dim ctr As Control
    Dim bReadInfo As Boolean
    Dim MInfo As New clsMediaInfo
    Dim GeneralInfo As New clsTitleGeneralInfo
    Dim VideoInfo As New clsTitleVideoInfo
    Dim AudioInfo As New clsTitleAudioInfo
    Dim SubsInfo As New clsTitleSubsInfo
    Dim sInfo As String
    Dim jj As Integer
    Dim sLog As String
    
    On Error GoTo Err_Handling
        
    If PathName = "" Then
        PathName = modDialog.OpenFile(Me.hwnd, "Select 'Container' file (avi, mkv, mpg, ts, ...)", FilterList.VideoContainerFiles, Preferences.InputPath, "", cdlOFNAllowMultiselect Or cdlOFNFileMustExist Or cdlOFNExplorer Or cdlOFNLongNames)
    End If
    If PathName <> "" Then
        modMain.Save_Preferences_InputPath PathName
        bReadInfo = MInfo.ReadMediaInfo(PathName, , False)
        If bReadInfo = True Then
            Me.txtPathname.Text = PathName
            Me.txtPathname.ToolTipText = ""
            For Each ctr In Me.Controls
                If LCase(Left(ctr.Name, 3)) = "int" Then
                    ctr.value = 0
                End If
            Next ctr
            Me.lstVideo.Clear
            Me.lstAudio.Clear
            Me.lstSubs.Clear
            With GeneralInfo
                .Initialize MInfo
                Me.txtPathname.ToolTipText = "Format: " & MInfo.Format & " - Filesize: " & Round(Val(MInfo.FileSize) / 1024 / 1024, 1) & " MB"
            End With
            With VideoInfo
                .Initialize MInfo
                sInfo = .Summary
                If .ID <> "" Then sInfo = "Track " & .ID & " (Stream " & .StreamOrder & "): " & sInfo
                Me.lstVideo.AddItem sInfo
            End With
            For jj = 0 To Val(GeneralInfo.AudioTracksCount) - 1
                With AudioInfo
                    .Initialize MInfo, jj
                    sInfo = .Summary
                    If .ID <> "" Then sInfo = "Track " & .ID & " (Stream " & .StreamOrder & "): " & sInfo
                    Me.lstAudio.AddItem sInfo
                End With
            Next jj
            For jj = 0 To Val(GeneralInfo.SubsTracksCount) - 1
                With SubsInfo
                    .Initialize MInfo, jj
                    sInfo = .Summary
                    If .ID <> "" Then sInfo = "Track " & .ID & " (Stream " & .StreamOrder & "): " & sInfo
                    Me.lstSubs.AddItem sInfo
                End With
            Next jj
            sLog = "Added file: '" & PathName & "'"
        Else
            sLog = "Warning! Error reading file '" & PathName & "'"
        End If
        Call Update_ListViewOper(sLog)
        Set MInfo = Nothing
        Set GeneralInfo = Nothing
        Set VideoInfo = Nothing
        Set AudioInfo = Nothing
        Set SubsInfo = Nothing
    End If
    
    Exit Sub
    
Err_Handling:
Select Case Err.Number
Case 9999   'Fake
    Resume
Case Else
    MsgBox "Warning! Failed to read File '" & Me.txtPathname.Text & "'!" & vbCrLf & vbCrLf & _
    "Error " & Err.Number & vbCrLf & vbCrLf & Err.Description, vbCritical, App.Title
End Select


End Sub


Private Sub Reset_Labels_Font()

    Dim ctr As Control
    
    For Each ctr In Me.Controls
        If LCase(Left(ctr.Name, 3)) = "lbl" Then
            ctr.FontBold = False
        End If
    Next ctr

End Sub


Private Sub Update_ListViewOper(Str As String)

    Dim iIcon As Integer
    
    iIcon = 6
    If InStr(1, UCase(Str), "WARNING") <> 0 Then iIcon = 7
    If InStr(1, UCase(Str), "ABORT") <> 0 Then iIcon = 7
    If InStr(1, UCase(Str), "ERROR") <> 0 Then iIcon = 7
    
    With Me.lViewOper
        .ListItems.add .ListItems.Count + 1, , ""
        With .ListItems(.ListItems.Count)
            .SmallIcon = iIcon
            .SubItems(1) = Format(Time, "hh:nn:ss")
            .SubItems(2) = Str
            .EnsureVisible
        End With
    End With
    modUtil.ListViewAutoSize Me.lViewOper, 1
    DoEvents
    
End Sub


Private Sub Populate_Form_Language()

    On Error Resume Next
    
    If Language.Count > 0 Then
        With Me
            ' Form
            .Caption = modStr.DefaultStr(Language("725000"), .Caption)
            .corSelectFile.Caption = modStr.DefaultStr(Language("725100"), .corSelectFile.Caption)
            .corSelectTracks.Caption = modStr.DefaultStr(Language("725200"), .corSelectTracks.Caption)
            .lblVideo.Caption = modStr.DefaultStr(Language("720210"), .lblVideo.Caption)
            .lblAudio.Caption = modStr.DefaultStr(Language("720220"), .lblAudio.Caption)
            .lblSubs.Caption = modStr.DefaultStr(Language("720230"), .lblSubs.Caption)
            .lblAudioAll.Caption = modStr.DefaultStr(Language("720250"), .lblAudioAll.Caption)
            .lblSubsAll.Caption = .lblAudioAll.Caption
            .lblAudioNone.Caption = modStr.DefaultStr(Language("720260"), .lblAudioNone.Caption)
            .lblSubsNone.Caption = .lblAudioNone.Caption
            .lblProcess.Caption = modStr.DefaultStr(Language("725500"), .lblProcess.Caption)
            .corOperations.Caption = modStr.DefaultStr(Language("105110"), .corOperations.Caption)
        End With
    End If
 
 End Sub

