Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. DirectShow VMR9 Window inside Direct3D interface

DirectShow VMR9 Window inside Direct3D interface

Scheduled Pinned Locked Moved C / C++ / MFC
helpgraphicsadobehardwarequestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dustin Henry
    wrote on last edited by
    #1

    I'm sorry for reposting this but I was not able to get back to work on this project until just now. I am currently designing a 2D/3D interface package based on Direct3D, but need to include a DirectShow VMR9 window in the interface which will be diplaying video from a capture card or pre-recorded videos. The problem is that I have a render loop that constantly updates and redraws the interface, which causes the embedded video to flash. Is there a way that I can tell part of a surface not to be redrawn, i.e. the surface behind the vid window? It is on top of a large fullscreen size surface which holds a background image. Else is there a simple way to place individual frames of a my video onto a Direct3D surface which can then be drawn on top of the backgroung image. I'm fairly new to Direct3D and very new to DirectShow. Any help is appreciated. Thanks, Dustin P.S. I have tried using ExcludeClipRect() but it appaerantly only works with GDI. I have also tried telling the video to repaint after the interface was drawn, but to no avail.

    M 1 Reply Last reply
    0
    • D Dustin Henry

      I'm sorry for reposting this but I was not able to get back to work on this project until just now. I am currently designing a 2D/3D interface package based on Direct3D, but need to include a DirectShow VMR9 window in the interface which will be diplaying video from a capture card or pre-recorded videos. The problem is that I have a render loop that constantly updates and redraws the interface, which causes the embedded video to flash. Is there a way that I can tell part of a surface not to be redrawn, i.e. the surface behind the vid window? It is on top of a large fullscreen size surface which holds a background image. Else is there a simple way to place individual frames of a my video onto a Direct3D surface which can then be drawn on top of the backgroung image. I'm fairly new to Direct3D and very new to DirectShow. Any help is appreciated. Thanks, Dustin P.S. I have tried using ExcludeClipRect() but it appaerantly only works with GDI. I have also tried telling the video to repaint after the interface was drawn, but to no avail.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Writing your own renderer is one option. The sample base classes included with the DirectShow SDK make it relatively simple. The Texture3D9 Sample[^] in the DirectShow SDK may help for rendering video to a Direct3D surface.

      D 1 Reply Last reply
      0
      • M Mark Salsbery

        Writing your own renderer is one option. The sample base classes included with the DirectShow SDK make it relatively simple. The Texture3D9 Sample[^] in the DirectShow SDK may help for rendering video to a Direct3D surface.

        D Offline
        D Offline
        Dustin Henry
        wrote on last edited by
        #3

        I've tried looking through that sample but can't really make heads or tails of it, mainly because I don't really have a clue about how DirectShow actually works. I have searched everywhere for a good tutorial, but everone I can find does things that I don't need and doesn't do the things that I do. I've got a file loading and playing just fine with full control over playback, but that's where my success ends. I need to be able to load multiple videos and play them back based on events generated by the interface. The problem is I don't know how the videos are actually stored. Do I need to create a multiple IVMRWindowlessControl9 or IGraphBuilder. Which interfaces can be reused and which cannot. If anybody knows of a good tutorial that would teach me all this I would very much appreciate it. It seems DirectShow is far less popular than the other DirectX APIs. Thanks for your help, Dustin

        M 1 Reply Last reply
        0
        • D Dustin Henry

          I've tried looking through that sample but can't really make heads or tails of it, mainly because I don't really have a clue about how DirectShow actually works. I have searched everywhere for a good tutorial, but everone I can find does things that I don't need and doesn't do the things that I do. I've got a file loading and playing just fine with full control over playback, but that's where my success ends. I need to be able to load multiple videos and play them back based on events generated by the interface. The problem is I don't know how the videos are actually stored. Do I need to create a multiple IVMRWindowlessControl9 or IGraphBuilder. Which interfaces can be reused and which cannot. If anybody knows of a good tutorial that would teach me all this I would very much appreciate it. It seems DirectShow is far less popular than the other DirectX APIs. Thanks for your help, Dustin

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Using the VMR in windowless mode is not too helpful since you only have control at the window (HWND) level. Using the VMR in renderless mode provides almost exactly what you need to do except the Direct3D surfaces are created to match the video stream. If you're already managing the surfaces and the video is secondary then this is (in a sense) the reverse of what you need. If you have code running with direct show and the only problem is flicker then I still think the easiest route would be to write your own renderer instead of the VMR (unless you're really using the mixing features of the renderer). I personally found the Windows Media Format SDK to be more flexible, although I work mainly with ASF files (.wma, .wmv, etc.) and prefer to write my own renderers. If you can work with ASF files then it's fairly simple (and there's decent sample code in the SDK) to read streams from a file. Using the asynchronous reader you can set up to read a file and you'll get a callback called for each frame of video, at the right time, and in the right order. What you do with the frame is up to you. If you work with 24-bit RGB video, it's a fairly simple blt to a Direct3D surface, GDI device context, or whatever. A downside is, besides mpeg-4, the only video codes included for free are the windows media codecs. Might be worth taking a look at the Windows Media Format SDK[^]

          D D 2 Replies Last reply
          0
          • M Mark Salsbery

            Using the VMR in windowless mode is not too helpful since you only have control at the window (HWND) level. Using the VMR in renderless mode provides almost exactly what you need to do except the Direct3D surfaces are created to match the video stream. If you're already managing the surfaces and the video is secondary then this is (in a sense) the reverse of what you need. If you have code running with direct show and the only problem is flicker then I still think the easiest route would be to write your own renderer instead of the VMR (unless you're really using the mixing features of the renderer). I personally found the Windows Media Format SDK to be more flexible, although I work mainly with ASF files (.wma, .wmv, etc.) and prefer to write my own renderers. If you can work with ASF files then it's fairly simple (and there's decent sample code in the SDK) to read streams from a file. Using the asynchronous reader you can set up to read a file and you'll get a callback called for each frame of video, at the right time, and in the right order. What you do with the frame is up to you. If you work with 24-bit RGB video, it's a fairly simple blt to a Direct3D surface, GDI device context, or whatever. A downside is, besides mpeg-4, the only video codes included for free are the windows media codecs. Might be worth taking a look at the Windows Media Format SDK[^]

            D Offline
            D Offline
            d34studios
            wrote on last edited by
            #5

            Thank you very much for the advice. You're right, I do not need most of the features in VMR and I can work with any format I want as I am authoring the videos. I will give it a go, although there may be more questions coming.:) Thanks for always being so helpful Mark, Dustin

            1 Reply Last reply
            0
            • M Mark Salsbery

              Using the VMR in windowless mode is not too helpful since you only have control at the window (HWND) level. Using the VMR in renderless mode provides almost exactly what you need to do except the Direct3D surfaces are created to match the video stream. If you're already managing the surfaces and the video is secondary then this is (in a sense) the reverse of what you need. If you have code running with direct show and the only problem is flicker then I still think the easiest route would be to write your own renderer instead of the VMR (unless you're really using the mixing features of the renderer). I personally found the Windows Media Format SDK to be more flexible, although I work mainly with ASF files (.wma, .wmv, etc.) and prefer to write my own renderers. If you can work with ASF files then it's fairly simple (and there's decent sample code in the SDK) to read streams from a file. Using the asynchronous reader you can set up to read a file and you'll get a callback called for each frame of video, at the right time, and in the right order. What you do with the frame is up to you. If you work with 24-bit RGB video, it's a fairly simple blt to a Direct3D surface, GDI device context, or whatever. A downside is, besides mpeg-4, the only video codes included for free are the windows media codecs. Might be worth taking a look at the Windows Media Format SDK[^]

              D Offline
              D Offline
              Dustin Henry
              wrote on last edited by
              #6

              Mark, I just wanted to let you know I fixed the problem. All I did was take the '9' off of everything regarding VMR so that I am now using the original version VMR7. I have no idea why this fixed the problem or even what inspired me to try it, but it now works. I just LOVE Microsoft. Thanks for the help, Dustin

              M 1 Reply Last reply
              0
              • D Dustin Henry

                Mark, I just wanted to let you know I fixed the problem. All I did was take the '9' off of everything regarding VMR so that I am now using the original version VMR7. I have no idea why this fixed the problem or even what inspired me to try it, but it now works. I just LOVE Microsoft. Thanks for the help, Dustin

                M Offline
                M Offline
                Mark Salsbery
                wrote on last edited by
                #7

                :laugh: Cool! I'll note that for future reference, thanks! Cheers! Mark

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups