Hello I have successfully managed to push video to the ASFWriter Sink; I am able to view the video on other computers in my network using Windows Media Player Open Url.
As this is great, because it has taken a month to just get this far, but I am still attempting to receive the video feed from inside a windows form and ultimately from an ASPX web page.
Below is the code I am using to receive the video on the client side:
Dim vDecoderGuid As New Guid("82d353df-90bd-4382-8bc2-3f6192b76e34")
Dim vRendererGuid As New Guid("B87BEB7B-8D29-423F-AE4D-6582C10175AC")
Dim aDecoderGuid As New Guid("2EEB4ADF-4578-4D10-BCA7-BB955F56320A")
Dim aRendererGuid As New Guid("79376820-07D0-11CF-A24D-0020AFD79767")
Dim vdecoderDMOWrapper As IDMOWrapperFilter = DirectCast(New DMOWrapperFilter(), IDMOWrapperFilter)
vdecoderDMOWrapper.Init(vDecoderGuid, DirectShowLib.DMO.DMOCategory.VideoDecoder)
vdecoder = DirectCast(vdecoderDMOWrapper, IBaseFilter)
GraphBuilder.AddFilter(vdecoder, "WMV DMO Decoder")
vrender = New VideoMixingRenderer()
GraphBuilder.AddFilter(TryCast(vrender, IBaseFilter), "Video Renderer")
monitorConfig = DirectCast(vrender, IVMRMonitorConfig)
If useAudio Then
Dim adecoderDMOWrapper As IDMOWrapperFilter = DirectCast(New DMOWrapperFilter(), IDMOWrapperFilter)
adecoderDMOWrapper.Init(aDecoderGuid, DirectShowLib.DMO.DMOCategory.AudioDecoder)
adecoder = DirectCast(adecoderDMOWrapper, IBaseFilter)
GraphBuilder.AddFilter(adecoder, "WMV DMO Decoder")
arender = AddFilterFromClsid(GraphBuilder, aRendererGuid, "arenderer")
pinADecoderIn = DsFindPin.ByName(adecoder, "in0")
pinADecoderOut = DsFindPin.ByName(adecoder, "out0")
pinARenderIn = DsFindPin.ByName(arender, "Audio Input pin (rendered)")
End If
pinVDecoderIn = DsFindPin.ByName(vdecoder, "in0")
pinVDecoderOut = DsFindPin.ByName(vdecoder, "out0")
pinVRenderIn = DsFindPin.ByName(TryCast(vrender, IBaseFilter), "VMR Input0")
Try
DisconnectPins()
DirectCast(readerObject, IFileSourceFilter).Load(filename, Nothing)
reader = DirectCast(readerObject, IBaseFilter)
GraphBuilder.AddFilter(reader, "Reader")
pinreaderVOut = DsFindPin.ByName(reader, "Raw Video 1")
If pinreaderVOut Is Nothing Then
pinreaderVOut = DsFindPin.ByName(reader, "Raw Video 0")
End If
If useAudio Then
pinReaderAOut = DsFindPin.ByName(reader, "Raw Audio 0")
If pinReaderAOut Is Nothing Then
pinReaderAOut = DsFindPin.ByName(reader, "Raw Audio 1")
End If
End If
hr = GraphBuilder.ConnectDirect(pinreaderVOut, pinVDecoderIn, Nothing)
hr = GraphBuilder.ConnectDirect(pinVDecoderOut, pinVRenderIn, Nothing)
If useAudio Then
If pinReaderAOut IsNot Nothing Then
hr = GraphBuilder.ConnectDirect(pinReaderAOut, pinADecoderIn, Nothing)
hr = GraphBuilder.ConnectDirect(pinADecoderOut, pinARenderIn, Nothing)
End If
End If
rot = New DsROTEntry(Me.GraphBuilder)
hr = Me.MediaControl.Run()
This seems to work when I use small WMV files (larger files 300 meg for 7 minutes of video time opposed to 28 meg for 7 minutes). The small sized files work most of the time. When it doesn't work, it simply displays a single picture of a frame of the video (with no errors) - this also happens with the larger files (just a picture of one of the frames).
Could the issue be that I need to buffer the video stream before I play it? If so, where would I start?
Thanks