summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuciana Fujii Pontello <luciana@fujii.eti.br>2010-06-25 23:02:34 (GMT)
committerLuciana Fujii Pontello <luciana@fujii.eti.br>2010-07-10 02:06:45 (GMT)
commit06b4ac6560203ba43193c8315f54783db308b9b2 (patch)
tree08746783f1bec0fe4bedb32af6372a326d16d393
parent44a574338a1194f74db6c8f00e70900e89817e82 (diff)
downloadsltv-06b4ac6560203ba43193c8315f54783db308b9b2.tar.gz
sltv-06b4ac6560203ba43193c8315f54783db308b9b2.tar.xz
Adding videobalance to sltv
Videobalance was added after watermark, so it will adjust the resulting video with picture-in-picture and watermark.
-rw-r--r--sltv/sltv.py51
-rw-r--r--sltv/ui/Makefile.am3
-rw-r--r--sltv/ui/settings.py14
-rw-r--r--sltv/ui/videobalance.py72
-rw-r--r--ui/Makefile.am3
-rw-r--r--ui/settings.ui20
-rw-r--r--ui/videobalance.ui64
7 files changed, 221 insertions, 6 deletions
diff --git a/sltv/sltv.py b/sltv/sltv.py
index e7a6ae4..176021a 100644
--- a/sltv/sltv.py
+++ b/sltv/sltv.py
@@ -106,6 +106,11 @@ class Sltv(gobject.GObject):
self.watermark_alpha = None
self.watermark_selected = 0
+ self.videobalance_contrast = None
+ self.videobalance_brightness = None
+ self.videobalance_hue = None
+ self.videobalance_saturation = None
+
self.input_type = 0
def set_halign(self, halign):
@@ -183,6 +188,26 @@ class Sltv(gobject.GObject):
self._set_watermark_position(self.watermark_selected)
+ def set_videobalance_contrast(self, value):
+ self.videobalance_contrast = value
+ if self.playing():
+ self.videobalance.set_property("contrast", value)
+
+ def set_videobalance_brightness(self, value):
+ self.videobalance_brightness = value
+ if self.playing():
+ self.videobalance.set_property("brightness", value)
+
+ def set_videobalance_hue(self, value):
+ self.videobalance_hue = value
+ if self.playing():
+ self.videobalance.set_property("hue", value)
+
+ def set_videobalance_saturation(self, value):
+ self.videobalance_saturation = value
+ if self.playing():
+ self.videobalance.set_property("saturation", value)
+
def set_effect_name(self, effect_type, effect_name):
if effect_name == "none":
effect_name = "identity"
@@ -288,7 +313,31 @@ class Sltv(gobject.GObject):
"cairoimageoverlay", "cairoimageoverlay"
)
self.player.add(self.watermark)
- gst.element_link_many(self.pip, self.watermark, self.queue_video)
+
+ self.videobalance = gst.element_factory_make(
+ "videobalance", "videobalance"
+ )
+ self.player.add(self.videobalance)
+ if self.videobalance_contrast:
+ self.videobalance.set_property(
+ "contrast", self.videobalance_contrast
+ )
+ if self.videobalance_brightness:
+ self.videobalance.set_property(
+ "brightness", self.videobalance_brightness
+ )
+ if self.videobalance_hue:
+ self.videobalance.set_property(
+ "hue", self.videobalance_hue
+ )
+ if self.videobalance_saturation:
+ self.videobalance.set_property(
+ "saturation", self.videobalance_saturation
+ )
+
+ gst.element_link_many(
+ self.pip, self.watermark, self.videobalance, self.queue_video
+ )
self._switch_source()
self._switch_pip()
diff --git a/sltv/ui/Makefile.am b/sltv/ui/Makefile.am
index f2d2db7..571f839 100644
--- a/sltv/ui/Makefile.am
+++ b/sltv/ui/Makefile.am
@@ -27,6 +27,7 @@ sltvlib_DATA = \
audiosetting.py \
pip_widget.py \
metadata.py \
- watermark.py
+ watermark.py \
+ videobalance.py
EXTRA_DIST = $(sltvlib_DATA)
diff --git a/sltv/ui/settings.py b/sltv/ui/settings.py
index f4de61d..bc45a0e 100644
--- a/sltv/ui/settings.py
+++ b/sltv/ui/settings.py
@@ -21,6 +21,7 @@ from sltv.settings import UI_DIR
import effects
import overlay
import watermark
+import videobalance
class SettingsUI:
@@ -35,10 +36,14 @@ 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.videobalance = videobalance.VideoBalanceUI(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")
+ self.videobalance_button = self.interface.get_object(
+ "videobalance_toolbutton"
+ )
settings_group = gtk.ActionGroup("settings_group")
settings_actions = [
@@ -48,6 +53,8 @@ class SettingsUI:
"Overlay", 1),
("watermark_radioaction", "gtk-missing-image", "Watermark", None,
"Watermark", 2),
+ ("videobalance_radioaction", "gtk-missing-image", "VideoBalance", None,
+ "Video Balance", 3),
]
settings_group.add_radio_actions(
settings_actions, 0, self.on_settings_changed, None
@@ -68,6 +75,11 @@ class SettingsUI:
)
self.watermark_radioaction.connect_proxy(self.watermark_button)
+ self.videobalance_radioaction = settings_group.get_action(
+ "videobalance_radioaction"
+ )
+ self.videobalance_radioaction.connect_proxy(self.videobalance_button)
+
self.selected_box = self.effects.get_widget()
self.content.add(self.effects.get_widget())
@@ -83,6 +95,8 @@ class SettingsUI:
self.selected_box = self.overlay.get_widget()
elif name == "watermark_radioaction":
self.selected_box = self.watermark.get_widget()
+ elif name == "videobalance_radioaction":
+ self.selected_box = self.videobalance.get_widget()
else:
self.selected_box = None
diff --git a/sltv/ui/videobalance.py b/sltv/ui/videobalance.py
new file mode 100644
index 0000000..0d01187
--- /dev/null
+++ b/sltv/ui/videobalance.py
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2010 Holoscópio Tecnologia
+# Author: Luciana Fujii Pontello <luciana@holoscopio.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import gobject
+import gtk
+from sltv.settings import UI_DIR
+
+class VideoBalanceUI:
+
+ def __init__(self, ui, sltv):
+ self.ui = ui
+ self.sltv = sltv
+
+ self.interface = gtk.Builder()
+ self.interface.add_from_file(UI_DIR + "/videobalance.ui")
+ self.widget = self.interface.get_object("table1")
+ self.contrast_adjustment = gtk.Adjustment(1.0, 0, 2.0)
+ self.contrast_scale = gtk.HScale(self.contrast_adjustment)
+ self.contrast_scale.set_property("digits", 2)
+ self.widget.attach(self.contrast_scale, 1, 2, 0, 1)
+
+ self.brightness_adjustment = gtk.Adjustment(0, -1.0, 1.0)
+ self.brightness_scale = gtk.HScale(self.brightness_adjustment)
+ self.brightness_scale.set_property("digits", 2)
+ self.widget.attach(self.brightness_scale, 1, 2, 1, 2)
+
+ self.hue_adjustment = gtk.Adjustment(0, -1.0, 1.0)
+ self.hue_scale = gtk.HScale(self.hue_adjustment)
+ self.hue_scale.set_property("digits", 2)
+ self.widget.attach(self.hue_scale, 1, 2, 2, 3)
+
+ self.saturation_adjustment = gtk.Adjustment(1.0, 0, 2.0)
+ self.saturation_scale = gtk.HScale(self.saturation_adjustment)
+ self.saturation_scale.set_property("digits", 2)
+ self.widget.attach(self.saturation_scale, 1, 2, 3, 4)
+
+ self.widget.show_all()
+
+ self.contrast_scale.connect("value-changed", self._on_contrast_changed)
+ self.brightness_scale.connect("value-changed", self._on_brightness_changed)
+ self.hue_scale.connect("value-changed", self._on_hue_changed)
+ self.saturation_scale.connect("value-changed", self._on_saturation_changed)
+
+ def _on_contrast_changed(self, adjustment):
+ self.sltv.set_videobalance_contrast(self.contrast_scale.get_value())
+
+ def _on_brightness_changed(self, adjustment):
+ self.sltv.set_videobalance_brightness(self.brightness_scale.get_value())
+
+ def _on_hue_changed(self, adjustment):
+ self.sltv.set_videobalance_hue(self.hue_scale.get_value())
+
+ def _on_saturation_changed(self, adjustment):
+ self.sltv.set_videobalance_saturation(self.saturation_scale.get_value())
+
+ def get_widget(self):
+ return self.widget
diff --git a/ui/Makefile.am b/ui/Makefile.am
index ba78d2e..858e2f8 100644
--- a/ui/Makefile.am
+++ b/ui/Makefile.am
@@ -15,6 +15,7 @@ ui_DATA = edit.ui \
source.ui \
output.ui \
metadata.ui \
- watermark.ui
+ watermark.ui \
+ videobalance.ui
EXTRA_DIST = $(ui_DATA)
diff --git a/ui/settings.ui b/ui/settings.ui
index d4bb136..bbc0698 100644
--- a/ui/settings.ui
+++ b/ui/settings.ui
@@ -10,14 +10,15 @@
<property name="width_request">150</property>
<property name="visible">True</property>
<property name="orientation">vertical</property>
+ <property name="toolbar_style">text</property>
<property name="show_arrow">False</property>
- <property name="icon_size">2</property>
+ <property name="icon_size">0</property>
<child>
<object class="GtkRadioToolButton" id="effects_toolbutton">
<property name="visible">True</property>
<property name="label" translatable="yes">Effects</property>
<property name="use_underline">True</property>
- <property name="stock_id">gtk-missing-image</property>
+ <property name="stock_id">gtk-select-color</property>
</object>
<packing>
<property name="expand">False</property>
@@ -29,7 +30,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">Overlay</property>
<property name="use_underline">True</property>
- <property name="stock_id">gtk-missing-image</property>
+ <property name="stock_id">gtk-italic</property>
<property name="group">effects_toolbutton</property>
</object>
<packing>
@@ -50,6 +51,19 @@
<property name="homogeneous">True</property>
</packing>
</child>
+ <child>
+ <object class="GtkRadioToolButton" id="videobalance_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>
diff --git a/ui/videobalance.ui b/ui/videobalance.ui
new file mode 100644
index 0000000..bb36312
--- /dev/null
+++ b/ui/videobalance.ui
@@ -0,0 +1,64 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">5</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Contrast</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Brightness</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Hue</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Saturation</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+</interface>