Commit 6df6fa07 authored by GitLab CI's avatar GitLab CI

Merge remote-tracking branch 'upstream/master' into master-build

* upstream/master:
  WinGui: Language consistency tweak in queue.
  WinGui: Re-implement queue import/export functionality for the GUI. Note, this is incompatible with the CLI Queue parser. There is an existing separate option for exporting into a CLI friendly JSON format. Format subject to change in the future. For now, this is a quick way of getting this functionality back.  #898
  MacGui: use HB_VCODEC_X264_MASK to check whether x264 is selected or not.
  MacGui: don't show fast decode checkbox when the encoder is not x264, fixes #2083.
  MacGui: localize the 'None' item in the fallback encoders popup.
  MacGui: disable auto passthru fallback encoder options when fallback is set to none.
  MacGui: fix warnings.
parents e865e7f6 908b7845
Pipeline #65285302 passed with stages
in 64 minutes and 16 seconds
This diff is collapsed.
......@@ -198,11 +198,16 @@
}
}
- (BOOL)isAutoPassthruEnabledWithNoFallback
{
return (self.encoder == HB_ACODEC_AUTO_PASS && self.fallbackEncoder == HB_ACODEC_NONE);
}
- (BOOL)mixdownEnabled
{
BOOL retval = YES;
if (self.mixdown == HB_AMIXDOWN_NONE)
if (self.mixdown == HB_AMIXDOWN_NONE || self.isAutoPassthruEnabledWithNoFallback)
{
// "None" mixdown (passthru)
retval = NO;
......@@ -216,7 +221,7 @@
BOOL retval = YES;
int myCodecDefaultBitrate = hb_audio_bitrate_get_default(self.selectedEncoder, 0, 0);
if (myCodecDefaultBitrate < 0)
if (myCodecDefaultBitrate < 0 || self.isAutoPassthruEnabledWithNoFallback)
{
retval = NO;
}
......@@ -227,7 +232,7 @@
{
BOOL retval = YES;
if (self.selectedEncoder & HB_ACODEC_PASS_FLAG)
if (self.selectedEncoder & HB_ACODEC_PASS_FLAG || self.isAutoPassthruEnabledWithNoFallback)
{
retval = NO;
}
......
//
// HBAudioTransformers.h
// HandBrake
//
// Created by Damiano Galassi on 26/08/2016.
//
//
/* HBAudioTransformers.m $
This file is part of the HandBrake source code.
Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License. */
#import <Foundation/Foundation.h>
......@@ -12,6 +10,12 @@
* A series of value trasformers to bridge the libhb enums
* to the textual rapresentations used in the interface.
*/
@interface HBFallbackEncodersTransformer : NSValueTransformer
@end
@interface HBFallbackEncoderTransformer : NSValueTransformer
@end
@interface HBEncoderTransformer : NSValueTransformer
@end
......
//
// HBAudioTransformers.m
// HandBrake
//
// Created by Damiano Galassi on 26/08/2016.
//
//
/* HBAudioTransformers.m $
This file is part of the HandBrake source code.
Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License. */
#import "HBAudioTransformers.h"
#import "HBLocalizationUtilities.h"
#include "hb.h"
#pragma mark - Value Trasformers
@implementation HBFallbackEncodersTransformer
+ (Class)transformedValueClass
{
return [NSArray class];
}
- (id)transformedValue:(id)value
{
if (value != nil)
{
NSMutableArray *localizedArray = [NSMutableArray array];
for (NSString *text in value)
{
if ([text isEqualToString:@"None"])
{
[localizedArray addObject:HBKitLocalizedString(@"None", @"HBSubtitles -> none track name")];
}
else
{
[localizedArray addObject:text];
}
}
return localizedArray;
}
return value;
}
+ (BOOL)allowsReverseTransformation
{
return NO;
}
@end
@implementation HBFallbackEncoderTransformer
+ (Class)transformedValueClass
{
return [NSString class];
}
- (id)transformedValue:(id)value
{
const char *name = hb_audio_encoder_get_name([value intValue]);
if (name)
{
return @(name);
}
else
{
return HBKitLocalizedString(@"None", @"HBSubtitles -> none track name");
}
}
+ (BOOL)allowsReverseTransformation
{
return YES;
}
- (id)reverseTransformedValue:(id)value
{
if ([value isEqualTo:HBKitLocalizedString(@"None", @"HBSubtitles -> none track name")])
{
return @(hb_audio_encoder_get_from_name("none"));
}
else
{
return @(hb_audio_encoder_get_from_name([value UTF8String]));
}
}
@end
@implementation HBEncoderTransformer
+ (Class)transformedValueClass
......
......@@ -476,7 +476,7 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
srcGeo.par.num = self.sourceParNum;
srcGeo.par.den = self.sourceParDen;
uiGeo.mode = self.anamorphicMode;
uiGeo.mode = (int)self.anamorphicMode;
uiGeo.keep = self.keep;
uiGeo.itu_par = 0;
uiGeo.modulus = self.modulus;
......@@ -571,7 +571,7 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
encodeInt(_height);
encodeBool(_keepDisplayAspect);
encodeInt(_anamorphicMode);
encodeInt((int)_anamorphicMode);
encodeInt(_modulus);
encodeInt(_displayWidth);
......
......@@ -77,7 +77,7 @@ static NSString *versionKey = @"HBQueueItemVersion";
- (void)encodeWithCoder:(nonnull NSCoder *)coder
{
[coder encodeInt:1 forKey:versionKey];
encodeInt(_state);
encodeInt((int)_state);
encodeObject(_job);
encodeObject(_uuid);
}
......
......@@ -193,7 +193,7 @@ NSString *HBRangeChangedNotification = @"HBRangeChangedNotification";
{
[coder encodeInt:1 forKey:@"HBRangeVersion"];
encodeInt(_type);
encodeInt((int)_type);
encodeInt(_chapterStart);
encodeInt(_chapterStop);
......
......@@ -81,6 +81,11 @@
- (BOOL)fastDecodeSupported
{
if (!(self.encoder & HB_VCODEC_X264_MASK))
{
return NO;
}
const char * const *tunes = hb_video_encoder_get_tunes(self.encoder);
for (int i = 0; tunes != NULL && tunes[i] != NULL; i++)
......
......@@ -332,6 +332,11 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
if (levels.count && ![levels containsObject:self.level]) {
self.level = levels.firstObject;
}
if (!(self.encoder & HB_VCODEC_X264_MASK))
{
self.fastDecode = NO;
}
}
- (void)validateVideoOptionExtra:(int)previousEncoder
......@@ -390,7 +395,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
for (int i = 0; tunes != NULL && tunes[i] != NULL; i++)
{
// we filter out "fastdecode" as we have a dedicated checkbox for it
if (strcasecmp(tunes[i], "fastdecode") != 0)
if (!(self.encoder & HB_VCODEC_X264_MASK) || strcasecmp(tunes[i], "fastdecode") != 0)
{
[temp addObject:@(tunes[i])];
}
......@@ -492,7 +497,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
encodeInt(_encoder);
encodeInt(_qualityType);
encodeInt((int)_qualityType);
encodeInt(_avgBitrate);
encodeDouble(_quality);
......@@ -500,7 +505,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
encodeDouble(_qualityMaxValue);
encodeInt(_frameRate);
encodeInt(_frameRateMode);
encodeInt((int)_frameRateMode);
encodeBool(_twoPass);
encodeBool(_turboTwoPass);
......
......@@ -4093,7 +4093,7 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
/// Looks up a localized string similar to Export Queue for CLI.
/// Looks up a localized string similar to Export Queue.
/// </summary>
public static string QueueView_Export {
get {
......@@ -4101,6 +4101,15 @@ namespace HandBrakeWPF.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Export Queue (CLI Only).
/// </summary>
public static string QueueView_ExportCLI {
get {
return ResourceManager.GetString("QueueView_ExportCLI", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Filesize: .
/// </summary>
......@@ -4120,7 +4129,7 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
/// Looks up a localized string similar to Import.
/// Looks up a localized string similar to Import Queue.
/// </summary>
public static string QueueView_Import {
get {
......
......@@ -1459,7 +1459,7 @@ This will not affect your current settings in the Subtitle tab.</value>
<value>End Time:</value>
</data>
<data name="QueueView_Export" xml:space="preserve">
<value>Export Queue for CLI</value>
<value>Export Queue</value>
</data>
<data name="QueueView_FileSize" xml:space="preserve">
<value>Filesize: </value>
......@@ -1902,7 +1902,7 @@ This will not impact any of the software encoders.</value>
<value>Actions</value>
</data>
<data name="QueueView_Import" xml:space="preserve">
<value>Import</value>
<value>Import Queue</value>
</data>
<data name="QueueViewModel_EncodeStatusChanged_StatusLabel" xml:space="preserve">
<value>Encoding: Pass {0} of {1}, {2:00.00}%, FPS: {3:000.0}, Avg FPS: {4:000.0}
......@@ -2011,4 +2011,7 @@ Where supported, any user presets will have been imported.</value>
<data name="OptionsView_Play" xml:space="preserve">
<value>Play</value>
</data>
<data name="QueueView_ExportCLI" xml:space="preserve">
<value>Export Queue (CLI Only)</value>
</data>
</root>
\ No newline at end of file
......@@ -102,13 +102,14 @@ namespace HandBrakeWPF.Services.Queue.Interfaces
void BackupQueue(string exportPath);
/// <summary>
/// Export the Queue the standardised JSON format.
/// Export the windows queue in JSON format.
/// Note: Note compatible with CLI.
/// </summary>
/// <param name="exportPath">
/// The export path.
/// </param>
void ExportJson(string exportPath);
/// <summary>
/// Restore a JSON queue file.
/// </summary>
......@@ -117,6 +118,14 @@ namespace HandBrakeWPF.Services.Queue.Interfaces
/// </param>
void ImportJson(string path);
/// <summary>
/// Export the Queue the standardised JSON format for the CLI
/// </summary>
/// <param name="exportPath">
/// The export path.
/// </param>
void ExportCliJson(string exportPath);
/// <summary>
/// Checks the current queue for an existing instance of the specified destination.
/// </summary>
......
......@@ -497,10 +497,7 @@ namespace HandBrakeWPF.ViewModels
this.queueProcessor.Start(userSettingService.GetUserSetting<bool>(UserSettingConstants.ClearCompletedFromQueue));
}
/// <summary>
/// Export the Queue to a file.
/// </summary>
public void Export()
public void ExportCli()
{
SaveFileDialog dialog = new SaveFileDialog
{
......@@ -510,15 +507,28 @@ namespace HandBrakeWPF.ViewModels
AddExtension = true
};
if (dialog.ShowDialog() == true)
{
this.queueProcessor.ExportCliJson(dialog.FileName);
}
}
public void Export()
{
SaveFileDialog dialog = new SaveFileDialog
{
Filter = "Json (*.json)|*.json",
OverwritePrompt = true,
DefaultExt = ".json",
AddExtension = true
};
if (dialog.ShowDialog() == true)
{
this.queueProcessor.ExportJson(dialog.FileName);
}
}
/// <summary>
/// Import a saved queue
/// </summary>
public void Import()
{
OpenFileDialog dialog = new OpenFileDialog { Filter = "Json (*.json)|*.json", CheckFileExists = true };
......@@ -558,7 +568,6 @@ namespace HandBrakeWPF.ViewModels
public void OpenSourceDir()
{
this.OpenSourceDirectory(this.SelectedTask);
}
public void OpenDestDir()
......
......@@ -81,8 +81,10 @@
<MenuItem cal:Message.Attach="[Event Click] = [Action Clear]" Header="{x:Static Properties:Resources.QueueView_ClearAll}" />
<MenuItem cal:Message.Attach="[Event Click] = [Action RemoveSelectedJobs]" Header="{x:Static Properties:Resources.QueueView_ClearSelected}" />
<Separator />
<!--<MenuItem cal:Message.Attach="[Event Click] = [Action Import]" Header="{x:Static Properties:Resources.QueueView_Import}" />-->
<MenuItem cal:Message.Attach="[Event Click] = [Action Import]" Header="{x:Static Properties:Resources.QueueView_Import}" />
<MenuItem cal:Message.Attach="[Event Click] = [Action Export]" Header="{x:Static Properties:Resources.QueueView_Export}" />
<Separator />
<MenuItem cal:Message.Attach="[Event Click] = [Action ExportCli]" Header="{x:Static Properties:Resources.QueueView_ExportCLI}" />
</MenuItem>
</Menu>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment