How to change Directshow filter properties C++
Asked Answered
E

3

3

How to change Filter Properties programmatically?

I am using a filter AAC encoder, and I can manually change its bitrate in graphedit by right clicking on the filter and entering the bitrate value.

Is it possible to do the same through code?

Please give me valuable suggestions and if possible with code.

Endo answered 27/12, 2012 at 5:58 Comment(3)
@selbie i am building the graph, do you know how to do it? and do u have any sample code?Endo
To help you, id would be good to know WHICH AAC Encoder you are use.Animalize
@Animalize it is "VSS AAC Encoder DMO"Endo
T
3

You do this via private filter-specific interface. You need to refer to filter documentation or SDK to get details on this (VSS Tech Support). Sometimes you can obtain the necessary information from type library.

See:

Tortoise answered 27/12, 2012 at 10:19 Comment(4)
so there's no generic way that's like "enumerate all options" basically you either have to display a ISpecifyPropertyPages then persist the filter's setting after that (ref: microsoft.public.multimedia.directx.dshow.programming.narkive.c…), or have to refer to some third party filter specific interface?Momism
There is no mandatory filter interface that exposes generic properties, esp. named. So filters are supposed to implement something making sense for a developer... and it appears to be vendor dependant. Some might, for instance, implement IPersistPropertyBag but it's rare. In most cases it is just a filter specific interface.Tortoise
Thanks Roman, your stackoverflow responses are the only reason I understand dshow today :)Momism
I found out that when you're dealing with an undocumented filter, you can see what interfaces it implements by opening the filter properties in graphedit or graphbuilder and then by looking at the interfaces tab. I think this can be a good starting point for googling more about those interfaces and learning what you can do with them.Oophorectomy
I
1

Your AAC Encoder will have some interface exposed through some IID's. Make sure you get that IID's interface, then access to its additional functions like bitrate, sampling rate, etc,.

Initial answered 27/12, 2012 at 6:45 Comment(0)
M
1

Similar to Roman's answer, it seems there are two ways that a filter's "special properties" are typically set and/or saved.

One is to display its properties page "dialog" (ISpecifyPropertyPages), then allow the user to change things and close it, then afterward you get its IPersistStream interface, and save off its "current state" which you can then use later for basically settings its properties back to what they were saved to (this is how graphedit does it, ref: http://microsoft.public.multimedia.directx.dshow.programming.narkive.com/ldOko8Js/ispecifypropertypages-saving-and-restoring-settings) In addition, you can serialize "the whole graph" to a file by calling IPersistStream on the graph object itself. See https://mcmap.net/q/766669/-how-can-i-reverse-engineer-a-directshow-graph

The other way is to know "exactly what type of special filter it is" and cast it to some special interface that you know of, from the third party, which may expose getters and setters, etc. like the "avisynth" filter from the Windows SDK directshow examples exposes ISynth interface

See also here which lists a few more ways apparently...here also seems related. IPersist itself also has multiple interfaces that inherit from it, see comments here. By far in my experience for dshow devices, they typically implement only IPersist and IPersistStream (and IAMSpecificPropertyPages), though you could save away values yourself for other common interfaces as well (like IAMVideoProcAmp), then manually re-set properties as well...

Update: unfortunately though many filters implement IPersistStream, it seems that few of them actually use it for anything useful...

Momism answered 13/1, 2015 at 20:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.