Disable PAR checkbox if iPod encoder is selected

Archive of historical development discussions
Discussions / Development has moved to GitHub
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
drebes
Posts: 29
Joined: Sun Apr 22, 2007 2:58 pm

Disable PAR checkbox if iPod encoder is selected

Post by drebes »

Since the PAR option doesn't work when the iPod encoder is selected, it would be better to have it disabled so that the user wouldn't select it believing it works. This patch for r791 does just that:

Code: Select all

diff -ruN HandBrake/macosx/Controller.mm HandBrake.impede/macosx/Controller.mm
--- HandBrake/macosx/Controller.mm	2007-08-10 17:34:36.000000000 +0900
+++ HandBrake.impede/macosx/Controller.mm	2007-08-10 17:40:35.000000000 +0900
@@ -1218,8 +1218,18 @@
     hb_title_t * title = (hb_title_t *) hb_list_item( list,
             [fSrcTitlePopUp indexOfSelectedItem] );
 
-    /* Resize the panel */
-    NSSize newSize;
+	/* Set the job mux and vcodec to disable fPARCheck in PicturePannel */
+	int format = [fDstFormatPopUp indexOfSelectedItem];
+    int codecs = [fDstCodecsPopUp indexOfSelectedItem];
+    title->job->mux    = FormatSettings[format][codecs] & HB_MUX_MASK;
+    title->job->vcodec = FormatSettings[format][codecs] & HB_VCODEC_MASK;
+	if ([fVidEncoderPopUp indexOfSelectedItem] > 0 )
+	{
+		title->job->mux = HB_MUX_IPOD;
+	}	
+    
+	/* Resize the panel */
+	NSSize newSize;
     newSize.width  = 246 + title->width;
     newSize.height = 80 + title->height;
     [fPicturePanel setContentSize: newSize];
diff -ruN HandBrake/macosx/PictureController.mm HandBrake.impede/macosx/PictureController.mm
--- HandBrake/macosx/PictureController.mm	2007-08-10 17:34:36.000000000 +0900
+++ HandBrake.impede/macosx/PictureController.mm	2007-08-10 17:41:26.000000000 +0900
@@ -81,6 +81,7 @@
     [fHeightStepper     setIntValue: job->height];
     [fHeightField       setIntValue: job->height];
     [fRatioCheck        setState:    job->keep_ratio ? NSOnState : NSOffState];
+	[fPARCheck			setEnabled: YES];
     [fCropTopStepper    setMaxValue: title->height/2-2];
     [fCropBottomStepper setMaxValue: title->height/2-2];
     [fCropLeftStepper   setMaxValue: title->width/2-2];
@@ -181,6 +182,8 @@
 	}
 	else
 	{
+	/* Disable the PAR option if the iPod encoder is selected */	
+	if ((fTitle->job->vcodec == HB_VCODEC_X264) && (fTitle->job->mux == HB_MUX_IPOD)) [fPARCheck setEnabled: NO];
 	[fInfoField setStringValue: [NSString stringWithFormat:
         @"Source: %dx%d, Output: %dx%d", fTitle->width, fTitle->height,
         fTitle->job->width, fTitle->job->height]];	
The code is ugly: it shouldn't be necessary to pass the mux and vcodec to the PictureController, it should only poll the Controller for a "isIPodEncoding", but I didn't want to change anything else in the way they interface.
realityking
Veteran User
Posts: 680
Joined: Tue Apr 24, 2007 12:36 pm

Post by realityking »

According to this Topic http://handbrake.m0k.org/forum/viewtopic.php?t=2134 does PAR actually work on the iPod, so this might not be needed. Still a good Idea.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

Anamorphic already gets disabled when the iPod x264 encoding style is selected, so couldn't we just do this?

Code: Select all

Index: macosx/Controller.mm
===================================================================
--- macosx/Controller.mm        (revision 783)
+++ macosx/Controller.mm        (working copy)
@@ -1280,6 +1280,7 @@
                        job->mux = HB_MUX_IPOD;
                        /* move sanity check for iPod Encoding here */
                        job->pixel_ratio = 0 ;
+                       [fPARCheck setEnabled: NO];
 
                }
 
drebes
Posts: 29
Joined: Sun Apr 22, 2007 2:58 pm

Post by drebes »

jbrjake wrote:Anamorphic already gets disabled when the iPod x264 encoding style is selected, so couldn't we just do this?
Isnt this test in PrepareJob? If so, wont this only get called when the job has already been configured and will be queued/started? I dont have a copy here with me to check it out.
Last edited by drebes on Fri Aug 10, 2007 3:34 pm, edited 2 times in total.
drebes
Posts: 29
Joined: Sun Apr 22, 2007 2:58 pm

Post by drebes »

realityking wrote:According to this Topic http://handbrake.m0k.org/forum/viewtopic.php?t=2134 does PAR actually work on the iPod, so this might not be needed. Still a good Idea.
I created that topic. According to that, PAR works on the iPod if that patch is applied, and that is not in the official trunk because 1. its ugly, 2. it doesnt work with PAL DVDs and 3. developers dont see much use in it. Since this is not supported anyway, I think its better to make it clear by disabling the field, so that confusions like this will not occur.
Post Reply