DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code
Go Back  Xtreme Visual Basic Talk > > > > DirectShow in vb.net & filtergraphs inc code


Reply
 
Thread Tools Display Modes
  #1  
Old 12-05-2005, 08:12 AM
blackpenny15 blackpenny15 is offline
Newcomer
 
Join Date: Dec 2005
Posts: 1
Exclamation DirectShow in vb.net & filtergraphs inc code


Hi guys
erm im messing around with directshow, basicly coz mediaplay wont open vobs directly, or let me switch audio channels with mpegs, really need help with this, i know directshow isnt ment for vb.net, btw im using whidbey, shoulnt make a diffrence tho, code below is what i got and it works for mpegs, need to add my custom filter graph built with the graph edit utility, alot of rem'ed code down there coz i have been messing around with stuff, with no avalile, plz plz plz im begging someone, help me, understand this directshow mother, need to play vobs with my custom filter and switch audio channel in mpegs and in vobs, do i need to manual construct the graph in code and pin everything together?

thanks for reading, maybe this code will help some poor soul, i got 3 buttons on the form, and a listbox from the remed code but u dont need that, thanks

on futher reading it looks like im gonna need to manual put the filter graph together in code, plz help guys
1. example of using a filtergraph in my code(putting one custom together)
2. switching audio streams vobs and channels with mpegs
must be a genious out there somewhere

or my alternativre solution, how do i set what should be loaded up by default to play vobs? fix this and i dont need todo it from code, atm graphedit loads the screen with all sorts or crap it dosent need.
si

