[shotdetect] 07/11: Added 1006-label_xaxis_with_timecode.patch.
Giulio Paci
giuliopaci-guest at alioth.debian.org
Sun Aug 11 23:29:47 UTC 2013
This is an automated email from the git hooks/post-receive script.
giuliopaci-guest pushed a commit to branch master
in repository shotdetect.
commit 06749b47c7cd55c7a37502cea99ff7b139ca09d9
Author: Giulio Paci <giuliopaci at gmail.com>
Date: Sat Aug 10 16:13:00 2013 +0200
Added 1006-label_xaxis_with_timecode.patch.
---
.../patches/1006-label_xaxis_with_timecode.patch | 69 ++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/debian/patches/1006-label_xaxis_with_timecode.patch b/debian/patches/1006-label_xaxis_with_timecode.patch
new file mode 100644
index 0000000..69bc466
--- /dev/null
+++ b/debian/patches/1006-label_xaxis_with_timecode.patch
@@ -0,0 +1,69 @@
+Description: label x-axis with timecode
+ - Change grid-ticks to 10-second steps
+ - Display video timecode on x-axis
+Author: Peter B. <pb at das-werkstatt.com>
+Forwarded: no
+Last-Update: 2013-08-10
+--- a/src/graph.cpp
++++ b/src/graph.cpp
+@@ -166,6 +166,13 @@
+
+ void graph::draw_canvas (gdImagePtr im, string title)
+ {
++ int fps = 25; // TODO: read this from video
++ int tick_length;
++ bool is_second, is_minute, is_hour;
++ int hour, minute, second, frame;
++ char time[10];
++ int frames;
++
+ gdImageString (im, gdFontGetLarge (), im->sx / 2 - (title.size () * gdFontGetLarge ()->w / 2), 10, (unsigned char *) title.c_str (), grid_color);
+
+ // Y-axis
+@@ -181,10 +188,42 @@
+ // X-axis
+ gdImageLine (im, xoffset, xaxis_offset, xsize - xoffset, xaxis_offset, grid_color);
+
+- for (int i = xoffset; i < xsize - xoffset; i++) {
+- if (!(i % grid_size)) {
+- gdImageLine (im, i, xaxis_offset - 2, i, xaxis_offset + 2, grid_color);
+- }
++ for (int x = xoffset; x < xsize - xoffset; x++) {
++ // Calculate video position information:
++ frames = x - xoffset + 1;
++ frame = (frames % fps);
++ is_second = !frame;
++ is_minute = false;
++ is_hour = false;
++
++ tick_length = 2;
++ if (is_second) {
++ second = (frames / fps) % 60;
++ minute = (frames / fps / 60) % 60;
++ hour = (int)(frames / fps / 60 / 60);
++
++ is_minute = !second;
++ is_hour = !minute;
++
++ // Do something special every 10th second:
++ if (!(second % 10)) {
++ tick_length = 10;
++
++ // Write video position as grid label:
++ //printf("%d:%02d:%02d.%02d\n", hour, minute, second, frame);
++ sprintf(time, "%d:%02d:%02d.%02d", hour, minute, second, frame);
++
++ gdImageString (im,
++ gdFontGetLarge(),
++ x - (strlen(time) * gdFontGetLarge()->w / 2),
++ xaxis_offset + 8,
++ (unsigned char *) time,
++ grid_color
++ );
++ }
++
++ gdImageLine (im, x, xaxis_offset - 1, x, xaxis_offset + tick_length, grid_color);
++ }
+ }
+ }
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-multimedia/shotdetect.git
More information about the pkg-multimedia-commits
mailing list