本文整理汇总了C#中IMediaSeeking.GetRate方法的典型用法代码示例。如果您正苦于以下问题:C# IMediaSeeking.GetRate方法的具体用法?C# IMediaSeeking.GetRate怎么用?C# IMediaSeeking.GetRate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMediaSeeking
的用法示例。
在下文中一共展示了IMediaSeeking.GetRate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadVideo
private void loadVideo(String videoPath)
{
videoFilepath = videoPath;
videoFileName.Text = getDisplayVideoName();
if (graph != null)
{
graph = null;
}
if (mediaControl != null)
{
// Stop media playback
this.mediaControl.Stop();
mediaControl = null;
}
if (videoWindow != null)
{
videoWindow.put_Owner(IntPtr.Zero);
videoWindow = null;
}
if (mediaSeeking != null)
{
mediaSeeking = null;
}
if (basicAudio != null)
{
basicAudio = null;
}
GC.Collect();
/* if (mediaPosition != null)
{
mediaPosition = null;
}*/
graph = (IGraphBuilder)new FilterGraph();
mediaControl = (IMediaControl)graph;
//mediaPosition = (IMediaPosition)graph;
videoWindow = (IVideoWindow)graph;
mediaSeeking = (IMediaSeeking)graph;
basicAudio = (IBasicAudio)graph;
AviSplitter spliter = new AviSplitter();
graph.AddFilter((IBaseFilter)spliter, null);
graph.RenderFile(videoPath, null);
graph.SetDefaultSyncSource();
/*
* AMSeekingSeekingCapabilities cap = AMSeekingSeekingCapabilities.CanGetCurrentPos;
if (mediaSeeking.CheckCapabilities(ref cap) > 0)
{
this.consoleErreur.AppendText("Impossible de recuperer la position de la frame");
}
* */
videoWindow.put_Owner(videoPanel.Handle);
videoWindow.put_MessageDrain(videoPanel.Handle);
videoWindow.put_WindowStyle(WindowStyle.Child);
videoWindow.put_WindowStyleEx(WindowStyleEx.ControlParent);
videoWindow.put_Left(0);
videoWindow.put_Top(0);
videoWindow.put_Width(videoPanel.Width);
videoWindow.put_Height(videoPanel.Height);
//positionTrackbar.Enabled = true;
speedTrackBar.Enabled = true;
mediaSeeking.SetTimeFormat(TimeFormat.Frame);
double rate;
mediaSeeking.GetRate(out rate);
rateText.Text = rate.ToString();
speedTrackBar.Value = (int)(speedTrackBar.Maximum * rate / 2);
trackBar1.Value = trackBar1.Maximum / 2;
this.basicAudio.put_Volume(-5000 + 5000 * trackBar1.Value / trackBar1.Maximum);
//mediaPosition.put_Rate(0.5);
running = false;
frameChanged = false;
}
示例2: PreparePlayback
protected virtual HRESULT PreparePlayback()
{
m_MediaControl = (IMediaControl)m_GraphBuilder;
m_BasicVideo = (IBasicVideo)m_GraphBuilder;
m_MediaSeeking = (IMediaSeeking)m_GraphBuilder;
m_VideoWindow = (IVideoWindow)m_GraphBuilder;
m_MediaEventEx = (IMediaEventEx)m_GraphBuilder;
m_FrameStep = (IVideoFrameStep)m_GraphBuilder;
SettingUpVideoWindow();
int hr = m_MediaEventEx.SetNotifyWindow(m_EventControl.Handle, WM_GRAPHNOTIFY, Marshal.GetIUnknownForObject(this));
Debug.Assert(hr == 0);
SetVolume(m_bMute ? -10000 : m_iVolume);
if (m_dRate != 1.0)
{
m_MediaSeeking.SetRate(m_dRate);
m_MediaSeeking.GetRate(out m_dRate);
}
if (OnPlaybackReady != null) OnPlaybackReady(this, EventArgs.Empty);
return (HRESULT)hr;
}