[xiph-commits] r14636 - trunk/souffleur

conrad at svn.xiph.org conrad at svn.xiph.org
Thu Mar 27 03:21:30 PDT 2008


Author: conrad
Date: 2008-03-27 03:21:29 -0700 (Thu, 27 Mar 2008)
New Revision: 14636

Modified:
   trunk/souffleur/GPlayer.py
Log:
Applied patch from Jo?\195?\163o Mesquita:
Changes the default playbin video sink to autovideosink with textoverlay.
This change was done because GStreamer does not support all
kinds of subtitles yet and I do not expect to be dependent
on GStreamer subtitle support development


Modified: trunk/souffleur/GPlayer.py
===================================================================
--- trunk/souffleur/GPlayer.py	2008-03-26 22:29:33 UTC (rev 14635)
+++ trunk/souffleur/GPlayer.py	2008-03-27 10:21:29 UTC (rev 14636)
@@ -36,7 +36,17 @@
     # \param videowidget - VideoWidget class.
     def __init__(self, videowidget):
         self.playing = False
+	bin = gst.Bin('my-bin')
+	self.textoverlay = gst.element_factory_make('textoverlay')
+	bin.add(self.textoverlay)
+	pad = self.textoverlay.get_pad("video_sink")
+	ghostpad = gst.GhostPad("sink", pad)
+	bin.add_pad(ghostpad)
+	videosink = gst.element_factory_make('autovideosink')
+	bin.add(videosink)
+	gst.element_link_many(self.textoverlay, videosink)
         self.player = gst.element_factory_make("playbin", "player")
+	self.player.set_property("video-sink", bin)
         self.videowidget = videowidget
 
         bus = self.player.get_bus()
@@ -81,6 +91,16 @@
         self.player.set_property('uri', location)
 
 #==============================================================================
+    ## Set Subtitle Text
+    # Set subtitle text to be overlayed.
+    # \param text - Text (may have pango tags) 
+    # \param font - Pango FontDescrition for the text
+    def set_subtitle_text(self, text, font=None):
+	if font:
+	    self.textoverlay.set_property('subtitle-font-desc', font)
+	self.textoverlay.set_property('text', text)
+
+#==============================================================================
     ## Get location.
     # Get location of the source.
     def get_location(self):



More information about the commits mailing list