OSDN Git Service

LinGui: first cut at anamorphic picture settings enhancements
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 13 Apr 2009 21:26:18 +0000 (21:26 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 13 Apr 2009 21:26:18 +0000 (21:26 +0000)
git-svn-id: svn://localhost/HandBrake/trunk@2325 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/callbacks.c
gtk/src/ghb.ui
gtk/src/hb-backend.c
gtk/src/internal_defaults.xml
gtk/src/main.c
gtk/src/makedeps.c
gtk/src/presets.c
gtk/src/preview.h
gtk/src/queuehandler.c

index 36f78f7..61b6bf8 100644 (file)
@@ -1031,10 +1031,11 @@ show_title_info(signal_user_data_t *ud, ghb_title_info_t *tinfo)
        ghb_ui_update(ud, "scale_width", 
                ghb_int64_value(tinfo->width - tinfo->crop[2] - tinfo->crop[3]));
        // If anamorphic or keep_aspect, the hight will be automatically calculated
-       gboolean keep_aspect, anamorphic;
+       gboolean keep_aspect;
+       gint pic_par;
        keep_aspect = ghb_settings_get_boolean(ud->settings, "PictureKeepRatio");
-       anamorphic = ghb_settings_get_boolean(ud->settings, "anamorphic");
-       if (!(keep_aspect || anamorphic))
+       pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
+       if (!(keep_aspect || pic_par) || pic_par == 3)
        {
                ghb_ui_update(ud, "scale_height", 
                        ghb_int64_value(tinfo->height - tinfo->crop[0] - tinfo->crop[1]));
@@ -1341,7 +1342,24 @@ scale_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
        text = ghb_settings_get_boolean(ud->settings, "autoscale") ? "On" : "Off";
        widget = GHB_WIDGET (ud->builder, "scale_auto");
        gtk_label_set_text (GTK_LABEL(widget), text);
-       text = ghb_settings_get_boolean(ud->settings, "anamorphic") ? "On" : "Off";
+       switch (ghb_settings_combo_int(ud->settings, "PicturePAR"))
+       {
+               case 0:
+                       text = "Off";
+                       break;
+               case 1:
+                       text = "Strict";
+                       break;
+               case 2:
+                       text = "Loose";
+                       break;
+               case 3:
+                       text = "Custom";
+                       break;
+               default:
+                       text = "Unknown";
+                       break;
+       }
        widget = GHB_WIDGET (ud->builder, "scale_anamorphic");
        gtk_label_set_text (GTK_LABEL(widget), text);
 }
index d9e6c20..e4cc7be 100644 (file)
     <property name="page_size">0</property>
     <property name="value">1</property>
   </object>
+  <object class="GtkAdjustment" id="adjustment25">
+    <property name="upper">2000</property>
+    <property name="lower">0</property>
+    <property name="page_increment">16</property>
+    <property name="step_increment">1</property>
+    <property name="page_size">0</property>
+    <property name="value">0</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment26">
+    <property name="upper">1200</property>
+    <property name="lower">0</property>
+    <property name="page_increment">16</property>
+    <property name="step_increment">1</property>
+    <property name="page_size">0</property>
+    <property name="value">0</property>
+  </object>
   <object class="GtkAdjustment" id="preview_progress_adj">
     <property name="upper">100</property>
     <property name="lower">0</property>
@@ -4125,7 +4141,7 @@ location as the movie.</property>
             <property name="top_padding">6</property>
             <property name="bottom_padding">6</property>
             <child>
-              <object class="GtkVBox" id="vbox5">
+              <object class="GtkHBox" id="hbox75">
                 <property name="visible">True</property>
                 <child>
                   <object class="GtkFrame" id="Cropping2">
@@ -4264,7 +4280,21 @@ location as the movie.</property>
                               </packing>
                             </child>
                             <child>
-                              <placeholder/>
+                              <object class="GtkCheckButton" id="PictureAutoCrop">
+                                <property name="label" translatable="yes">Auto Crop</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="draw_indicator">True</property>
+                                <signal name="toggled" handler="scale_changed_cb"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">0</property>
+                                <property name="bottom_attach">1</property>
+                              </packing>
                             </child>
                             <child>
                               <placeholder/>
@@ -4320,20 +4350,6 @@ location as the movie.</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
-                        <child>
-                          <object class="GtkCheckButton" id="PictureAutoCrop">
-                            <property name="label" translatable="yes">Auto Crop</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                            <property name="draw_indicator">True</property>
-                            <signal name="toggled" handler="scale_changed_cb"/>
-                          </object>
-                          <packing>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
                       </object>
                     </child>
                     <child type="label">
@@ -4454,24 +4470,214 @@ location as the movie.</property>
                               </packing>
                             </child>
                             <child>
+                              <object class="GtkHBox" id="hbox20">
+                                <property name="visible">True</property>
+                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="spacing">5</property>
+                                <child>
+                                  <object class="GtkLabel" id="label96">
+                                    <property name="visible">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">Anamorphic:</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkComboBox" id="PicturePAR">
+                                    <property name="visible">True</property>
+                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <signal name="changed" handler="scale_changed_cb"/>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                            <child>
                               <object class="GtkHBox" id="hbox72">
                                 <property name="visible">True</property>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="spacing">5</property>
+                                <child>
+                                  <object class="GtkLabel" id="label95">
+                                    <property name="visible">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">Alignment:</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
                                 <child>
-                                  <object class="GtkCheckButton" id="ModDimensions">
-                                    <property name="label" translatable="yes">Align Dimensions (mod 16)</property>
+                                  <object class="GtkComboBox" id="PictureAlignment">
+                                    <property name="visible">True</property>
+                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <signal name="changed" handler="scale_changed_cb"/>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">3</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label29">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label" translatable="yes">&lt;b&gt;Storage&lt;/b&gt;</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="padding">2</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkFrame" id="frame4">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment7">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="top_padding">6</property>
+                        <property name="bottom_padding">2</property>
+                        <property name="left_padding">12</property>
+                        <property name="right_padding">2</property>
+                        <child>
+                          <object class="GtkVBox" id="vbox10">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="spacing">2</property>
+                            <child>
+                              <object class="GtkHBox" id="hbox52">
+                                <property name="visible">True</property>
+                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="spacing">4</property>
+                                <child>
+                                  <object class="GtkLabel" id="label91">
+                                    <property name="visible">True</property>
+                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="label" translatable="yes">width:</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkSpinButton" id="PictureDisplayWidth">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="draw_indicator">True</property>
-                                    <signal name="toggled" handler="scale_changed_cb"/>
+                                    <property name="adjustment">adjustment25</property>
+                                    <property name="snap_to_ticks">True</property>
+                                    <signal name="value_changed" handler="scale_changed_cb"/>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="label92">
+                                    <property name="visible">True</property>
+                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="label" translatable="yes">height:</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkSpinButton" id="PictureDisplayHeight">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="adjustment">adjustment26</property>
+                                    <signal name="value_changed" handler="scale_changed_cb"/>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">3</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkCheckButton" id="PictureKeepRatio">
+                                <property name="label" translatable="yes">Keep Aspect</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                                <signal name="toggled" handler="scale_changed_cb"/>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkHBox" id="hbox53">
+                                <property name="visible">True</property>
+                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="spacing">4</property>
+                                <child>
+                                  <object class="GtkLabel" id="label93">
+                                    <property name="width_request">100</property>
+                                    <property name="xalign">0</property>
+                                    <property name="visible">True</property>
+                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="label" translatable="yes">Display Aspect:</property>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <object class="GtkLabel" id="display_aspect">
+                                    <property name="visible">True</property>
+                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="label" translatable="yes">--:--</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
@@ -4479,20 +4685,17 @@ location as the movie.</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkHBox" id="hbox20">
+                              <object class="GtkHBox" id="hbox76">
                                 <property name="visible">True</property>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                <property name="spacing">5</property>
+                                <property name="spacing">4</property>
                                 <child>
-                                  <object class="GtkCheckButton" id="anamorphic">
-                                    <property name="label" translatable="yes">Anamorphic</property>
+                                  <object class="GtkLabel" id="label94">
+                                    <property name="width_request">100</property>
+                                    <property name="xalign">0</property>
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="active">True</property>
-                                    <property name="draw_indicator">True</property>
-                                    <signal name="toggled" handler="scale_changed_cb"/>
+                                    <property name="label" translatable="yes">Pixel Aspect:</property>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
@@ -4500,15 +4703,10 @@ location as the movie.</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkCheckButton" id="PictureKeepRatio">
-                                    <property name="label" translatable="yes">Keep Aspect</property>
+                                  <object class="GtkLabel" id="pixel_aspect">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="active">True</property>
-                                    <property name="draw_indicator">True</property>
-                                    <signal name="toggled" handler="scale_changed_cb"/>
+                                    <property name="label" translatable="yes">--:--</property>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
@@ -4529,7 +4727,7 @@ location as the movie.</property>
                       <object class="GtkLabel" id="label29">
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="label" translatable="yes">&lt;b&gt;Scaling&lt;/b&gt;</property>
+                        <property name="label" translatable="yes">&lt;b&gt;Display&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
                       </object>
                     </child>
@@ -4537,7 +4735,7 @@ location as the movie.</property>
                   <packing>
                     <property name="expand">False</property>
                     <property name="padding">2</property>
-                    <property name="position">1</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
               </object>
@@ -4559,22 +4757,12 @@ location as the movie.</property>
             <property name="visible">True</property>
             <property name="top_padding">6</property>
             <property name="bottom_padding">6</property>
+            <property name="left_padding">6</property>
+            <property name="right_padding">6</property>
             <child>
-              <object class="GtkVBox" id="vbox4">
+              <object class="GtkHBox" id="hbox77">
                 <property name="visible">True</property>
-                <child>
-                  <object class="GtkFrame" id="frame17">
-                    <property name="visible">True</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label_xalign">0</property>
-                    <property name="shadow_type">none</property>
-                    <child>
-                      <object class="GtkAlignment" id="alignment8">
-                        <property name="visible">True</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="top_padding">6</property>
-                        <property name="bottom_padding">2</property>
-                        <property name="left_padding">12</property>
+                <property name="spacing">16</property>
                         <child>
                           <object class="GtkVBox" id="vbox8">
                             <property name="visible">True</property>
@@ -4590,6 +4778,7 @@ location as the movie.</property>
                                 <signal name="toggled" handler="setting_widget_changed_cb"/>
                               </object>
                               <packing>
+                                <property name="expand">False</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
@@ -4602,7 +4791,7 @@ location as the movie.</property>
                             <child>
                               <object class="GtkTable" id="table90">
                                 <property name="visible">True</property>
-                                <property name="n_rows">2</property>
+                                <property name="n_rows">3</property>
                                 <property name="n_columns">2</property>
                                 <property name="column_spacing">5</property>
 
@@ -4629,10 +4818,10 @@ location as the movie.</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkLabel" id="label56">
+                                  <object class="GtkLabel" id="label32">
                                     <property name="visible">True</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">Detelecine:</property>
+                                    <property name="label" translatable="yes">Denoise:</property>
                                   </object>
                                   <packing>
                                     <property name="top_attach">1</property>
@@ -4640,7 +4829,7 @@ location as the movie.</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkComboBox" id="PictureDetelecine">
+                                  <object class="GtkComboBox" id="PictureDenoise">
                                     <property name="width_request">100</property>
                                     <property name="visible">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -4657,10 +4846,10 @@ location as the movie.</property>
                                   <placeholder/>
                                 </child>
                                 <child>
-                                  <object class="GtkEntry" id="PictureDetelecineCustom">
+                                  <object class="GtkEntry" id="PictureDenoiseCustom">
                                     <property name="width_chars">8</property>
-                                    <property name="tooltip-text" translatable="yes">Custom detelecine filter string format
-       JunkLeft:JunkRight:JunkTop:JunkBottom:StrictBreaks:MetricPlane</property>
+                                    <property name="tooltip-text" translatable="yes">Custom denoise filter string format
+       SpatialLuma:SpatialChroma:TemporalLuma:TemporalChroma</property>
                                     <signal name="changed" handler="setting_widget_changed_cb"/>
                                   </object>
                                   <packing>
@@ -4670,28 +4859,58 @@ location as the movie.</property>
                                     <property name="right_attach">2</property>
                                   </packing>
                                 </child>
+                              </object>
+                            </child>
+
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="padding">2</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkVBox" id="vbox39">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <child>
+                              <object class="GtkAlignment" id="alignment45">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="yalign">0</property>
+                                <property name="xscale">0</property>
+                                <property name="yscale">0</property>
+
+                            <child>
+                              <object class="GtkTable" id="table10">
+                                <property name="visible">True</property>
+                                <property name="n_rows">6</property>
+                                <property name="n_columns">2</property>
+                                <property name="column_spacing">5</property>
 
                                 <child>
                                   <object class="GtkLabel" id="label56">
                                     <property name="visible">True</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">Decomb:</property>
+                                    <property name="label" translatable="yes">Detelecine:</property>
                                   </object>
-                                  <packing>
-                                    <property name="top_attach">3</property>
-                                    <property name="bottom_attach">4</property>
-                                  </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkComboBox" id="PictureDecomb">
+                                  <object class="GtkComboBox" id="PictureDetelecine">
                                     <property name="width_request">100</property>
                                     <property name="visible">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                     <signal name="changed" handler="setting_widget_changed_cb"/>
                                   </object>
                                   <packing>
-                                    <property name="top_attach">3</property>
-                                    <property name="bottom_attach">4</property>
+                                    <property name="top_attach">0</property>
+                                    <property name="bottom_attach">1</property>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
                                   </packing>
@@ -4700,41 +4919,41 @@ location as the movie.</property>
                                   <placeholder/>
                                 </child>
                                 <child>
-                                  <object class="GtkEntry" id="PictureDecombCustom">
+                                  <object class="GtkEntry" id="PictureDetelecineCustom">
                                     <property name="width_chars">8</property>
-                                    <property name="tooltip-text" translatable="yes">Custom decomb filter string format
-       Mode:SpatialMetric:MotionThresh:SpatialThresh:BlockThresh:BlockWidth:BlockHeight</property>
+                                    <property name="tooltip-text" translatable="yes">Custom detelecine filter string format
+       JunkLeft:JunkRight:JunkTop:JunkBottom:StrictBreaks:MetricPlane</property>
                                     <signal name="changed" handler="setting_widget_changed_cb"/>
                                   </object>
                                   <packing>
-                                    <property name="top_attach">4</property>
-                                    <property name="bottom_attach">5</property>
+                                    <property name="top_attach">1</property>
+                                    <property name="bottom_attach">2</property>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
                                   </packing>
                                 </child>
 
                                 <child>
-                                  <object class="GtkLabel" id="label31">
+                                  <object class="GtkLabel" id="label56">
                                     <property name="visible">True</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">Deinterlace:</property>
+                                    <property name="label" translatable="yes">Decomb:</property>
                                   </object>
                                   <packing>
-                                    <property name="top_attach">5</property>
-                                    <property name="bottom_attach">6</property>
+                                    <property name="top_attach">2</property>
+                                    <property name="bottom_attach">3</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkComboBox" id="PictureDeinterlace">
+                                  <object class="GtkComboBox" id="PictureDecomb">
                                     <property name="width_request">100</property>
                                     <property name="visible">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                     <signal name="changed" handler="setting_widget_changed_cb"/>
                                   </object>
                                   <packing>
-                                    <property name="top_attach">5</property>
-                                    <property name="bottom_attach">6</property>
+                                    <property name="top_attach">2</property>
+                                    <property name="bottom_attach">3</property>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
                                   </packing>
@@ -4743,40 +4962,41 @@ location as the movie.</property>
                                   <placeholder/>
                                 </child>
                                 <child>
-                                  <object class="GtkEntry" id="PictureDeinterlaceCustom">
+                                  <object class="GtkEntry" id="PictureDecombCustom">
                                     <property name="width_chars">8</property>
-                                    <property name="tooltip-text" translatable="yes">Custom deinterlace filter string format
-       YadifMode:YadifParity:McdintMode:McdeintOp</property>
+                                    <property name="tooltip-text" translatable="yes">Custom decomb filter string format
+       Mode:SpatialMetric:MotionThresh:SpatialThresh:BlockThresh:BlockWidth:BlockHeight</property>
                                     <signal name="changed" handler="setting_widget_changed_cb"/>
                                   </object>
                                   <packing>
-                                    <property name="top_attach">6</property>
-                                    <property name="bottom_attach">7</property>
+                                    <property name="top_attach">3</property>
+                                    <property name="bottom_attach">4</property>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
                                   </packing>
                                 </child>
+
                                 <child>
-                                  <object class="GtkLabel" id="label32">
+                                  <object class="GtkLabel" id="label31">
                                     <property name="visible">True</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">Denoise:</property>
+                                    <property name="label" translatable="yes">Deinterlace:</property>
                                   </object>
                                   <packing>
-                                    <property name="top_attach">7</property>
-                                    <property name="bottom_attach">8</property>
+                                    <property name="top_attach">4</property>
+                                    <property name="bottom_attach">5</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkComboBox" id="PictureDenoise">
+                                  <object class="GtkComboBox" id="PictureDeinterlace">
                                     <property name="width_request">100</property>
                                     <property name="visible">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                     <signal name="changed" handler="setting_widget_changed_cb"/>
                                   </object>
                                   <packing>
-                                    <property name="top_attach">7</property>
-                                    <property name="bottom_attach">8</property>
+                                    <property name="top_attach">4</property>
+                                    <property name="bottom_attach">5</property>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
                                   </packing>
@@ -4785,15 +5005,15 @@ location as the movie.</property>
                                   <placeholder/>
                                 </child>
                                 <child>
-                                  <object class="GtkEntry" id="PictureDenoiseCustom">
+                                  <object class="GtkEntry" id="PictureDeinterlaceCustom">
                                     <property name="width_chars">8</property>
-                                    <property name="tooltip-text" translatable="yes">Custom denoise filter string format
-       SpatialLuma:SpatialChroma:TemporalLuma:TemporalChroma</property>
+                                    <property name="tooltip-text" translatable="yes">Custom deinterlace filter string format
+       YadifMode:YadifParity:McdintMode:McdeintOp</property>
                                     <signal name="changed" handler="setting_widget_changed_cb"/>
                                   </object>
                                   <packing>
-                                    <property name="top_attach">8</property>
-                                    <property name="bottom_attach">9</property>
+                                    <property name="top_attach">5</property>
+                                    <property name="bottom_attach">6</property>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
                                   </packing>
@@ -4808,24 +5028,12 @@ location as the movie.</property>
                               </packing>
                             </child>
                           </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="padding">2</property>
+                            <property name="position">1</property>
+                          </packing>
                         </child>
-                      </object>
-                    </child>
-                    <child type="label">
-                      <object class="GtkLabel" id="label66">
-                        <property name="visible">True</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="label" translatable="yes"></property>
-                        <property name="use_markup">True</property>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="padding">2</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
               </object>
             </child>
           </object>
index 97fcd04..5a1bc13 100644 (file)
@@ -63,6 +63,33 @@ static const gchar *index_str[] =
        "10",
 };
 
