summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuciana Fujii Pontello <luciana@holoscopio.com>2010-06-15 21:58:31 (GMT)
committerLuciana Fujii Pontello <luciana@fujii.eti.br>2010-07-09 22:40:43 (GMT)
commit33a0356edcd4f1aa16e96b854565124c7203412c (patch)
tree7ce837dde7edb77aaf7cd0af8b9f8ad9d8834c2e
parenta5fe51f6bddae17f4855a4688fe226e1dc5f1f2f (diff)
downloadsltv-33a0356edcd4f1aa16e96b854565124c7203412c.tar.gz
sltv-33a0356edcd4f1aa16e96b854565124c7203412c.tar.xz
Adding Watermark to sltv
A watermark toolbutton was added to the settings toolbar and sltv has a cairoimageoverlay element that will make watermark. For now we set a fixed position.
-rw-r--r--sltv/sltv.py36
-rw-r--r--sltv/ui/settings.py12
-rw-r--r--ui/settings.ui13
3 files changed, 60 insertions, 1 deletions
diff --git a/sltv/sltv.py b/sltv/sltv.py
index 6a5681f..926915f 100644
--- a/sltv/sltv.py
+++ b/sltv/sltv.py
@@ -101,6 +101,8 @@ class Sltv(gobject.GObject):
self.volume_value = None
self.pending_state = None
+ self.watermark_location = None
+ self.watermark_size = None
self.input_type = 0
@@ -130,6 +132,28 @@ class Sltv(gobject.GObject):
if self.playing():
self.overlay.set_property("text", overlay_text)
+ def set_watermark_location(self, location):
+ self.watermark_location = location
+ if self.playing():
+ self.watermark.set_property("location", location)
+
+ def set_watermark_size(self, size):
+ self.watermark_size = size
+
+ def _set_watermark(self, video_width, video_height):
+ if self.watermark_location:
+ self.watermark.set_property("location", self.watermark_location)
+
+ print self.watermark_size
+
+ wm_width = self.watermark_size * video_width
+ wm_height = self.watermark_size * video_height
+
+ self.watermark.set_property("window_left", 0)
+ self.watermark.set_property("window_right", 0 + wm_width)
+ self.watermark.set_property("window_top", 0)
+ self.watermark.set_property("window_bottom", 0 + wm_height)
+
def set_effect_name(self, effect_type, effect_name):
if effect_name == "none":
effect_name = "identity"
@@ -231,7 +255,15 @@ class Sltv(gobject.GObject):
if name == self.audio_source:
type |= element.get_type()
- self.pip.link(self.queue_video)
+ self.watermark = gst.element_factory_make(
+ "cairoimageoverlay", "cairoimageoverlay"
+ )
+ self.player.add(self.watermark)
+ gst.element_link_many(self.pip, self.watermark, self.queue_video)
+
+
+
+
self._switch_source()
self._switch_pip()
@@ -359,6 +391,8 @@ class Sltv(gobject.GObject):
self.pip.set_property("width", int(pip_width))
self.pip.set_property("height", int(pip_height))
+ self._set_watermark(int(pip_width), int(pip_height))
+
self.overlay.set_property("text", self.overlay_text)
if self.volume_value is not None:
self.volume.set_property("volume", self.volume_value)
diff --git a/sltv/ui/settings.py b/sltv/ui/settings.py
index dabcc5e..f4de61d 100644
--- a/sltv/ui/settings.py
+++ b/sltv/ui/settings.py
@@ -20,6 +20,7 @@ import gtk
from sltv.settings import UI_DIR
import effects
import overlay
+import watermark
class SettingsUI:
@@ -33,9 +34,11 @@ class SettingsUI:
self.effects = effects.EffectsUI(self.ui, self.sltv)
self.overlay = overlay.OverlayUI(self.ui, self.sltv)
+ self.watermark = watermark.WaterMarkUI(self.ui, self.sltv)
self.effects_button = self.interface.get_object("effects_toolbutton")
self.overlay_button = self.interface.get_object("overlay_toolbutton")
+ self.watermark_button = self.interface.get_object("watermark_toolbutton")
settings_group = gtk.ActionGroup("settings_group")
settings_actions = [
@@ -43,6 +46,8 @@ class SettingsUI:
"Effects", 0),
("overlay_radioaction", "gtk-missing-image", "Overlay", None,
"Overlay", 1),
+ ("watermark_radioaction", "gtk-missing-image", "Watermark", None,
+ "Watermark", 2),
]
settings_group.add_radio_actions(
settings_actions, 0, self.on_settings_changed, None
@@ -58,6 +63,11 @@ class SettingsUI:
)
self.overlay_radioaction.connect_proxy(self.overlay_button)
+ self.watermark_radioaction = settings_group.get_action(
+ "watermark_radioaction"
+ )
+ self.watermark_radioaction.connect_proxy(self.watermark_button)
+
self.selected_box = self.effects.get_widget()
self.content.add(self.effects.get_widget())
@@ -71,6 +81,8 @@ class SettingsUI:
self.selected_box = self.effects.get_widget()
elif name == "overlay_radioaction":
self.selected_box = self.overlay.get_widget()
+ elif name == "watermark_radioaction":
+ self.selected_box = self.watermark.get_widget()
else:
self.selected_box = None
diff --git a/ui/settings.ui b/ui/settings.ui
index 717189b..d4bb136 100644
--- a/ui/settings.ui
+++ b/ui/settings.ui
@@ -37,6 +37,19 @@
<property name="homogeneous">True</property>
</packing>
</child>
+ <child>
+ <object class="GtkRadioToolButton" id="watermark_toolbutton">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">WaterMark</property>
+ <property name="use_underline">True</property>
+ <property name="stock_id">gtk-orientation-landscape</property>
+ <property name="group">effects_toolbutton</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>