[shotdetect] 06/11: Added 1005-add_framenumber_to_filename.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 d5dfb72233a706ea04226bf642d63738db3a368b
Author: Giulio Paci <giuliopaci at gmail.com>
Date: Sat Aug 10 16:12:37 2013 +0200
Added 1005-add_framenumber_to_filename.patch.
---
.../patches/1005-add_framenumber_to_filename.patch | 118 ++++++++++++++++++++
1 file changed, 118 insertions(+)
diff --git a/debian/patches/1005-add_framenumber_to_filename.patch b/debian/patches/1005-add_framenumber_to_filename.patch
new file mode 100644
index 0000000..0b778a6
--- /dev/null
+++ b/debian/patches/1005-add_framenumber_to_filename.patch
@@ -0,0 +1,118 @@
+Description: add frame number to image filenames
+Author: Peter B. <pb at das-werkstatt.com>
+Forwarded: no
+Last-Update: 2013-08-10
+--- a/include/image.h
++++ b/include/image.h
+@@ -54,7 +54,7 @@
+ string img;
+ int id;
+ bool type; // BEGIN || END
+- int SaveFrame (AVFrame * pFrame);
++ int SaveFrame (AVFrame * pFrame, int frame_number);
+ int create_img_dir ();
+ image (film *, int, int, int, bool);
+ };
+--- a/src/film.cpp
++++ b/src/film.cpp
+@@ -53,6 +53,7 @@
+ int y;
+ int x;
+ int diff;
++ int frame_number = pCodecCtx->frame_number;
+ char c1, c2, c3;
+ int c1tot, c2tot, c3tot;
+ c1tot = 0;
+@@ -123,13 +124,13 @@
+ if (this->first_img_set)
+ {
+ image *im_begin = new image (this, width, height, s.myid, BEGIN);
+- im_begin->SaveFrame (pFrame);
++ im_begin->SaveFrame (pFrame, frame_number);
+ s.img_begin = im_begin;
+ }
+ if (this->last_img_set)
+ {
+ image *im_end = new image (this, width, height, s.myid - 1, END);
+- im_end->SaveFrame (pFramePrev);
++ im_end->SaveFrame (pFramePrev, frame_number);
+ shots.back ().img_end = im_end;
+ }
+ shots.push_back (s);
+@@ -390,7 +391,7 @@
+ */
+ image *begin_i = new image (this, width, height, s.myid, BEGIN);
+ begin_i->create_img_dir ();
+- begin_i->SaveFrame (pFrameRGB);
++ begin_i->SaveFrame (pFrameRGB, frame_number);
+ shots.back ().img_begin = begin_i;
+ }
+ memcpy (buffer2, buffer, numBytes);
+@@ -414,9 +415,13 @@
+ shots.back ().fduration = lastFrame - shots.back ().fbegin;
+ shots.back ().msduration = int (((shots.back ().fduration) * 1000) / fps);
+ duration.mstotal = int (shots.back ().msduration + shots.back ().msbegin);
++
++ if (this->last_img_set)
++ {
+ image *end_i = new image (this, width, height, shots.back ().myid, END);
+- end_i->SaveFrame (pFrameRGB);
+- shots.back ().img_end = end_i;
++ end_i->SaveFrame (pFrameRGB, frame_number);
++ shots.back ().img_end = end_i;
++ }
+
+ /*
+ * Graph: Quantity of movement
+--- a/src/image.cpp
++++ b/src/image.cpp
+@@ -69,7 +69,7 @@
+ }
+
+ int
+-image::SaveFrame (AVFrame * pFrame)
++image::SaveFrame (AVFrame * pFrame, int frame_number)
+ {
+ // c->thumb_height remplac� par 84
+ int width_s = (THUMB_HEIGHT * this->width) / this->height;
+@@ -116,17 +116,24 @@
+
+ }
+
++ /* Pad numbers to constant string width: */
++ char s_id[6];
++ char s_frame_number[9];
+
+- /* Creating file and saving it */
+- if (f->get_thumb())
++ sprintf(s_id, "%05d", id);
++ sprintf(s_frame_number, "%06d", frame_number);
++
++
++ /* Creating file and saving it */
++ if (f->get_thumb())
+ {
+
+ /* Name the images */
+ str.str ("");
+ if (this->type == BEGIN)
+- str << "/thumbs/" << id << "_in.jpg";
++ str << "/thumbs/" << s_id << "-" << s_frame_number << "_in.jpg";
+ else
+- str << "/thumbs/" << id << "_out.jpg";
++ str << "/thumbs/" << s_id << "-" << s_frame_number << "_out.jpg";
+ thumb = str.str ();
+ str.str ("");
+ str << f->global_path << "/" << thumb;
+@@ -148,9 +155,9 @@
+ /* Name the images */
+ str.str ("");
+ if (this->type == BEGIN)
+- str << "/shots/" << id << "_in.jpg";
++ str << "/shots/" << s_id << "-" << s_frame_number << "_in.jpg";
+ else
+- str << "/shots/" << id << "_out.jpg";
++ str << "/shots/" << s_id << "-" << s_frame_number << "_out.jpg";
+ img = str.str ();
+ str.str ("");
+ str << f->global_path << "/" << img;
--
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