0

I just want to query the number of streams in a file. But an unimaginable difficulty has emerged from this simple task.

It seems the query involves using IMediaObject.I have searched IMediaObject documentation in DirectShow. It only lists out its functions but it has no samples and description on how to use it.

I have also searched Windows 7 SDK. The only demonstration is in dmoenum The initiation is incapsulated in ShowSelectedDMOInfo(const GUID *pCLSID)

what types can pCLSID be? Any samples are out there to illustrate how to use IMediaObject?

Roman R.
  • 68,205
  • 6
  • 94
  • 158
Hoy Cheung
  • 1,552
  • 3
  • 19
  • 36

1 Answers1

1

I just want to query the number of streams in a file

IMediaObject is not of any help. It only returns number of streams it is designed to accept on the input and deliver on the output, according to its design. Typical DMO has one input and one output stream, completely irrelevant to file streams.

In DirectShow you can query streams from demultiplexing filter for the respective file format. These are rarely (if ever) packaged as DMOs.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • should I use MPEG-2 Demultiplexer? MSDN documentation is really unsupporting. I don't know COM very well. Moreover, there aren't any samples or good guides there. I am really perplexed – Hoy Cheung Jun 11 '13 at 09:40
  • You should use it for what exactly purpose? – Roman R. Jun 11 '13 at 09:47
  • i want to extract subtitles from teletext wtv files. I think the first thing I need to do is to read the stream? – Hoy Cheung Jun 11 '13 at 10:39
  • It will take time to attempt to mount random things and eventually get it working. [Consumption of a WTV file in DirectShow](http://msdn.microsoft.com/en-us/library/cc963726.aspx) looks like a starting point. If you figure out how basic consumption works, you will be able to start fitting it to your needs. – Roman R. Jun 11 '13 at 10:58
  • I have read this. but I still don't know how to output any reading from this code... and there is no executive. I don't know how this program behave – Hoy Cheung Jun 11 '13 at 11:04
  • besides, I use directshowsharp. There is no corresponding FindOutputPinByType method. – Hoy Cheung Jun 11 '13 at 11:08
  • This make it harder, but since you are on the path of using DirectShow through wrapper library, you have to deal with more complicated code porting. – Roman R. Jun 11 '13 at 11:44
  • here is a line "spGraph->AddSourceFilter(sSourceFileName, L"Source Filter", &spSBE);" what kind of strings I should put here for "Source Filter"? – Hoy Cheung Jun 12 '13 at 01:03
  • [See MSDN](http://msdn.microsoft.com/en-us/library/windows/desktop/dd390087%28v=vs.85%29.aspx), this string is informational, any will do. – Roman R. Jun 12 '13 at 06:08
  • I just read it. I don't understand its meaning. I have seen most samples provide null for the parameter or use the file name. so this parameter has no practical function but it's only for a appearance/naming purpose? – Hoy Cheung Jun 12 '13 at 07:46