How to change Directshow filter properties C++

后端 未结 3 769
夕颜
夕颜 2020-12-04 02:56

How to change Filter Properties programmatically?

I am using a filter AAC encoder, and I can manually change its bitrate in graphedit

相关标签:
3条回答
  • 2020-12-04 03:14

    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://stackoverflow.com/a/11781370/32453

    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...

    0 讨论(0)
  • 2020-12-04 03:23

    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,.

    0 讨论(0)
  • 2020-12-04 03:29

    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:

    • Controlling variables in filter remotely
    • with out property page, How can I input a value through codes?
    • Define a Mechanism for Setting the Property on MSDN
    0 讨论(0)
提交回复
热议问题