+static options_map_t d_par_opts[] =
+{
+       {"Off", "0", 0, "0"},
+       {"Strict", "1", 1, "1"},
+       {"Loose", "2", 2, "2"},
+       {"Custom", "3", 3, "3"},
+};
+combo_opts_t par_opts =
+{
+       sizeof(d_par_opts)/sizeof(options_map_t),
+       d_par_opts
+};
+
+static options_map_t d_alignment_opts[] =
+{
+       {"1", "1", 1, "1"},
+       {"2", "2", 2, "2"},
+       {"4", "4", 4, "4"},
+       {"8", "8", 8, "8"},
+       {"16", "16", 16, "16"},
+};
+combo_opts_t alignment_opts =
+{
+       sizeof(d_alignment_opts)/sizeof(options_map_t),
+       d_alignment_opts
+};
+
 static options_map_t d_logging_opts[] =
 {
        {"0", "0", 0, "0"},
@@ -286,6 +313,8 @@ typedef struct
 
 combo_name_map_t combo_name_map[] =
 {
+       {"PicturePAR", &par_opts},
+       {"PictureAlignment", &alignment_opts},
        {"LoggingLevel", &logging_opts},
        {"VideoQualityGranularity", &vqual_granularity_opts},
        {"FileFormat", &container_opts},
@@ -1980,6 +2009,8 @@ ghb_update_ui_combo_box(GtkBuilder *builder, const gchar *name, gint user_data,
                title_opts_set(builder, "title");
                audio_track_opts_set(builder, "AudioTrack", user_data);
                generic_opts_set(builder, "VideoQualityGranularity", &vqual_granularity_opts);
+               generic_opts_set(builder, "PicturePAR", &par_opts);
+               generic_opts_set(builder, "PictureAlignment", &alignment_opts);
                generic_opts_set(builder, "LoggingLevel", &logging_opts);
                generic_opts_set(builder, "FileFormat", &container_opts);
                generic_opts_set(builder, "PictureDeinterlace", &deint_opts);
@@ -2544,13 +2575,49 @@ ghb_get_default_acodec()
        return HB_ACODEC_FAAC;
 }
 
+static void
+picture_settings_deps(signal_user_data_t *ud)
+{
+       gboolean autoscale, keep_aspect;
+       gboolean enable_scale_width, enable_scale_height;
+       gboolean enable_disp_width, enable_disp_height;
+       gint pic_par, disp_width, disp_height, scale_width, scale_height;
+
+       pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
+       keep_aspect = ghb_settings_get_boolean(ud->settings, "PictureKeepRatio");
+       autoscale = ghb_settings_get_boolean(ud->settings, "autoscale");
+       disp_width = ghb_settings_get_int(ud->settings, "PictureDisplayWidth");
+       disp_height = ghb_settings_get_int(ud->settings, "PictureDisplayHeight");
+       scale_width = ghb_settings_get_int(ud->settings, "scale_width");
+       scale_height = ghb_settings_get_int(ud->settings, "scale_height");
+
+       enable_scale_width = !autoscale && (pic_par != 1);
+       enable_scale_height = !autoscale &&
+               ((pic_par == 0 && !keep_aspect) || (pic_par == 3));
+       enable_disp_width = (pic_par == 3) && !keep_aspect &&
+               (disp_height == scale_height);
+       enable_disp_height = (pic_par == 3) && !keep_aspect &&
+               (disp_width == scale_width);
+
+       GtkWidget *widget;
+       widget = GHB_WIDGET(ud->builder, "scale_width");
+       gtk_widget_set_sensitive(widget, enable_scale_width);
+       widget = GHB_WIDGET(ud->builder, "scale_height");
+       gtk_widget_set_sensitive(widget, enable_scale_height);
+       widget = GHB_WIDGET(ud->builder, "PictureDisplayWidth");
+       gtk_widget_set_sensitive(widget, enable_disp_width);
+       widget = GHB_WIDGET(ud->builder, "PictureDisplayHeight");
+       gtk_widget_set_sensitive(widget, enable_disp_height);
+}
+
 void
 ghb_set_scale(signal_user_data_t *ud, gint mode)
 {
        hb_list_t  * list;
        hb_title_t * title;
        hb_job_t   * job;
-       gboolean keep_aspect, round_dims, anamorphic;
+       gboolean keep_aspect;
+       gint pic_par;
        gboolean autocrop, autoscale, noscale;
        gint crop[4], width, height, par_width, par_height;
        gint crop_width, crop_height;
@@ -2581,8 +2648,8 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
        if (job == NULL) return;
        
        // First configure widgets
-       round_dims = ghb_settings_get_boolean(ud->settings, "ModDimensions");
-       anamorphic = ghb_settings_get_boolean(ud->settings, "anamorphic");
+       mod = ghb_settings_combo_int(ud->settings, "PictureAlignment");
+       pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
        keep_aspect = ghb_settings_get_boolean(ud->settings, "PictureKeepRatio");
        autocrop = ghb_settings_get_boolean(ud->settings, "PictureAutoCrop");
        autoscale = ghb_settings_get_boolean(ud->settings, "autoscale");
@@ -2592,7 +2659,6 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
        // Align dimensions to either 16 or 2 pixels
        // The scaler crashes if the dimensions are not divisible by 2
        // x264 also will not accept dims that are not multiple of 2
-       mod = round_dims ? 16 : 2;
        if (autoscale)
        {
                keep_width = FALSE;
@@ -2603,50 +2669,89 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
                keep_height = FALSE;
        }
        // Step needs to be at least 2 because odd widths cause scaler crash
-       step = round_dims ? 16 : 2;
+       step = mod;
        widget = GHB_WIDGET (ud->builder, "scale_width");
-       gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 16);
+       gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, mod);
        widget = GHB_WIDGET (ud->builder, "scale_height");
-       gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 16);
-       if (autocrop)
+       gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, mod);
+       if (mod == 1)
+       {
+               widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
+               gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 2);
+               widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
+               gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 2);
+               widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
+               gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 2);
+               widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
+               gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 2);
+       }
+       else
        {
-               ghb_title_info_t tinfo;
-
-               if (ghb_get_title_info (&tinfo, titleindex))
+               widget = GHB_WIDGET (ud->builder, "PictureTopCrop");
+               gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 1);
+               widget = GHB_WIDGET (ud->builder, "PictureBottomCrop");
+               gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 1);
+               widget = GHB_WIDGET (ud->builder, "PictureLeftCrop");
+               gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 1);
+               widget = GHB_WIDGET (ud->builder, "PictureRightCrop");
+               gtk_spin_button_set_increments (GTK_SPIN_BUTTON(widget), step, 1);
+       }
+       ghb_title_info_t tinfo;
+       if (autocrop && ghb_get_title_info (&tinfo, titleindex))
+       {
+               crop[0] = tinfo.crop[0];
+               crop[1] = tinfo.crop[1];
+               crop[2] = tinfo.crop[2];
+               crop[3] = tinfo.crop[3];
+               if (noscale)
                {
-                       crop[0] = tinfo.crop[0];
-                       crop[1] = tinfo.crop[1];
-                       crop[2] = tinfo.crop[2];
-                       crop[3] = tinfo.crop[3];
-                       if (noscale)
-                       {
-                               gint need1, need2;
-
-                               // Adjust the cropping to accomplish the desired width and height
-                               crop_width = tinfo.width - crop[2] - crop[3];
-                               crop_height = tinfo.height - crop[0] - crop[1];
-                               width = MOD_ROUND(crop_width, mod);
-                               height = MOD_ROUND(crop_height, mod);
-
-                               need1 = (crop_height - height) / 2;
-                               need2 = crop_height - height - need1;
-                               crop[0] += need1;
-                               crop[1] += need2;
-                               need1 = (crop_width - width) / 2;
-                               need2 = crop_width - width - need1;
-                               crop[2] += need1;
-                               crop[3] += need2;
-                       }
+                       gint need1, need2;
+
+                       // Adjust the cropping to accomplish the desired width and height
+                       crop_width = tinfo.width - crop[2] - crop[3];
+                       crop_height = tinfo.height - crop[0] - crop[1];
+                       width = MOD_ROUND(crop_width, mod);
+                       height = MOD_ROUND(crop_height, mod);
+
+                       need1 = (crop_height - height) / 2;
+                       need2 = crop_height - height - need1;
+                       crop[0] += need1;
+                       crop[1] += need2;
+                       need1 = (crop_width - width) / 2;
+                       need2 = crop_width - width - need1;
+                       crop[2] += need1;
+                       crop[3] += need2;
+               }
+               if (mod == 1)
+               {
+                       crop[0] = MOD_UP(crop[0], 2);
+                       crop[1] = MOD_UP(crop[1], 2);
+                       crop[2] = MOD_UP(crop[2], 2);
+                       crop[3] = MOD_UP(crop[3], 2);
+               }
+               ghb_ui_update(ud, "PictureTopCrop", ghb_int64_value(crop[0]));
+               ghb_ui_update(ud, "PictureBottomCrop", ghb_int64_value(crop[1]));
+               ghb_ui_update(ud, "PictureLeftCrop", ghb_int64_value(crop[2]));
+               ghb_ui_update(ud, "PictureRightCrop", ghb_int64_value(crop[3]));
+       }
+       else
+       {
+               crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
+               crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
+               crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
+               crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
+               if (mod == 1)
+               {
+                       crop[0] = MOD_UP(crop[0], 2);
+                       crop[1] = MOD_UP(crop[1], 2);
+                       crop[2] = MOD_UP(crop[2], 2);
+                       crop[3] = MOD_UP(crop[3], 2);
                        ghb_ui_update(ud, "PictureTopCrop", ghb_int64_value(crop[0]));
                        ghb_ui_update(ud, "PictureBottomCrop", ghb_int64_value(crop[1]));
                        ghb_ui_update(ud, "PictureLeftCrop", ghb_int64_value(crop[2]));
                        ghb_ui_update(ud, "PictureRightCrop", ghb_int64_value(crop[3]));
                }
        }
