Merge lp:~sylvain-pineau/checkbox/story482.7_screenshot_fullscreen_video into lp:checkbox

Proposed by Sylvain Pineau
Status: Merged
Merged at revision: 1302
Proposed branch: lp:~sylvain-pineau/checkbox/story482.7_screenshot_fullscreen_video
Merge into: lp:checkbox
Diff against target: 176 lines (+97/-15) (has conflicts)
4 files modified
debian/changelog (+10/-0)
debian/control (+1/-1)
jobs/graphics.txt.in (+21/-0)
scripts/gst_pipeline_test (+65/-14)
Text conflict in debian/changelog
To merge this branch: bzr merge lp:~sylvain-pineau/checkbox/story482.7_screenshot_fullscreen_video
Reviewer Review Type Date Requested Status
Javier Collado (community) Approve
Marc Tardif (community) Approve
Jeff Lane  Needs Fixing
Review via email: mp+95575@code.launchpad.net

Description of the change

This proposal comes with a new gst_pipeline_test script which support fullscreen video playback by forcing the video sink element to use a specific Gtk Window identifier for rendering.

A new features ensures that the video playback will loop until the given timeout is reached by seeking to the first frame on EOS events.

A new job takes care of performing a still capture during a fullscreen video playback.

To post a comment you must log in.
Revision history for this message
Jeff Lane  (bladernr) wrote :

I'm not comfortable with hard coding /dev/video1 into the job command like that.

On the system I tested with, I somehow ended up with three video devices:
bladernr@klaatu:~$ find /dev -name video*
/dev/video1
/dev/video0
bladernr@klaatu:~$ find /dev -name video*
/dev/video2
/dev/video1
/dev/video0

And in my system, the USB webcam I just plugged in is video2, not video1.

Also, some systems may not already have a built in webcam... for example, my Thinkpad x201:

bladernr@GarbageScow:~/Downloads$ find /dev -name video*
bladernr@GarbageScow:~/Downloads$

and after plugging in the webcam:

bladernr@GarbageScow:~/Downloads$ find /dev -name video*
/dev/video0
bladernr@GarbageScow:~/Downloads$

review: Needs Fixing
Revision history for this message
Daniel Manrique (roadmr) wrote :

As things continue moving towards gtk3 and gi.repository the bug will need to be addressed. We can expect some pressure to port all of our test scripts to avoid depending on python-gtk2. Once this makes it in, we need to keep an eye on the bug and on whether python-gtk2 is still on the default cd.

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

@Daniel, the latest manifest still mentions python-gtk2, so i think we're good with precise. The bug with the gi Gst version should be solved for gstreamer-0.11 or version 1. So yes, i'll keep an eye on this bug to move this code to gtk3 asap.

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

@Jeff,

I'm not super happy with the hard-coded /dev/video1 too and Javier Collado proposed to take the higher digit of video device to find the usb camera. The change will certainly be in the camera_test script. Once done, all jobs like this one (with /dev/video1) will be corrected.

Revision history for this message
Javier Collado (javier.collado) wrote :

@Jeff

Please find the changes Sylvain mentioned in the previous comment in this merge proposal:
https://code.launchpad.net/~javier.collado/checkbox/story482_avoid_hardcoding_device/+merge/95867

1294. By Sylvain Pineau

Updated job commands to use --highest-device to find the USB camera

1295. By Sylvain Pineau

typo fixed

Revision history for this message
Marc Tardif (cr3) wrote :

In jobs/graphics.txt.in, I see the following command:

+command:
+ gst_pipeline_test -t 20 -f "playbin2 uri=file://${CHECKBOX_SHARE}/data/video/Ogg_Theora_Video.ogv" &
+ sleep 15 && camera_test still --highest-device -f ${CHECKBOX_DATA}/screenshot_fullscreen_video.jpg -q 2>&1 | ansi_parser

So, you run a gst_pipeline_test for 20 seconds in the background and then sleep for 15 seconds before running the camera_test. Any reason why you're sleeping for such a long time?

The rest looks good though, so I'd merge after clarifying the above question.

review: Needs Information
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

I wanted the playback to run for a longer period before performing the screengrab, maximizing the chance to find a bug. As the file is just a 4s sample, looping/waiting 15s seemed to me quite reasonable

Revision history for this message
Marc Tardif (cr3) wrote :

Is there any precedent of a bug occuring within those 15 seconds or is that hypothetical?

review: Needs Information
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Not really, I not only want to trap bugs that occur at the beginning of the playback but also those that may happen later. So yes later is difficult to estimate. That's why am looping 3 times the same video before the performing screenshot. I don't want to create a stress test for this one but 15 seconds is not so long.

Revision history for this message
Marc Tardif (cr3) wrote :

