[Sugar-devel] [PATCH Record (Gtk3)] Use new syntax for Gst.Caps

Manuel Kaufmann humitos at gmail.com
Wed Feb 6 11:11:14 EST 2013


Using the new syntax for Gst.Caps we avoid Gst's WARNING message in
the log.

Signed-off-by: Manuel Kaufmann <humitos at gmail.com>
---
 glive.py | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/glive.py b/glive.py
index 5d78bbe..d39e292 100644
--- a/glive.py
+++ b/glive.py
@@ -102,8 +102,7 @@ class Glive:
         
         pipeline = Gst.Pipeline()
         
-        # WARNING **: 0.10-style raw video caps are being created. Should be video/x-raw,format=(string)
-        caps = Gst.Caps.from_string('video/x-raw-yuv,framerate=10/1')
+        caps = Gst.Caps.from_string('video/x-raw, format=(string)yuv, framerate=(fraction)10/1')
         camerafilter = Gst.ElementFactory.make("capsfilter", "capsfilter")
         camerafilter.set_property("caps", caps)
         
@@ -165,8 +164,7 @@ class Glive:
         if not hwdev_available:
             src.set_property("device", "default")
 
-        # WARNING **: 0.10-style raw audio caps are being created. Should be audio/x-raw,format=(string)
-        srccaps = Gst.Caps.from_string("audio/x-raw-int,rate=16000,channels=1,depth=16")
+        srccaps = Gst.Caps.from_string("audio/x-raw, rate=(int)16000, channels=(int)1, depth=(int)16")
 
         # guarantee perfect stream, important for A/V sync
         rate = Gst.ElementFactory.make("audiorate", 'audiorate')
@@ -210,8 +208,7 @@ class Glive:
 
         scale = Gst.ElementFactory.make("videoscale", "vbscale")
 
-        # WARNING **: 0.10-style raw video caps are being created. Should be video/x-raw,format=(string)
-        scalecaps = Gst.Caps.from_string('video/x-raw-yuv,width=160,height=120')
+        scalecaps = Gst.Caps.from_string('video/x-raw, format=(string)yuv, width=(int)160, height=(int)120')
         scalecapsfilter = Gst.ElementFactory.make("capsfilter", "scalecaps")
         scalecapsfilter.set_property("caps", scalecaps)
 
@@ -273,7 +270,7 @@ class Glive:
         vbenc = self._videobin.get_by_name("vbenc")
         vbenc.set_property("quality", 16)
         #scaps = self._videobin.get_by_name("scalecaps") # FIXME: If these elements connect the pipeline does not run.
-        #scaps.set_property("caps", Gst.Caps.from_string("video/x-raw-yuv,width=%d,height=%d" % (width, height)))
+        #scaps.set_property("caps", Gst.Caps.from_string("video/x-raw, format=(string)yuv, width=(int)%d, height=(int)%d" % (width, height)))
 
     def _create_pipeline(self):
         
@@ -287,10 +284,10 @@ class Glive:
         # camera level
         
         if self._can_limit_framerate:
-            srccaps = Gst.Caps.from_string('video/x-raw-yuv,framerate=10/1')
+            srccaps = Gst.Caps.from_string('video/x-raw, format=(string)yuv, framerate=(fraction)10/1')
             
         else:
-            srccaps = Gst.Caps.from_string('video/x-raw-yuv')
+            srccaps = Gst.Caps.from_string('video/x-raw, format=(string)yuv')
 
         # we attempt to limit the framerate on the v4l2src directly, but we
         # can't trust this: perhaps we are falling behind in our capture,
@@ -299,7 +296,7 @@ class Glive:
         # for A/V sync because OGG does not store timestamps, it just stores
         # the FPS value.
         rate = Gst.ElementFactory.make("videorate", 'videorate')
-        ratecaps = Gst.Caps.from_string('video/x-raw-yuv,framerate=10/1')
+        ratecaps = Gst.Caps.from_string('video/x-raw, format=(string)yuv, framerate=(fraction)10/1')
 
         tee = Gst.ElementFactory.make("tee", "tee")
         queue = Gst.ElementFactory.make("queue", "dispqueue")
@@ -860,4 +857,3 @@ class Glive:
         
         if os.path.exists(mux_path):
             os.remove(mux_path)
-    
\ No newline at end of file
-- 
1.7.11.7



More information about the Sugar-devel mailing list