Hi,
I am trying to add attributes to media metadata. I am using iwmheaderinfo3.AddAttribute for adding the attribute.
The code gives no error. But the attributes are not adding.
Any help would be well appreciated. Thanks In advance.
nnair.
Hi,
I am trying to add attributes to media metadata. I am using iwmheaderinfo3.AddAttribute for adding the attribute.
The code gives no error. But the attributes are not adding.
Any help would be well appreciated. Thanks In advance.
nnair.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
neethi nairPosted Dec 15, 2008, 10:49 AM
Hi,
Sorry for the late reply sir.
The error was because, I made an instance of metadataeditor twice, which set a null valu for it second time. I had met with some other exception after that, saying "Value is out of expected range". While debugging the values passed in all were correct.
The windows media COM is imported in the ComWrapper class which I created instead of just referencing the wrapper class. I had declared just the functions which I needed in the wrapper class. But when we use an interface, importing a COM, we need to declare all the functions in it in the wrapper class and use the functions which we need. Also, the functions should be in order, which its declared in the original wrapper class. Otherwise it will take the wrong function. This happened in my case. The details of this is specified in my previous post.
Hope this would help you. Thanks a lot.
nnair
Bechir BejaouiPosted Dec 5, 2008, 6:02 PM
neethi nairPosted Dec 4, 2008, 11:37 AM
Well, solved it.
I was using my own ComWrapper, not the one provided by SDK. When declaring COM interfaces in .NET, you cannot simply pick and choose what methods you want. All the methods needed to be declared, and it needs to be in order.
COM Interfaces cannot include any interfaces in their base interface list, and they must declare the interface member functions in the order tht the methods appear in the COM Interface. COM interfaces declared in c# must include declarations of all the members of their base interfaces with the exception of members of IUnknown and IDispatch..dotnet framework automatically adds these!
Hope this will help, anyone who have the problem.
Thanks for your help sir.
neethi nairPosted Dec 3, 2008, 6:24 AM
Bechir BejaouiPosted Dec 2, 2008, 1:14 PM
neethi nairPosted Dec 2, 2008, 4:32 AM
Hi Bechir,
Thanks for the link. I used this msdn site to find out how to add media attributes. I checked with so many blogs too. The message in the catch section I got is "Object is not set to instance of an object". But I am not passing any null values to the interface function. In the ComWrapper I have declared it in the way below:
void AddAttribute([
In] ushort wStreamNum,[
In, MarshalAs(UnmanagedType.LPWStr)] string pszName,[
Out] out ushort pwIndex,[
In] WMT_ATTR_DATATYPE Type,[
In] ushort wLangIndex,[
In, MarshalAs(UnmanagedType.LPArray)] byte[] pValue,[
In] uint dwlength);All the values are being passed correctly. I am now trying to find whether somewhere its setting some null values.
Reg
Nnair
Bechir BejaouiPosted Dec 1, 2008, 2:26 PM
please read the remarque section, may you have a such case