-       crop[0] = ghb_settings_get_int(ud->settings, "PictureTopCrop");
-       crop[1] = ghb_settings_get_int(ud->settings, "PictureBottomCrop");
-       crop[2] = ghb_settings_get_int(ud->settings, "PictureLeftCrop");
-       crop[3] = ghb_settings_get_int(ud->settings, "PictureRightCrop");
        hb_reduce(&aspect_n, &aspect_d, 
                                title->width * title->pixel_aspect_width, 
                                title->height * title->pixel_aspect_height);
@@ -2669,11 +2774,11 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
        // Adjust dims according to max values
        if (!max_height)
        {
-               max_height = MOD_DOWN(title->height, mod);
+               max_height = MOD_DOWN(crop_height, mod);
        }
        if (!max_width)
        {
-               max_width = MOD_DOWN(title->width, mod);
+               max_width = MOD_DOWN(crop_width, mod);
        }
        // Align max dims 
        g_debug("max_width %d, max_height %d\n", max_width, max_height);
@@ -2690,12 +2795,12 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
        if (max_width)
                width = MIN(width, max_width);
 
-       if (anamorphic)
+       if (pic_par)
        {
-               job->anamorphic.mode = autoscale || keep_aspect ? 2 : 3;
+               job->anamorphic.mode = pic_par;
                // The scaler crashes if the dimensions are not divisible by 2
                // Align mod 2.  And so does something in x264_encoder_headers()
-               job->anamorphic.modulus = round_dims ? 16 : 2;
+               job->anamorphic.modulus = mod;
                job->width = width;
                job->height = height;
                if (max_width) 
@@ -2704,12 +2809,34 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
                        job->maxHeight = max_height;
                job->crop[0] = crop[0]; job->crop[1] = crop[1];
                job->crop[2] = crop[2]; job->crop[3] = crop[3];
+               if (job->anamorphic.mode == 3 && !keep_aspect)
+               {
+                       gint dar_width, dar_height;
+                       dar_width = ghb_settings_get_int(ud->settings, "PictureDisplayWidth");
+                       dar_height = ghb_settings_get_int(ud->settings, "PictureDisplayHeight");
+                       if (dar_width > width)
+                               dar_height = height;
+                       else if (dar_height > height)
+                               dar_width = width;
+                       else
+                       {
+                               dar_width = width;
+                               dar_height = height;
+                       }
+                       job->anamorphic.dar_width = dar_width;
+                       job->anamorphic.dar_height = dar_height;
+               }
+               else
+               {
+                       job->anamorphic.dar_width = 0;
+                       job->anamorphic.dar_height = 0;
+               }
                hb_set_anamorphic_size( job, &width, &height, 
                                                                &par_width, &par_height );
        }
        else 
        {
-               job->anamorphic.mode = 0;
+               job->anamorphic.mode = pic_par;
                if (keep_aspect)
                {
                        gdouble par;
@@ -2756,9 +2883,42 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
                        height = MIN(height, max_height);
                if (max_width)
                        width = MIN(width, max_width);
+               par_width = par_height = 1;
        }
        ghb_ui_update(ud, "scale_width", ghb_int64_value(width));
        ghb_ui_update(ud, "scale_height", ghb_int64_value(height));
+
+       gint disp_width, disp_height, dar_width, dar_height;
+       gchar *str;
+
+       disp_width = width;
+       disp_height = height;
+       if (par_width >= par_height)
+       {
+               disp_width = par_width * width / par_height;
+       }
+       else
+       {
+               disp_height = par_height * height / par_width;
+       }
+       hb_reduce(&dar_width, &dar_height, disp_width, disp_height);
+               
+       if (dar_width > 2 * dar_height)
+       {
+               str = g_strdup_printf("%.2f:1", (gdouble)dar_width / dar_height);
+       }
+       else
+       {
+               str = g_strdup_printf("%d:%d", dar_width, dar_height);
+       }
+       ghb_ui_update(ud, "display_aspect", ghb_string_value(str));
+       g_free(str);
+       str = g_strdup_printf("%d:%d", par_width, par_height);
+       ghb_ui_update(ud, "pixel_aspect", ghb_string_value(str));
+       g_free(str);
+       ghb_ui_update(ud, "PictureDisplayWidth", ghb_int64_value(disp_width));
+       ghb_ui_update(ud, "PictureDisplayHeight", ghb_int64_value(disp_height));
+       picture_settings_deps(ud);
 }
 
 static void
