/// <summary> /// Converts a MediaPositionFormat enum to a DShow TimeFormat GUID /// </summary> protected static Guid ConvertPositionFormat(MediaPositionFormat positionFormat) { Guid timeFormat; switch (positionFormat) { case MediaPositionFormat.MediaTime: timeFormat = TimeFormat.MediaTime; break; case MediaPositionFormat.Frame: timeFormat = TimeFormat.Frame; break; case MediaPositionFormat.Byte: timeFormat = TimeFormat.Byte; break; case MediaPositionFormat.Field: timeFormat = TimeFormat.Field; break; case MediaPositionFormat.Sample: timeFormat = TimeFormat.Sample; break; default: timeFormat = TimeFormat.None; break; } return(timeFormat); }
/// <summary> /// Runs when the MediaPlayer has successfully opened media /// </summary> protected override void OnMediaPlayerOpened() { MediaPositionFormat positionFormat = MediaSeekingPlayer.CurrentPositionFormat; long duration = MediaSeekingPlayer.Duration; Dispatcher.BeginInvoke((Action) delegate { /* Set our DP values */ SetCurrentPositionFormat(positionFormat); SetMediaPositionInternal(0); SetMediaDuration(duration); double rate = SpeedRatio; double volume = Volume; MediaSeekingPlayer.Dispatcher.BeginInvoke((Action) delegate { MediaSeekingPlayer.SpeedRatio = rate; MediaPlayerBase.Volume = volume; }); }); base.OnMediaPlayerOpened(); }
protected void SetCurrentPositionFormat(MediaPositionFormat value) { SetValue(CurrentPositionFormatPropertyKey, value); }
/// <summary> /// Converts a MediaPositionFormat enum to a DShow TimeFormat GUID /// </summary> protected static Guid ConvertPositionFormat(MediaPositionFormat positionFormat) { Guid timeFormat; switch (positionFormat) { case MediaPositionFormat.MediaTime: timeFormat = TimeFormat.MediaTime; break; case MediaPositionFormat.Frame: timeFormat = TimeFormat.Frame; break; case MediaPositionFormat.Byte: timeFormat = TimeFormat.Byte; break; case MediaPositionFormat.Field: timeFormat = TimeFormat.Field; break; case MediaPositionFormat.Sample: timeFormat = TimeFormat.Sample; break; default: timeFormat = TimeFormat.None; break; } return timeFormat; }