Problem setting media type for new profile
- From: "J Hendrich" <ajwain3000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 21 Apr 2005 09:42:15 -0700
Hi,
I'm trying to create a custom profile with one video stream of Windows Media
Video 9. I'm encountering two main problems. First, my query for the
IWMCodecInfo3 interface always fails (step 3 below). Second, when I call
SetMediaType( pMediaType) where the media subtype is a compressed type like
WMV9, it fails (step 10 below).
Here's the steps I believe I'm supposed to take in creating the profile.
1. Create the profile manager.
2. I create the empty profile.
3. Then I query the profile manager for the IWMProfile3 interface.
4. Thru the IWMProfile3 interface, I call CreateNewStream(
WMMEDIATYPE_Video, pNewStreamConfig)
5. Query the profile manager interface for the IWMCodecInfo3 interface.
6. From the IWMCodecInfo3 interface, get the IWMStreamConfig interface for
the Windows Media Video 9 codec.
7. From the IWMStreamConfig interface for WMV9, get the WM_MEDIA_TYPE
structure associated with the WMV9 codec -- pWMV9CodecMediaType
8. Back to pNewStreamConfig -- query for the IWMVideoMediaProps interface.
9. From the IWMVideoMediaProps Interface, Call GetMediaType twice, to first
get the size, then get the structure.
10. Thru IWMVideoMediaProps, call SetMediaType( pWMV9CodecMediaType ).
11. Thru the IWMProfile3 interface, add the pNewStreamConfig to the profile.
Since step 3 above is always failing (I have not the faintest idea why it
would fail either), I try to work around it by manually setting up a
WM_MEDIA_TYPE structure and using that in step 10 above rather than the
WM_MEDIA_TYPE structure directly associated with the WMV9 codec. The strange
thing with this workaround is, if I have the media subtype as uncompressed
(RGB24), the method succeeds. If I have the media subtype as WMV9 (which I
want), it fails. Setting it as RGB24 does me no good...since I'm trying to
create a WMV9 file, and it doesn't play back right.
Here's the code for the baffling fail to query for the IWMCodec3 interface.
If I can't even query for this interface, it would seem something's quite
wrong.
if( FAILED(WMCreateProfileManager(&m_pWMProfileManager)))
{
_tcscpy(m_szErrMsg,_T("Unable to Create WindowsMedia Profile Manager"));
throw CAssertException();
}
if ( FAILED( m_pWMProfileManager->QueryInterface( IID_IWMCodecInfo3,
(void**) pCodecInfo3 ) ) )
{
_tcscpy(m_szErrMsg,_T("Unable to get codecInfo3 IMWVideoMediaProps."));
throw CAssertException();
}
Thanks.
Jon Hendrich
--
"When in the company of others, I shall always consider myself the lowest of
all"
.
- Follow-Ups:
- Re: Problem setting media type for new profile
- From: sasha
- Re: Problem setting media type for new profile
- Prev by Date: Re: RGB and BGR encoded WMV videos
- Next by Date: Re: source BMP dimensions to target rendered dimensions
- Previous by thread: Seeking behavior in WMP
- Next by thread: Re: Problem setting media type for new profile
- Index(es):
Relevant Pages
|