1

Directshow オーディオ/ビデオ キャプチャ

VB.Netでは、接続されたデバイスからビデオをキャプチャできますが、スピーカーが接続されているため、音声を受信できません。MediaPlayer から動画や mp3 を再生できます。でも、なぜ音が出ないのか不思議。次のコードでオーディオ フィルタを設定する方法を教えてください。助けてください、親切に次のコードに関連する変更を加えてください...

    Public Function FindCaptureDevice() As IBaseFilter
        Debug.WriteLine("Start the Sub FindCaptureDevice")
        Dim hr As Integer = 0
        Dim classEnum As IEnumMoniker = Nothing
        'Dim classEnum1 As IEnumMoniker = Nothing
        Dim moniker As IMoniker() = New IMoniker(0) {}
        Dim source As Object = Nothing
        Dim devEnum As ICreateDevEnum = CType(New CreateDevEnum, ICreateDevEnum)

        hr = devEnum.CreateClassEnumerator(FilterCategory.VideoInputDevice, classEnum, 0)
        DsError.ThrowExceptionForHR(hr)
        Marshal.ReleaseComObject(devEnum)

        If classEnum Is Nothing Then
            Throw New ApplicationException("No video capture device was detected.\r\n\r\n" & _
                           "This sample requires a video capture device, such as a USB WebCam,\r\n" & _
                           "to be installed and working properly.  The sample will now close.")
        End If


        If classEnum.Next(moniker.Length, moniker, IntPtr.Zero) = 0 Then
            Dim iid As Guid = GetType(IBaseFilter).GUID
            moniker(0).BindToObject(Nothing, Nothing, iid, source)
        Else
            Throw New ApplicationException("Unable to access video capture device!")
        End If
        Marshal.ReleaseComObject(moniker(0))
        Marshal.ReleaseComObject(classEnum)
        Return CType(source, IBaseFilter)
    End Function
4

0 に答える 0