I don't know how your code look like but normaly, with DirectShowLib, you just allocate COM objects and interact with them. Except if you implemented a filter (or a DMO) in .NET, I don't see how changing the version could interact with your video display.
Are you sure that your problem is not related to a x86/x64 problem ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm having this exact problem at the moment. It doesn't matter if I use the prebuilt library or rebuild it against various .net versions and/or cpu targets. This happens in the DxPlay sample too, so it's not just my app. I'm on Win7 x64 FWIW, and I'm testing with a .mov file. If I target 3.5 with the sample, it works fine. So whether it's the library or the sample, I'm not sure. My app is borrowing heavily from DxPlay so it could certainly be a bug in DxPlay, although nothing stands out to me as I look through the code.
I also get an SEHException when my app closes if I've played a video. That doesn't happen in DxPlay but I'm guessing (hoping) when the main problem is solved, this will go away.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
no i'am on x86 ( 32 bit ) and i don't even set my targeting cpy to ( any cpu 'both x86/x64 )
i always set it to x86 programing and i use windows 7
it drives me crazy
and here is my module to play files
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Imports DirectShowLib ' add refrence to direct show lib ( a .dll file )
Module Module1
Public Class DirectShowMedia
Implements IDisposable
Private Declare Auto Function BitBlt Lib "GDI32.DLL" (ByVal hdcDest As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As Int32) As Boolean
Public Sub Dispose() Implements IDisposable.Dispose
CloseClip()
End Sub
Public Enum moviestatus
stop_ = 0
play = 1
pause = 2
End Enum
Private Enum PlayState
Stopped
Paused
Running
Init
End Enum
Private Enum MediaType
Audio
Video
End Enum
Private Const WMGraphNotify As Integer = 13
Private Const VolumeFull As Integer = 0
Private Const VolumeSilence As Integer = -10000
Private graphBuilder As IGraphBuilder = Nothing
Private mediaControl As IMediaControl = Nothing
Private mediaEventEx As IMediaEventEx = Nothing
Private videoWindow As IVideoWindow = Nothing
Private basicAudio As IBasicAudio = Nothing
Private basicVideo As IBasicVideo2 = Nothing
Private mediaSeeking As IMediaSeeking = Nothing
Private mediaPosition As IMediaPosition = Nothing
Private frameStep As IVideoFrameStep = Nothing
Dim hr As Integer = 0
Private filename As String
Private isAudioOnly As Boolean = False
Private isFullScreen As Boolean = False
Private currentVolume As Integer = VolumeSilence
Private currentState As PlayState = PlayState.Stopped
Private currentPlaybackRate As Double = 1.0
Private UseHand As IntPtr
Private FsDrain As IntPtr = IntPtr.Zero
Private can_seek As OABool
Public Event MedClose()
'Start Media
hr = mediaControl.Run
DsError.ThrowExceptionForHR(hr)
currentState = PlayState.Running
hr = videoWindow.put_MessageDrain(controlholder.Handle.ToInt32)
DsError.ThrowExceptionForHR(hr)
hr = mediaPosition.CanSeekForward(can_seek)
DsError.ThrowExceptionForHR(hr)
If isAudioOnly = False Then
'Set Video Size
SetVideoSize()
End If
hr = basicAudio.put_Volume(-10000)
DsError.ThrowExceptionForHR(hr)
Catch ex As Exception
MsgBox("Error " & ex.Message, MsgBoxStyle.Critical, "Mob Error")
RaiseEvent MedClose()
End Try
End Sub
Public Sub pauseMedia()
Try
mediaControl.Pause()
currentState = PlayState.Paused
Catch ex As Exception
currentState = PlayState.Stopped
End Try
End Sub
Public Sub ResumeMedia()
Try
mediaControl.Run()
currentState = PlayState.Running
Catch ex As Exception
currentState = PlayState.Stopped
End Try
End Sub
Public Sub StopMedia()
Try
mediaControl.Stop()
mediaPosition.put_CurrentPosition(0)
currentState = PlayState.Stopped
Catch ex As Exception
currentState = PlayState.Stopped
End Try
End Sub
Private Sub CloseClip()
Try
Dim hr As Integer = 0
'Reset all Properties to Default
currentState = PlayState.Stopped
isAudioOnly = True
isFullScreen = False
filename = ""
'Call sub to Close and Release from memory
'Release Window Handle, Reset back to Normal
If isAudioOnly = False Then
hr = videoWindow.put_Visible(OABool.False)
DsError.ThrowExceptionForHR(hr)
hr = videoWindow.put_Owner(IntPtr.Zero)
DsError.ThrowExceptionForHR(hr)
End If
If Not mediaEventEx Is Nothing Then
hr = mediaEventEx.SetNotifyWindow(IntPtr.Zero, 0, IntPtr.Zero)
DsError.ThrowExceptionForHR(hr)
End If
in direct show some of flv videos playes very weird in vb.net 2010
but when i change the programming targeted framework from 4.0 to 3.5 it play normmaly
any ideas
Can you define what you mean by "playes very weird" ?
like a lot of slow black pixels shadows showed in the movies
and when i change the targeted .NET framework to version 3.5
it plays perfect but i can't use the new .NET 4.0 features
and by the way i don't know what filters is
i just play media from filtergraph interface by using
the graphBuilder.RenderFile(filepath, Nothing) method
Last edit: Ahmed Mobarako 2013-04-13
I don't know how your code look like but normaly, with DirectShowLib, you just allocate COM objects and interact with them. Except if you implemented a filter (or a DMO) in .NET, I don't see how changing the version could interact with your video display.
Are you sure that your problem is not related to a x86/x64 problem ?
I'm having this exact problem at the moment. It doesn't matter if I use the prebuilt library or rebuild it against various .net versions and/or cpu targets. This happens in the DxPlay sample too, so it's not just my app. I'm on Win7 x64 FWIW, and I'm testing with a .mov file. If I target 3.5 with the sample, it works fine. So whether it's the library or the sample, I'm not sure. My app is borrowing heavily from DxPlay so it could certainly be a bug in DxPlay, although nothing stands out to me as I look through the code.
I also get an SEHException when my app closes if I've played a video. That doesn't happen in DxPlay but I'm guessing (hoping) when the main problem is solved, this will go away.
no i'am on x86 ( 32 bit ) and i don't even set my targeting cpy to ( any cpu 'both x86/x64 )
i always set it to x86 programing and i use windows 7
it drives me crazy
and here is my module to play files
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Imports DirectShowLib ' add refrence to direct show lib ( a .dll file )
Module Module1
If DEBUG Then
End If
If DEBUG Then
End If
If DEBUG Then
End If
End Module