Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / dvd playback w/ renderless VMR-9 filter? Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
jag

March 31, 2005, 03:07 PM

Is this even possible? I've been stuck on this problem for a while now. Since I needed access to each individual frame, I needed to use renderless VMR-9. This works well with AVI's etc but if I do this:

  1.  
  2. // tell dvd graph builder to instantiate VMR-9
  3. hr = m_pIDvdGB->GetDvdInterface(IID_IVMRFilterConfig9, reinterpret_cast<void**>(&filterConfig1));
  4.  
  5. FAIL_RET( filterConfig->SetRenderingMode( VMR9Mode_Renderless ) );
  6.  
  7. ....
  8.  
  9. // try to render dvd, always fails, because of the above getdvdinterface call,
  10. // even if i use AM_DVD_VMR9_ONLY in m_dwRenderFlags :(
  11. FAIL_RET( m_pIDvdGB->RenderDvdVideoVolume(pszwDiscPath, m_dwRenderFlags, &buildStatus) );
  12.  
  13.  



Anyone know how to set this up properly so that RenderDvdVideoVolume will succeed?

 
Steven Hansen

March 31, 2005, 04:36 PM

Are you certain that the reason RenderDvdVideoVolume is failing is the call to GetDvdInterface? What is the HRESULT of that failure? Perhaps additional setup (not listed) is incorrect.

The code you've posted looks good. Check the rest of your code thoroughly. Or... post more code for additional help.

Good luck.

 
jag

April 01, 2005, 01:14 AM

Thanks Steve, anyways I'm pretty sure it is a Directx or a hardware thing...
If you go into dvdsample.exe in the bin directory of the directshow samples(dx sdk 9.0c extras), you can choose to use VMR-9 under options, the error I get is the same, 2/3 dvd streams failed to render properly(video/sub picture). I've tried this sample on a few computers, with recent hardware and got the same thing, The problem lies in creating VMR-9 along with the dvd graph builder. Has anyone gotten this to work??

 
Steven Hansen

April 01, 2005, 12:50 PM

Honestly those samples are sometimes absolutely worthless. All that framework and error checking really blur what you actually need to do to get things working.

I wish I knew a bit more about the VMR so I could help more. We've used the typical filters for nearly everything - with a custom renderer. This has been the easiest approach, and incredibly flexible. It is similar to the sample that shows the skier movie on a cylinder via a texture, except of course that you have to make it a bit more robust for professional deployment.

Regarding DVDs, we build all our graphs manually (filter by filter). This gives us complete ability to customize the whole thing. I'm sure you could manually connect the VMR filter to the end of a DVD filter (minus the renderer). At least... it *should* work.

It is really annoying that DirectShow was always an afterthought on Microsoft's part, and now they discourage its use. They say something is on its way, but meanwhile, I haven't seen an update in a while!

I tried the DvDSample, and sure enough - VMR render for DVDs fails. Why release a sample that can't do its job? Argh!

If you find an answer, please post it here for the rest of us. :)

 
jag

April 01, 2005, 03:54 PM

Steve,

