本文整理汇总了C#中IMediaSeeking.GetDuration方法的典型用法代码示例。如果您正苦于以下问题:C# IMediaSeeking.GetDuration方法的具体用法?C# IMediaSeeking.GetDuration怎么用?C# IMediaSeeking.GetDuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMediaSeeking
的用法示例。
在下文中一共展示了IMediaSeeking.GetDuration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getTotal
public static int getTotal(IMediaSeeking mediaSeeking, double fps)
{
if (mediaSeeking == null) return 1;
long dur;
mediaSeeking.GetDuration(out dur);
if (!isInFrames(mediaSeeking))
dur = refTime2frame(dur,fps);
return (int)dur;
}
示例2: CheckGraphConversion
private bool CheckGraphConversion(ref IMediaSeeking mediaSeeking)
{
int hr;
IMediaEvent mediaEvent = (IMediaEvent)currentFilterGraph;
// Check the graph / conversion is going ok, and raise any progress events
EventCode statusCode;
hr = mediaEvent.WaitForCompletion(100, out statusCode);
switch (statusCode)
{
case EventCode.Complete:
return true;
case 0: // Still going - fire event with an update on where we are
if (mediaSeeking != null)
{
long curPos;
mediaSeeking.GetCurrentPosition(out curPos);
long length;
mediaSeeking.GetDuration(out length);
double progress = curPos * 100.0 / (double)length;
if (ConversionProgressChanged != null)
ConversionProgressChanged(new object(), new ProgressChangedEventArgs(progress));
}
return false;
default: // Error
EventCode tryCode;
IntPtr lp1, lp2;
hr = mediaEvent.GetEvent(out tryCode, out lp1, out lp2, 200);
DsError.ThrowExceptionForHR(hr);
throw new Exception(statusCode.ToString());
}
}