[pitivi/ges] Add the ability to render video only or audio only



commit c012a2c03ac2bf35995fe2c26c2b623198df1eec
Author: Daniel Thul <daniel thul googlemail com>
Date:   Thu Apr 5 22:12:20 2012 +0200

    Add the ability to render video only or audio only
    
    Fixes bug #590639

 data/ui/renderingdialog.ui |   88 +++++++++++++++++++++++++++++++------------
 pitivi/render.py           |   61 ++++++++++++++++++++++++++----
 2 files changed, 115 insertions(+), 34 deletions(-)
---
diff --git a/data/ui/renderingdialog.ui b/data/ui/renderingdialog.ui
index 5095583..74c941c 100644
--- a/data/ui/renderingdialog.ui
+++ b/data/ui/renderingdialog.ui
@@ -100,7 +100,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="recordbutton">
+              <object class="GtkButton" id="render_button">
                 <property name="label">pitivi-render</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -191,9 +191,9 @@
                   <object class="GtkScrolledWindow" id="scrolledwindow2">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="shadow_type">in</property>
                     <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
                     <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <property name="shadow_type">in</property>
                     <child>
                       <object class="GtkTreeView" id="render_preset_treeview">
                         <property name="visible">True</property>
@@ -462,7 +462,7 @@
                       <object class="GtkTable" id="table3">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="n_rows">3</property>
+                        <property name="n_rows">4</property>
                         <property name="n_columns">2</property>
                         <property name="column_spacing">6</property>
                         <property name="row_spacing">6</property>
@@ -509,8 +509,8 @@
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
@@ -521,8 +521,8 @@
                             <property name="label" translatable="yes">Codec:</property>
                           </object>
                           <packing>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
                             <property name="x_options">GTK_FILL</property>
                           </packing>
                         </child>
@@ -547,8 +547,8 @@
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                           </packing>
                         </child>
                         <child>
@@ -619,6 +619,8 @@
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
                           </packing>
                         </child>
                         <child>
@@ -629,8 +631,8 @@
                             <property name="label" translatable="yes">Frame rate:</property>
                           </object>
                           <packing>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                             <property name="x_options">GTK_FILL</property>
                           </packing>
                         </child>
@@ -642,9 +644,26 @@
                             <property name="label" translatable="yes">Scale:</property>
                           </object>
                           <packing>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
                             <property name="x_options">GTK_FILL</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkCheckButton" id="video_output_checkbutton">
+                            <property name="label" translatable="yes">Enable video</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                            <signal name="toggled" handler="_videoOutputCheckbuttonToggledCb" swapped="no"/>
+                          </object>
+                          <packing>
+                            <property name="right_attach">2</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -678,7 +697,7 @@
                       <object class="GtkTable" id="table4">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="n_rows">4</property>
+                        <property name="n_rows">5</property>
                         <property name="n_columns">2</property>
                         <property name="column_spacing">6</property>
                         <property name="row_spacing">6</property>
@@ -725,8 +744,8 @@
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
                           </packing>
                         </child>
                         <child>
@@ -737,8 +756,8 @@
                             <property name="label" translatable="yes">Codec:</property>
                           </object>
                           <packing>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
                             <property name="x_options">GTK_FILL</property>
                           </packing>
                         </child>
@@ -758,6 +777,8 @@
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
                           </packing>
                         </child>
                         <child>
@@ -768,6 +789,8 @@
                             <property name="label" translatable="yes">Channels:</property>
                           </object>
                           <packing>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
                             <property name="x_options">GTK_FILL</property>
                           </packing>
                         </child>
@@ -779,8 +802,8 @@
                             <property name="label" translatable="yes">Sample rate:</property>
                           </object>
                           <packing>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                             <property name="x_options">GTK_FILL</property>
                           </packing>
                         </child>
@@ -792,8 +815,8 @@
                             <property name="label" translatable="yes">Sample depth:</property>
                           </object>
                           <packing>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
                             <property name="x_options">GTK_FILL</property>
                           </packing>
                         </child>
@@ -812,8 +835,8 @@
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                           </packing>
                         </child>
                         <child>
@@ -831,8 +854,23 @@
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="audio_output_checkbutton">
+                            <property name="label" translatable="yes">Enable audio</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                            <signal name="toggled" handler="_audioOutputCheckbuttonToggledCb" swapped="no"/>
+                          </object>
+                          <packing>
+                            <property name="right_attach">2</property>
                           </packing>
                         </child>
                       </object>
@@ -876,7 +914,7 @@
     </child>
     <action-widgets>
       <action-widget response="0">closebutton</action-widget>