@@ -2769,26 +2929,31 @@ set_preview_job_settings(hb_job_t *job, GValue *settings)
        job->crop[2] = ghb_settings_get_int(settings, "PictureLeftCrop");
        job->crop[3] = ghb_settings_get_int(settings, "PictureRightCrop");
 
-       gboolean anamorphic, round_dimensions, autoscale, keep_aspect;
-       autoscale = ghb_settings_get_boolean(settings, "autoscale");
-       anamorphic = ghb_settings_get_boolean(settings, "anamorphic");
-       round_dimensions = ghb_settings_get_boolean(settings, "ModDimensions");
+       job->anamorphic.mode = ghb_settings_combo_int(settings, "PicturePAR");
+       job->anamorphic.modulus = 
+               ghb_settings_combo_int(settings, "PictureAlignment");
+       job->width = ghb_settings_get_int(settings, "scale_width");
+       job->height = ghb_settings_get_int(settings, "scale_height");
+
+       gint deint = ghb_settings_combo_int(settings, "PictureDeinterlace");
+       gint decomb = ghb_settings_combo_int(settings, "PictureDecomb");
+       job->deinterlace = (!decomb && deint == 0) ? 0 : 1;
+
+       gboolean keep_aspect;
        keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
-       if (anamorphic)
+       if (job->anamorphic.mode == 3 && !keep_aspect)
        {
-               job->anamorphic.modulus = round_dimensions ? 16 : 2;
-               job->anamorphic.mode = autoscale || keep_aspect ? 2 : 3;
+               gint disp_width, disp_height;
+               disp_width = ghb_settings_get_int(settings, "PictureDisplayWidth");
+               disp_height = ghb_settings_get_int(settings, "PictureDisplayHeight");
+               job->anamorphic.dar_width = disp_width;
+               job->anamorphic.dar_height = disp_height;
        }
        else
        {
-               job->anamorphic.modulus = 2;
-               job->anamorphic.mode = 0;
+               job->anamorphic.dar_width = 0;
+               job->anamorphic.dar_height = 0;
        }