Agreed, 15 seconds sounds reasonable then. Merging and pushing. Thanks!

review: Approve
Revision history for this message
Javier Collado (javier.collado) wrote :

Even if the branch is already merged, I just want to add that I've finally been able to run the test cases and submit the results successfully (using the merged changes in trunk).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2012-03-05 14:40:48 +0000
+++ debian/changelog 2012-03-05 16:27:21 +0000
@@ -42,6 +42,7 @@
42 plugins/jobs_prompt.py: Added a progress bar showing tests completed and42 plugins/jobs_prompt.py: Added a progress bar showing tests completed and
43 total.43 total.
4444
45<<<<<<< TREE
45 [Tiago Salem Herrmann]46 [Tiago Salem Herrmann]
46 * checkbox_qt/qt_interface.py, qt/frontend/qtfront.cpp,47 * checkbox_qt/qt_interface.py, qt/frontend/qtfront.cpp,
47 qt/frontend/qtfront.h, qt/frontend/treemodel.cpp, qt/frontend/treemodel.h:48 qt/frontend/qtfront.h, qt/frontend/treemodel.cpp, qt/frontend/treemodel.h:
@@ -49,6 +50,15 @@
49 children nodes.50 children nodes.
5051
51 -- Jeff Lane <jeff@ubuntu.com> Fri, 02 Mar 2012 12:13:34 -050052 -- Jeff Lane <jeff@ubuntu.com> Fri, 02 Mar 2012 12:13:34 -0500
53=======
54 [Sylvain Pineau]
55 * Updated gst_pipeline_test to add a --fullscreen option for video playback.
56 * Add python-gtk2 dependency, Gst from gi.repository don't work well with
57 messages (See https://bugzilla.gnome.org/show_bug.cgi?id=631901).
58 * Add a new job to capture screen during fullscreen video playback.
59
60 -- Daniel Manrique <roadmr@ubuntu.com> Thu, 01 Mar 2012 17:32:15 -0500
61>>>>>>> MERGE-SOURCE
5262
53checkbox (0.13.3) precise; urgency=low63checkbox (0.13.3) precise; urgency=low
5464
5565
=== modified file 'debian/control'
--- debian/control 2012-02-24 10:05:04 +0000
+++ debian/control 2012-03-05 16:27:21 +0000
@@ -11,7 +11,7 @@
11Section: python11Section: python
12Architecture: any12Architecture: any
13Depends: ${misc:Depends}, ${python:Depends}, debconf, python-libxml2, udev13Depends: ${misc:Depends}, ${python:Depends}, debconf, python-libxml2, udev
14Recommends: dpkg (>= 1.13), gstreamer0.10-gconf, lsb-release, perl, pm-utils, python-apport, python-apt, python-dateutil, python-gst0.1014Recommends: dpkg (>= 1.13), gstreamer0.10-gconf, lsb-release, perl, pm-utils, python-apport, python-apt, python-dateutil, python-gst0.10, python-gtk2
15Suggests: checkbox-cli | checkbox-gtk, bonnie++, bootchart, bzr, cvs, ethtool, flex, fwts, git-core, hdparm, lshw, make, nmap, obexd-client, python-pexpect, smartmontools, sox, stress, wodim15Suggests: checkbox-cli | checkbox-gtk, bonnie++, bootchart, bzr, cvs, ethtool, flex, fwts, git-core, hdparm, lshw, make, nmap, obexd-client, python-pexpect, smartmontools, sox, stress, wodim
16Description: System testing application 16Description: System testing application
17 This project provides an extensible interface for system testing. The17 This project provides an extensible interface for system testing. The
1818
=== modified file 'jobs/graphics.txt.in'
--- jobs/graphics.txt.in 2012-03-05 16:10:58 +0000
+++ jobs/graphics.txt.in 2012-03-05 16:27:21 +0000
@@ -163,3 +163,24 @@
163depends: graphics/screenshot163depends: graphics/screenshot
164command: cat ${CHECKBOX_DATA}/screenshot.jpg164command: cat ${CHECKBOX_DATA}/screenshot.jpg
165_description: Attaches the screenshot captured in graphics/screenshot.165_description: Attaches the screenshot captured in graphics/screenshot.
166
167plugin: shell
168name: graphics/screenshot_fullscreen_video
169requires: package.name == 'fswebcam'
170command:
171 gst_pipeline_test -t 20 -f "playbin2 uri=file://${CHECKBOX_SHARE}/data/video/Ogg_Theora_Video.ogv" &
172 sleep 15 && camera_test still --highest-device -f ${CHECKBOX_DATA}/screenshot_fullscreen_video.jpg -q 2>&1 | ansi_parser
173_description:
174 PURPOSE:
175 Take a screengrab of the current screen during fullscreen video playback
176 STEPS:
177 1. Start a fullscreen video playback
178 2. Take picture using USB webcam after a few seconds
179 VERIFICATION:
180 1. Review attachment manually later
181
182plugin: attachment
183name: screenshot_fullscreen_video.jpg
184depends: graphics/screenshot_fullscreen_video
185command: cat ${CHECKBOX_DATA}/screenshot_fullscreen_video.jpg
186_description: Attaches the screenshot captured in graphics/screenshot_fullscreen_video.
166187
=== modified file 'scripts/gst_pipeline_test'
--- scripts/gst_pipeline_test 2008-10-23 03:34:16 +0000
+++ scripts/gst_pipeline_test 2012-03-05 16:27:21 +0000
@@ -1,37 +1,88 @@
1#!/usr/bin/python1#!/usr/bin/python
22
3# Note: this code is not based on gi.repository because of a bug that prevents
4# sync-message to be decoded from the bus (current message reports "None" in
5# all cases). See https://bugzilla.gnome.org/show_bug.cgi?id=631901
6
3import sys7import sys
4import time8import gtk
59import gobject
6import pygst10import pygst
7pygst.require("0.10")11pygst.require("0.10")
812import gst
9from optparse import OptionParser13from optparse import OptionParser
1014
1115
16class GTK_Main:
17
18 def __init__(self, pipeline, options):
19 self.options = options
20 self.loop = gobject.MainLoop()
21 self.player = gst.parse_launch(pipeline)
22 bus = self.player.get_bus()
23 bus.add_signal_watch()
24 bus.enable_sync_message_emission()
25 bus.connect("message", self.on_message)
26 bus.connect("sync-message::element", self.on_sync_message)
27 self.player.set_state(gst.STATE_PLAYING)
28 gobject.timeout_add(self.options.timeout*1000, self.timeout_cb)
29 self.loop.run()
30
31 def delete_event(self, widget, event, data=None):
32 return False
33
34 def destroy(self, widget, data=None):
35 self.timeout_cb()
36
37 def on_message(self, bus, message):
38 t = message.type
39 if t == gst.MESSAGE_EOS:
40 self.player.seek_simple(gst.FORMAT_TIME, gst.SEEK_FLAG_FLUSH, 0)
41
42 def on_sync_message(self, bus, message):
43 if message.structure is None:
44 return
45 message_name = message.structure.get_name()
46 if message_name == "prepare-xwindow-id":
47 gtk.gdk.threads_enter()
48 gtk.gdk.display_get_default().sync()
49 self.window = gtk.Window()
50 self.window.connect("delete_event", self.delete_event)
51 self.window.connect("destroy", self.destroy)
52 self.movie_window = gtk.DrawingArea()
53 self.window.add(self.movie_window)
54 if self.options.fullscreen:
55 self.window.fullscreen()
56 self.window.show_all()
57 imagesink = message.src
58 imagesink.set_property("force-aspect-ratio", True)
59 imagesink.set_xwindow_id(self.movie_window.window.xid)
60 gtk.gdk.threads_leave()
61
62 def timeout_cb(self):
63 self.player.set_state(gst.STATE_NULL)
64 self.loop.quit()
65
66
12def main(args):67def main(args):
13 import gst
14
15 usage = "Usage: %prog [OPTIONS] PIPELINE"68 usage = "Usage: %prog [OPTIONS] PIPELINE"
16 parser = OptionParser(usage=usage)69 parser = OptionParser(usage=usage)
17 parser.add_option("-t", "--timeout",70 parser.add_option("-t", "--timeout",
18 type="int",71 type="int",
19 default=0,72 default=-1,
20 help="Timeout for running the pipeline.")73 help="Timeout for running the pipeline.")
74 parser.add_option("-f", "--fullscreen",
75 default=False,
76 action="store_true",
77 help="Fullscreen mode (pipeline with video sink only).")
21 (options, args) = parser.parse_args(args)78 (options, args) = parser.parse_args(args)
2279
23 if len(args) != 1:80 if len(args) != 1:
24 parser.error("Must provide a PIPELINE")81 parser.error("Must provide a PIPELINE")
2582
26 pipeline = args[0]83 pipeline = args[0]
27 element = gst.parse_launch(pipeline)84 gtk.gdk.threads_init()
28 element.set_state(gst.STATE_PLAYING)85 GTK_Main(pipeline, options)
29
30 if options.timeout:
31 time.sleep(options.timeout)
32
33 element.set_state(gst.STATE_NULL)
34 return 0
3586
3687
37if __name__ == "__main__":88if __name__ == "__main__":

Subscribers

People subscribed via source and target branches