-      <action-widget response="0">recordbutton</action-widget>
+      <action-widget response="0">render_button</action-widget>
     </action-widgets>
   </object>
 </interface>
diff --git a/pitivi/render.py b/pitivi/render.py
index 28efc02..b10cd75 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -755,6 +755,11 @@ class RenderDialog(Loggable):
         self.window = self.builder.get_object("render-dialog")
         self.selected_only_button = self.builder.get_object(
             "selected_only_button")
+        self.video_output_checkbutton = self.builder.get_object("video_output_checkbutton")
+        self.audio_output_checkbutton = self.builder.get_object("audio_output_checkbutton")
+        self.render_button = self.builder.get_object("render_button")
+        self.video_settings_button = self.builder.get_object("video_settings_button")
+        self.audio_settings_button = self.builder.get_object("audio_settings_button")
         self.frame_rate_combo = self.builder.get_object("frame_rate_combo")
         self.scale_spinbutton = self.builder.get_object("scale_spinbutton")
         self.channels_combo = self.builder.get_object("channels_combo")
@@ -966,16 +971,20 @@ class RenderDialog(Loggable):
         self.window.hide()  # Hide the rendering settings dialog while rendering
 
         # FIXME GES: Handle presets here!
-        # FIXME: Handle audio-only or video-only here
         self.containerprofile = gst.pbutils.EncodingContainerProfile(None, None,
-                gst.Caps(self.muxertype), None)
-        self.videoprofile = gst.pbutils.EncodingVideoProfile(gst.Caps(self.videotype),
-                None, self.settings.getVideoCaps(True), 0)
-        self.audioprofile = gst.pbutils.EncodingAudioProfile(gst.Caps(self.audiotype), None,
-                self.settings.getAudioCaps(), 0)
-
-        self.containerprofile.add_profile(self.videoprofile)
-        self.containerprofile.add_profile(self.audioprofile)
+                                    gst.Caps(self.muxertype), None)
+
+        if self.video_output_checkbutton.get_active():
+            self.videoprofile = gst.pbutils.EncodingVideoProfile(
+                                    gst.Caps(self.videotype), None,
+                                    self.settings.getVideoCaps(True), 0)
+            self.containerprofile.add_profile(self.videoprofile)
+        if self.audio_output_checkbutton.get_active():
+            self.audioprofile = gst.pbutils.EncodingAudioProfile(
+                                    gst.Caps(self.audiotype), None,
+                                    self.settings.getAudioCaps(), 0)
+            self.containerprofile.add_profile(self.audioprofile)
+
         self._pipeline.set_render_settings(self.outfile, self.containerprofile)
         self.startAction()
         self.progress.window.show()
@@ -1054,6 +1063,40 @@ class RenderDialog(Loggable):
                                          depth=settings.audiodepth)
         self._displaySettings()
 
+    def _audioOutputCheckbuttonToggledCb(self, audio):
+        active = self.audio_output_checkbutton.get_active()
+        if active:
+            self.channels_combo.set_sensitive(True)
+            self.sample_rate_combo.set_sensitive(True)
+            self.sample_depth_combo.set_sensitive(True)
+            self.audio_encoder_combo.set_sensitive(True)
+            self.audio_settings_button.set_sensitive(True)
+            self.render_button.set_sensitive(True)
+        else:
+            self.channels_combo.set_sensitive(False)
+            self.sample_rate_combo.set_sensitive(False)
+            self.sample_depth_combo.set_sensitive(False)
+            self.audio_encoder_combo.set_sensitive(False)
+            self.audio_settings_button.set_sensitive(False)
+            if not self.video_output_checkbutton.get_active():
+                self.render_button.set_sensitive(False)
+
+    def _videoOutputCheckbuttonToggledCb(self, video):
+        active = self.video_output_checkbutton.get_active()
+        if active:
+            self.scale_spinbutton.set_sensitive(True)
+            self.frame_rate_combo.set_sensitive(True)
+            self.video_encoder_combo.set_sensitive(True)
+            self.video_settings_button.set_sensitive(True)
+            self.render_button.set_sensitive(True)
+        else:
+            self.scale_spinbutton.set_sensitive(False)
+            self.frame_rate_combo.set_sensitive(False)
+            self.video_encoder_combo.set_sensitive(False)
+            self.video_settings_button.set_sensitive(False)
+            if not self.audio_output_checkbutton.get_active():
+                self.render_button.set_sensitive(False)
+
     def _frameRateComboChangedCb(self, combo):
         framerate = get_combo_value(combo)
         self.settings.setVideoProperties(framerate=framerate)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]