VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "StnMgrEnc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Dim Name As String
Dim EncProfile As String

Dim WithEvents Encoder   As WMEncoder
Attribute Encoder.VB_VarHelpID = -1

Dim Over As Integer

Dim VidOpt  As Integer

Dim PlayCnt As Integer

Dim LstEnd As Integer

Private Type EncPlaylist
    Vid As String
    Aud As String
    Duration As String
End Type

Dim EncPlaylistArray() As EncPlaylist

Public Property Get EncName() As String
    EncName = Name
End Property

Public Property Let EncName(ByVal NewEnc As String)
    Name = NewEnc
End Property

Public Property Get EncPrfName() As String
    EncPrfName = EncProfile
End Property

Public Property Let EncPrfName(ByVal NewEncPrf As String)
    EncProfile = NewEncPrf
End Property

Public Property Get ExistEnc() As WMEncoder
    Set ExistEnc = Encoder
End Property

Public Property Get VideoOpt() As Integer
    VideoOpt = VidOpt
End Property

Public Property Let VideoOpt(ByVal Opt As Integer)
    VidOpt = Opt
End Property
Public Sub Popl_Array(Vid As String, Aud As String, Durationdev As String, Cnt As Integer)
    EncPlaylistArray(Cnt).Aud = Aud
    EncPlaylistArray(Cnt).Vid = Vid
    EncPlaylistArray(Cnt).Duration = Durationdev
End Sub

Public Sub Init_Array(Cnt As Integer)
   ReDim EncPlaylistArray(1 To Cnt)
End Sub

Public Property Get PlaylistPos() As Integer
    PlaylistPos = PlayCnt
End Property

Public Property Let PlaylistPos(ByVal iNewValue As Integer)
    PlayCnt = iNewValue
End Property


Public Property Get Stat() As Integer
    Stat = Over
End Property

Public Property Let Stat(ByVal NewValue As Integer)
    Over = NewValue
End Property


Public Sub EncInit()
    Set Encoder = New WMEncoder
End Sub
Public Property Get LstStop() As Integer
    
    LstStop = LstEnd

End Property

Public Property Let LstStop(ByVal iNewValue As Integer)
    LstEnd = iNewValue
End Property
Public Sub PlayElem(Vid As String, Aud As String, Dur As String)
    
    Dim EncPlay As EncPlaylist
    Dim LenPlay As Long
    
    EncPlay = EncPlaylistArray(PlayCnt)
    
    Vid = EncPlay.Vid
    Aud = EncPlay.Aud
    Dur = EncPlay.Duration
    
    If Dur <> "0" And Dur <> "-" Then
        
        LenPlay = Dur
        LenPlay = LenPlay - 1
        
        EncPlay.Duration = LenPlay
        EncPlaylistArray(PlayCnt) = EncPlay
    
    End If

End Sub

Public Property Get MaxBound() As Integer
    On Error GoTo error_handler
    MaxBound = UBound(EncPlaylistArray)
    Exit Property
error_handler:
    MaxBound = 0
End Property

Public Sub AllElem(Vid As String, Aud As String, Dur As String, pos As Integer)
    Dim EncList As EncPlaylist
    
    EncList = EncPlaylistArray(pos)
    Vid = EncList.Vid
    Aud = EncList.Aud
    Dur = EncList.Duration
End Sub

Private Sub Encoder_OnSourceStateChange(ByVal enumState As WMEncoderLib.WMENC_SOURCE_STATE, ByVal enumType As WMEncoderLib.WMENC_SOURCE_TYPE, ByVal iIndex As Integer, ByVal bstrSourceGroup As String)
    If enumState = WMENC_SOURCE_STOP Then
        Over = 1
    Else
        If enumState = WMENC_SOURCE_START Then
            Over = 0

        End If
    End If

End Sub

