Attribute VB_Name = "modVar"
' -------------------------------------------------------------------------------
'
'   AVStoDVD - by MrC
'   File: modVar.bas
'   Purpose: List of public variables, constants, enums, types
'
' -------------------------------------------------------------------------------


Option Explicit
Option Compare Binary
Option Base 0

Public Const MaxTitles As Integer = 64
Public Const MaxAudioTracks As Byte = 3
Public Const MaxSubsTracks As Byte = 3
Public Const MaxChapters As Integer = 64
Public Const MaxMenuTitles As Integer = 64
Public Const MaxJobs As Integer = 30

Public Enum DiscSizeType
    DVD5
    DVD9
    Custom
End Enum

Public Enum OutputSetupType
    MPEG2_Streams
    MPEG2_File
    DVD_Folder
    ISO_UDF_Image
    Burn_DVD
End Enum

Public Enum VideoStandardType
    PAL
    NTSC
End Enum

Public Enum VideoResolutionType
    Auto
    Full_D1
    Half_D1
    VCD
End Enum

Public Enum VideoEncoderType
    SmartSelection
    FFMpegCBR1pass
    HCencVBR1pass
    HCencVBR2pass
    FFMpegSafeMode
    DirectCopy
End Enum

Public Enum AspectRatioType
    Standard
    Widescreen
End Enum

Public Enum FrameAdjustType
    AddBordersLeftRight
    CropTopBottom
End Enum

Public Enum FPSHardConversionType
    MotionProtectedFPS
    ChangeFPS
    ConvertFPS
End Enum

Public Enum FPSAdjustType
    NoConversion
    HardConversion
    SelectEven
    PullDown
    PALSpeedUp
    NTSCSlowDown
End Enum

Public Enum AC3AudioEncoderType
    Wavi_Aften
    FFmpeg_Aften
    FFmpeg_Avisynth
    FFmpeg_Safe
End Enum

Public Enum AudioFormatType
    AC3  '0
    MP2  '1
    WAV  '2
    DTS  '3
End Enum

Public Enum MenuStyle
    StaticMenu
    MotionMenu
End Enum

Public Enum MenuTitlesFormat
    Text
    Thumbs
End Enum

Public Enum MenuHLFormat
    Solid
    Underline
    'Frame
End Enum

Public Enum MenuHLColors
    Blue
    Red
    Black
    White
    LightGreen
    LightMagenta
    Yellow
    Oil
    DarkGrey
    LightGrey
    Brown
    DarkGreen
    Indigo
    DarkMagenta
    Orange
    Violet
End Enum

Public Enum MenuDropShadow
    None
    Simple
    Progressive
End Enum

Public Enum ThumbSourceType
    SourceTitle
    ExternalFile
End Enum

Public Enum PriorityType
    Idle          '0
    Low           '1
    Normal        '2
    AboveNormal   '3
    High          '4
    Realtime      '5
End Enum

Public Type SubPosOptions
    Left As Integer
    Bottom As Integer
    Width As Integer
End Type

Public Type GeneralPreferences
    MultiThread As Boolean
    
    InputPath As String
    OutputPath As String
    AssetsPath As String
    ProjectsPath As String
    TempPath As String
    MenuTemplatesPath As String
    PreviewerPathName As String

    AVSVideoInput As String
    AVSAudioInput As String
    AVSUpSize As String
    AVSDownSize As String
    FrameAdjust As FrameAdjustType
    FPSHardConversion As FPSHardConversionType
    PALSpeedUp As Boolean
    NTSCSlowDown As Boolean
    
    KeepOrigVideo As Boolean
    VideoStandard As VideoStandardType
    VideoResolution As VideoResolutionType
    VideoEncoder As VideoEncoderType
    VideoProfileLevel1 As String
    VideoProfileLevel2 As String
    VideoFFmpegHQ As Boolean
    VideoFFmpegHQCmd As String
    VideoMinAvgBitRate As String
    VideoMaxAvgBitRate As String
    VideoMaxBitRate As String
    
    KeepOrigAudio As Boolean
    AudioFormat As AudioFormatType
    AC3AudioEncoder As AC3AudioEncoderType
    ForceFFmpeg4GB As Boolean
    AudioBitRate As String
    AudioNormalize As Boolean
    AudioNormalizeVal As String
    AudioDelayAuto As Boolean
    
    AudioLanguage As String
    AudioLanguage2 As String
    SubsLanguage As String
    SubsLanguage2 As String
    SubsFont As MyFont
    SubsPos As SubPosOptions
    ChaptersInterval As String
    ChaptersUseSource As Boolean
    DVDBurningDrive As String
    DVDBurningSpeed As String
    DVDAutoErase As Boolean
    
    SplashScreenName As String
    EncodingPriority As PriorityType
    EncodingWindowStyle As Byte
    ForceRunAsAdmin As Boolean
    UnloadDShow As Boolean
    DSFiltersRuntime As Boolean
    SaveSettings As Boolean
    
    Language As String
    Skin As String

    ' Debug section
    FFmpegDemuxMatroska As Boolean
    SlowSystemFlag As Boolean
