PrepareToEncode Encoder SDK (push server) failed???

  • Thread starter Thread starter Crisco www.misericordia.com.br
  • Start date Start date
C

Crisco www.misericordia.com.br

Hi

I m working on WEBRADIO Software. im using Windows media encoder 9 SDK
on Windows 2003 server using VB.NET.


My current scenario is my soundcard . My application will push my
server the live audio on specific port.

I am using Windows media encoder sdk sample (entire code), currently i
am facing problem in "PrepareToEncode" (Number Error: 0XC00D2F0C),
entire code is given below:
'====================================

Imports WMEncoderLib
Public Class Form1
' Declare variables.
Dim WithEvents Encoder As WMEncoder
Dim SrcGrpColl As IWMEncSourceGroupCollection
Dim SrcGrp As IWMEncSourceGroup2
Dim SrcAud As IWMEncAudioSource
Dim SrcVid As IWMEncVideoSource
Dim ProColl As IWMEncProfileCollection
Dim Pro As IWMEncProfile
Dim PushDist As IWMEncPushDistribution
Dim strServerName As String
Dim strPubPoint As String
Dim strPubTemplate As String
Dim MyNSCFile As String
Dim MyNSCURL As String
Dim MyASXFile As String
Private Function Encoder_OnAcquireCredentials(ByVal strRealm As
String, ByVal strSite As String, ByVal varUser As Object, ByVal
varPassword As Object, ByVal lngFlags As Long) As Boolean
'strRealm = ""
'strSite = "media.site.com.br"
varUser = "admin"
varPassword = "statesecret"
lngFlags = 2
'MsgBox("Credenciais")
End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
' Generate the announcement file.
PushDist.GenerateMulticastInfoFile(MyNSCFile)
PushDist.GenerateAnnouncementFile(MyNSCURL, MyASXFile)

' Start encoding.
Encoder.Start()
MsgBox("Click OK to stop broadcasting.")
Encoder.Stop()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Create a WMEncoder object.
Encoder = New WMEncoder

' Retrieve the source group collection and add sources.
' Use the default devices for the audio and video sources.
SrcGrpColl = Encoder.SourceGroupCollection
SrcGrp = SrcGrpColl.Add("SG_1")
SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO)
SrcVid = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO)

SrcAud.SetInput("device://default_audio_device")
SrcVid.SetInput("device://default_video_device")

' Retrieve the profile collection. This example uses the 3rd
profile.
ProColl = Encoder.ProfileCollection
Pro = ProColl.Item(2)
SrcGrp.Profile = Pro

' Set up the push broadcast.
PushDist = Encoder.Broadcast

' Specify the push distribution variables, including the
Windows Media
' server name, publishing point, and announcement files.
' Provide real values for the following placeholders.
strServerName = "media.site.com.br"
strPubPoint = "webradio"
strPubTemplate = "tmp_online"
MyNSCFile = ""
MyNSCURL = ""
MyASXFile = ""

' Remove the publishing point when the broadcast is over.
PushDist.AutoRemovePublishingPoint = True

' Set the push distribution variables.
PushDist.ServerName = strServerName
PushDist.PublishingPoint = strPubPoint
PushDist.Template = strPubTemplate
Encoder.PrepareToEncode(True)
End Sub
End Class


'====================================

Could anybody please help me out.
Any hints/ ideas will be highly appreciated.


Thnx
Crisco
 
Back
Top