[longomatch/0.20] Fix exception when the capturer fails to ge a frame
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch/0.20] Fix exception when the capturer fails to ge a frame
- Date: Fri, 15 Aug 2014 14:55:26 +0000 (UTC)
commit ddaf694b7b0d179c48f8c3aa3c790c6ca5853f88
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri Aug 15 14:50:23 2014 +0200
Fix exception when the capturer fails to ge a frame
.../Services/RenderingJobsManager.cs | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch.Services/Services/RenderingJobsManager.cs
b/LongoMatch.Services/Services/RenderingJobsManager.cs
index d520637..daf8717 100644
--- a/LongoMatch.Services/Services/RenderingJobsManager.cs
+++ b/LongoMatch.Services/Services/RenderingJobsManager.cs
@@ -16,6 +16,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
//
using System;
+using System.Threading;
using System.Collections.Generic;
using Mono.Unix;
@@ -188,19 +189,21 @@ namespace LongoMatch.Services
Log.Debug(String.Format("Adding segment with {0} drawings", segment.Drawings.Count));
if (segment.Drawings.Count >= 1) {
- Drawing drawing = segment.Drawings[0];
- string image_path = CreateStillImage(segment.MediaFile.FilePath, drawing);
+ Drawing drawing = segment.Drawings[0];
videoEditor.AddSegment(segment.MediaFile.FilePath,
segment.Start.MSeconds,
drawing.RenderTime - segment.Start.MSeconds,
segment.Rate,
segment.Name,
segment.MediaFile.HasAudio);
- videoEditor.AddImageSegment(image_path,
+ string image_path = CreateStillImage(segment.MediaFile.FilePath, drawing);
+ if (image_path != null) {
+ videoEditor.AddImageSegment(image_path,
drawing.RenderTime,
drawing.PauseTime,
segment.Name);
+ }
videoEditor.AddSegment(segment.MediaFile.FilePath,
drawing.RenderTime,
segment.Stop.MSeconds - drawing.RenderTime,
@@ -225,6 +228,13 @@ namespace LongoMatch.Services
capturer.Open(filename);
capturer.SeekTime(drawing.RenderTime, true);
frame = capturer.GetCurrentFrame();
+ if (frame == null) {
+ Thread.Sleep (200);
+ frame = capturer.GetCurrentFrame();
+ if (frame == null) {
+ return null;
+ }
+ }
final_image = Image.Composite(frame, drawing.Pixbuf);
final_image.Save(path);
return path;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]