FORUMS: list search recent posts

Capture Problem Using Decklink Intensity Pro/Direct Show in VB.NET

COW Forums : Blackmagic Design

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Philip Hardy
Capture Problem Using Decklink Intensity Pro/Direct Show in VB.NET
on Jun 23, 2011 at 9:46:16 am

Hi all

I'm trying to implement some direct show functionality using a Decklink Intensity Pro capture card. I've created and run the graphs I need in GraphEdit with no problem (to both render on screen and capture to file) but when I try to implement either in VB.NET the output is just a black screen. Note I'm trying to implement this new functionality on a 64 bit version of Windows 7.

Connecting to remote graph when the app is running produces the same graph that I created initially, but when run in GraphEdit also outputs a black screen, then replacing the capture source filter with the one from the filter list in GraphEdit produces correct results again. This leads me to believe I'm configuring the capture source filter incorrectly in my code, or its assuming the incorrect settings from whatever source.

Here's the code I'm using to try to write from the capture source output to file. Am I supposed to be setting up the capture source filter in a different way? Any suggestions would be greatly appreciated.

Thanks in advance


Private m_dsROT As DsROTEntry

Private m_graphBuilder As IFilterGraph2
Private m_mediaCtrl As IMediaControl
Private m_mediaEvent As IMediaEvent
Private m_mediaSeeking As IMediaSeeking

Private f_videoCapture As IBaseFilter = Nothing
Private f_mjpegCompressor As IBaseFilter = Nothing
Private f_aviMux As IBaseFilter = Nothing
Private f_fileWriter As IFileSinkFilter = Nothing


Public Sub StartCapture(ByVal path As String)

m_graphBuilder = DirectCast(New FilterGraph(), IFilterGraph2)
m_mediaCtrl = DirectCast(m_graphBuilder, IMediaControl)
m_mediaEvent = DirectCast(m_graphBuilder, IMediaEvent)
m_mediaSeeking = DirectCast(m_graphBuilder, IMediaSeeking)

#If DEBUG Then
m_dsROT = New DsROTEntry(m_graphBuilder)
#End If

Try
'Adding the selected video source filter to the filtergraph
Dim videoDevice As DsDevice = SharedFunctions.GetVideoDevice(VideoDeviceName)
hr = m_graphBuilder.AddSourceFilterForMoniker(videoDevice.Mon, Nothing, videoDevice.Name, f_videoCapture)
DsError.ThrowExceptionForHR(hr)
Catch ex As Exception
Throw New Exception("Error adding video source filter to the graph (" & hr & "). " & ex.Message, ex.InnerException)
End Try


Try
'Adding Decklink MJPEG Compressor to the filtergraph
Dim mjpegCompressorGuid As New Guid("1E003B41-B606-4AE4-B2BB-C35E133575A5")
Dim mjpegCompressorComtype As Type = Type.GetTypeFromCLSID(mjpegCompressorGuid)
f_mjpegCompressor = DirectCast(Activator.CreateInstance(mjpegCompressorComtype), IBaseFilter)
hr = m_graphBuilder.AddFilter(f_mjpegCompressor, "Decklink MJPEG Compressor")
DsError.ThrowExceptionForHR(hr)
Catch ex As Exception
Throw New Exception("Error adding Decklink MJPEG Compressor to the graph (" & hr & "). " & ex.Message, ex.InnerException)
End Try

Try
'Connecting pins
Dim videoDeviceOut As IPin = DsFindPin.ByName(f_videoCapture, "Capture")
Dim mjpegCompressorIn As IPin = DsFindPin.ByName(f_mjpegCompressor, "XForm In")
hr = m_graphBuilder.Connect(videoDeviceOut, mjpegCompressorIn)
DsError.ThrowExceptionForHR(hr)
Catch ex As Exception
Throw New Exception("Error connecting video source and mjpeg compressor filters (" & hr & "). " & ex.Message, ex.InnerException)
End Try

Try
'Adding AVI Mux to the filtergraph
'Dim aviMuxGuid As New Guid("E2510970-F137-11CE-8B67-00AA00A3F1A6")
'Dim aviMuxComtype As Type = Type.GetTypeFromCLSID(aviMuxGuid)
'f_aviMux = DirectCast(Activator.CreateInstance(aviMuxComtype), IBaseFilter)
f_aviMux = DirectCast(New AviDest, IBaseFilter)
hr = m_graphBuilder.AddFilter(f_aviMux, "AVI Mux")
DsError.ThrowExceptionForHR(hr)
Catch ex As Exception
Throw New Exception("Error adding AVI Mux to the graph (" & hr & "). " & ex.Message, ex.InnerException)
End Try

Try
'Connecting pins
Dim mjpegCompressorOut As IPin = DsFindPin.ByName(f_mjpegCompressor, "XForm Out")
Dim aviMuxIn As IPin = DsFindPin.ByName(f_aviMux, "Input 01")
hr = m_graphBuilder.Connect(mjpegCompressorOut, aviMuxIn)
DsError.ThrowExceptionForHR(hr)
Catch ex As Exception
Throw New Exception("Error connecting mjpeg compressor and avi mux filters (" & hr & "). " & ex.Message, ex.InnerException)
End Try

Try
'Adding FileWriter to the filtergraph
f_fileWriter = DirectCast(New FileWriter(), IFileSinkFilter)
f_fileWriter.SetFileName(path, Nothing)
hr = m_graphBuilder.AddFilter(f_fileWriter, "File Writer")
DsError.ThrowExceptionForHR(hr)
Catch ex As Exception
Throw New Exception("Error adding File Writer to the graph (" & hr & "). " & ex.Message, ex.InnerException)
End Try

Try
'Connecting pins
Dim aviMuxOut As IPin = DsFindPin.ByName(f_aviMux, "AVI Out")
Dim fileWriterIn As IPin = DsFindPin.ByName(f_fileWriter, "in")
hr = m_graphBuilder.Connect(aviMuxOut, fileWriterIn)
DsError.ThrowExceptionForHR(hr)
Catch ex As Exception
Throw New Exception("Error connecting avi mux and file writer filters (" & hr & "). " & ex.Message, ex.InnerException)
End Try

Try
'Start the capture graph.
hr = m_mediaCtrl.Run
DsError.ThrowExceptionForHR(hr)

RaiseEvent StartedRecording()
Catch ex As Exception
Throw New Exception("Error starting the capture graph (" & hr & "). " & ex.Message, ex.InnerException)
End Try
End Sub


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]