Windows Media Encoder SDK and IWMEncPrePreview: How do I initialize this? RRS feed

  • Question

  • I've tried my best to do this, but I think I finally need to reach out.

    Essentially, I'm writing an encoder application, and to improve the speed of things, I've realized that I need an IWMEncPrePreview object to view the stream before actually starting the encoding and postviewing process. However, I've found the documentation specifically on IWMEncPrePreview rather confusing. It doesn't say how to initialize it, and attempting to initialize it like IWMEncDataView yields either a) a crash in the program or b) an error message stating that there's no interface defined for the PrePreview object.

    So I tried essentially looking through the header files, which eventually lead me to find out that IWMEncPrePreview is actually a derivative of something called IPSFactoryBuffer. So I tried that, with the CLSID of IPSFactoryBuffer and the IID of IWMEncPrePreview, but then it just threw an error telling me that the class factory couldn't give me the IWMEncPrePreview interface!

    Now, I'm pretty sure the main handicap of my coding is the fact that I don't know much about COM programming, but then again that's why I'm here.

    My question is this: how do I initialize IWMEncPrePreview? Is there something with CoCreateInstance I'm doing wrong? Am I supposed to use CoCreateInstance at all? Is there a certain member of the WMESDK that allows me to query the interface instead?

    Thanks in advance.
    Thursday, June 7, 2007 5:46 PM


  • Since you're asking a WM Encoder question, you'll probably be best off with the WM Encoder newsgroup: http://www.microsoft.com/windows/windowsmedia/community/newsgroups/WindowsMedia/default.mspx?dg=microsoft.public.windowsmedia.encoder&lang=en&cr=US


    But just from reading your question, you're probably just having some COM problems.  When you do a CoCreateInstance, you can think of the CLSID as being an identifier for the implementation that you want for the interface you want to use.  In other words, if you're passing IID_IPSFactory for the clsid argument, you're almost definitely doing something wrong.  That argument will usually take a GUID that looks like CLSID_xxx, and the iid argument is the IID for the interface you plan to use.  Hopefully that will help a bit.  I have no idea, though, whether this IPSFactoryBuffer is going to be useful to you in the end, though; for that you'll probably want the WM Encoder newsgroup.

    Friday, June 8, 2007 5:08 PM