Code:
Public Class frm_quartz
    Private m_objBasicAudio As QuartzTypeLib.IBasicAudio
    Private m_objBasicVideo As QuartzTypeLib.IBasicVideo
    Private m_objMediaEvent As QuartzTypeLib.IMediaEvent
    Private m_objVideoWindow As QuartzTypeLib.IVideoWindow
    Private m_objMediaControl As QuartzTypeLib.IMediaControl
    Private m_objMediaPosition As QuartzTypeLib.IMediaPosition
    Public Const WS_BORDER = &H800000
    Public Const WS_CAPTION = &HC00000
    Public Const WS_CHILD = &H40000000
    Public Const WS_CHILDWINDOW = (WS_CHILD)
    Public Const WS_CLIPCHILDREN = &H2000000
    Public Const WS_CLIPSIBLINGS = &H4000000
    Public Const WS_DISABLED = &H8000000
    Public Const WS_DLGFRAME = &H400000
    Public Const WS_GROUP = &H20000
    Public Const WS_HSCROLL = &H100000
    Public Const WS_ICONIC = WS_MINIMIZE
    Public Const WS_MAXIMIZE = &H1000000
    Public Const WS_MAXIMIZEBOX = &H10000
    Public Const WS_MINIMIZE = &H20000000
    Public Const WS_MINIMIZEBOX = &H20000
    Public Const WS_OVERLAPPED = &H0&
    Public Const WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED Or WS_CAPTION Or _
                                                                           WS_SYSMENU Or WS_THICKFRAME Or _
                                                                           WS_MINIMIZEBOX Or WS_MAXIMIZEBOX)
    Public Const WS_POPUP = &H80000000
    Public Const WS_POPUPWINDOW = (WS_POPUP Or WS_BORDER Or WS_SYSMENU)
    Public Const WS_SIZEBOX = WS_THICKFRAME
    Public Const WS_SYSMENU = &H80000
    Public Const WS_TABSTOP = &H10000
    Public Const WS_THICKFRAME = &H40000
    Public Const WS_TILED = WS_OVERLAPPED
    Public Const WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW
    Public Const WS_VISIBLE = &H10000000
    Public Const WS_VSCROLL = &H200000

    Sub RemoveDShow()
        Try

            'If a MediaControl instance exists, then stop it from playing
            'If ObjPtr(m_objMediaControl) > 0 Then
            'm_objMediaControl.Stop()
            'End If
            'If a VideoWindow instance exists, then remove the link to the render target
            'If ObjPtr(m_objVideoWindow) > 0 Then
            'm_objVideoWindow.Owner = 0
            'End If
            'Destroy all objects
            'If ObjPtr(m_objBasicAudio) > 0 Then m_objBasicAudio = Nothing
            'If ObjPtr(m_objBasicVideo) > 0 Then m_objBasicVideo = Nothing
            'If ObjPtr(m_objMediaControl) > 0 Then m_objMediaControl = Nothing
            'If ObjPtr(m_objVideoWindow) > 0 Then m_objVideoWindow = Nothing
            'If ObjPtr(m_objMediaPosition) > 0 Then m_objMediaPosition = Nothing
            'Exit Sub
        Catch
            'Err.Clear()
            'Exit Sub
        End Try

    End Sub

    Sub OpenDShowFile(ByVal Filename As String)
        Try
            m_objMediaControl = New QuartzTypeLib.FilgraphManager
            'm_objMediaControl.AddSourceFilter("C:\Documents and Settings\tracer.HELLOKITTY\Desktop\10216.GRF", Nothing)

            Call m_objMediaControl.RenderFile(Filename)

            m_objBasicAudio = CType(m_objMediaControl, QuartzTypeLib.IBasicAudio)
            m_objBasicAudio.Volume = 0 'Loudest
            m_objBasicAudio.Balance = 0 'Centered

            m_objVideoWindow = CType(m_objMediaControl, QuartzTypeLib.IVideoWindow)
            m_objVideoWindow.WindowStyle = WS_VISIBLE 'WS_VISIBLE = &H10000000
            m_objVideoWindow.Top = Me.Location.Y
            m_objVideoWindow.Left = Me.Location.X
            m_objVideoWindow.Width = Me.Width
            m_objVideoWindow.Height = Me.Height
            'm_objVideoWindow.Owner = Me.hWnd

            m_objMediaEvent = CType(m_objMediaControl, QuartzTypeLib.IMediaEvent)

            m_objMediaPosition = CType(m_objMediaControl, QuartzTypeLib.IMediaPosition)
            m_objMediaPosition.Rate = 1 'Normal forward playback speed

            Exit Sub
        Catch

            Err.Clear()
        End Try
    End Sub
    Private Sub play_movie()
        If CLng(m_objMediaPosition.CurrentPosition) = CLng(m_objMediaPosition.Duration) Then
            m_objMediaPosition.CurrentPosition = 0
        End If
        Call m_objMediaControl.Run()
    End Sub
    Private Sub pause_movie()
        Call m_objMediaControl.Pause()
    End Sub
    Private Sub stop_movie()
        Call m_objMediaControl.Stop()
        m_objMediaPosition.CurrentPosition = 0
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        OpenFileDialog1.ShowDialog()
        OpenDShowFile(OpenFileDialog1.FileName)
        'Dim g_objMC As QuartzTypeLib.FilgraphManager
        'Dim filter As QuartzTypeLib.IRegFilterInfo
        'g_objMC = New QuartzTypeLib.FilgraphManager ' create the new filter graph 

        'Dim objFilter As Object  ' temporary object for valid syntax; not used 

        'OpenFileDialog1.ShowDialog() ' get the name of the source or filter graph file 
        'g_objMC.AddSourceFilter(OpenFileDialog1.FileName, objFilter)

        ' code fragment that populates the registered filter list box 
        ' global variable g_objRegFilters is set to FilgraphManager.RegFilterCollection
        ' Set g_objRegFilters = g_objMC.RegFilterCollection 

        'Dim g_objregfilters = g_objMC.RegFilterCollection
        'listRegFilters.Items.Clear()
        'If Not g_objRegFilters Is Nothing Then
        'For Each Filter() In g_objRegFilters  ' for each filter in collection 
        'listRegFilters.Items.Add(Filter.Name) ' add name to the list box 
        'Next Filter()
        'End If

        ' find the selected filter and add it to the graph 
        ' g_objRegFilters is the FilgraphManager object's RegFilterCollection property 
        'For Each Filter() In g_objRegFilters
        'If Filter.Name = listRegFilters.Text Then  ' the selected filter? 
        'Dim f As QuartzTypeLib.IFilterInfo  ' yes 
        'Filter.filter(f)  ' add to the filter graph, return IFilterInfo f 
        'If f.IsFileSource Then
        'OpenFileDialog1.ShowDialog()
        'f.Filename = OpenFileDialog1.FileName
        'End If
        'Exit For
        'End If
        'Next Filter()

        Call play_movie()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Call pause_movie()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Call stop_movie()
    End Sub

    Private Sub frm_quartz_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'OpenDShowFile("E:\ayu\Ayumi Hamasaki - Dearest.mpg")
        'OpenDShowFile("C:\Documents and Settings\tracer.HELLOKITTY\Desktop\10148.vob")
    End Sub
End Class
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code
 
DirectShow in vb.net & filtergraphs inc code
DirectShow in vb.net & filtergraphs inc code
 
-->