mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
move to new FFME control and probe media info
This commit is contained in:
@@ -75,4 +75,28 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class TimeSpanToSecondsConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType,
|
||||
object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is TimeSpan) return ((TimeSpan) value).TotalSeconds;
|
||||
if (value is Duration)
|
||||
return ((Duration) value).HasTimeSpan ? ((Duration) value).TimeSpan.TotalSeconds : 0d;
|
||||
|
||||
return 0d;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType,
|
||||
object parameter, CultureInfo culture)
|
||||
{
|
||||
var result = TimeSpan.FromTicks((long) Math.Round(TimeSpan.TicksPerSecond * (double) value, 0));
|
||||
// Do the conversion from visibility to bool
|
||||
if (targetType == typeof(TimeSpan)) return result;
|
||||
if (targetType == typeof(Duration)) return new Duration(result);
|
||||
|
||||
return Activator.CreateInstance(targetType);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user