|
@@ -1,4 +1,6 @@
|
|
|
using fis.Log;
|
|
|
+using fis.Managers;
|
|
|
+using fis.Managers.Interfaces;
|
|
|
using fis.Vid;
|
|
|
using fis.Win.Dev.Utilities.FFMPEG.Settings;
|
|
|
using fis.Win.Dev.Utilities.FFMPEG.Video;
|
|
@@ -20,22 +22,23 @@ namespace fis.Win.Dev.Utilities.FFMPEG
|
|
|
#region
|
|
|
private Stream _stream;
|
|
|
private VinnoImageData _vid;
|
|
|
- private const string Header = "VINNO IMAGE DATA";
|
|
|
+ private IFileExporterManager _exportManager;
|
|
|
|
|
|
- private long _basePosition;
|
|
|
-
|
|
|
-
|
|
|
public int FrameRate { get; set; }
|
|
|
|
|
|
public int ImageCount { get; set; }
|
|
|
public VideoFFmpegHelper(string path)
|
|
|
{
|
|
|
ExportVideo(path);
|
|
|
+ _exportManager = AppManager.Get<IFileExporterManager>();
|
|
|
}
|
|
|
|
|
|
public void ExportVideo(string path)
|
|
|
{
|
|
|
+ FFmpegService.SetFFmpegPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SmartPublisher","ffmpeg.exe"));
|
|
|
+#if DEBUG
|
|
|
FFmpegService.SetFFmpegPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ffmpeg.exe"));
|
|
|
+#endif
|
|
|
_stream = new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
|
|
|
_vid = new VinnoImageData(_stream);
|
|
|
FrameRate = (int) _vid.Probe.FrameRate;
|
|
@@ -146,10 +149,14 @@ namespace fis.Win.Dev.Utilities.FFMPEG
|
|
|
VideoCodec = FFmpegVideoCodec.X264
|
|
|
};
|
|
|
using (var videoWriter = new FFmpegVideoWriter(writeArgs, setting))
|
|
|
- {
|
|
|
+ {
|
|
|
for (var i = 0; i < ImageCount; i++)
|
|
|
{
|
|
|
- SKBitmap bitmap = GetBitmap(i);
|
|
|
+ if (_exportManager.IsCancelled)
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ SKBitmap bitmap = GetBitmap(i);
|
|
|
if (bitmap != null && (bitmap.Width != width || bitmap.Height != height))
|
|
|
{
|
|
|
bitmap = bitmap.Resize(new SKImageInfo(width, height), SKFilterQuality.None);
|