having trouble reading wma files with IWMReader in c# ...
WMPTalk.com Forum Index WMPTalk.com
Discuss Windows Media Player
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web wmptalk.com
having trouble reading wma files with IWMReader in c# ...

 
Post new topic   Reply to topic    WMPTalk.com Forum Index -> SDK
Author Message
jimbo22



Joined: 02 Mar 2006
Posts: 1

Posted: Thu Mar 02, 2006 9:18 pm    Post subject: having trouble reading wma files with IWMReader in c# ... Reply with quote

I want to be able to read tags of wma files located on the internet. I expect that opening the file using the WMCreateReader method and querying the object for the IWMHeaderInfo interface should do the trick. I am able to open the file, but all subsequent calls to the object fails with a E_NOINTERFACE error. What am I doing wrong? (See code below)


Comment on the code:
The C# version of the wmsdkidl interface definitions that I'm using was found here: http://www.codeproject.com/cs/media/ManWMF.asp
Let me know if you suspect that the problem originates from the interface definitions and I'll post them here.

------------------------------------------------------------------------------------

class WMPTest : IWMReaderCallback
{

[DllImport("WMVCore.dll",
EntryPoint = "WMCreateReader",
SetLastError = true,
CharSet = CharSet.Unicode,
ExactSpelling = true,
CallingConvention = CallingConvention.StdCall)]
public static extern uint WMCreateReader(
[In, MarshalAs(UnmanagedType.Interface)] object
pUnkReserved, // Always null.
[In] WMT_RIGHTS dwRights,
[Out, MarshalAs(UnmanagedType.Interface)] out IWMReader
ppReader
);


private IWMReader reader;


public void open(string url)
{
WMCreateReader(null, WMT_RIGHTS.WMT_RIGHT_PLAYBACK, out reader);

reader.Open(url, this, null);

}


public uint OnSample(uint dwOutputNum, ulong cnsSampleTime, ulong cnsSampleDuration, uint dwFlags, INSSBuffer pSample, object pvContext)
{
return 0;
}

public uint OnStatus(WMT_STATUS Status, uint hResult, WMT_ATTR_DATATYPE dwType, byte[] pValue, object pvContext)
{
if (((int)hResult) < 0)
throw new Exception("failed!");

if (Status == WMT_STATUS.WMT_OPENED)
{
//IWMHeaderInfo info = (IWMHeaderInfo)reader;
reader.Start(0, 100, 100, null); //this call fails with E_NOINTERFACE
}
return 0;
}
}


------------------------------------------------------------------------------------

Back to top
View user's profile Send private message
 
Post new topic   Reply to topic    WMPTalk.com Forum Index -> SDK All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Microsoft Office Forum New Topics
Powered by phpBB