Meanwhile im stuck with the problem :( lol ok so the road I should take is to build it manually, but I have no clue which filters to create so that a dvd can be streamed. I'm guessing I have to use the DVD Navigator Filter(IDvdControl2) just that I thought you needed a DVD graph builder in order to retrieve the dvd navigation filter(only made sense).

So this what I have in mind.... create a dvd navigation filter, create my vmr-9 as I have now, except do not add the vmr-9 filter to the graph builder, instead connect vmr-9 to the end of the navigation filter, and add the navigation filter to the graph builder using AddFilter(), does that seem right?

 
jag

April 02, 2005, 06:23 PM

Sweet, I got it....


problem was that my power dvd 5.0 decoder was not vmr-9 compatible. I got power dvd 6.0 and it worked, weird I installed a bunch of newer dvd decoder but they weren't recognized it still used Cyberlink's old decoder.... Here's the code that works hopefully this will help someone a few days work.

  1.  
  2.         HRESULT hr;
  3.         // Clear DirectShow interfaces (COM smart pointers)
  4.         CloseGraph(window);
  5.  
  6.         CComPtr<IVMRFilterConfig9> pIVMRFC;
  7.         // if this is a dvd source
  8.         if(m_dvd){
  9.                 // create graph builder
  10.                 FAIL_RET( m_pIDvdGB.CoCreateInstance(  CLSID_DvdGraphBuilder,
  11.                             NULL,
  12.                             CLSCTX_INPROC_SERVER) );
  13.                  
  14.                 // to use VMR9, we get the dvd interface for the filter config, this will also
  15.                 // add the vmr-9 renderer to the graph builder
  16.                 FAIL_RET( m_pIDvdGB->GetDvdInterface(IID_IVMRFilterConfig9, (void**)&pIVMRFC) );
  17.                 FAIL_RET( m_pIDvdGB->GetFiltergraph(&m_pIGB) );
  18.                
  19.                 // get the renderer so we can later create a custom allocator-presenter
  20.                 FAIL_RET( m_pIGB->FindFilterByName(L"Video Mixing Renderer 9", &m_pIBF ) );
  21.        
  22.         }
  23.         // if it is any other media source
  24.         else{
  25.  
  26.                 // we do not have a DVD so start from scratch, create a filter graph to hold VMR-9 renderer
  27.                 FAIL_RET( m_pIGB.CoCreateInstance(CLSID_FilterGraph) );
  28.                 FAIL_RET( m_pIBF.CoCreateInstance(CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER) );
  29.                
  30.                
  31.                 FAIL_RET( m_pIBF->QueryInterface(IID_IVMRFilterConfig9, reinterpret_cast<void**>(&pIVMRFC)) );
  32.        
  33.         }
  34.  
  35.  
  36.  
  37.         // want to work in renderless mode, since I am doing some shader work on each frame          
  38.         FAIL_RET( pIVMRFC->SetRenderingMode( VMR9Mode_Renderless ) );
  39.        
  40.         // dvd graph builder automatically sets the number of streams, if it is not a dvd
  41.         // we need to set this manually
  42.         if(!m_dvd)
  43.                 FAIL_RET( pIVMRFC->SetNumberOfStreams(2) );
  44.  
  45.         // create a custom allocator-presenter so that we can do custom effects on a d3d surface per frame
  46.         FAIL_RET( SetAllocatorPresenter( m_pIBF, window ) );
  47.        
  48.         // if not dvd add the filter to the graph builder we created from scratch
  49.         if(!m_dvd)
  50.                 FAIL_RET( m_pIGB->AddFilter(m_pIBF, L"Video Mixing Renderer 9") );
  51.  
  52.         m_path = path;
  53.  
  54.         // render all filters in graph builder if it is not dvd
  55.         if(!m_dvd)
  56.                 FAIL_RET( m_pIGB->RenderFile( m_path, NULL ) );
  57.         else{
  58.  
  59.                 // this will parse out the dvd IFO headers, and get the dvd ready to render as needed,
  60.                 // if we used renderfile, it would render the exact VOB selected, with this, it will
  61.                 // start the dvd from the title menu, also we need to select AM_DVD_VMR9_ONLY so that
  62.                 // the dvd graph builder knows to use VMR-9 and not the overlay
  63.                 AM_DVD_RENDERSTATUS buildStatus;
  64.                 FAIL_RET( m_pIDvdGB->RenderDvdVideoVolume(m_path, AM_DVD_SWDEC_PREFER | AM_DVD_VMR9_ONLY, &buildStatus));
  65.                
  66.                 // helpers to control dvd stuff
  67.                 FAIL_RET( m_pIDvdGB->GetDvdInterface(IID_IDvdInfo2, reinterpret_cast<void**>(&m_pIDvdI2)));
  68.                 FAIL_RET( m_pIDvdGB->GetDvdInterface(IID_IDvdControl2, reinterpret_cast<void**>(&m_pIDvdC2)));
  69.         }
  70.  
  71.  
  72.         // helpers to control media playback as well as procamp controll
  73.         FAIL_RET( m_pIGB->QueryInterface(IID_IMediaControl, reinterpret_cast<void**>(&m_pIMC)) );
  74.         FAIL_RET( m_pIGB->QueryInterface(IID_IMediaSeeking, reinterpret_cast<void**>(&m_pIMS)) );
  75.  
  76.         FAIL_RET( m_pIBF->QueryInterface(IID_IVMRMixerControl9, reinterpret_cast<void**>(&m_pIVMRMC)) );
  77.  
  78.        
  79.  
  80.  
  81.     return hr;
  82.  


remember that we still need to handle window commands so that user can select the buttons during the main title menu ie: goto extras etc... For that you would want to create a MessageSink, see 'DVDPLAY' in dshow samples

 
Steven Hansen

April 04, 2005, 12:09 PM

Way to go!

That's really odd about the version of PowerDVD.

Interesting note: with capture to texture, we've never been able to get Cyberlink to work, and have had to stick with WinDVD.

Good job! Thanks for the code.

 
jag

April 04, 2005, 08:21 PM

I guess it depends on the codec, 6.0 supports VMR-9 dvd decoding while my old one didn't. WinDVD didn't work for me... but I don't think I got the updated version.

I wonder how MPlayer is able to have all the codecs built in. Did they code it themselves or simply include libraries.

 
This thread contains 8 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.