End Type

Public Type AVSSettings
    CropDx As Integer
    CropSx As Integer
    CropUp As Integer
    CropDo As Integer
    VResize As Integer
    DeIntThreshold As Integer
    FrameStart As Long
    FrameEnd As Long
    Hue As Single
    Saturation As Single
    Brightness As Single
    Contrast As Single
    Sharpness As Single
    AudioDelay As Single
    AudioAmplify As Single
    FadeIOFrames As Long
    ColorMatrixSource As Byte
    ColorMatrixDest As Byte
    MSharpenThreshold As Integer
    MSharpenStrength As Integer
    HQDN3DStrength As Integer
    DeBlock As Integer
End Type

Public Type HCencAdvancedOptions
    AQ As String
    Lumgain As String
    Matrix As String
    Profile As String
    Bias As String
    DCPrec As String
    Zone As String
End Type

Public Type AftenAdvancedOptions
    Pad As String
    DRC As String
    BWFilter As String
End Type

Public Type TitleSettings
    TitleName As String
    
    FPS As Single
    FPSAVS As Single
    TimeTotal As Long       'seconds
    TimeTrimmed As Long     'seconds
    
    InputGeneralInfo As New clsTitleGeneralInfo
    InputVideoPathName As String
    InputVideoInfo As New clsTitleVideoInfo
    InputAudioPathName(1 To MaxAudioTracks) As String
    InputAudioInfo(1 To MaxAudioTracks) As New clsTitleAudioInfo
    InputSubsPathName(1 To MaxSubsTracks) As String
    InputSubsInfo(1 To MaxSubsTracks) As New clsTitleSubsInfo
    
    VideoAutoSetup As Variant
    VideoIsToBeKept As Variant
    VideoEncoder As VideoEncoderType
    VideoHCenc As HCencAdvancedOptions
    VideoResolution As VideoResolutionType
    VideoAspectRatio As AspectRatioType
    VideoDVSource As Variant
    VideoInterlacedEncoding As Variant
    VideoFieldOrder As String
    VideoCloseAllGOPs As Variant
    VideoBitRate As Long
    VideoMaxBitRate As Long
    VideoAutoBitRate As Variant
    VideoFPSAdjust As FPSAdjustType
    
    AudioTracksCount As Integer
    AudioAutoSetup(1 To MaxAudioTracks) As Variant
    AudioIsToBeKept(1 To MaxAudioTracks) As Variant
    AudioFormat(1 To MaxAudioTracks) As AudioFormatType
    AudioChannelsMode(1 To MaxAudioTracks) As String
    AudioLanguage(1 To MaxAudioTracks) As String
    AudioBitRate(1 To MaxAudioTracks) As Integer
    AudioNormalize(1 To MaxAudioTracks) As Variant
    AudioDelayAuto(1 To MaxAudioTracks) As Variant
    AudioFixAC3(1 To MaxAudioTracks) As Variant
    AudioAften(1 To MaxAudioTracks) As AftenAdvancedOptions

    SubsTracksCount As Integer
    SubsAutoSetup(1 To MaxSubsTracks) As Variant
    SubsLanguage(1 To MaxSubsTracks) As String
    SubsExtension(1 To MaxSubsTracks) As Byte
    SubsHardEncode(1 To MaxSubsTracks) As Variant
    SubsFix(1 To MaxSubsTracks) As Variant
    
    AVSAutoSetup As Variant
    AVSAutoScript As String
    AVSScript As String
    AVSCrop As Variant
    AVSVerticalResize As Variant
    AVSDeInterlace As Variant
    AVSTrim As Variant
    AVSInfo As Variant
    AVSTweak As Variant
    AVSSharpen As Variant
    AVSDelayAudio As Variant
    AVSAmplifyAudio As Variant
    AVSFadeIO As Variant
    AVSColorMatrix As Variant
    AVSMSharpen As Variant
    AVSHQDN3D As Variant
    AVSDeBlock As Variant
    AVSIVTC As Variant
    AVS As AVSSettings
    
    ChaptersAutoSetup As Variant
    ChaptersList As String
End Type

Public Type SkinSettings
    Path As String
    ForeRed As String
    ForeGreen As String
    ForeBlue As String
    Font As String
End Type

