GNOME Bugzilla – Bug 747557
zbar: Get an image along with the barcode
Last modified: 2015-05-31 23:06:40 UTC
I am using the zbar element and I would like to "catch" the image that made zbar decode a barcode. So I do not only want to get the decoded barcode, but also the image which caused zbar to generate a signal. The scenario is that an attacker could "inject", for a frame or two, a malicious image. And I want to show the user "see, this image apparently contained a barcode which decoded to this string".
My suggestion would be to attach a GstSample to the message. Looks like a good enhancement.
Created attachment 302748 [details] [review] zbar: add frame sample to barcode message Quickly drafted but should work. Tobias, can you check and report back please?
Seems to work. Thanks! I'm in the process of figuring out how to actually display the pixbuf nicely, but I think GStreamer's job is done. Thanks!
Patch looks fine, but I wonder if this should be made opt-in and conditional on a separate property, mostly because you might end up with a whole bunch of frames 'stuck' on the bus. It depends a bit how often a message is posted for the same code I guess. I did not check what the default behaviour is in that case.
From what I see, I think it's posted often enough to add a property to opt this in indeed.
+1 for opt in. Otherwise sounds like a good idea.
Created attachment 304280 [details] [review] zbar: add frame sample to barcode message Updated patch adds attach-frame property to control behavior
Comment on attachment 304280 [details] [review] zbar: add frame sample to barcode message Thanks, looks good! Two small nitpicks: - could you add "(Since 1.6)" in the property description and/or a gtk-doc chunk for the property with a "Since: 1.6"? - create the structure with the common fields and then do: if (zbar->frame_attach) gst_structure_set (s, frame", GST_TYPE_SAMPLE, sample, NULL); Feel free to push then.
> if (zbar->frame_attach) > gst_structure_set (s, frame", GST_TYPE_SAMPLE, sample, NULL); That's more code in practice of course, all I meant was that the structure is just created once with the common fields.
commit 1246d93f3e32a13c95c70cf3ba0f26b224de5e58 Author: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com> Date: Fri May 1 23:20:30 2015 -0300 zbar: add frame sample to barcode message New attach-frame property enables barcode frame dumping when set to true. https://bugzilla.gnome.org/show_bug.cgi?id=747557