NO

Author Topic: COM and Direct Show...  (Read 5378 times)

CommonTater

  • Guest
COM and Direct Show...
« on: May 13, 2012, 08:39:00 AM »
Part of my current project would benefit greatly from being able to play instructional videos and sound tracks.  These would be in MP3, AVI or MP4 format.
 
However, this leaves me at a bit of a disadvantage since I've done very little with COM and haven't even touched DShow.  I could really use a couple of good tutorials but so far, everything I'm finding assumes too much and leaves me scratching my head...  I've tried the DShow examples from Microsoft, I get the idea of the filter chain... but still no joy in expanding it beyond the examples.
 
There are a couple of specific areas that are problematic for me...
 
1) How can I determine in software which COM interfaces are available on a given machine.
2) Same as #1 but this time about codecs...
 
Also... I'm pretty sure I get the concept of VTables but how do I go about finding out what's what in a given VTable?  I've looked at a couple of Codec dlls trying to suss it out, but no joy... and almost no documentation.
 
Any links to real beginnerish tutorials would be appreciated...
Any information you can provide directly would also help out...
 
I'm sure it's just that the little light hasn't gone on yet... but I'm kinda stuck...
 
Thanks guys!

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: COM and Direct Show...
« Reply #1 on: May 13, 2012, 11:01:59 AM »
Have you tried the ATL control, which might be really easy to use?

Another way would be using the winmm API, which is still working under Win7 and is really simple too.
---
Stefan

Proud member of the UltraDefrag Development Team

CommonTater

  • Guest
Re: COM and Direct Show...
« Reply #2 on: May 13, 2012, 04:44:19 PM »
Have you tried the ATL control, which might be really easy to use?

Another way would be using the winmm API, which is still working under Win7 and is really simple too.

I've used MCI and winmm before, mostly for audio.  Frankly, I'm a little surprised it's still included... 

Giving this a little more thought... It's looking like they want me to build them a very lightweight media player. But, the details I asked for didn't mention imbedding it into a window... so absent any better idea I just might resort to launching their default media player for these files.

Still would like to get my head around COM and DShow...
Even if it's not in this project, they've given me an interesting idea...

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: COM and Direct Show...
« Reply #3 on: May 13, 2012, 09:21:31 PM »
Still would like to get my head around COM and DShow...
Converted MS example to PellesC...
Needs PSDK too.

EDIT: Cleaned for PSDK v6.0A  headerfiles. Removed PellesC\include\Win from include-path.
Code: [Select]
// with C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include
#define WIN32_LEAN_AND_MEAN
#include <wchar.h>
#include <windows.h>
#include <oleauto.h>
#include <strmif.h>
#include <dshow.h
...
« Last Edit: May 14, 2012, 06:47:12 PM by timovjl »
May the source be with you

CommonTater

  • Guest
Re: COM and Direct Show...
« Reply #4 on: May 13, 2012, 11:04:34 PM »
Still would like to get my head around COM and DShow...
Converted MS example to PellesC...
Needs PSDK too.

Thank you Timo! ...

I have it downloaded and will spend time with it after supper.
(Can't say no to roast beef, taters :D, and brussel sprouts!)

Still looking for tutorials...



crb136

  • Guest
Re: COM and Direct Show...
« Reply #5 on: August 11, 2014, 04:04:24 PM »
Forgive me for resurrecting an ancient topic :o I've just followed Timo's approach and now have a simple webcam capture app working with DirectShow.

To clarify:
1) Download the Windows SDK (6.1 worked for me)
2) Use the includes from the SDK and remove the path to the Pelles Win includes
3) Make sure to use the C interfaces for COM and DirectShow
4) Link against the right libs, e.g. strmiids.lib

What I mean for 3) is that the SDK samples, e.g. PlayCap and AmCap, use C++ interfaces so need converted for Pelles. For example, the last line here:

Code: [Select]
// Attach the filter graph to the capture graph
IGraphBuilder * g_pGraph = NULL;
ICaptureGraphBuilder2 * g_pCapture = NULL;
HRESULT hr = g_pCapture->SetFiltergraph(g_pGraph);

becomes

Code: [Select]
HRESULT hr = g_pCapture->lpVtbl->SetFiltergraph(g_pCapture, g_pGraph);

EASY!