[gegl] ff-load: add 'frames' property
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] ff-load: add 'frames' property
- Date: Thu, 1 Oct 2015 15:35:01 +0000 (UTC)
commit b4c3dcc5a18636eea848894204f45ef62dff0c1d
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Sep 30 02:06:38 2015 +0200
ff-load: add 'frames' property
operations/external/ff-load.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/operations/external/ff-load.c b/operations/external/ff-load.c
index f00eb45..aeb2eb3 100644
--- a/operations/external/ff-load.c
+++ b/operations/external/ff-load.c
@@ -19,7 +19,6 @@
#include "config.h"
#include <glib/gi18n-lib.h>
-
#ifdef GEGL_PROPERTIES
property_file_path (path, _("File"), "")
@@ -29,6 +28,11 @@ property_int (frame, _("Frame number"), 0)
value_range (0, G_MAXINT)
ui_range (0, 10000)
+property_int (frames, _("frames"), 0)
+ description (_("Number of frames in video, updates at least when first frame has been decoded."))
+ value_range (0, G_MAXINT)
+ ui_range (0, 10000)
+
#else
#define GEGL_OP_SOURCE
@@ -200,7 +204,7 @@ decode_frame (GeglOperation *operation,
decodeframe = prevframe + 1;
}
- if (decodeframe < prevframe)
+ if (decodeframe < prevframe + 0.0) // XXX: shuts up gcc
{
/* seeking backwards, since it ffmpeg doesn't allow us,. we'll reload the file */
g_free (p->loadedfilename);
@@ -352,6 +356,15 @@ prepare (GeglOperation *operation)
p->prevframe = -1;
p->coded_bytes = 0;
p->coded_buf = NULL;
+
+ o->frames = p->video_st->nb_frames;
+ if (!o->frames)
+ {
+ /* With no declared frame count, compute number of frames based on
+ duration and video codecs frame
+ */
+ o->frames = p->ic->duration * p->video_st->time_base.den / p->video_st->time_base.num /
AV_TIME_BASE;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]