Discussion:
Using IMediaSeek with external devices
(too old to reply)
Victor Reboucas
2007-11-09 23:03:28 UTC
Permalink
Hi, I'm developing a remote control for a miniDV camcoder and I could
implement almost everything I need... but cannot put IMediaSeek to work...

I saw some examples on the web all using digital media (wmv / avi / etc),
so, in these codes I found that people bind the IMediaSeek interface to an
instance of IGraphBuilder... there's the confusion started...

PS: code in the end

I'm trying to use media seek to seek a video tape in an external device
(camcoder), so, I used the same approach I used for tranport control
(play/stop/etc) and device state (device is turned on/no tape/etc), I mean,
I created a reference to the interface and issue commands to the device
using this reference object. Well, when I try to use the IMediaSeek object I
get a "Not implemented" exception.

So, trying to find a diferent solution I binded that IMediaSeek object to
the transport reference without any success... did the same with the
DeviceState object and got the same results...

If someone could give me any clue about this kind of approach (media seeking
in external devices)... I'm getting crazy with that...

OBS: all interface definitions are setup background as a class library, so,
in the code I just use the interface names to reference the types (like
IAMExtTransport that references the GUID
"A03CD5F0-3045-11cf-8C44-00AA006B6814" and has all interface methods
implemented, like "int GetCapability" and so on)

Using the code, when I create a new "remoteControl" object and call
PlayTape() everything works fine, but, when using media seek, I cannot put
that to work... but can set the timeFormat without any problem...

thanks for any help,
Regards,
Victor


Code Sample (vb.net)
--------------

Private DVTransport As IAMExtTransport
Private DVSeek As IMediaSeeking

Private Sub BindDeviceInterfaces(ByVal mon As ComTypes.IMoniker)

'PS: the "mon" variable is the IComMoniker to the external video device

Dim objTransport As Object = Nothing
Dim objSeek As Object = Nothing

Try

'get the GUID for the media interfaces
Dim transpGUID As Guid = GetType(IAMExtTransport).GUID
Dim SeekGUID As Guid = GetType(IMediaSeeking).GUID

'bind the objects to the COM (windows) implementation of it
mon.BindToObject(Nothing, Nothing, transpGUID, objTransport)
mon.BindToObject(Nothing, Nothing, SeekGUID, objSeek)

'bind the apps "reference interfaces" to the objects returned above
DVTransport = CType(objTransport, IAMExtTransport)
DVSeek = CType(objSeek, IMediaSeeking)

Finally

'release temporary objs
If objTransport IsNot Nothing Then objTransport = Nothing
If objSeek IsNot Nothing Then objSeek = Nothing

End Try

End Sub


Public Sub PlayTape()

DVTransport.put_Mode(DirectShowLib.ExtTransportModes.Play)

End Sub

Public Sub SeekMedia()

'this is a test routine (always seeking to the same timecode)

Dim r As Int32
Dim pos As Long = 2700581 'equivalent to timecode 29:35:25

r = DVSeek.SetTimeFormat(TimeFormat.Field)

If r < 0 Then
MsgBox("Hr <0 : " & Marshal.GetExceptionForHR(r).Message)
End If

r = 0

r = DVSeek.SetPositions(pos, AMSeekingSeekingFlags.AbsolutePositioning,
0, AMSeekingSeekingFlags.NoPositioning)

If r < 0 Then
MsgBox("Hr <0 : " & Marshal.GetExceptionForHR(r).Message)
End If

End Sub
Michel Roujansky - DirectShow Consultant and Trainer
2007-11-15 09:45:23 UTC
Permalink
I am afraid you are on the wrong track with IMediaSeeking. Does not
work. You have to use raw av/c commands.
See : Controlling
http://msdn2.microsoft.com/en-us/library/ms782287.aspx

"Although DV devices support a command to search by time code or by
absolute track number (ATN), the MSDV driver does not have a standard,
device-independent way to access these functions. The only option is
to send a raw AV/C command to the driver as described in the topic
Issuing Raw AV/C Commands."

http://msdn2.microsoft.com/en-us/library/ms786761.aspx

Loading...