Re: IWMHeaderInfo::GetAttributeByIndex fails with 'buffer too smal
From: bzirk (bzirk_at_discussions.microsoft.com)
Date: 09/17/04
- Next message: sam Terry: "Using multiple Script streams in media 9?"
- Previous message: Chris P. [MVP]: "Re: Mirror images of Webcam video"
- In reply to: ccallen: "Re: IWMHeaderInfo::GetAttributeByIndex fails with 'buffer too small'"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 17 Sep 2004 06:55:04 -0700
Conan,
I modified the GetAttributeByIndex definition to pass ByVal pointers to
wszName and Value rather then ByRef inclusions of the variables themselves.
That worked!
The definition now looks like:
Function GetAttributeByIndex( _
ByVal wIndex As UInt16, _
ByRef wStreamNum As UInt16, _
ByVal pwszName As IntPtr, _
ByRef cchNameLen As UInt16, _
ByRef [Type] As WMT_ATTR_DATATYPE, _
ByVal pValue As IntPtr, _
ByRef cbLength As UInt16) As UInt32
Off to the next opportunity...
Thanks.
Bud
"ccallen" wrote:
> Hmmm,
>
> Here is something else to try. This takes the aproach of converting the app
> to vb and using the orginal C# wrapper.
>
> Create a new vb.net application.
> Reference the orginal csharp wrapper.
>
> Cut & past the C# ShowAttributes function into the VB app and translate it
> to VB. For a quick test, just hard code the name and stream number into your
> code.
>
> Did that work?
>
> Because it gets compiled and refenced from your app, the wrapper can be in
> any language. The typical method to create a PIA is to muck around with IL.
> And this is a pretty big typelib to create it by hand, like the MetadataEdit
> sample does.
>
> Conan
>
>
> Using the orginal c# wrapper.
> "bzirk" <bzirk@discussions.microsoft.com> wrote in message
> news:10885CFD-50BA-48E5-95F4-0298C17FCCEC@microsoft.com...
> > I have translated the WMFSDKWrapper from the managed code example in
> > WMFSDK95. I can succuessfully open ASF files, but when I attempt to
> iterate
> > through the attributes using IWMHeaderInfo::GetAttributeByIndex it throws
> a
> > ComException with an HRESULT of 0xC00D07D1 which I believe is
> > ASF_E_BUFFERTOOSMALL.
> >
> > The GetAttributeByIndex functions is defined as follows:
> >
> > Function GetAttributeByIndex( _
> > ByVal wIndex As UInt16, _
> > ByRef wStreamNum As UInt16, _
> > <MarshalAs(UnmanagedType.LPWStr)> ByRef wszName As String, _
> > ByRef cchNameLen As UInt16, _
> > ByRef [Type] As WMT_ATTR_DATATYPE, _
> > <MarshalAs(UnmanagedType.LPArray)> ByRef Value As Byte(), _
> > ByRef cbLength As UInt16) As UInt32
> >
> > As suggested in the WMFSDK documentation, the first call is to retrieve
> the
> > sizes of the wszName string and Value byte arrary. That call is as
> follows:
> >
> > Dim mmr As UInt32
> > Dim wIndex As UInt16 = Convert.ToUInt16(i)
> > Dim wStreamNum As UInt16 = Convert.ToUInt16(0)
> > Dim wAttribType As WMSDK.WMFSDKWrapper.WMT_ATTR_DATATYPE
> > Dim ccNameLen As UInt16 = Convert.ToUInt16(0)
> > Dim cbLength As UInt16 = Convert.ToUInt16(0)
> >
> > mmr = hdr.GetAttributeByIndex(wIndex, wStreamNum, Nothing,
> > ccNameLen, wAttribType, Nothing, cbLength)
> >
> > where i in the first pass is zero. The first call fails with the
> > aforementioned ComException. Any ideas?
> >
> > Thanks,
> >
> > BZ
> >
> >
> >
> >
>
>
>
- Next message: sam Terry: "Using multiple Script streams in media 9?"
- Previous message: Chris P. [MVP]: "Re: Mirror images of Webcam video"
- In reply to: ccallen: "Re: IWMHeaderInfo::GetAttributeByIndex fails with 'buffer too small'"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|