473,490 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Having problem with IWMReaderCallbackAdvanced

I'm relatively new at C#/.NET and having a problem with a utility I'm
writing to create some data from Windows Media files.

I set up a class that creates a WMReader object. Before I kickoff the
reader, I use the IWMReaderAdvanced interface to call
SetUserProvidedClock(true), indicating I want to use my own clock to
create time intervals. Once I start the Reader, it makes the callback
to OnStatus method properly, passing status of WMT_STARTED (I used the
yeti WMFSDK, but had to implement IWMReaderCallbackAdvanced myself as
it wasn't implemented in the library). However, I try to update the
clock value using the DeliverTime method, and it hangs there. I'm
thinking it may not be kosher to access the IWMReaderAdvanced interface
that was created in the main thread, by the thread created by the
Reader.
Here's an abbreviated snippet of the code I am using:

using System;
using System.Text;
using Yeti.WMFSdk
using Yeti.MMedia
using System.Runtime.InteropServices;

namespace SL
{
public class WMVCreateLog : IWMReaderCallback,
IWMReaderCallbackAdvanced
{
private IWMReaderAdvanced _WMReaderAdvanced;
private IWMHeaderInfo _WMHeader;
private IWMReader _WMReader;
private IWMProfile _WMProfile;
private WMHeaderInfo _WMHeaderInfo;
private ulong _ReaderTime;
private string _MediaFilepath;
private NamedEvent _event;
public void CreateReader()
{

try
{
_WMReader =
WMFSdk.CreateReader(WMT_RIGHTS.WMT_RIGHT_NO_DRM);
_WMReader.Open(_MediaFilepath, this, IntPtr.Zero);
WaitForCompletion();
_WMReaderAdvanced = (IWMReaderAdvanced)_WMReader;
_WMReaderAdvanced.SetUserProvidedClock(true);
_WMReader.Start((ulong)0, (ulong)0, (float)1.0,
IntPtr.Zero);
WaitForCompletion();
}
catch (Exception e)
{
}
}

public void OnStatus(WMT_STATUS Status,
IntPtr hr,
WMT_ATTR_DATATYPE dwType,
IntPtr pValue,
IntPtr pvContext)
{
switch (Status)
{
case WMT_STATUS.WMT_OPENED:
_event.Set();
break;
case WMT_STATUS.WMT_STARTED:
_ReaderTime = 10000000;
try
{
_WMReaderAdvanced.DeliverTime(_ReaderTime);
}
catch (Exception e)
{
Console.WriteLine("Failed in WMT_STARTED");
_event.Set();
}
break;
case WMT_STATUS.WMT_EOF:
_EOF = true;
_event.Set();
break;
}
}
}
}

Any help would be appreciated.

Patrick

Apr 14 '06 #1
0 1250

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
354
by: malcolm | last post by:
Hello, We have a small team building a project that involves some 30 or so c# assembly dlls. It is a client server application with 1 exe as the starting point. The dlls and exe are sharing an...
1
1768
by: malcolm | last post by:
Hello, We have a small team building a project that involves some 30 or so c# assembly dlls. It is a client server application with 1 exe as the starting point. The dlls and exe are sharing an...
2
9238
by: sanderson82 | last post by:
Hi I am having problems with the HAVING clause. I know it can use aliases but the alias I am using has a space in it, eg 'Device ID' My querry looks like (simplified, devID is a calculation) ...
2
10391
by: Jack | last post by:
Hi, Performance-wise, is there a difference between these 2 clauses? I assume a large database... 1) With the WHERE clause: Select FLD1, FLD2, FLD3 From myFile Where FLD1 = 1 And FLD2 = 1
0
7112
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7146
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7183
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4878
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4573
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
628
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
277
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.