Public Type MenuSettings
    IsInit As Boolean
    IsFinal As Boolean
    Style As MenuStyle
    AR As AspectRatioType
    TitlesFormat As MenuTitlesFormat
    
    Template As String
    MaxTitlesPage As String
    PlayAllButton As Boolean
    ForcePlayAllSelection As Boolean
    BackgroundAudio As Boolean
    MotionMenuDuration As String
    VideoBitRate As String
    
    MaxThumbsRow As String
    ThumbImageSource As ThumbSourceType
    ThumbFramePos As String
    HLFormat As MenuHLFormat
    HLColorsPlay As MenuHLColors
    HLColorsSel As MenuHLColors
    ThumbShadow As MenuDropShadow
    PlayAllShadow As MenuDropShadow
    ArrowsShadow As MenuDropShadow
    
    BackgroundPicturePath As String
    BackgroundVideoPath As String
    BackgroundAudioPath As String
    TitleText As String
    TitleFont As MyFont                             'MyFont public structure is defined in modDialog.bas module
    TitleAlignment As AlignmentConstants
    TitleLeft As Long
    TitleTop As Long
    TitleWidth As Long
    TitleHeight As Long
    NumMenuPages As Integer
    NumMenuTitles As Integer
    ThumbLeft(1 To MaxMenuTitles) As Long
    ThumbTop(1 To MaxMenuTitles) As Long
    ThumbWidth(1 To MaxMenuTitles) As Long
    ThumbHeight(1 To MaxMenuTitles) As Long
    ThumbLabelText(1 To MaxMenuTitles) As String
    ThumbLabelFont(1 To MaxMenuTitles) As MyFont
    ThumbLabelAlignment(1 To MaxMenuTitles) As AlignmentConstants
    ThumbLabelLeft(1 To MaxMenuTitles) As Long
    ThumbLabelTop(1 To MaxMenuTitles) As Long
    ThumbLabelWidth(1 To MaxMenuTitles) As Long
    ThumbLabelHeight(1 To MaxMenuTitles) As Long
    ThumbFrameStart(1 To MaxMenuTitles) As Long
    ThumbFrameEnd(1 To MaxMenuTitles) As Long
    ThumbAVSSCript(1 To MaxMenuTitles) As String
    ThumbPicturePath(1 To MaxMenuTitles) As String
    PlayAllButtonPicturePath As String
    PlayAllButtonLeft As Long
    PlayAllButtonTop As Long
    PlayAllButtonWidth As Long
    PlayAllButtonHeight As Long
    ArrowLButtonPicturePath As String
    ArrowLButtonLeft As Long
    ArrowLButtonTop As Long
    ArrowLButtonWidth As Long
    ArrowLButtonHeight As Long
    ArrowRButtonPicturePath As String
    ArrowRButtonLeft As Long
    ArrowRButtonTop As Long
    ArrowRButtonWidth As Long
    ArrowRButtonHeight As Long
End Type

' ButPos and ButAdj: structures for DVD Menu Buttons
Public Type ButPos
    X As Integer
    w As Integer
    Y As Integer
    h As Integer
End Type

Public Type ButAdj
    Up As Integer
    Left As Integer
    Right As Integer
    Down As Integer
End Type

' General purpose messages
Public Type GeneralMsgs
    FileExistsOverwrite As String
    CreateSuccess As String
    FileNotFound As String
    InvalidValue As String
End Type

' ffdshow related settings
Public Type ffdshowType
    CLSID As String
    PathName As String
    RegKey As String
    Version As String
    MixerEnabled As Boolean
    MixerBackup As Long
    RawVideoBackup As Long
    RawAudioBackup As Long
End Type

' LAVFilters related settings
Public Type LAVFiltersType
    CLSID As String
    PathName As String
    RegKey As String
    Version As String
    MixerEnabled As Boolean
    MixerBackup As Long
    PreferHighQualityAudioBackup As Boolean
End Type

' AviSynth related settings
Public Type AviSynthType
    CLSID As String
    PathName As String
    RegKey As String
    Version As String
End Type

' Windows Security Identifiers
Public Type SIDType
    CurrentUser As String
    Administrators As String
    Users As String
    Guests As String
    PowerUsers As String
    TrustedInstaller As String
End Type

Public Type GeneralPathNames
    WebBrowser As String
    MSComCtlOcx As String
    ImgBurn As String
End Type

' Project/Job Variables
Public VideoStandard As VideoStandardType
Public OutputSetup As OutputSetupType
Public DiscSize As DiscSizeType
Public NumTitles As Integer
Public CurrentTitle As Integer
Public CurrentAudioTrack As Integer
Public ChangeFlag As Boolean                    'Check project changes
Public Title(1 To MaxTitles) As TitleSettings
Public DVDMenu As MenuSettings
Public JobsListStr(1 To MaxJobs) As String

' Video/Audio standards variables
Public BitRates(AC3 To DTS) As New Collection
Public FilterList As New clsFilesFilterList

' Variables and constants used throughout
Public RegRelease As String
Public CurRelease As String
Public AVStoDVD_Picture As String
Public AVStoDVD_RegKey As String
Public PathNames As GeneralPathNames
Public ffdshow As ffdshowType
Public LAVFilters As LAVFiltersType
Public AviSynth As AviSynthType
Public SID As SIDType
Public Preferences As GeneralPreferences
Public PreferencesDefault As GeneralPreferences
Public Language As New Collection
Public ISOLangCode As New Collection
Public Skin As SkinSettings
Public Msgs As GeneralMsgs
Public Drives As New clsDrives
Public SysInfo As New clsSysInfo
Public SpecialChars As String