-       job->width = ghb_settings_get_int(settings, "scale_width");
-       job->height = ghb_settings_get_int(settings, "scale_height");
-       gint deint = ghb_settings_combo_int(settings, "PictureDeinterlace");
-       gint decomb = ghb_settings_combo_int(settings, "PictureDecomb");
-       job->deinterlace = (!decomb && deint == 0) ? 0 : 1;
 }
 
 gint
@@ -3305,23 +3470,9 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
                job->deinterlace = 0;
     job->grayscale   = ghb_settings_get_boolean(js, "VideoGrayScale");
 
-       gboolean autoscale, anamorphic, round_dimensions, keep_aspect;
+       job->anamorphic.mode = ghb_settings_get_boolean(js, "PicturePAR");
+       job->anamorphic.modulus = ghb_settings_combo_int(js, "PictureAlignment");
 
-       autoscale = ghb_settings_get_boolean(js, "autoscale");
-       anamorphic = ghb_settings_get_boolean(js, "anamorphic");
-       round_dimensions = ghb_settings_get_boolean(js, "ModDimensions");
-       keep_aspect = ghb_settings_get_boolean(js, "PictureKeepRatio");
-       if (anamorphic)
-       {
-               job->anamorphic.mode = autoscale || keep_aspect ? 2 : 3;
-               // Also, x264 requires things to be divisible by 2.
-               job->anamorphic.modulus = round_dimensions ? 16 : 2;
-       }
-       else
-       {
-               job->anamorphic.mode = 0;
-               job->anamorphic.modulus = 2;
-       }
        /* Add selected filters */
        job->filters = hb_list_init();
        gint vrate = ghb_settings_combo_int(js, "VideoFramerate");
@@ -3807,10 +3958,11 @@ ghb_get_preview_image(
        // hb_get_preview doesn't compensate for anamorphic, so lets
        // calculate scale factors
        gint width, height, par_width = 1, par_height = 1;
-       gboolean anamorphic = ghb_settings_get_boolean(settings, "anamorphic");
-       if (anamorphic)
+       gint pic_par = ghb_settings_combo_int(settings, "PicturePAR");
+       if (pic_par)
        {
-               hb_set_anamorphic_size( title->job, &width, &height, &par_width, &par_height );
+               hb_set_anamorphic_size( title->job, &width, &height, 
+                                                               &par_width, &par_height );
        }
 
        // And also creates artifacts if the width is not a multiple of 8
index 260f800..ad93669 100644 (file)
                <string>mp4</string>
                <key>Folder</key>
                <false />
+               <key>PictureAlignment</key>
+               <integer>16</integer>
                <key>PictureDeblock</key>
                <integer>0</integer>
                <key>PictureDecomb</key>
                <true />
                <key>Mp4LargeFile</key>
                <false />
-               <key>ModDimensions</key>
-               <true />
                <key>PicturePAR</key>
                <integer>2</integer>
                <key>PictureHeight</key>
index 0ea38f4..76097cb 100644 (file)
@@ -501,6 +501,13 @@ void preview_window_expose_cb(void);
 
 // Some style definitions for the preview window and hud
 const gchar *hud_rcstyle =
+"style \"ghb-entry\" {\n"
+"GtkEntry::inner-border = {2,2,1,1}\n"
+"}\n"
+"style \"ghb-combo\" {\n"
+"xthickness = 1\n"
+"ythickness = 1\n"
+"}\n"
 "style \"ghb-preview\" {\n"
 "bg[NORMAL]=\"black\"\n"
 "}\n"
@@ -516,6 +523,8 @@ const gchar *hud_rcstyle =
 "fg[ACTIVE]=\"white\"\n"
 "fg[PRELIGHT]=\"white\"\n"
 "}\n"
+"widget_class \"*.GtkComboBox.GtkToggleButton\" style \"ghb-combo\"\n"
+"widget_class \"*.GtkEntry\" style \"ghb-entry\"\n"
 "widget \"preview_window.*.preview_hud.*\" style \"ghb-hud\"\n"
 "widget \"preview_window\" style \"ghb-preview\"\n";
 
@@ -565,6 +574,9 @@ main (int argc, char *argv[])
        watch_volumes (ud);
        ud->builder = create_builder_or_die (BUILDER_NAME);
 
+       //GtkWidget *widget = GHB_WIDGET(ud->builder, "PictureDetelecineCustom");
+       //gtk_entry_set_inner_border(widget, 2);
+
        // Set up the "hud" control overlay for the preview window
        GtkWidget *draw, *hud, *blender, *align;
 
index c11e7b3..26bf0fb 100644 (file)
@@ -47,12 +47,6 @@ static dependency_t dep_map[] =
        {"PictureAutoCrop", "PictureBottomCrop", "FALSE", FALSE, FALSE},
        {"PictureAutoCrop", "PictureLeftCrop", "FALSE", FALSE, FALSE},
        {"PictureAutoCrop", "PictureRightCrop", "FALSE", FALSE, FALSE},
-       {"autoscale", "scale_width", "FALSE", FALSE, FALSE},
-       {"autoscale", "scale_height", "FALSE", FALSE, FALSE},
-       // "CHECK" is a dummy value that forces scale_height deps to
-       // be re-evaluated whenever anamorphic changes
-       {"anamorphic", "scale_height", "CHECK", TRUE, FALSE},
-       {"PictureKeepRatio", "scale_height", "FALSE", FALSE, FALSE},
        {"VideoEncoder", "x264_tab", "x264", FALSE, FALSE},
        {"VideoEncoder", "x264_tab_label", "x264", FALSE, FALSE},
        {"VideoEncoder", "Mp4iPodCompatible", "x264", FALSE, FALSE},
index 507797e..fb4bfc2 100644 (file)
@@ -2203,32 +2203,26 @@ import_xlat_preset(GValue *dict)
        {
        case 0:
        {
-               ghb_dict_insert(dict, g_strdup("anamorphic"), 
-                                               ghb_boolean_value_new(FALSE));
-               if (ghb_dict_lookup(dict, "ModDimensions") == NULL)
-                       ghb_dict_insert(dict, g_strdup("ModDimensions"), 
-                                                       ghb_boolean_value_new(TRUE));
+               if (ghb_dict_lookup(dict, "PictureAlignment") == NULL)
+                       ghb_dict_insert(dict, g_strdup("PictureAlignment"), 
+                                                       ghb_int_value_new(16));
        } break;
        case 1:
        {
-               ghb_dict_insert(dict, g_strdup("anamorphic"), 
-                                               ghb_boolean_value_new(TRUE));
-               ghb_dict_insert(dict, g_strdup("ModDimensions"), 
-                                               ghb_boolean_value_new(FALSE));
+               ghb_dict_insert(dict, g_strdup("PictureAlignment"), 
+                                               ghb_int_value_new(1));
        } break;
        case 2:
        {
-               ghb_dict_insert(dict, g_strdup("anamorphic"), 
-                                               ghb_boolean_value_new(TRUE));
-               ghb_dict_insert(dict, g_strdup("ModDimensions"), 
-                                               ghb_boolean_value_new(TRUE));
+               if (ghb_dict_lookup(dict, "PictureAlignment") == NULL)
+                       ghb_dict_insert(dict, g_strdup("PictureAlignment"), 
+                                                       ghb_int_value_new(16));
        } break;
        default:
        {
-               ghb_dict_insert(dict, g_strdup("anamorphic"), 
-                                               ghb_boolean_value_new(TRUE));
-               ghb_dict_insert(dict, g_strdup("ModDimensions"), 
-                                               ghb_boolean_value_new(TRUE));
+               if (ghb_dict_lookup(dict, "PictureAlignment") == NULL)
+                       ghb_dict_insert(dict, g_strdup("PictureAlignment"), 
+                                                       ghb_int_value_new(16));
        } break;
        }
        // VideoQualityType/0/1/2 - vquality_type_/target/bitrate/constant
@@ -2342,12 +2336,10 @@ import_xlat_presets(GValue *presets)
 static void
 export_xlat_preset(GValue *dict)
 {
-       gboolean ana, round, autoscale, target, br, constant;
+       gboolean autoscale, target, br, constant;
 
        g_debug("export_xlat_prest ()");
        autoscale = ghb_value_boolean(preset_dict_get_value(dict, "autoscale"));
-       ana = ghb_value_boolean(preset_dict_get_value(dict, "anamorphic"));
-       round = ghb_value_boolean(preset_dict_get_value(dict, "ModDimensions"));
        target = ghb_value_boolean(
                                preset_dict_get_value(dict, "vquality_type_target"));
        br = ghb_value_boolean(
@@ -2362,20 +2354,6 @@ export_xlat_preset(GValue *dict)
                ghb_dict_insert(dict, g_strdup("UsesPictureSettings"), 
                                                ghb_int_value_new(1));
 
-       if (ana)
-       {
-               if (round)
-                       ghb_dict_insert(dict, g_strdup("PicturePAR"), 
-                                               ghb_int_value_new(2));
-               else
-                       ghb_dict_insert(dict, g_strdup("PicturePAR"), 
-                                               ghb_int_value_new(1));
-       }
-       else
-       {
-               ghb_dict_insert(dict, g_strdup("PicturePAR"), 
-                                               ghb_int_value_new(0));
-       }
        // VideoQualityType/0/1/2 - vquality_type_/target/bitrate/constant
        if (target)
        {
@@ -2394,7 +2372,6 @@ export_xlat_preset(GValue *dict)
        }
        ghb_dict_remove(dict, "UsesMaxPictureSettings");
        ghb_dict_remove(dict, "autoscale");
-       ghb_dict_remove(dict, "anamorphic");
        ghb_dict_remove(dict, "vquality_type_target");
        ghb_dict_remove(dict, "vquality_type_bitrate");
        ghb_dict_remove(dict, "vquality_type_constant");
@@ -3289,10 +3266,11 @@ preset_update_title_deps(signal_user_data_t *ud, ghb_title_info_t *tinfo)
        ghb_ui_update(ud, "scale_width", 
                        ghb_int64_value(tinfo->width - tinfo->crop[2] - tinfo->crop[3]));
        // If anamorphic or keep_aspect, the hight will be automatically calculated
-       gboolean keep_aspect, anamorphic;
+       gboolean keep_aspect;
+       gint pic_par;
        keep_aspect = ghb_settings_get_boolean(ud->settings, "PictureKeepRatio");
-       anamorphic = ghb_settings_get_boolean(ud->settings, "anamorphic");
-       if (!(keep_aspect || anamorphic))
+       pic_par = ghb_settings_combo_int(ud->settings, "PicturePAR");
+       if (!(keep_aspect || pic_par) || pic_par == 3)
        {
                ghb_ui_update(ud, "scale_height", 
                        ghb_int64_value(tinfo->height - tinfo->crop[0] - tinfo->crop[1]));
index a650a24..b30d1a9 100644 (file)
@@ -16,7 +16,7 @@
 #if !defined(_GHB_PREVIEW_H_)
 #define _GHB_PREVIEW_H_
 
-#define MOD_ROUND(v,m) (m * ((v + (m>>1) - 1) / m))
+#define MOD_ROUND(v,m) ((m==1)?v:(m * ((v + (m>>1) - 1) / m)))
 #define MOD_DOWN(v,m)  (m * (v / m))
 #define MOD_UP(v,m)    (m * ((v + m - 1) / m))
 
index 0231b14..f01f543 100644 (file)
@@ -72,7 +72,8 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
        gchar *fps, *vcodec_abbr;
        gint title, start_chapter, end_chapter, width, height;
        gint source_width, source_height;
-       gboolean pass2, anamorphic, round_dim, keep_aspect, vqtype, turbo;
+       gboolean pass2, keep_aspect, vqtype, turbo;
+       gint pic_par;
        gboolean tweaks;
        gchar *escape;
        
@@ -186,23 +187,13 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
 
        width = ghb_settings_get_int(settings, "scale_width");
        height = ghb_settings_get_int(settings, "scale_height");
-       anamorphic = ghb_settings_get_boolean(settings, "anamorphic");
-       round_dim = ghb_settings_get_boolean(settings, "ModDimensions");
+       pic_par = ghb_settings_combo_int(settings, "PicturePAR");
        keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");
 
        gchar *aspect_desc;
-       if (anamorphic)
+       switch (pic_par)
        {
-               if (round_dim)
-               {
-                       aspect_desc = "(Anamorphic)";
-               }
-               else
-               {
-                       aspect_desc = "(Strict Anamorphic)";
-               }
-       }
-       else
+       case 0:
        {
                if (keep_aspect)
                {
@@ -212,6 +203,27 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
                {
                        aspect_desc = "(Aspect Lost)";
                }
+       } break;
+
+       case 1:
+       {
+               aspect_desc = "(Strict Anamorphic)";
+       } break;
+
+       case 2:
+       {
+               aspect_desc = "(Loose Anamorphic)";
+       } break;
+
+       case 3:
+       {
+               aspect_desc = "(Custom Anamorphic)";
+       } break;
+
+       default:
+       {
+               aspect_desc = "(Unknown)";
+       } break;
        }
        vqtype = ghb_settings_get_boolean(settings, "vquality_type_constant");