From e6bbf3b9ecfd237eec98bd2711800f267ee9ddb1 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 9 Mar 2013 22:32:07 +0000 Subject: [PATCH] Merging Trunk to OpenCL branch git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/opencl@5319 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- CREDITS | 3 +- NEWS | 45 + contrib/fdk-aac/module.defs | 5 + contrib/fdk-aac/module.rules | 2 + contrib/ffmpeg/A01-h264-recovery-point.patch | 4 +- contrib/ffmpeg/module.defs | 14 +- doc/texi/Building.mingw.texi | 2 +- gtk/configure.ac | 11 + gtk/module.defs | 3 + gtk/src/Makefile.am | 15 - gtk/src/callbacks.c | 4 +- gtk/src/callbacks.h | 2 +- gtk/src/standard_presets.xml | 2784 ++++++++++------- libhb/audio_remap.c | 2 +- libhb/audio_remap.h | 2 +- libhb/audio_resample.c | 2 +- libhb/audio_resample.h | 2 +- libhb/batch.c | 2 +- libhb/bd.c | 2 +- libhb/bits.h | 2 +- libhb/common.c | 56 +- libhb/common.h | 8 +- libhb/cropscale.c | 2 +- libhb/deca52.c | 2 +- libhb/decavcodec.c | 4 +- libhb/declpcm.c | 2 +- libhb/decmetadata.c | 2 +- libhb/decmpeg2.c | 2 +- libhb/decomb.c | 2 +- libhb/decpgssub.c | 2 +- libhb/decsrtsub.c | 2 +- libhb/decssasub.c | 2 +- libhb/dectx3gsub.c | 2 +- libhb/decutf8sub.c | 2 +- libhb/decvobsub.c | 2 +- libhb/demuxmpeg.c | 2 +- libhb/detelecine.c | 2 +- libhb/dvd.c | 2 +- libhb/dvd.h | 2 +- libhb/dvdnav.c | 2 +- libhb/eedi2.c | 2 +- libhb/eedi2.h | 2 +- libhb/encavcodec.c | 2 +- libhb/encavcodecaudio.c | 136 +- libhb/encfaac.c | 2 +- libhb/enclame.c | 2 +- libhb/enctheora.c | 2 +- libhb/encvobsub.c | 2 +- libhb/encvorbis.c | 2 +- libhb/encx264.c | 9 +- libhb/encx264.h | 2 +- libhb/fifo.c | 2 +- libhb/hb.c | 2 +- libhb/hb.h | 2 +- libhb/hb_dict.c | 2 +- libhb/hb_dict.h | 2 +- libhb/hbffmpeg.h | 2 +- libhb/internal.h | 2 +- libhb/lang.c | 2 +- libhb/lang.h | 2 +- libhb/mcdeint.h | 2 +- libhb/module.defs | 13 +- libhb/muxcommon.c | 2 +- libhb/muxmkv.c | 7 +- libhb/muxmp4.c | 6 +- libhb/ports.c | 2 +- libhb/ports.h | 2 +- libhb/reader.c | 2 +- libhb/rendersub.c | 2 +- libhb/rotate.c | 2 +- libhb/scan.c | 2 +- libhb/stream.c | 2 +- libhb/sync.c | 2 +- libhb/taskset.c | 2 +- libhb/taskset.h | 2 +- libhb/update.c | 2 +- libhb/vfr.c | 2 +- libhb/work.c | 61 +- macosx/Controller.m | 8 +- macosx/HBPresets.h | 22 +- macosx/HBPresets.m | 1842 +++++------ macosx/module.defs | 6 + make/configure.py | 4 + make/include/main.defs | 4 + pkg/appcast.xml.m4 | 2 +- scripts/manicure.rb | 97 +- test/module.defs | 4 + test/test.c | 303 +- .../EventArgs/ScanProgressEventArgs.cs | 6 + .../Isolation/IsolatedEncodeService.cs | 11 + .../Parsing/Parser.cs | 13 +- .../Properties/AssemblyInfo.cs.tmpl | 2 +- .../Services/Base/EncodeBase.cs | 71 +- .../Services/Encode.cs | 60 +- .../Services/Interfaces/IEncode.cs | 5 + .../Services/LibEncode.cs | 13 - .../Services/ScanService.cs | 6 +- .../Utilities/LanguageUtilities.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../Properties/AssemblyInfo.cs | 4 +- win/CS/HandBrakeWPF/Installer/Installer.nsi | 4 +- win/CS/HandBrakeWPF/Installer/Installer64.nsi | 4 +- .../HandBrakeWPF/Properties/AssemblyInfo.cs | 4 +- .../Properties/AssemblyInfo.cs.tmpl | 2 +- .../Services/EncodeServiceWrapper.cs | 11 + .../ViewModels/EncoderOptionsViewModel.cs | 41 + .../ViewModels/Interfaces/ILogViewModel.cs | 4 + .../HandBrakeWPF/ViewModels/LogViewModel.cs | 97 +- .../HandBrakeWPF/ViewModels/MainViewModel.cs | 38 +- .../ViewModels/OptionsViewModel.cs | 2 +- .../HandBrakeWPF/ViewModels/QueueViewModel.cs | 40 +- .../ViewModels/SubtitlesViewModel.cs | 11 +- win/CS/HandBrakeWPF/Views/ChaptersView.xaml | 5 + win/CS/HandBrakeWPF/Views/LogView.xaml | 35 +- win/CS/HandBrakeWPF/Views/MainView.xaml | 1 + win/CS/HandBrakeWPF/Views/OptionsView.xaml | 4 +- win/CS/HandBrakeWPF/Views/ShellView.xaml | 2 +- win/CS/HandBrakeWPF/Views/Styles/Styles.xaml | 4 +- win/CS/HandBrakeWPF/defaultsettings.xml | 6 +- 119 files changed, 3445 insertions(+), 2663 deletions(-) create mode 100644 contrib/fdk-aac/module.defs create mode 100644 contrib/fdk-aac/module.rules diff --git a/CREDITS b/CREDITS index 26ea7fc69..968f57f92 100644 --- a/CREDITS +++ b/CREDITS @@ -29,4 +29,5 @@ libmp4v2 libmpeg2dec libpthreadsw32 libx264 -libzlib \ No newline at end of file +libzlib +fdk-aac \ No newline at end of file diff --git a/NEWS b/NEWS index 96197d02e..f13f57839 100644 --- a/NEWS +++ b/NEWS @@ -1,15 +1,58 @@ NEWS file for HandBrake + +Changes betwen 0.9.8 and 0.9.9: + +General: +- Improved HandBrake Pineapple Icon by Matt Johnson +- Improved Retina Resolution Icons within the Application by Nik Pawlak ​​http://nikpawlak.com + +Core: +- PGS Subtitle support. (Burn-in with MP4, passthru and burn-in for MKV) +- Additional Framerates 30, 50, 59.94, 60 +- Bob mode for De-interlacing and Decomb. +- Updated libraries (x264, libav) +- Assorted bug fixes and improvements to the core libhb library. +- Better Audio Mixdown support. (6.1, 7.1, 7.1 (5F/2R/LFE), Mono left only, Mono Right only). CLI users should note 6ch becomes 5point1 +- Allow the selection of higher audio bitrates where appropriate +- Allow the selection of slower samplerates where appropriate. +- Use libav for dts audio decoding instead of libdca +- Addition of x264 Tune, Preset, Profile and Level options. Can be used instead of the Advanced Tab. + +Windows: +- User Interface has been re-written in WPF. Includes many small UI enhancements +- Switched to .NET 4 Client Profile. (Smaller download for those who don't have .NET 4 Full installed) + +Linux: +- Moved to GTK 3 +- Assorted bug fixes and improvements. +- Use some system libraries rather than bundling (libass-dev, libsamplerate-dev) + +Mac: +- Drag/Drop? files onto the Main window or application icon to scan. +- Nicer Progress indication on the dock icon. +- Prevent sleep during encoding and scanning for Mountain Lion. +- Assorted bug fixes including better support for retina displays + +CLI: +- Audio option (-a) will ignore invalid input tracks and encode with only the valid ones. +- Allow use of hh:mm:ss format when specifying p-to-p start/stop time + + + Changes betwen 0.9.7 and 0.9.8: -> Corrects a few crash bugs that showed up in 0.9.7 + + Changes betwen 0.9.6 and 0.9.7: -> This is a bug fix release for 0.9.6. -> Includes an AppleTV3 Preset and updated iPad Preset + Changes betwen 0.9.5 and 0.9.6: Encoders: @@ -239,6 +282,8 @@ Changes between 0.9.4 and 0.9.5: - Multiple instance support (run multiple copies of ghb at once) - Many Bug fixes and UI improvements. + + Changes between 0.9.3 and 0.9.4: Core: diff --git a/contrib/fdk-aac/module.defs b/contrib/fdk-aac/module.defs new file mode 100644 index 000000000..628e0c52b --- /dev/null +++ b/contrib/fdk-aac/module.defs @@ -0,0 +1,5 @@ +$(eval $(call import.MODULE.defs,FDKAAC,fdkaac)) +$(eval $(call import.CONTRIB.defs,FDKAAC)) + +FDKAAC.FETCH.url = http://download.handbrake.fr/handbrake/contrib/fdk-aac-v0.1.1-6-gbae4553.tar.bz2 + diff --git a/contrib/fdk-aac/module.rules b/contrib/fdk-aac/module.rules new file mode 100644 index 000000000..b46629e4f --- /dev/null +++ b/contrib/fdk-aac/module.rules @@ -0,0 +1,2 @@ +$(eval $(call import.MODULE.rules,FDKAAC)) +$(eval $(call import.CONTRIB.rules,FDKAAC)) diff --git a/contrib/ffmpeg/A01-h264-recovery-point.patch b/contrib/ffmpeg/A01-h264-recovery-point.patch index 8688c021c..b9c29dc3a 100644 --- a/contrib/ffmpeg/A01-h264-recovery-point.patch +++ b/contrib/ffmpeg/A01-h264-recovery-point.patch @@ -1,5 +1,5 @@ diff --git a/libavcodec/h264.c b/libavcodec/h264.c -index 848d6a2..5a12fdb 100644 +index 54f6186..2647d5d 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2164,6 +2164,7 @@ static void flush_dpb(AVCodecContext *avctx) @@ -10,7 +10,7 @@ index 848d6a2..5a12fdb 100644 } static int init_poc(H264Context *h) -@@ -3992,9 +3993,18 @@ again: +@@ -3995,9 +3996,18 @@ again: if ((err = decode_slice_header(hx, h))) break; diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs index 351b56df8..e30b1bcc5 100644 --- a/contrib/ffmpeg/module.defs +++ b/contrib/ffmpeg/module.defs @@ -1,7 +1,7 @@ -$(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,YASM BZIP2 ZLIB)) +$(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,YASM BZIP2 ZLIB FDKAAC)) $(eval $(call import.CONTRIB.defs,FFMPEG)) -FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libav-v9.2.tar.bz2 +FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libav-v9.3.tar.bz2 FFMPEG.CONFIGURE.deps = FFMPEG.CONFIGURE.env = @@ -14,8 +14,9 @@ FFMPEG.CONFIGURE.extra = \ --disable-avconv \ --disable-avplay \ --disable-avprobe \ - --disable-avserver \ + --disable-avdevice \ --disable-avfilter \ + --disable-avserver \ --disable-muxers \ --disable-network \ --disable-hwaccels \ @@ -31,6 +32,13 @@ FFMPEG.CONFIGURE.extra = \ --cc="$(FFMPEG.GCC.gcc)" \ --extra-ldflags="$(call fn.ARGS,FFMPEG.GCC,*archs *sysroot *minver ?extra) -L$(call fn.ABSOLUTE,$(CONTRIB.build/)lib)" +ifeq (1,$(FEATURE.fdk_aac)) +FFMPEG.CONFIGURE.extra += \ + --enable-nonfree \ + --enable-libfdk-aac \ + --enable-encoder=libfdk_aac +endif + ## check against tuple: B-SYSTEM where B is { 0 | 1 } for cross-compiling flag ifeq (0-cygwin,$(BUILD.cross)-$(BUILD.system)) FFMPEG.CONFIGURE.extra += --enable-pthreads --enable-memalign-hack diff --git a/doc/texi/Building.mingw.texi b/doc/texi/Building.mingw.texi index 9a1f86ebc..60238761d 100644 --- a/doc/texi/Building.mingw.texi +++ b/doc/texi/Building.mingw.texi @@ -19,7 +19,7 @@ The following are the recommended specifications for building on @value{OS.mingw @itemize @bullet @item Intel 32-bit or 64-bit hardware -@item @value{OS.mingw} on Fedora 17+, Ubuntu 12+ or Debian, gcc 4.5+ +@item @value{OS.mingw} on Fedora 17+, Ubuntu 12+ or Debian, gcc 4.6+ @item yasm 1.2.x (for i386 or x86_64 architectures) @end itemize diff --git a/gtk/configure.ac b/gtk/configure.ac index d13659b4b..6d013f935 100644 --- a/gtk/configure.ac +++ b/gtk/configure.ac @@ -56,6 +56,10 @@ AC_ARG_ENABLE(dl, AS_HELP_STRING([--enable-dl], [enable libdl]), use_libdl=yes, use_libdl=no) +AC_ARG_ENABLE(fdk-aac, + AS_HELP_STRING([--enable-fdk-aac], [enable fdk aac encoder]), + use_fdk_aac=yes, use_fdk_aac=no) + AC_ARG_ENABLE(gst, AS_HELP_STRING([--disable-gst], [disable gstreamer (live preview)]), gst_disable=yes, gst_disable=no) @@ -199,6 +203,13 @@ case $host in ;; esac +HB_LIBS="-lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil -ldvdnav -ldvdread -lfaac -lmp3lame -lmpeg2 -lvorbis -lvorbisenc -logg -lsamplerate -lx264 -lmp4v2 -lswscale -ltheoraenc -ltheoradec -lz -lbz2 -lpthread -lbluray -lass -lfontconfig -lfreetype -lxml2" + +if test "x$use_fdk_aac" = "xyes" ; then + HB_LIBS+=" -lfdk-aac" +fi + +AC_SUBST(HB_LIBS) AC_SUBST(GHB_TOOLS_CFLAGS) AC_SUBST(GHB_TOOLS_LIBS) AC_SUBST(GHB_CFLAGS) diff --git a/gtk/module.defs b/gtk/module.defs index c37af412e..8eddc6d91 100644 --- a/gtk/module.defs +++ b/gtk/module.defs @@ -29,3 +29,6 @@ ifeq (0,$(FEATURE.gst)) GTK.CONFIGURE.extra += --disable-gst endif +ifeq (1,$(FEATURE.fdk_aac)) + GTK.CONFIGURE.extra += --enable-fdk-aac +endif diff --git a/gtk/src/Makefile.am b/gtk/src/Makefile.am index 2aff574ad..1320d5b2b 100644 --- a/gtk/src/Makefile.am +++ b/gtk/src/Makefile.am @@ -1,20 +1,5 @@ ## Process this file with automake to produce Makefile.in -if MINGW -HB_LIBS= \ - -lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil \ - -ldvdnav -ldvdread -lfaac -lmp3lame -lmpeg2 -lvorbis -lvorbisenc \ - -logg -lsamplerate -lx264 -lmp4v2 -lswscale -ltheoraenc -ltheoradec -lz \ - -lbz2 -lpthreadGC2 -lbluray -lass -lfontconfig -lfreetype -lxml2 \ - -lgmodule-2.0 -else -HB_LIBS= \ - -lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil \ - -ldvdnav -ldvdread -lfaac -lmp3lame -lmpeg2 -lvorbis -lvorbisenc \ - -logg -lsamplerate -lx264 -lmp4v2 -lswscale -ltheoraenc -ltheoradec -lz \ - -lbz2 -lpthread -lbluray -lass -lfontconfig -lfreetype -lxml2 -endif - icons = \ hb-icon.256.png \ hb-icon.128.png \ diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 6e494f26e..3b9edea12 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -410,7 +410,7 @@ get_dvd_device_name(GDrive *gd) #endif static GHashTable *volname_hash = NULL; -#if GTK_CHECK_VERSION(2, 32, 0) +#if GLIB_CHECK_VERSION(2, 32, 0) static GMutex volname_mutex_static; #endif static GMutex *volname_mutex; @@ -488,7 +488,7 @@ get_dvd_volume_name(gpointer gd) void ghb_volname_cache_init(void) { -#if GTK_CHECK_VERSION(2, 32, 0) +#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_init(&volname_mutex_static); volname_mutex = &volname_mutex_static; #else diff --git a/gtk/src/callbacks.h b/gtk/src/callbacks.h index 3a22b4c2c..83ece43ba 100644 --- a/gtk/src/callbacks.h +++ b/gtk/src/callbacks.h @@ -32,7 +32,7 @@ #include #include "settings.h" -#if GTK_CHECK_VERSION(2, 32, 0) +#if GLIB_CHECK_VERSION(2, 32, 0) #define GHB_THREAD_NEW(n, f, p) \ g_thread_new(n, (GThreadFunc)(f), (p)) #else diff --git a/gtk/src/standard_presets.xml b/gtk/src/standard_presets.xml index 0b71c030d..f73475bd8 100644 --- a/gtk/src/standard_presets.xml +++ b/gtk/src/standard_presets.xml @@ -2,1216 +2,1578 @@ - - ChildrenArray - - - AudioList - - - AudioBitrate - 160 - AudioEncoder - AAC (faac) - AudioMixdown - Dolby Pro Logic II - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - AudioBitrate - 160 - AudioEncoder - AC3 Passthru - AudioMixdown - None - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - ChapterMarkers - 1 - Default - 0 - FileFormat - MP4 file - Folder - - Mp4LargeFile - 0 - PictureAutoCrop - 1 - PictureBottomCrop - 0 - PictureDeblock - 0 - PictureDeinterlace - 0 - PictureDenoise - 0 - PictureDetelecine - 0 - PictureHeight - 0 - PictureKeepRatio - 0 - PictureLeftCrop - 0 - PictureModulus - 2 - PicturePAR - 2 - PictureRightCrop - 0 - PictureTopCrop - 0 - PictureWidth - 720 - PresetDescription - HandBrake's universally compatible, full resolution settings for all current Apple devices: iPod (6G and up), iPhone, AppleTV, and Macs - PresetName - Universal - Subtitles - None - Type - 0 - UsesPictureFilters - 1 - UsesPictureSettings - 1 - VFR - 0 - VideoAvgBitrate - 2500 - VideoEncoder - H.264 (x264) - VideoFramerate - 30 - VideoFramerateMode - pfr - VideoGrayScale - 0 - VideoQualitySlider - 20 - VideoQualityType - 2 - VideoTwoPass - 0 - h264Level - 3.0 - x264UseAdvancedOptions - - x264Option - level=3.0:ref=1:bframes=0:cabac=0:8x8dct=0:weightp=0:subme=6:vbv-bufsize=10000:vbv-maxrate=10000:rc-lookahead=30 - x264OptionExtra - - x264Preset - fast - h264Profile - baseline - x264Tune - none - - - AudioList - - - AudioBitrate - 160 - AudioEncoder - AAC (faac) - AudioMixdown - Dolby Pro Logic II - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - ChapterMarkers - 1 - Default - 0 - FileFormat - MP4 file - Mp4iPodCompatible - 1 - PictureAutoCrop - 1 - PictureBottomCrop - 0 - PictureDeblock - 0 - PictureDeinterlace - 0 - PictureDenoise - 0 - PictureDetelecine - 0 - PictureHeight - 0 - PictureKeepRatio - 1 - PictureLeftCrop - 0 - PictureModulus - 2 - PicturePAR - 0 - PictureRightCrop - 0 - PictureTopCrop - 0 - PictureWidth - 320 - PresetDescription - HandBrake's low resolution settings for the iPod (5G and up). Optimized for great playback on the iPod screen, with smaller file size. - PresetName - iPod - Subtitles - None - Type - 0 - UsesPictureFilters - 1 - UsesPictureSettings - 1 - VFR - 0 - VideoAvgBitrate - 700 - VideoEncoder - H.264 (x264) - VideoFramerate - 30 - VideoFramerateMode - pfr - VideoGrayScale - 0 - VideoQualitySlider - 22 - VideoQualityType - 2 - VideoTwoPass - 0 - h264Level - 1.3 - x264UseAdvancedOptions - - x264Option - level=1.3:ref=1:bframes=0:cabac=0:8x8dct=0:weightp=0:vbv-bufsize=2000:vbv-maxrate=768 - x264OptionExtra - - x264Preset - medium - h264Profile - baseline - x264Tune - none - - - AudioList - - - AudioBitrate - 160 - AudioEncoder - AAC (faac) - AudioMixdown - Dolby Pro Logic II - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - ChapterMarkers - 1 - Default - 0 - FileFormat - MP4 file - Folder - - Mp4LargeFile - 1 - PictureAutoCrop - 1 - PictureBottomCrop - 0 - PictureDeblock - 0 - PictureDeinterlace - 0 - PictureDenoise - 0 - PictureDetelecine - 0 - PictureHeight - 0 - PictureKeepRatio - 0 - PictureLeftCrop - 0 - PictureModulus - 2 - PicturePAR - 2 - PictureRightCrop - 0 - PictureTopCrop - 0 - PictureWidth - 960 - PresetDescription - HandBrake's preset for the iPhone 4 is optimized for viewing on its 960x480 display. - PresetName - iPhone & iPod Touch - Subtitles - None - Type - 0 - UsesPictureFilters - 1 - UsesPictureSettings - 1 - VFR - 0 - VideoAvgBitrate - 2500 - VideoEncoder - H.264 (x264) - VideoFramerate - 29.97 (NTSC Video) - VideoFramerateMode - pfr - VideoGrayScale - 0 - VideoQualitySlider - 22 - VideoQualityType - 2 - VideoTwoPass - 0 - h264Level - 3.1 - x264UseAdvancedOptions - - x264Option - level=3.1:vbv-bufsize=17500:vbv-maxrate=17500 - x264OptionExtra - - x264Preset - medium - h264Profile - high - x264Tune - none - - - AudioList - - - AudioBitrate - 160 - AudioEncoder - AAC (faac) - AudioMixdown - Dolby Pro Logic II - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - ChapterMarkers - 1 - Default - 0 - FileFormat - MP4 file - Folder - - Mp4LargeFile - 1 - PictureAutoCrop - 1 - PictureBottomCrop - 0 - PictureDeblock - 0 - PictureDeinterlace - 0 - PictureDenoise - 0 - PictureDetelecine - 0 - PictureHeight - 0 - PictureKeepRatio - 0 - PictureLeftCrop - 0 - PictureModulus - 2 - PicturePAR - 2 - PictureRightCrop - 0 - PictureTopCrop - 0 - PictureWidth - 1280 - PresetDescription - HandBrake's preset for the iPad (all generations) is optimized for a good balance between quality and filesize. - PresetName - iPad - Subtitles - None - Type - 0 - UsesPictureFilters - 1 - UsesPictureSettings - 1 - VFR - 0 - VideoAvgBitrate - 2500 - VideoEncoder - H.264 (x264) - VideoFramerate - 29.97 (NTSC Video) - VideoFramerateMode - pfr - VideoGrayScale - 0 - VideoQualitySlider - 20 - VideoQualityType - 2 - VideoTwoPass - 0 - h264Level - 3.1 - x264UseAdvancedOptions - - x264Option - level=3.1:vbv-bufsize=17500:vbv-maxrate=17500 - x264OptionExtra - - x264Preset - medium - h264Profile - high - x264Tune - none - - - AudioList - - - AudioBitrate - 160 - AudioEncoder - AAC (faac) - AudioMixdown - Dolby Pro Logic II - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - AudioBitrate - 160 - AudioEncoder - AC3 Passthru - AudioMixdown - None - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - ChapterMarkers - 1 - Default - 0 - FileFormat - MP4 file - Folder - - Mp4LargeFile - 1 - PictureAutoCrop - 1 - PictureBottomCrop - 0 - PictureDeblock - 0 - PictureDeinterlace - 0 - PictureDenoise - 0 - PictureDetelecine - 0 - PictureHeight - 0 - PictureKeepRatio - 0 - PictureLeftCrop - 0 - PictureModulus - 2 - PicturePAR - 2 - PictureRightCrop - 0 - PictureTopCrop - 0 - PictureWidth - 960 - PresetDescription - HandBrake's settings for the AppleTV and 2009's iPhone and iPod Touch lineup. Provides a good balance between quality and file size, and pushes the devices to their limits. Includes Dolby Digital 5.1 AC3 sound for the AppleTV. - PresetName - AppleTV - Subtitles - None - Type - 0 - UsesPictureFilters - 1 - UsesPictureSettings - 1 - VFR - 0 - VideoAvgBitrate - 2500 - VideoEncoder - H.264 (x264) - VideoFramerate - 30 - VideoFramerateMode - pfr - VideoGrayScale - 0 - VideoQualitySlider - 20 - VideoQualityType - 2 - VideoTwoPass - 0 - h264Level - 3.1 - x264UseAdvancedOptions - - x264Option - cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500:level=3.1 - x264OptionExtra - cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500 - x264Preset - medium - h264Profile - high - x264Tune - none - - - AudioList - - - AudioBitrate - 160 - AudioEncoder - AAC (faac) - AudioMixdown - Dolby Pro Logic II - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - AudioBitrate - 160 - AudioEncoder - AC3 Passthru - AudioMixdown - None - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - ChapterMarkers - 1 - Default - 0 - FileFormat - MP4 file - Folder - - Mp4LargeFile - 1 - PictureAutoCrop - 1 - PictureBottomCrop - 0 - PictureDeblock - 0 - PictureDeinterlace - 0 - PictureDenoise - 0 - PictureDetelecine - 0 - PictureHeight - 0 - PictureKeepRatio - 0 - PictureLeftCrop - 0 - PictureModulus - 2 - PicturePAR - 2 - PictureRightCrop - 0 - PictureTopCrop - 0 - PictureWidth - 1280 - PresetDescription - HandBrake's preset for the Apple TV (2nd gen) is optimized for viewing on its 1280x720 display. - PresetName - AppleTV 2 - Subtitles - None - Type - 0 - UsesPictureFilters - 1 - UsesPictureSettings - 1 - VFR - 0 - VideoAvgBitrate - 2500 - VideoEncoder - H.264 (x264) - VideoFramerate - 29.97 (NTSC Video) - VideoFramerateMode - pfr - VideoGrayScale - 0 - VideoQualitySlider - 20 - VideoQualityType - 2 - VideoTwoPass - 0 - h264Level - 3.1 - x264UseAdvancedOptions - - x264Option - level=3.1:vbv-bufsize=17500:vbv-maxrate=17500 - x264OptionExtra - - x264Preset - medium - h264Profile - high - x264Tune - none - - - AudioList - - - AudioBitrate - 160 - AudioEncoder - AAC (faac) - AudioMixdown - Dolby Pro Logic II - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - AudioBitrate - 160 - AudioEncoder - AC3 Passthru - AudioMixdown - None - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - ChapterMarkers - 1 - Default - 0 - FileFormat - MP4 file - Folder - - Mp4LargeFile - 1 - PictureAutoCrop - 1 - PictureBottomCrop - 0 - PictureDeblock - 0 - PictureDecomb - 3 - PictureDecombDeinterlace - 1 - PictureDeinterlace - 0 - PictureDenoise - 0 - PictureDetelecine - 0 - PictureHeight - 0 - PictureKeepRatio - 0 - PictureLeftCrop - 0 - PictureModulus - 2 - PicturePAR - 2 - PictureRightCrop - 0 - PictureTopCrop - 0 - PictureWidth - 1920 - PresetDescription - HandBrake's preset for the Apple TV (3rd gen) is optimized for up to 1080p playback. - PresetName - AppleTV 3 - Subtitles - None - Type - 0 - UsesPictureFilters - 1 - UsesPictureSettings - 1 - VideoAvgBitrate - 2500 - VideoEncoder - H.264 (x264) - VideoFramerate - 30 - VideoFramerateMode - pfr - VideoGrayScale - 0 - VideoQualitySlider - 20 - VideoQualityType - 2 - VideoTwoPass - 0 - h264Level - 4.0 - x264UseAdvancedOptions - - x264Option - level=4.0:vbv-bufsize=31250:vbv-maxrate=25000 - x264OptionExtra - - x264Preset - medium - h264Profile - high - x264Tune - none - - - AudioList - - - AudioBitrate - 128 - AudioEncoder - AAC (faac) - AudioMixdown - Dolby Pro Logic II - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - ChapterMarkers - 0 - Default - 0 - FileFormat - MP4 file - Mp4LargeFile - 0 - Mp4iPodCompatible - 0 - PictureAutoCrop - 1 - PictureBottomCrop - 0 - PictureDeblock - 0 - PictureDeinterlace - 0 - PictureDenoise - 0 - PictureDetelecine - 0 - PictureHeight - 0 - PictureKeepRatio - 1 - PictureLeftCrop - 0 - PictureModulus - 2 - PicturePAR - 2 - PictureRightCrop - 0 - PictureTopCrop - 0 - PictureWidth - 720 - PresetDescription - HandBrake's settings for Mid-range Android 2.3 or better devices. - PresetName - Android - Subtitles - None - Type - 0 - UsesPictureFilters - 1 - UsesPictureSettings - 1 - VFR - 0 - VideoAvgBitrate - 960 - VideoEncoder - H.264 (x264) - VideoFramerate - 29.97 (NTSC Video) - VideoFramerateMode - pfr - VideoGrayScale - 0 - VideoQualitySlider - 22 - VideoQualityType - 2 - VideoTwoPass - 0 - h264Level - 2.2 - x264UseAdvancedOptions - - x264Option - level=2.2:ref=1:bframes=0:8x8dct=0:vbv-bufsize=4000:vbv-maxrate=4000 - x264OptionExtra - - x264Preset - medium - h264Profile - main - x264Tune - none - - - AudioList - - - AudioBitrate - 128 - AudioEncoder - AAC (faac) - AudioMixdown - Dolby Pro Logic II - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - ChapterMarkers - 0 - Default - 0 - FileFormat - MP4 file - Folder - - Mp4LargeFile - 0 - PictureAutoCrop - 1 - PictureBottomCrop - 0 - PictureDeblock - 0 - PictureDeinterlace - 0 - PictureDenoise - 0 - PictureDetelecine - 0 - PictureHeight - 0 - PictureKeepRatio - 0 - PictureLeftCrop - 0 - PictureModulus - 2 - PicturePAR - 2 - PictureRightCrop - 0 - PictureTopCrop - 0 - PictureWidth - 1280 - PresetDescription - HandBrake's preset for the Higher end Anroid 2.3 or better devices. - PresetName - Android Tablet - Subtitles - None - Type - 0 - UsesPictureFilters - 1 - UsesPictureSettings - 1 - VFR - 0 - VideoAvgBitrate - 2500 - VideoEncoder - H.264 (x264) - VideoFramerate - 29.97 (NTSC Video) - VideoFramerateMode - pfr - VideoGrayScale - 0 - VideoQualitySlider - 22 - VideoQualityType - 2 - VideoTwoPass - 0 - h264Level - 3.1 - x264UseAdvancedOptions - - x264Option - level=3.1:8x8dct=0:vbv-bufsize=14000:vbv-maxrate=14000 - x264OptionExtra - - x264Preset - medium - h264Profile - main - x264Tune - none - - - Default - 0 - Folder - - PresetBuildNumber - 2012041101 - PresetName - Devices - Type - 0 - - - ChildrenArray - - - AudioList - - - AudioBitrate - 160 - AudioEncoder - AAC (faac) - AudioMixdown - Dolby Pro Logic II - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - ChapterMarkers - 1 - Default - 1 - FileFormat - MP4 file - PictureAutoCrop - 1 - PictureBottomCrop - 0 - PictureDeblock - 0 - PictureDeinterlace - 0 - PictureDenoise - 0 - PictureDetelecine - 0 - PictureHeight - 0 - PictureKeepRatio - 0 - PictureLeftCrop - 0 - PictureModulus - 2 - PicturePAR - 2 - PictureRightCrop - 0 - PictureTopCrop - 0 - PictureWidth - 0 - PresetDescription - HandBrake's normal, default settings. - PresetName - Normal - Subtitles - None - Type - 0 - UsesPictureFilters - 1 - UsesPictureSettings - 2 - VFR - 0 - VideoAvgBitrate - 1500 - VideoEncoder - H.264 (x264) - VideoFramerate - Same as source - VideoFramerateMode - vfr - VideoGrayScale - 0 - VideoQualitySlider - 20 - VideoQualityType - 2 - VideoTurboTwoPass - 0 - VideoTwoPass - 0 - h264Level - 4.0 - x264UseAdvancedOptions - - x264Option - level=4.0:ref=1:8x8dct=0:weightp=1:subme=2:mixed-refs=0:trellis=0:vbv-bufsize=25000:vbv-maxrate=20000:rc-lookahead=10 - x264OptionExtra - - x264Preset - veryfast - h264Profile - main - x264Tune - none - - - AudioList - - - AudioBitrate - 160 - AudioEncoder - AAC (faac) - AudioMixdown - Dolby Pro Logic II - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - AudioBitrate - 160 - AudioEncoder - AC3 Passthru - AudioMixdown - None - AudioSamplerate - Auto - AudioTrack - 1 - AudioTrackDRCSlider - 0.0 - - - ChapterMarkers - 1 - Default - 0 - FileFormat - MP4 file - Mp4LargeFile - 1 - PictureAutoCrop - 1 - PictureBottomCrop - 0 - PictureDeblock - 0 - PictureDecomb - 2 - PictureDecombDeinterlace - 1 - PictureDeinterlace - 0 - PictureDenoise - 0 - PictureDetelecine - 0 - PictureHeight - 0 - PictureKeepRatio - 0 - PictureLeftCrop - 0 - PictureModulus - 2 - PicturePAR - 2 - PictureRightCrop - 0 - PictureTopCrop - 0 - PictureWidth - 0 - PresetDescription - HandBrake's general-purpose preset for High Profile H.264 video, with all the bells and whistles. - PresetName - High Profile - Subtitles - None - Type - 0 - UsesPictureFilters - 1 - UsesPictureSettings - 2 - VideoAvgBitrate - 1800 - VideoEncoder - H.264 (x264) - VideoFramerate - Same as source - VideoFramerateMode - vfr - VideoGrayScale - 0 - VideoQualitySlider - 20 - VideoQualityType - 2 - VideoTurboTwoPass - 0 - VideoTwoPass - 0 - h264Level - 4.1 - x264UseAdvancedOptions - - x264Option - level=4.1:vbv-bufsize=78125:vbv-maxrate=62500 - x264OptionExtra - - x264Preset - medium - h264Profile - high - x264Tune - none - - - Default - 0 - Folder - - PresetBuildNumber - 2012041101 - PresetName - Regular - Type - 0 - + + ChildrenArray + + + AudioAllowAACPass + 1 + AudioAllowAC3Pass + 1 + AudioAllowDTSHDPass + 1 + AudioAllowDTSPass + 1 + AudioAllowMP3Pass + 1 + AudioEncoderFallback + AC3 (ffmpeg) + AudioList + + + AudioBitrate + 160 + AudioEncoder + AAC (faac) + AudioMixdown + Dolby Pro Logic II + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + AudioBitrate + 160 + AudioEncoder + AC3 Passthru + AudioMixdown + None + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + ChapterMarkers + 1 + Default + 0 + FileFormat + MP4 file + Folder + + Mp4HttpOptimize + 0 + Mp4LargeFile + 0 + Mp4iPodCompatible + 0 + PictureAutoCrop + 1 + PictureBottomCrop + 0 + PictureDeblock + 0 + PictureDecomb + 0 + PictureDecombCustom + + PictureDecombDeinterlace + 1 + PictureDeinterlace + 0 + PictureDeinterlaceCustom + + PictureDenoise + 0 + PictureDenoiseCustom + + PictureDetelecine + 0 + PictureDetelecineCustom + + PictureHeight + 576 + PictureKeepRatio + 0 + PictureLeftCrop + 0 + PictureModulus + 2 + PicturePAR + 2 + PictureRightCrop + 0 + PictureTopCrop + 0 + PictureWidth + 720 + PresetDescription + HandBrake's settings for compatibility with all Apple devices (including the iPod 6G and later). Includes Dolby Digital audio for surround sound. + PresetName + Universal + Subtitles + None + Type + 0 + UsesPictureFilters + 1 + UsesPictureSettings + 1 + VideoAvgBitrate + 2500 + VideoEncoder + H.264 (x264) + VideoFramerate + 30 + VideoFramerateMode + pfr + VideoGrayScale + 0 + VideoQualitySlider + 20 + VideoQualityType + 2 + VideoTurboTwoPass + 0 + VideoTwoPass + 0 + h264Level + 3.0 + h264Profile + baseline + lavcOption + + x264Option + + x264OptionExtra + + x264Preset + fast + x264Tune + + x264UseAdvancedOptions + 0 + + + AudioAllowAACPass + 1 + AudioAllowAC3Pass + 1 + AudioAllowDTSHDPass + 1 + AudioAllowDTSPass + 1 + AudioAllowMP3Pass + 1 + AudioEncoderFallback + AC3 (ffmpeg) + AudioList + + + AudioBitrate + 160 + AudioEncoder + AAC (faac) + AudioMixdown + Dolby Pro Logic II + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + ChapterMarkers + 1 + Default + 0 + FileFormat + MP4 file + Folder + + Mp4HttpOptimize + 0 + Mp4LargeFile + 0 + Mp4iPodCompatible + 1 + PictureAutoCrop + 1 + PictureBottomCrop + 0 + PictureDeblock + 0 + PictureDecomb + 0 + PictureDecombCustom + + PictureDecombDeinterlace + 1 + PictureDeinterlace + 0 + PictureDeinterlaceCustom + + PictureDenoise + 0 + PictureDenoiseCustom + + PictureDetelecine + 0 + PictureDetelecineCustom + + PictureHeight + 240 + PictureKeepRatio + 1 + PictureLeftCrop + 0 + PictureModulus + 2 + PicturePAR + 0 + PictureRightCrop + 0 + PictureTopCrop + 0 + PictureWidth + 320 + PresetDescription + HandBrake's settings for playback on the iPod with Video (all generations). + PresetName + iPod + Subtitles + None + Type + 0 + UsesPictureFilters + 1 + UsesPictureSettings + 1 + VideoAvgBitrate + 2500 + VideoEncoder + H.264 (x264) + VideoFramerate + 30 + VideoFramerateMode + pfr + VideoGrayScale + 0 + VideoQualitySlider + 22 + VideoQualityType + 2 + VideoTurboTwoPass + 0 + VideoTwoPass + 0 + h264Level + 1.3 + h264Profile + baseline + lavcOption + + x264Option + + x264OptionExtra + + x264Preset + medium + x264Tune + + x264UseAdvancedOptions + 0 + + + AudioAllowAACPass + 1 + AudioAllowAC3Pass + 1 + AudioAllowDTSHDPass + 1 + AudioAllowDTSPass + 1 + AudioAllowMP3Pass + 1 + AudioEncoderFallback + AC3 (ffmpeg) + AudioList + + + AudioBitrate + 160 + AudioEncoder + AAC (faac) + AudioMixdown + Dolby Pro Logic II + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + ChapterMarkers + 1 + Default + 0 + FileFormat + MP4 file + Folder + + Mp4HttpOptimize + 0 + Mp4LargeFile + 1 + Mp4iPodCompatible + 0 + PictureAutoCrop + 1 + PictureBottomCrop + 0 + PictureDeblock + 0 + PictureDecomb + 0 + PictureDecombCustom + + PictureDecombDeinterlace + 1 + PictureDeinterlace + 0 + PictureDeinterlaceCustom + + PictureDenoise + 0 + PictureDenoiseCustom + + PictureDetelecine + 0 + PictureDetelecineCustom + + PictureHeight + 640 + PictureKeepRatio + 0 + PictureLeftCrop + 0 + PictureModulus + 2 + PicturePAR + 2 + PictureRightCrop + 0 + PictureTopCrop + 0 + PictureWidth + 960 + PresetDescription + HandBrake's settings for handheld iOS devices (iPhone 4, iPod touch 3G and later). + PresetName + iPhone & iPod touch + Subtitles + None + Type + 0 + UsesPictureFilters + 1 + UsesPictureSettings + 1 + VideoAvgBitrate + 2500 + VideoEncoder + H.264 (x264) + VideoFramerate + 30 + VideoFramerateMode + pfr + VideoGrayScale + 0 + VideoQualitySlider + 22 + VideoQualityType + 2 + VideoTurboTwoPass + 0 + VideoTwoPass + 0 + h264Level + 3.1 + h264Profile + high + lavcOption + + x264Option + + x264OptionExtra + + x264Preset + medium + x264Tune + + x264UseAdvancedOptions + 0 + + + AudioAllowAACPass + 1 + AudioAllowAC3Pass + 1 + AudioAllowDTSHDPass + 1 + AudioAllowDTSPass + 1 + AudioAllowMP3Pass + 1 + AudioEncoderFallback + AC3 (ffmpeg) + AudioList + + + AudioBitrate + 160 + AudioEncoder + AAC (faac) + AudioMixdown + Dolby Pro Logic II + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + ChapterMarkers + 1 + Default + 0 + FileFormat + MP4 file + Folder + + Mp4HttpOptimize + 0 + Mp4LargeFile + 1 + Mp4iPodCompatible + 0 + PictureAutoCrop + 1 + PictureBottomCrop + 0 + PictureDeblock + 0 + PictureDecomb + 0 + PictureDecombCustom + + PictureDecombDeinterlace + 1 + PictureDeinterlace + 0 + PictureDeinterlaceCustom + + PictureDenoise + 0 + PictureDenoiseCustom + + PictureDetelecine + 0 + PictureDetelecineCustom + + PictureHeight + 720 + PictureKeepRatio + 0 + PictureLeftCrop + 0 + PictureModulus + 2 + PicturePAR + 2 + PictureRightCrop + 0 + PictureTopCrop + 0 + PictureWidth + 1280 + PresetDescription + HandBrake's settings for playback on the iPad (all generations). + PresetName + iPad + Subtitles + None + Type + 0 + UsesPictureFilters + 1 + UsesPictureSettings + 1 + VideoAvgBitrate + 2500 + VideoEncoder + H.264 (x264) + VideoFramerate + 30 + VideoFramerateMode + pfr + VideoGrayScale + 0 + VideoQualitySlider + 20 + VideoQualityType + 2 + VideoTurboTwoPass + 0 + VideoTwoPass + 0 + h264Level + 3.1 + h264Profile + high + lavcOption + + x264Option + + x264OptionExtra + + x264Preset + medium + x264Tune + + x264UseAdvancedOptions + 0 + + + AudioAllowAACPass + 1 + AudioAllowAC3Pass + 1 + AudioAllowDTSHDPass + 1 + AudioAllowDTSPass + 1 + AudioAllowMP3Pass + 1 + AudioEncoderFallback + AC3 (ffmpeg) + AudioList + + + AudioBitrate + 160 + AudioEncoder + AAC (faac) + AudioMixdown + Dolby Pro Logic II + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + AudioBitrate + 160 + AudioEncoder + AC3 Passthru + AudioMixdown + None + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + ChapterMarkers + 1 + Default + 0 + FileFormat + MP4 file + Folder + + Mp4HttpOptimize + 0 + Mp4LargeFile + 1 + Mp4iPodCompatible + 0 + PictureAutoCrop + 1 + PictureBottomCrop + 0 + PictureDeblock + 0 + PictureDecomb + 0 + PictureDecombCustom + + PictureDecombDeinterlace + 1 + PictureDeinterlace + 0 + PictureDeinterlaceCustom + + PictureDenoise + 0 + PictureDenoiseCustom + + PictureDetelecine + 0 + PictureDetelecineCustom + + PictureHeight + 720 + PictureKeepRatio + 0 + PictureLeftCrop + 0 + PictureModulus + 2 + PicturePAR + 2 + PictureRightCrop + 0 + PictureTopCrop + 0 + PictureWidth + 960 + PresetDescription + HandBrake's settings for the original AppleTV. Includes Dolby Digital audio for surround sound. Also compatible with iOS devices released since 2009. + PresetName + AppleTV + Subtitles + None + Type + 0 + UsesPictureFilters + 1 + UsesPictureSettings + 1 + VideoAvgBitrate + 2500 + VideoEncoder + H.264 (x264) + VideoFramerate + 30 + VideoFramerateMode + pfr + VideoGrayScale + 0 + VideoQualitySlider + 20 + VideoQualityType + 2 + VideoTurboTwoPass + 0 + VideoTwoPass + 0 + h264Level + 3.1 + h264Profile + high + lavcOption + + x264Option + + x264OptionExtra + qpmin=4:cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500 + x264Preset + medium + x264Tune + + x264UseAdvancedOptions + 0 + + + AudioAllowAACPass + 1 + AudioAllowAC3Pass + 1 + AudioAllowDTSHDPass + 1 + AudioAllowDTSPass + 1 + AudioAllowMP3Pass + 1 + AudioEncoderFallback + AC3 (ffmpeg) + AudioList + + + AudioBitrate + 160 + AudioEncoder + AAC (faac) + AudioMixdown + Dolby Pro Logic II + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + AudioBitrate + 160 + AudioEncoder + AC3 Passthru + AudioMixdown + None + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + ChapterMarkers + 1 + Default + 0 + FileFormat + MP4 file + Folder + + Mp4HttpOptimize + 0 + Mp4LargeFile + 1 + Mp4iPodCompatible + 0 + PictureAutoCrop + 1 + PictureBottomCrop + 0 + PictureDeblock + 0 + PictureDecomb + 0 + PictureDecombCustom + + PictureDecombDeinterlace + 1 + PictureDeinterlace + 0 + PictureDeinterlaceCustom + + PictureDenoise + 0 + PictureDenoiseCustom + + PictureDetelecine + 0 + PictureDetelecineCustom + + PictureHeight + 720 + PictureKeepRatio + 0 + PictureLeftCrop + 0 + PictureModulus + 2 + PicturePAR + 2 + PictureRightCrop + 0 + PictureTopCrop + 0 + PictureWidth + 1280 + PresetDescription + HandBrake's settings for the second-generation AppleTV. Includes Dolby Digital audio for surround sound. NOT compatible with the original AppleTV. + PresetName + AppleTV 2 + Subtitles + None + Type + 0 + UsesPictureFilters + 1 + UsesPictureSettings + 1 + VideoAvgBitrate + 2500 + VideoEncoder + H.264 (x264) + VideoFramerate + 30 + VideoFramerateMode + pfr + VideoGrayScale + 0 + VideoQualitySlider + 20 + VideoQualityType + 2 + VideoTurboTwoPass + 0 + VideoTwoPass + 0 + h264Level + 3.1 + h264Profile + high + lavcOption + + x264Option + + x264OptionExtra + + x264Preset + medium + x264Tune + + x264UseAdvancedOptions + 0 + + + AudioAllowAACPass + 1 + AudioAllowAC3Pass + 1 + AudioAllowDTSHDPass + 1 + AudioAllowDTSPass + 1 + AudioAllowMP3Pass + 1 + AudioEncoderFallback + AC3 (ffmpeg) + AudioList + + + AudioBitrate + 160 + AudioEncoder + AAC (faac) + AudioMixdown + Dolby Pro Logic II + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + AudioBitrate + 160 + AudioEncoder + AC3 Passthru + AudioMixdown + None + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + ChapterMarkers + 1 + Default + 0 + FileFormat + MP4 file + Folder + + Mp4HttpOptimize + 0 + Mp4LargeFile + 1 + Mp4iPodCompatible + 0 + PictureAutoCrop + 1 + PictureBottomCrop + 0 + PictureDeblock + 0 + PictureDecomb + 3 + PictureDecombCustom + + PictureDecombDeinterlace + 1 + PictureDeinterlace + 0 + PictureDeinterlaceCustom + + PictureDenoise + 0 + PictureDenoiseCustom + + PictureDetelecine + 0 + PictureDetelecineCustom + + PictureHeight + 1080 + PictureKeepRatio + 0 + PictureLeftCrop + 0 + PictureModulus + 2 + PicturePAR + 2 + PictureRightCrop + 0 + PictureTopCrop + 0 + PictureWidth + 1920 + PresetDescription + HandBrake's settings for the third-generation AppleTV. Includes Dolby Digital audio for surround sound. NOT compatible with the original AppleTV. May stutter on the second-generation AppleTV. + PresetName + AppleTV 3 + Subtitles + None + Type + 0 + UsesPictureFilters + 1 + UsesPictureSettings + 1 + VideoAvgBitrate + 2500 + VideoEncoder + H.264 (x264) + VideoFramerate + 30 + VideoFramerateMode + pfr + VideoGrayScale + 0 + VideoQualitySlider + 20 + VideoQualityType + 2 + VideoTurboTwoPass + 0 + VideoTwoPass + 0 + h264Level + 4.0 + h264Profile + high + lavcOption + + x264Option + + x264OptionExtra + + x264Preset + medium + x264Tune + + x264UseAdvancedOptions + 0 + + + AudioAllowAACPass + 1 + AudioAllowAC3Pass + 1 + AudioAllowDTSHDPass + 1 + AudioAllowDTSPass + 1 + AudioAllowMP3Pass + 1 + AudioEncoderFallback + AC3 (ffmpeg) + AudioList + + + AudioBitrate + 128 + AudioEncoder + AAC (faac) + AudioMixdown + Dolby Pro Logic II + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + ChapterMarkers + 0 + Default + 0 + FileFormat + MP4 file + Folder + + Mp4HttpOptimize + 0 + Mp4LargeFile + 0 + Mp4iPodCompatible + 0 + PictureAutoCrop + 1 + PictureBottomCrop + 0 + PictureDeblock + 0 + PictureDecomb + 0 + PictureDecombCustom + + PictureDecombDeinterlace + 1 + PictureDeinterlace + 0 + PictureDeinterlaceCustom + + PictureDenoise + 0 + PictureDenoiseCustom + + PictureDetelecine + 0 + PictureDetelecineCustom + + PictureHeight + 576 + PictureKeepRatio + 0 + PictureLeftCrop + 0 + PictureModulus + 2 + PicturePAR + 2 + PictureRightCrop + 0 + PictureTopCrop + 0 + PictureWidth + 720 + PresetDescription + HandBrake's settings for midrange devices running Android 2.3 or later. + PresetName + Android + Subtitles + None + Type + 0 + UsesPictureFilters + 1 + UsesPictureSettings + 1 + VideoAvgBitrate + 2500 + VideoEncoder + H.264 (x264) + VideoFramerate + 30 + VideoFramerateMode + pfr + VideoGrayScale + 0 + VideoQualitySlider + 22 + VideoQualityType + 2 + VideoTurboTwoPass + 0 + VideoTwoPass + 0 + h264Level + 3.0 + h264Profile + main + lavcOption + + x264Option + + x264OptionExtra + + x264Preset + medium + x264Tune + + x264UseAdvancedOptions + 0 + + + AudioAllowAACPass + 1 + AudioAllowAC3Pass + 1 + AudioAllowDTSHDPass + 1 + AudioAllowDTSPass + 1 + AudioAllowMP3Pass + 1 + AudioEncoderFallback + AC3 (ffmpeg) + AudioList + + + AudioBitrate + 128 + AudioEncoder + AAC (faac) + AudioMixdown + Dolby Pro Logic II + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + ChapterMarkers + 0 + Default + 0 + FileFormat + MP4 file + Folder + + Mp4HttpOptimize + 0 + Mp4LargeFile + 0 + Mp4iPodCompatible + 0 + PictureAutoCrop + 1 + PictureBottomCrop + 0 + PictureDeblock + 0 + PictureDecomb + 0 + PictureDecombCustom + + PictureDecombDeinterlace + 1 + PictureDeinterlace + 0 + PictureDeinterlaceCustom + + PictureDenoise + 0 + PictureDenoiseCustom + + PictureDetelecine + 0 + PictureDetelecineCustom + + PictureHeight + 720 + PictureKeepRatio + 0 + PictureLeftCrop + 0 + PictureModulus + 2 + PicturePAR + 2 + PictureRightCrop + 0 + PictureTopCrop + 0 + PictureWidth + 1280 + PresetDescription + HandBrake's preset for tablets running Android 2.3 or later. + PresetName + Android Tablet + Subtitles + None + Type + 0 + UsesPictureFilters + 1 + UsesPictureSettings + 1 + VideoAvgBitrate + 2500 + VideoEncoder + H.264 (x264) + VideoFramerate + 30 + VideoFramerateMode + pfr + VideoGrayScale + 0 + VideoQualitySlider + 22 + VideoQualityType + 2 + VideoTurboTwoPass + 0 + VideoTwoPass + 0 + h264Level + 3.1 + h264Profile + main + lavcOption + + x264Option + + x264OptionExtra + + x264Preset + medium + x264Tune + + x264UseAdvancedOptions + 0 + + + Default + 0 + Folder + + PresetBuildNumber + 2013030401 + PresetName + Devices + Type + 0 + + + ChildrenArray + + + AudioAllowAACPass + 1 + AudioAllowAC3Pass + 1 + AudioAllowDTSHDPass + 1 + AudioAllowDTSPass + 1 + AudioAllowMP3Pass + 1 + AudioEncoderFallback + AC3 (ffmpeg) + AudioList + + + AudioBitrate + 160 + AudioEncoder + AAC (faac) + AudioMixdown + Dolby Pro Logic II + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + ChapterMarkers + 1 + Default + 1 + FileFormat + MP4 file + Folder + + Mp4HttpOptimize + 0 + Mp4LargeFile + 0 + Mp4iPodCompatible + 0 + PictureAutoCrop + 1 + PictureBottomCrop + 0 + PictureDeblock + 0 + PictureDecomb + 0 + PictureDecombCustom + + PictureDecombDeinterlace + 1 + PictureDeinterlace + 0 + PictureDeinterlaceCustom + + PictureDenoise + 0 + PictureDenoiseCustom + + PictureDetelecine + 0 + PictureDetelecineCustom + + PictureHeight + 0 + PictureKeepRatio + 0 + PictureLeftCrop + 0 + PictureModulus + 2 + PicturePAR + 2 + PictureRightCrop + 0 + PictureTopCrop + 0 + PictureWidth + 0 + PresetDescription + HandBrake's normal, default settings. + PresetName + Normal + Subtitles + None + Type + 0 + UsesPictureFilters + 1 + UsesPictureSettings + 1 + VideoAvgBitrate + 2500 + VideoEncoder + H.264 (x264) + VideoFramerate + Same as source + VideoFramerateMode + vfr + VideoGrayScale + 0 + VideoQualitySlider + 20 + VideoQualityType + 2 + VideoTurboTwoPass + 0 + VideoTwoPass + 0 + h264Level + 4.0 + h264Profile + main + lavcOption + + x264Option + + x264OptionExtra + + x264Preset + veryfast + x264Tune + + x264UseAdvancedOptions + 0 + + + AudioAllowAACPass + 1 + AudioAllowAC3Pass + 1 + AudioAllowDTSHDPass + 1 + AudioAllowDTSPass + 1 + AudioAllowMP3Pass + 1 + AudioEncoderFallback + AC3 (ffmpeg) + AudioList + + + AudioBitrate + 160 + AudioEncoder + AAC (faac) + AudioMixdown + Dolby Pro Logic II + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + AudioBitrate + 160 + AudioEncoder + AC3 Passthru + AudioMixdown + None + AudioSamplerate + Auto + AudioTrack + 1 + AudioTrackDRCSlider + 0.0 + AudioTrackGainSlider + 0.0 + + + ChapterMarkers + 1 + Default + 0 + FileFormat + MP4 file + Folder + + Mp4HttpOptimize + 0 + Mp4LargeFile + 1 + Mp4iPodCompatible + 0 + PictureAutoCrop + 1 + PictureBottomCrop + 0 + PictureDeblock + 0 + PictureDecomb + 2 + PictureDecombCustom + + PictureDecombDeinterlace + 1 + PictureDeinterlace + 0 + PictureDeinterlaceCustom + + PictureDenoise + 0 + PictureDenoiseCustom + + PictureDetelecine + 0 + PictureDetelecineCustom + + PictureHeight + 0 + PictureKeepRatio + 0 + PictureLeftCrop + 0 + PictureModulus + 2 + PicturePAR + 2 + PictureRightCrop + 0 + PictureTopCrop + 0 + PictureWidth + 0 + PresetDescription + HandBrake's general-purpose preset for High Profile H.264 video. + PresetName + High Profile + Subtitles + None + Type + 0 + UsesPictureFilters + 1 + UsesPictureSettings + 1 + VideoAvgBitrate + 2500 + VideoEncoder + H.264 (x264) + VideoFramerate + Same as source + VideoFramerateMode + vfr + VideoGrayScale + 0 + VideoQualitySlider + 20 + VideoQualityType + 2 + VideoTurboTwoPass + 0 + VideoTwoPass + 0 + h264Level + 4.1 + h264Profile + high + lavcOption + + x264Option + + x264OptionExtra + + x264Preset + medium + x264Tune + + x264UseAdvancedOptions + 0 + + + Default + 0 + Folder + + PresetBuildNumber + 2013030401 + PresetName + Regular + Type + 0 + diff --git a/libhb/audio_remap.c b/libhb/audio_remap.c index 2ca935fbb..44f0d73d3 100644 --- a/libhb/audio_remap.c +++ b/libhb/audio_remap.c @@ -1,6 +1,6 @@ /* audio_remap.c * - * Copyright (c) 2003-2012 HandBrake Team + * Copyright (c) 2003-2013 HandBrake Team * This file is part of the HandBrake source code * Homepage: * It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/audio_remap.h b/libhb/audio_remap.h index 3e4ab722b..3092fb854 100644 --- a/libhb/audio_remap.h +++ b/libhb/audio_remap.h @@ -1,6 +1,6 @@ /* audio_remap.h * - * Copyright (c) 2003-2012 HandBrake Team + * Copyright (c) 2003-2013 HandBrake Team * This file is part of the HandBrake source code * Homepage: * It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/audio_resample.c b/libhb/audio_resample.c index a1cfb1d24..b48cc7271 100644 --- a/libhb/audio_resample.c +++ b/libhb/audio_resample.c @@ -1,6 +1,6 @@ /* audio_resample.c * - * Copyright (c) 2003-2012 HandBrake Team + * Copyright (c) 2003-2013 HandBrake Team * This file is part of the HandBrake source code * Homepage: * It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/audio_resample.h b/libhb/audio_resample.h index c1903eac0..bac3b3292 100644 --- a/libhb/audio_resample.h +++ b/libhb/audio_resample.h @@ -1,6 +1,6 @@ /* audio_resample.h * - * Copyright (c) 2003-2012 HandBrake Team + * Copyright (c) 2003-2013 HandBrake Team * This file is part of the HandBrake source code * Homepage: * It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/batch.c b/libhb/batch.c index 1d7513ab9..420ac6489 100644 --- a/libhb/batch.c +++ b/libhb/batch.c @@ -1,6 +1,6 @@ /* batch.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/bd.c b/libhb/bd.c index 85c22a060..df7f3d492 100644 --- a/libhb/bd.c +++ b/libhb/bd.c @@ -1,6 +1,6 @@ /* dvd.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/bits.h b/libhb/bits.h index 23a29eeb0..c7ae0b236 100644 --- a/libhb/bits.h +++ b/libhb/bits.h @@ -1,6 +1,6 @@ /* bits.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/common.c b/libhb/common.c index 7caae40a4..d22b2aebd 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -1,6 +1,6 @@ /* common.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. @@ -127,6 +127,10 @@ hb_encoder_t hb_audio_encoders[] = { "HE-AAC (CoreAudio)", "ca_haac", HB_ACODEC_CA_HAAC, HB_MUX_MP4|HB_MUX_MKV }, #endif { "AAC (faac)", "faac", HB_ACODEC_FAAC, HB_MUX_MP4|HB_MUX_MKV }, +#ifdef USE_FDK_AAC + { "AAC (FDK)", "fdk_aac", HB_ACODEC_FDK_AAC, HB_MUX_MP4|HB_MUX_MKV }, + { "HE-AAC (FDK)", "fdk_haac", HB_ACODEC_FDK_HAAC, HB_MUX_MP4|HB_MUX_MKV }, +#endif { "AAC (ffmpeg)", "ffaac", HB_ACODEC_FFAAC, HB_MUX_MP4|HB_MUX_MKV }, { "AAC Passthru", "copy:aac", HB_ACODEC_AAC_PASS, HB_MUX_MP4|HB_MUX_MKV }, { "AC3 (ffmpeg)", "ffac3", HB_ACODEC_AC3, HB_MUX_MP4|HB_MUX_MKV }, @@ -179,6 +183,8 @@ int hb_audio_dither_is_supported(uint32_t codec) switch (codec) { case HB_ACODEC_FFFLAC: + case HB_ACODEC_FDK_AAC: + case HB_ACODEC_FDK_HAAC: return 1; default: return 0; @@ -630,9 +636,36 @@ supported samplerates: 32 - 48 kHz Core Audio API provides a range of allowed bitrates: 32 kHz 12 - 40 24 - 80 64 - 192 N/A 96 - 256 48 kHz 16 - 40 32 - 80 80 - 192 N/A 112 - 256 -Limits: minimum of 12 (+ 4 if rate >= 44100) Kbps per full-bandwidth channel +Limits: minimum of 12 Kbps per full-bandwidth channel (<= 32 kHz) + minimum of 16 Kbps per full-bandwidth channel ( > 32 kHz) maximum of 40 Kbps per full-bandwidth channel Note: encCoreAudioInit() will sanitize any mistake made here. + +fdk_aac +------- +supported samplerates: 8 - 48 kHz +libfdk limits the bitrate to the following values: + 8 kHz 48 96 240 +12 kHz 72 144 360 +16 kHz 96 192 480 +24 kHz 144 288 720 +32 kHz 192 384 960 +48 kHz 288 576 1440 +Limits: minimum of samplerate * 2/3 Kbps per full-bandwidth channel (see ca_aac) + maximum of samplerate * 6.0 Kbps per full-bandwidth channel + +fdk_haac +-------- +supported samplerates: 16 - 48 kHz +libfdk limits the bitrate to the following values: +16 kHz 8 - 48 16 - 96 45 - 199 +24 kHz 8 - 63 16 - 127 45 - 266 +32 kHz 8 - 63 16 - 127 45 - 266 +48 kHz 12 - 63 16 - 127 50 - 266 +Limits: minimum of 12 Kbps per full-bandwidth channel (<= 32 kHz) (see ca_haac) + minimum of 16 Kbps per full-bandwidth channel ( > 32 kHz) (see ca_haac) + maximum of 48, 96 or 192 Kbps (1.0, 2.0, 5.1) (<= 16 kHz) + maximum of 64, 128 or 256 Kbps (1.0, 2.0, 5.1) ( > 16 kHz) */ void hb_get_audio_bitrate_limits(uint32_t codec, int samplerate, int mixdown, @@ -709,6 +742,18 @@ void hb_get_audio_bitrate_limits(uint32_t codec, int samplerate, int mixdown, *high = nchannels * 40; break; + case HB_ACODEC_FDK_AAC: + *low = nchannels * samplerate * 2 / 3000; + *high = nchannels * samplerate * 6 / 1000; + break; + + case HB_ACODEC_FDK_HAAC: + *low = (nchannels * (12 + (4 * (samplerate >= 44100)))); + *high = (nchannels - (nchannels > 2)) * (48 + + (16 * + (samplerate >= 22050))); + break; + case HB_ACODEC_FAAC: *low = (nchannels + lfe_count) * 32; *high = (nchannels + lfe_count) * (192 >> sr_shift); @@ -788,6 +833,7 @@ int hb_get_default_audio_bitrate(uint32_t codec, int samplerate, int mixdown) break; case HB_ACODEC_CA_HAAC: + case HB_ACODEC_FDK_HAAC: bitrate = nchannels * 32; break; @@ -994,6 +1040,12 @@ int hb_get_best_samplerate(uint32_t codec, int samplerate, int *sr_shift) best_samplerate = 32000; samplerate_shift = 0; } + else if (samplerate < 16000 && codec == HB_ACODEC_FDK_HAAC) + { + // fdk_haac can't do samplerates < 16 kHz + best_samplerate = 16000; + samplerate_shift = 1; + } else { best_samplerate = samplerate; diff --git a/libhb/common.h b/libhb/common.h index a50591a5f..2198aa0d7 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -1,6 +1,6 @@ /* common.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. @@ -483,7 +483,7 @@ struct hb_job_s /* Audio starts here */ /* Audio Codecs */ -#define HB_ACODEC_MASK 0x003FFF00 +#define HB_ACODEC_MASK 0x00FFFF00 #define HB_ACODEC_FAAC 0x00000100 #define HB_ACODEC_LAME 0x00000200 #define HB_ACODEC_VORBIS 0x00000400 @@ -498,7 +498,9 @@ struct hb_job_s #define HB_ACODEC_MP3 0x00080000 #define HB_ACODEC_FFFLAC 0x00100000 #define HB_ACODEC_FFFLAC24 0x00200000 -#define HB_ACODEC_FF_MASK 0x003F2000 +#define HB_ACODEC_FDK_AAC 0x00400000 +#define HB_ACODEC_FDK_HAAC 0x00800000 +#define HB_ACODEC_FF_MASK 0x00FF2000 #define HB_ACODEC_PASS_FLAG 0x40000000 #define HB_ACODEC_PASS_MASK (HB_ACODEC_MP3 | HB_ACODEC_FFAAC | HB_ACODEC_DCA_HD | HB_ACODEC_AC3 | HB_ACODEC_DCA) #define HB_ACODEC_AUTO_PASS (HB_ACODEC_PASS_MASK | HB_ACODEC_PASS_FLAG) diff --git a/libhb/cropscale.c b/libhb/cropscale.c index 1614b65f2..12d50f9a5 100644 --- a/libhb/cropscale.c +++ b/libhb/cropscale.c @@ -1,6 +1,6 @@ /* cropscale.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/deca52.c b/libhb/deca52.c index 32da29ce1..3c78d157c 100644 --- a/libhb/deca52.c +++ b/libhb/deca52.c @@ -1,6 +1,6 @@ /* deca52.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 3484a11d7..1c8f391e4 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -1,6 +1,6 @@ /* decavcodec.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. @@ -1200,7 +1200,6 @@ static int decavcodecvInit( hb_work_object_t * w, hb_job_t * job ) pv->context->workaround_bugs = FF_BUG_AUTODETECT; pv->context->err_recognition = AV_EF_CRCCHECK; pv->context->error_concealment = FF_EC_GUESS_MVS|FF_EC_DEBLOCK; - init_video_avcodec_context( pv ); } return 0; } @@ -1338,7 +1337,6 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in, // it to preserve any existing priv_data because they test the pointer // before allocating new memory, but the memset has already cleared it. avcodec_get_context_defaults3( pv->context, codec ); - init_video_avcodec_context( pv ); if ( setup_extradata( w, in ) ) { // we didn't find the headers needed to set up extradata. diff --git a/libhb/declpcm.c b/libhb/declpcm.c index 03210af81..7a17f2a14 100644 --- a/libhb/declpcm.c +++ b/libhb/declpcm.c @@ -1,6 +1,6 @@ /* declpcm.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/decmetadata.c b/libhb/decmetadata.c index 513e64fbe..5f6b6af7b 100644 --- a/libhb/decmetadata.c +++ b/libhb/decmetadata.c @@ -1,6 +1,6 @@ /* decmetadata.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/decmpeg2.c b/libhb/decmpeg2.c index 0e1d78eda..8844a09af 100644 --- a/libhb/decmpeg2.c +++ b/libhb/decmpeg2.c @@ -1,6 +1,6 @@ /* decmpeg2.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/decomb.c b/libhb/decomb.c index c23d45baf..a95e998d8 100644 --- a/libhb/decomb.c +++ b/libhb/decomb.c @@ -1,6 +1,6 @@ /* decomb.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/decpgssub.c b/libhb/decpgssub.c index 7a11d924b..8229c6eda 100644 --- a/libhb/decpgssub.c +++ b/libhb/decpgssub.c @@ -1,6 +1,6 @@ /* decpgssub.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/decsrtsub.c b/libhb/decsrtsub.c index 6d1754068..9bc9cedcd 100644 --- a/libhb/decsrtsub.c +++ b/libhb/decsrtsub.c @@ -1,6 +1,6 @@ /* decsrtsub.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/decssasub.c b/libhb/decssasub.c index 01d571d23..b85ff0524 100644 --- a/libhb/decssasub.c +++ b/libhb/decssasub.c @@ -1,6 +1,6 @@ /* decssasub.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/dectx3gsub.c b/libhb/dectx3gsub.c index 3efb74588..b8d8c28be 100644 --- a/libhb/dectx3gsub.c +++ b/libhb/dectx3gsub.c @@ -1,6 +1,6 @@ /* dectx3gsub.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/decutf8sub.c b/libhb/decutf8sub.c index 900e5a879..cf86678d7 100644 --- a/libhb/decutf8sub.c +++ b/libhb/decutf8sub.c @@ -1,6 +1,6 @@ /* decutf8sub.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/decvobsub.c b/libhb/decvobsub.c index 05d4ae09d..12bf94417 100644 --- a/libhb/decvobsub.c +++ b/libhb/decvobsub.c @@ -1,6 +1,6 @@ /* decvobsub.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/demuxmpeg.c b/libhb/demuxmpeg.c index cb896bcaa..e3000f207 100644 --- a/libhb/demuxmpeg.c +++ b/libhb/demuxmpeg.c @@ -1,6 +1,6 @@ /* demuxmpeg.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/detelecine.c b/libhb/detelecine.c index 17f7d1f6e..2fdc48038 100644 --- a/libhb/detelecine.c +++ b/libhb/detelecine.c @@ -1,6 +1,6 @@ /* detelecine.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/dvd.c b/libhb/dvd.c index 0368486a8..56c1ba571 100644 --- a/libhb/dvd.c +++ b/libhb/dvd.c @@ -1,6 +1,6 @@ /* dvd.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/dvd.h b/libhb/dvd.h index 2b5529f58..2a4296469 100644 --- a/libhb/dvd.h +++ b/libhb/dvd.h @@ -1,6 +1,6 @@ /* dvd.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c index 14d8100c6..9217f7dba 100644 --- a/libhb/dvdnav.c +++ b/libhb/dvdnav.c @@ -1,6 +1,6 @@ /* dvdnav.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/eedi2.c b/libhb/eedi2.c index b8107b315..c9c443449 100644 --- a/libhb/eedi2.c +++ b/libhb/eedi2.c @@ -1,6 +1,6 @@ /* eedi2.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/eedi2.h b/libhb/eedi2.h index 1c2cbbb92..ab54a3559 100644 --- a/libhb/eedi2.h +++ b/libhb/eedi2.h @@ -1,6 +1,6 @@ /* eedi2.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c index 7468e9657..b232dae81 100644 --- a/libhb/encavcodec.c +++ b/libhb/encavcodec.c @@ -1,6 +1,6 @@ /* encavcodec.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/encavcodecaudio.c b/libhb/encavcodecaudio.c index ecd75ff98..2c4471bab 100644 --- a/libhb/encavcodecaudio.c +++ b/libhb/encavcodecaudio.c @@ -1,6 +1,6 @@ /* encavcodecaudio.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. @@ -50,31 +50,104 @@ static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job) pv->job = job; pv->list = hb_list_init(); - codec = avcodec_find_encoder(w->codec_param); - if (codec == NULL) + // channel count, layout and matrix encoding + int matrix_encoding; + uint64_t channel_layout = hb_ff_mixdown_xlat(audio->config.out.mixdown, + &matrix_encoding); + pv->out_discrete_channels = + hb_mixdown_get_discrete_channel_count(audio->config.out.mixdown); + + // default settings and options + AVDictionary *av_opts = NULL; + const char *codec_name = NULL; + enum AVCodecID codec_id = AV_CODEC_ID_NONE; + enum AVSampleFormat sample_fmt = AV_SAMPLE_FMT_FLTP; + int bits_per_raw_sample = 0; + int profile = FF_PROFILE_UNKNOWN; + + // override with encoder-specific values + switch (audio->config.out.codec) { - hb_error("encavcodecaInit: avcodec_find_encoder() failed"); - return 1; - } - context = avcodec_alloc_context3(codec); + case HB_ACODEC_AC3: + codec_id = AV_CODEC_ID_AC3; + if (matrix_encoding != AV_MATRIX_ENCODING_NONE) + av_dict_set(&av_opts, "dsur_mode", "on", 0); + break; - int mode; - context->channel_layout = hb_ff_mixdown_xlat(audio->config.out.mixdown, - &mode); - context->channels = pv->out_discrete_channels = - hb_mixdown_get_discrete_channel_count(audio->config.out.mixdown); - context->sample_rate = audio->config.out.samplerate; + case HB_ACODEC_FDK_AAC: + case HB_ACODEC_FDK_HAAC: + codec_name = "libfdk_aac"; + sample_fmt = AV_SAMPLE_FMT_S16; + bits_per_raw_sample = 16; + switch (audio->config.out.codec) + { + case HB_ACODEC_FDK_HAAC: + profile = FF_PROFILE_AAC_HE; + break; + default: + profile = FF_PROFILE_AAC_LOW; + break; + } + // Libav's libfdk-aac wrapper expects back channels for 5.1 + // audio, and will error out unless we translate the layout + if (channel_layout == AV_CH_LAYOUT_5POINT1) + channel_layout = AV_CH_LAYOUT_5POINT1_BACK; + break; - AVDictionary *av_opts = NULL; - if (w->codec_param == AV_CODEC_ID_AAC) + case HB_ACODEC_FFAAC: + codec_name = "aac"; + av_dict_set(&av_opts, "stereo_mode", "ms_off", 0); + break; + + case HB_ACODEC_FFFLAC: + case HB_ACODEC_FFFLAC24: + codec_id = AV_CODEC_ID_FLAC; + switch (audio->config.out.codec) + { + case HB_ACODEC_FFFLAC24: + sample_fmt = AV_SAMPLE_FMT_S32; + bits_per_raw_sample = 24; + break; + default: + sample_fmt = AV_SAMPLE_FMT_S16; + bits_per_raw_sample = 16; + break; + } + break; + + default: + hb_error("encavcodecaInit: unsupported codec (0x%x)", + audio->config.out.codec); + return 1; + } + if (codec_name != NULL) { - av_dict_set(&av_opts, "stereo_mode", "ms_off", 0); + codec = avcodec_find_encoder_by_name(codec_name); + if (codec == NULL) + { + hb_error("encavcodecaInit: avcodec_find_encoder_by_name(%s) failed", + codec_name); + return 1; + } } - else if (w->codec_param == AV_CODEC_ID_AC3 && - mode != AV_MATRIX_ENCODING_NONE) + else { - av_dict_set(&av_opts, "dsur_mode", "on", 0); + codec = avcodec_find_encoder(codec_id); + if (codec == NULL) + { + hb_error("encavcodecaInit: avcodec_find_encoder(%d) failed", + codec_id); + return 1; + } } + // allocate the context and apply the settings + context = avcodec_alloc_context3(codec); + hb_ff_set_sample_fmt(context, codec, sample_fmt); + context->bits_per_raw_sample = bits_per_raw_sample; + context->profile = profile; + context->channel_layout = channel_layout; + context->channels = pv->out_discrete_channels; + context->sample_rate = audio->config.out.samplerate; if (audio->config.out.bitrate > 0) { @@ -91,23 +164,11 @@ static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job) context->compression_level = audio->config.out.compression_level; } - // set the sample format and bit depth to something practical - switch (audio->config.out.codec) - { - case HB_ACODEC_FFFLAC: - hb_ff_set_sample_fmt(context, codec, AV_SAMPLE_FMT_S16); - context->bits_per_raw_sample = 16; - break; - - case HB_ACODEC_FFFLAC24: - hb_ff_set_sample_fmt(context, codec, AV_SAMPLE_FMT_S32); - context->bits_per_raw_sample = 24; - break; - - default: - hb_ff_set_sample_fmt(context, codec, AV_SAMPLE_FMT_FLTP); - break; - } + // For some codecs, libav requires the following flag to be set + // so that it fills extradata with global header information. + // If this flag is not set, it inserts the data into each + // packet instead. + context->flags |= CODEC_FLAG_GLOBAL_HEADER; if (hb_avcodec_open(context, codec, &av_opts, 0)) { @@ -124,6 +185,7 @@ static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job) av_dict_free(&av_opts); pv->context = context; + audio->config.out.samples_per_frame = pv->samples_per_frame = context->frame_size; pv->input_samples = context->frame_size * context->channels; pv->input_buf = malloc(pv->input_samples * sizeof(float)); @@ -171,8 +233,6 @@ static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job) pv->output_buf = pv->input_buf; } - audio->config.out.samples_per_frame = pv->samples_per_frame; - if (context->extradata != NULL) { memcpy(w->config->extradata.bytes, context->extradata, diff --git a/libhb/encfaac.c b/libhb/encfaac.c index c8754f7d7..ffdddc8d4 100644 --- a/libhb/encfaac.c +++ b/libhb/encfaac.c @@ -1,6 +1,6 @@ /* encfaac.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/enclame.c b/libhb/enclame.c index a5e284d57..2858f6078 100644 --- a/libhb/enclame.c +++ b/libhb/enclame.c @@ -1,6 +1,6 @@ /* enclame.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/enctheora.c b/libhb/enctheora.c index 3d2ecc440..07fdb7f95 100644 --- a/libhb/enctheora.c +++ b/libhb/enctheora.c @@ -1,6 +1,6 @@ /* enctheora.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/encvobsub.c b/libhb/encvobsub.c index dfd2d45f5..2a3fcd87c 100644 --- a/libhb/encvobsub.c +++ b/libhb/encvobsub.c @@ -1,6 +1,6 @@ /* encvobsub.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/encvorbis.c b/libhb/encvorbis.c index d02297195..e75bce622 100644 --- a/libhb/encvorbis.c +++ b/libhb/encvorbis.c @@ -1,6 +1,6 @@ /* encvorbis.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/encx264.c b/libhb/encx264.c index b52832416..df978206a 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -1,6 +1,6 @@ /* encx264.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. @@ -96,13 +96,6 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job ) /* Enable metrics */ param.analyse.b_psnr = 1; param.analyse.b_ssim = 1; - - /* - * QuickTime has trouble with very low QPs (resulting in visual artifacts). - * Known to affect QuickTime 7, QuickTime X and iTunes. - * Testing shows that a qpmin of 4 usually works. - */ - param.rc.i_qp_min = 4; if( job->pass == 2 && job->cfr != 1 ) { diff --git a/libhb/encx264.h b/libhb/encx264.h index 963797afe..b0ff8b9ca 100644 --- a/libhb/encx264.h +++ b/libhb/encx264.h @@ -1,6 +1,6 @@ /* encx264.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/fifo.c b/libhb/fifo.c index 6d11551f9..df83340fd 100644 --- a/libhb/fifo.c +++ b/libhb/fifo.c @@ -1,6 +1,6 @@ /* fifo.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/hb.c b/libhb/hb.c index 518212737..abaece8cb 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -1,6 +1,6 @@ /* hb.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/hb.h b/libhb/hb.h index 1cf1c2382..e23a0dfd4 100644 --- a/libhb/hb.h +++ b/libhb/hb.h @@ -1,6 +1,6 @@ /* hb.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/hb_dict.c b/libhb/hb_dict.c index 152cf7feb..0e9cd0523 100644 --- a/libhb/hb_dict.c +++ b/libhb/hb_dict.c @@ -1,6 +1,6 @@ /* hb_dict.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/hb_dict.h b/libhb/hb_dict.h index 30155f1ba..aebec39bc 100644 --- a/libhb/hb_dict.h +++ b/libhb/hb_dict.h @@ -1,6 +1,6 @@ /* hb_dict.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/hbffmpeg.h b/libhb/hbffmpeg.h index 6447a367c..776eec61a 100644 --- a/libhb/hbffmpeg.h +++ b/libhb/hbffmpeg.h @@ -1,6 +1,6 @@ /* hbffmpeg.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/internal.h b/libhb/internal.h index 8bf9fa533..2e890a752 100644 --- a/libhb/internal.h +++ b/libhb/internal.h @@ -1,6 +1,6 @@ /* internal.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/lang.c b/libhb/lang.c index eb447c324..2e0cc3a48 100644 --- a/libhb/lang.c +++ b/libhb/lang.c @@ -1,6 +1,6 @@ /* lang.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/lang.h b/libhb/lang.h index dc6723dba..9df8e10f4 100644 --- a/libhb/lang.h +++ b/libhb/lang.h @@ -1,6 +1,6 @@ /* lang.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/mcdeint.h b/libhb/mcdeint.h index 1429767c7..621fd58e2 100644 --- a/libhb/mcdeint.h +++ b/libhb/mcdeint.h @@ -1,6 +1,6 @@ /* mcdeint.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/module.defs b/libhb/module.defs index fb9399e29..daa5396e2 100644 --- a/libhb/module.defs +++ b/libhb/module.defs @@ -1,6 +1,6 @@ __deps__ := A52DEC BZIP2 FAAC FFMPEG FONTCONFIG FREETYPE LAME LIBASS LIBDCA \ LIBDVDREAD LIBDVDNAV LIBICONV LIBMKV LIBOGG LIBSAMPLERATE LIBTHEORA LIBVORBIS LIBXML2 \ - MP4V2 MPEG2DEC PTHREADW32 X264 ZLIB LIBBLURAY + MP4V2 MPEG2DEC PTHREADW32 X264 ZLIB LIBBLURAY FDKAAC $(eval $(call import.MODULE.defs,LIBHB,libhb,$(__deps__))) $(eval $(call import.GCC,LIBHB)) @@ -37,7 +37,9 @@ LIBHB.out += $(LIBHB.a) ifeq (1,$(FEATURE.ff.mpeg2)) LIBHB.GCC.D += USE_FF_MPEG2 endif - +ifeq (1,$(FEATURE.fdk_aac)) +LIBHB.GCC.D += USE_FDK_AAC +endif ifeq (1,$(FEATURE.opencl)) LIBHB.GCC.D += USE_OPENCL endif @@ -106,10 +108,15 @@ LIBHB.dll = $(LIBHB.build/)hb.dll LIBHB.lib = $(LIBHB.build/)hb.lib LIBHB.dll.libs = $(foreach n, \ - a52 ass avcodec avformat avutil avresample dvdnav dvdread faac fontconfig freetype mkv mpeg2 mp3lame mp4v2 \ + a52 ass avcodec avformat avutil avresample dvdnav dvdread faac \ + fontconfig freetype mkv mpeg2 mp3lame mp4v2 \ ogg samplerate swscale theora vorbis vorbisenc x264 xml2 bluray, \ $(CONTRIB.build/)lib/lib$(n).a ) +ifeq (1,$(FEATURE.fdk_aac)) +LIBHB.dll.libs += $(CONTRIB.build/)lib/libfdk-aac.a +endif + ifneq ($(HAS.iconv),1) LIBHB.dll.libs += $(CONTRIB.build/)lib/libiconv.a else diff --git a/libhb/muxcommon.c b/libhb/muxcommon.c index d5d9c7a92..a97ada699 100644 --- a/libhb/muxcommon.c +++ b/libhb/muxcommon.c @@ -1,6 +1,6 @@ /* muxcommon.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/muxmkv.c b/libhb/muxmkv.c index e45ebb126..8a14168c1 100644 --- a/libhb/muxmkv.c +++ b/libhb/muxmkv.c @@ -1,6 +1,6 @@ /* muxmkv.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. @@ -260,6 +260,8 @@ static int MKVInit( hb_mux_object_t * m ) case HB_ACODEC_FFAAC: case HB_ACODEC_CA_AAC: case HB_ACODEC_CA_HAAC: + case HB_ACODEC_FDK_AAC: + case HB_ACODEC_FDK_HAAC: track->codecPrivate = audio->priv.config.extradata.bytes; track->codecPrivateSize = audio->priv.config.extradata.length; track->codecID = MK_ACODEC_AAC; @@ -285,7 +287,8 @@ static int MKVInit( hb_mux_object_t * m ) lang = lang_for_code2( audio->config.lang.iso639_2 ); track->language = lang->iso639_2b ? lang->iso639_2b : lang->iso639_2; // sample rate - if ((audio->config.out.codec == HB_ACODEC_CA_HAAC) || + if ((audio->config.out.codec == HB_ACODEC_CA_HAAC) || + (audio->config.out.codec == HB_ACODEC_FDK_HAAC) || (audio->config.out.codec == HB_ACODEC_AAC_PASS && audio->config.in.samples_per_frame > 1024)) { diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c index 987292d30..a6444ea14 100644 --- a/libhb/muxmp4.c +++ b/libhb/muxmp4.c @@ -1,6 +1,6 @@ /* muxmp4.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. @@ -382,6 +382,8 @@ static int MP4Init( hb_mux_object_t * m ) case HB_ACODEC_FFAAC: case HB_ACODEC_CA_AAC: case HB_ACODEC_CA_HAAC: + case HB_ACODEC_FDK_AAC: + case HB_ACODEC_FDK_HAAC: case HB_ACODEC_LAME: case HB_ACODEC_MP3: case HB_ACODEC_DCA_HD: @@ -397,6 +399,8 @@ static int MP4Init( hb_mux_object_t * m ) case HB_ACODEC_FFAAC: case HB_ACODEC_CA_AAC: case HB_ACODEC_CA_HAAC: + case HB_ACODEC_FDK_AAC: + case HB_ACODEC_FDK_HAAC: { audio_type = MP4_MPEG4_AUDIO_TYPE; config_bytes = audio->priv.config.extradata.bytes; diff --git a/libhb/ports.c b/libhb/ports.c index 11952c052..7097f2ee9 100644 --- a/libhb/ports.c +++ b/libhb/ports.c @@ -1,6 +1,6 @@ /* ports.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/ports.h b/libhb/ports.h index 9f7da2b14..162781347 100644 --- a/libhb/ports.h +++ b/libhb/ports.h @@ -1,6 +1,6 @@ /* ports.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/reader.c b/libhb/reader.c index 4318b8005..83e6e513f 100644 --- a/libhb/reader.c +++ b/libhb/reader.c @@ -1,6 +1,6 @@ /* reader.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/rendersub.c b/libhb/rendersub.c index 9166ad89f..f42bdf8eb 100644 --- a/libhb/rendersub.c +++ b/libhb/rendersub.c @@ -1,6 +1,6 @@ /* rendersub.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/rotate.c b/libhb/rotate.c index 6807eda2d..0d1c3fbfd 100644 --- a/libhb/rotate.c +++ b/libhb/rotate.c @@ -1,6 +1,6 @@ /* rorate.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/scan.c b/libhb/scan.c index 6d563f2d0..7dfb44c60 100644 --- a/libhb/scan.c +++ b/libhb/scan.c @@ -1,6 +1,6 @@ /* scan.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/stream.c b/libhb/stream.c index 7cd4c1f44..b122bcf77 100644 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -1,6 +1,6 @@ /* stream.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/sync.c b/libhb/sync.c index 444f2f98b..fe3d01915 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -1,6 +1,6 @@ /* sync.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/taskset.c b/libhb/taskset.c index aced5dbc5..2dd7da016 100644 --- a/libhb/taskset.c +++ b/libhb/taskset.c @@ -1,6 +1,6 @@ /* taskset.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/taskset.h b/libhb/taskset.h index eb5af14d3..608ce945b 100644 --- a/libhb/taskset.h +++ b/libhb/taskset.h @@ -1,6 +1,6 @@ /* taskset.h - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/update.c b/libhb/update.c index ea09bf43e..6112bc44e 100644 --- a/libhb/update.c +++ b/libhb/update.c @@ -1,6 +1,6 @@ /* update.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/vfr.c b/libhb/vfr.c index b52d06a0c..844beef80 100644 --- a/libhb/vfr.c +++ b/libhb/vfr.c @@ -1,6 +1,6 @@ /* vfr.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. diff --git a/libhb/work.c b/libhb/work.c index d8137f1b5..009c1a603 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -1,6 +1,6 @@ /* work.c - Copyright (c) 2003-2012 HandBrake Team + Copyright (c) 2003-2013 HandBrake Team This file is part of the HandBrake source code Homepage: . It may be used under the terms of the GNU General Public License v2. @@ -120,51 +120,36 @@ hb_work_object_t * hb_get_work( int id ) return NULL; } -hb_work_object_t * hb_codec_decoder( int codec ) +hb_work_object_t* hb_codec_decoder(int codec) { - switch( codec ) + if (codec & HB_ACODEC_FF_MASK) { - case HB_ACODEC_AC3: return hb_get_work( WORK_DECA52 ); - case HB_ACODEC_LPCM: return hb_get_work( WORK_DECLPCM ); - default: - if ( codec & HB_ACODEC_FF_MASK ) - { - return hb_get_work( WORK_DECAVCODEC ); - } - break; + return hb_get_work(WORK_DECAVCODEC); + } + switch (codec) + { + case HB_ACODEC_AC3: return hb_get_work(WORK_DECA52); + case HB_ACODEC_LPCM: return hb_get_work(WORK_DECLPCM); + default: break; } return NULL; } -hb_work_object_t * hb_codec_encoder( int codec ) +hb_work_object_t* hb_codec_encoder(int codec) { - hb_work_object_t * w; - switch( codec ) + if (codec & HB_ACODEC_FF_MASK) { - case HB_ACODEC_FAAC: return hb_get_work( WORK_ENCFAAC ); - case HB_ACODEC_LAME: return hb_get_work( WORK_ENCLAME ); - case HB_ACODEC_VORBIS: return hb_get_work( WORK_ENCVORBIS ); - case HB_ACODEC_CA_AAC: return hb_get_work( WORK_ENC_CA_AAC ); - case HB_ACODEC_CA_HAAC:return hb_get_work( WORK_ENC_CA_HAAC ); - case HB_ACODEC_FFAAC: - { - w = hb_get_work( WORK_ENCAVCODEC_AUDIO ); - w->codec_param = AV_CODEC_ID_AAC; - return w; - } - case HB_ACODEC_FFFLAC: - case HB_ACODEC_FFFLAC24: - { - w = hb_get_work( WORK_ENCAVCODEC_AUDIO ); - w->codec_param = AV_CODEC_ID_FLAC; - return w; - } - case HB_ACODEC_AC3: - { - w = hb_get_work( WORK_ENCAVCODEC_AUDIO ); - w->codec_param = AV_CODEC_ID_AC3; - return w; - } + return hb_get_work(WORK_ENCAVCODEC_AUDIO); + } + switch (codec) + { + case HB_ACODEC_AC3: return hb_get_work(WORK_ENCAVCODEC_AUDIO); + case HB_ACODEC_FAAC: return hb_get_work(WORK_ENCFAAC); + case HB_ACODEC_LAME: return hb_get_work(WORK_ENCLAME); + case HB_ACODEC_VORBIS: return hb_get_work(WORK_ENCVORBIS); + case HB_ACODEC_CA_AAC: return hb_get_work(WORK_ENC_CA_AAC); + case HB_ACODEC_CA_HAAC: return hb_get_work(WORK_ENC_CA_HAAC); + default: break; } return NULL; } diff --git a/macosx/Controller.m b/macosx/Controller.m index 9506bde0f..b1faa7d08 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -5403,6 +5403,8 @@ the user is using "Custom" settings by determining the sender*/ { // using advanced panel, enable if applicable [fAdvancedOptions enableUI:enable]; + // TODO: set the advanced options string based on the previously + // selected x264 system setting // reset x264 system widgets [fX264PresetsSlider setIntegerValue: fX264MediumPresetIndex]; [fX264TunePopUp selectItemAtIndex:0]; @@ -6102,12 +6104,12 @@ return YES; } - /* We use Bold Text for the HB Default */ - if ([[item objectForKey:@"Default"] intValue] == 1)// 1 is HB default + /* We use bold text for the default preset */ + if (presetUserDefault == nil && // no User default found + [[item objectForKey:@"Default"] intValue] == 1)// 1 is HB default { txtFont = [NSFont boldSystemFontOfSize: [NSFont smallSystemFontSize]]; } - /* We use Bold Text for the User Specified Default */ if ([[item objectForKey:@"Default"] intValue] == 2)// 2 is User default { txtFont = [NSFont boldSystemFontOfSize: [NSFont smallSystemFontSize]]; diff --git a/macosx/HBPresets.h b/macosx/HBPresets.h index 598971efa..139b200ed 100644 --- a/macosx/HBPresets.h +++ b/macosx/HBPresets.h @@ -6,26 +6,28 @@ #import - @interface HBPresets : NSObject {} -/* Called by -addFactoryPresets in Controller.mm */ -- (NSMutableArray *) generateBuiltinPresets: (NSMutableArray *) UserPresets; +/* Called by -addFactoryPresets in Controller.m */ +- (NSMutableArray *)generateBuiltinPresets:(NSMutableArray *)UserPresets; -/* Built-In Preset Dictionaries (one for each built in preset) */ +/* Dictionaries for preset folders ("Devices, "Regular") */ - (NSDictionary *)createDevicesPresetFolder; - (NSDictionary *)createRegularPresetFolder; +/* Dictionaries for individual presets ("Devices" folder) */ +- (NSDictionary *)createUniversalPreset; +- (NSDictionary *)createiPodPreset; +- (NSDictionary *)createiPhoneiPodtouchPreset; - (NSDictionary *)createiPadPreset; -- (NSDictionary *)createAppleTV2Preset; - (NSDictionary *)createAppleTVPreset; +- (NSDictionary *)createAppleTV2Preset; - (NSDictionary *)createAppleTV3Preset; -- (NSDictionary *)createUniversalPreset; -- (NSDictionary *)createiPhoneiPodtouchPreset; -- (NSDictionary *)createiPodPreset; -- (NSDictionary *)createNormalPreset; -- (NSDictionary *)createHighProfilePreset; - (NSDictionary *)createAndroidPreset; - (NSDictionary *)createAndroidTabletPreset; +/* Dictionaries for individual presets ("Regular" folder) */ +- (NSDictionary *)createNormalPreset; +- (NSDictionary *)createHighProfilePreset; + @end diff --git a/macosx/HBPresets.m b/macosx/HBPresets.m index 7d3aa0eac..0281a4365 100644 --- a/macosx/HBPresets.m +++ b/macosx/HBPresets.m @@ -7,52 +7,50 @@ #import "HBPresets.h" @implementation HBPresets + - (id)init { self = [super init]; return self; } -/* Called by -addFactoryPresets in Controller.mm */ -- (NSMutableArray *) generateBuiltinPresets: (NSMutableArray *) UserPresets +/* Called by -addFactoryPresets in Controller.m */ +- (NSMutableArray *)generateBuiltinPresets:(NSMutableArray *)UserPresets { - /* We receive the user presets array of dictionaries from controller.mm */ - /* We re-create new built in presets programmatically and add them to our presets array */ - - /* Note: the built in presets will *not* sort themselves alphabetically, so they will - * appear in the order you create them + /* + * We receive the user presets array of dictionaries from Controller.m + * + * Re-create new built-in presets programmatically and add them to the array + * + * Note: the built-in presets will *not* sort themselves alphabetically, + * so they will appear in the order you create them. */ - /* Built in preset folders at the root of the hierarchy */ + + /* Built-in preset folders at the root of the hierarchy */ [UserPresets addObject:[self createDevicesPresetFolder]]; [UserPresets addObject:[self createRegularPresetFolder]]; /* Independent presets at the root hierarchy level would go here */ - /* return the newly regenerated preset array back to Controller.mm */ + /* Return the newly-regenerated preset array back to Controller.m */ return UserPresets; } #pragma mark - - -#pragma mark Built In Preset Folder Definitions +#pragma mark Preset Folder Definitions - (NSDictionary *)createDevicesPresetFolder { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Devices" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: YES] forKey:@"Folder"]; - - /* Lets initalize the child array of dictionaries for folders, this - is an array of dictionaries much like the root level of presets and - may contain folders and presets alike, etc.*/ + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"Devices" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:YES] forKey:@"Folder"]; + + /* Initialize a child array, and add the individual presets to it */ NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; - /* we actually call the methods for the nests here */ [childrenArray addObject:[self createUniversalPreset]]; [childrenArray addObject:[self createiPodPreset]]; [childrenArray addObject:[self createiPhoneiPodtouchPreset]]; @@ -62,13 +60,13 @@ [childrenArray addObject:[self createAppleTV3Preset]]; [childrenArray addObject:[self createAndroidPreset]]; [childrenArray addObject:[self createAndroidTabletPreset]]; - - [preset setObject:[NSMutableArray arrayWithArray: childrenArray] forKey:@"ChildrenArray"]; + /* Add the individual presets to the folder */ + [preset setObject:[NSMutableArray arrayWithArray:childrenArray] + forKey:@"ChildrenArray"]; + + /* Clean up and return the folder */ [childrenArray autorelease]; - - - [preset autorelease]; return preset; } @@ -76,1196 +74,1230 @@ - (NSDictionary *)createRegularPresetFolder { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Regular" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: YES] forKey:@"Folder"]; - - /* Lets initalize the child array of dictionaries for folders, this - is an array of dictionaries much like the root level of presets and - may contain folders and presets alike, etc.*/ + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"Regular" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:YES] forKey:@"Folder"]; + + /* Initialize a child array, and add the individual presets to it */ NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; - /* we actually call the methods for the nests here */ [childrenArray addObject:[self createNormalPreset]]; [childrenArray addObject:[self createHighProfilePreset]]; - [preset setObject:[NSMutableArray arrayWithArray: childrenArray] forKey:@"ChildrenArray"]; + /* Add the individual presets to the folder */ + [preset setObject:[NSMutableArray arrayWithArray:childrenArray] + forKey:@"ChildrenArray"]; + + /* Clean up and return the folder */ [childrenArray autorelease]; - - - [preset autorelease]; return preset; } #pragma mark - +#pragma mark Individual Preset Definitions +/* These NSDictionary definitions contain settings for one built-in preset */ -#pragma mark Built In Preset Definitions - -/* These NSDictionary Buit-In Preset definitions contain all of the settings for one built in preset */ -/* Note: For now, you can no longer have reference to any main window fields in your key values */ - -- (NSDictionary *)createAppleTVPreset +- (NSDictionary *)createUniversalPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"AppleTV" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's settings for the AppleTV and 2009's iPhone and iPod Touch lineup. Provides a good balance between quality and file size, and pushes the devices to their limits. Includes Dolby Digital 5.1 AC3 sound for the AppleTV." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"Universal" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for compatibility with all Apple devices (including the iPod 6G and later). Includes Dolby Digital audio for surround sound." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the appleTV output)*/ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; + [preset setObject:@"fast" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"baseline" forKey:@"h264Profile"]; + [preset setObject:@"3.0" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /* Basic Picture Settings */ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:960] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:576] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru */ + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - /* Track 2 */ NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ + [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; + [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; + [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack2Array autorelease]; [audioListArray addObject:audioTrack2Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createUniversalPreset +- (NSDictionary *)createiPodPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Universal" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's universally compatible, full resolution settings for all current Apple devices: iPod (6G and up), iPhone, AppleTV, and Macs" forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"iPod" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for playback on the iPod with Video (all generations)." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the appleTV output)*/ - [preset setObject:@"" forKey:@"x264Option"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4iPodCompatible"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"fast" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"baseline" forKey:@"h264Profile"]; - [preset setObject:@"3.0" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"baseline" forKey:@"h264Profile"]; + [preset setObject:@"1.3" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq + [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /* Basic Picture Settings */ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:320] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:240] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PicturePAR"]; //none + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureKeepRatio"]; + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru */ + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - /* Track 2 */ - NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack2Array autorelease]; - [audioListArray addObject:audioTrack2Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createiPadPreset +- (NSDictionary *)createiPhoneiPodtouchPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"iPad" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's preset for the iPad (all generations) is optimized for a good balance between quality and filesize." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"iPhone & iPod touch" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for handheld iOS devices (iPhone 4, iPod touch 3G and later)." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the output)*/ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"29.97 (NTSC Video)" forKey:@"VideoFramerate"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"high" forKey:@"h264Profile"]; + [preset setObject:@"3.1" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq + [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /* Basic Picture Settings */ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:960] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:640] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru */ + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createAppleTV2Preset +- (NSDictionary *)createiPadPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"AppleTV 2" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's preset for the Apple TV (2nd gen) is optimized for viewing on its 1280x720 display." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"iPad" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for playback on the iPad (all generations)." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the output)*/ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"high" forKey:@"h264Profile"]; + [preset setObject:@"3.1" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"29.97 (NTSC Video)" forKey:@"VideoFramerate"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /* Basic Picture Settings */ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru */ + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - /* Track 2 */ - NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack2Array autorelease]; - [audioListArray addObject:audioTrack2Array]; - - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createAppleTV3Preset +- (NSDictionary *)createAppleTVPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"AppleTV 3" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's preset for the Apple TV (3rd gen) is optimized for up to 1080p playback." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"AppleTV" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for the original AppleTV. Includes Dolby Digital audio for surround sound. Also compatible with iOS devices released since 2009." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the output)*/ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"4.0" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"qpmin=4:cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500" + forKey:@"x264OptionExtra"]; + [preset setObject:@"high" forKey:@"h264Profile"]; + [preset setObject:@"3.1" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /* Basic Picture Settings */ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1920] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:960] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - /* We use Loose Anamorphic with a Modulus of 2 */ - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - /* Note: decided to use Fast Decomb. This makes this the only device preset using - * decomb that we have. Fast Decomb is better than no decomb imo and has basically no - * speed hit on progressive sources. Once Default decomb is sped up, we can switch */ - [preset setObject:[NSNumber numberWithInt:3] forKey:@"PictureDecomb"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru */ + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - /* Track 2 */ NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ + [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; + [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; + [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack2Array autorelease]; [audioListArray addObject:audioTrack2Array]; - - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createHighProfilePreset +- (NSDictionary *)createAppleTV2Preset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"High Profile" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's general-purpose preset for High Profile H.264 video, with all the bells and whistles." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"AppleTV 2" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for the second-generation AppleTV. Includes Dolby Digital audio for surround sound. NOT compatible with the original AppleTV." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String */ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"4.1" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"high" forKey:@"h264Profile"]; + [preset setObject:@"3.1" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; - [preset setObject:@"vfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - - /*Picture Settings*/ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; + [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; + + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureDecomb"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru */ + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - /* Track 2 */ NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ + [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; + [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; + [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack2Array autorelease]; [audioListArray addObject:audioTrack2Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createiPhoneiPodtouchPreset +- (NSDictionary *)createAppleTV3Preset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"iPhone & iPod Touch" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's settings for all iPhones and iPod Touches going back to the original iPhone 2G." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"AppleTV 3" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for the third-generation AppleTV. Includes Dolby Digital audio for surround sound. NOT compatible with the original AppleTV. May stutter on the second-generation AppleTV." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - /* x264 Option String */ - [preset setObject:@"" forKey:@"x264Option"]; + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; - [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"29.97 (NTSC Video)" forKey:@"VideoFramerate"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"high" forKey:@"h264Profile"]; + [preset setObject:@"4.0" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq + [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /*Picture Settings*/ - /* Use a width of 960 for the iPhone 4 and later */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:960] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:1920] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:1080] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:3] forKey:@"PictureDecomb"]; //fast + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru */ + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Track 2 */ + NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; + [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; + [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; + [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; + [audioTrack2Array autorelease]; + [audioListArray addObject:audioTrack2Array]; + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createiPodPreset +- (NSDictionary *)createAndroidPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"iPod" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's low resolution settings for the iPod (5G and up). Optimized for great playback on the iPod screen, with smaller file size." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"Android" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for midrange devices running Android 2.3 or later." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - /* x264 Option String */ - [preset setObject:@"" forKey:@"x264Option"]; + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"baseline" forKey:@"h264Profile"]; - [preset setObject:@"1.3" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"main" forKey:@"h264Profile"]; + [preset setObject:@"3.0" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /*Picture Settings*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:320] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:576] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru */ + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"128" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createNormalPreset +- (NSDictionary *)createAndroidTabletPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Normal" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's normal, default settings." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"Android Tablet" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's preset for tablets running Android 2.3 or later." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String */ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"veryfast" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"main" forKey:@"h264Profile"]; - [preset setObject:@"4.0" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; - [preset setObject:@"vfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - - /*Picture Settings*/ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"main" forKey:@"h264Profile"]; + [preset setObject:@"3.1" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq + [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; + [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; + + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru */ + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"128" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createAndroidPreset +- (NSDictionary *)createNormalPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Android" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's settings for Mid-range Android 2.3 or better devices." forKey:@"PresetDescription"]; + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"Normal" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Default"]; //default + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's normal, default settings." + forKey:@"PresetDescription"]; - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - /* x264 Option String */ - [preset setObject:@"" forKey:@"x264Option"]; + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"main" forKey:@"h264Profile"]; - [preset setObject:@"2.2" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; - [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; + [preset setObject:@"veryfast" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"main" forKey:@"h264Profile"]; + [preset setObject:@"4.0" forKey:@"h264Level"]; - /* Video framerate */ - [preset setObject:@"29.97 (NTSC Video)" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq + [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + /* Video frame rate */ + [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; + [preset setObject:@"vfr" forKey:@"VideoFramerateMode"]; - /*Picture Settings*/ + /* Picture size */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - /* Explicitly set the filters for built-in presets */ + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + /* Picture crop */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Auto Passthru */ + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; - /* Track 1 */ + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"128" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createAndroidTabletPreset +- (NSDictionary *)createHighProfilePreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Android Tablet" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's preset for the Higher end Anroid 2.3 or better devices." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"High Profile" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's general-purpose preset for High Profile H.264 video." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the output)*/ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"main" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; - [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"29.97 (NTSC Video)" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"high" forKey:@"h264Profile"]; + [preset setObject:@"4.1" forKey:@"h264Level"]; - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /* Basic Picture Settings */ + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq + [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; + + /* Video frame rate */ + [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; + [preset setObject:@"vfr" forKey:@"VideoFramerateMode"]; + + /* Picture size */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureDecomb"]; //default + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru */ + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"128" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Track 2 */ + NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; + [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; + [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; + [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; + [audioTrack2Array autorelease]; + [audioListArray addObject:audioTrack2Array]; + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } - @end diff --git a/macosx/module.defs b/macosx/module.defs index ff1dff762..1870d5fe9 100644 --- a/macosx/module.defs +++ b/macosx/module.defs @@ -25,6 +25,10 @@ MACOSX.map.g.min = debug MACOSX.map.g.std = debug MACOSX.map.g.max = debug +ifeq (1,$(FEATURE.fdk_aac)) +MACOSX.extra_ldflags = OTHER_LDFLAGS='$(abspath $(BUILD))/contrib/lib/libfdk-aac.a' +endif + ## xcconfig: must be one of macosx/xcconfig/*.xcconfig MACOSX.xcconfig = $(foreach x,$(XCODE.xcconfig),-xcconfig $(MACOSX.src/)xcconfig/$(x)) MACOSX.sdk = $(foreach sdk,$(GCC.sysroot),-sdk $(sdk)) @@ -54,4 +58,6 @@ MACOSX.XCODE = $(strip \ EXTERNAL_JOBS='$(BUILD.jobs)' \ EXTERNAL_VARS='$(-*-command-variables-*-)' \ \ + $(MACOSX.extra_ldflags) \ + \ $(2) ) diff --git a/make/configure.py b/make/configure.py index 9c2a7981a..af5bb0ff5 100644 --- a/make/configure.py +++ b/make/configure.py @@ -1180,6 +1180,9 @@ def createCLI(): h = IfHost( 'enable HWD features', '*-*-*', none=optparse.SUPPRESS_HELP ).value grp.add_option( '--enable-hwd', default=False, action='store_true', help=h ) + h = IfHost( 'enable use of fdk-aac encoder', '*-*-*', none=optparse.SUPPRESS_HELP ).value + grp.add_option( '--enable-fdk-aac', default=False, action='store_true', help=h ) + cli.add_option_group( grp ) ## add launch options @@ -1619,6 +1622,7 @@ int main () doc.add( 'FEATURE.gtk.mingw', int( options.enable_gtk_mingw )) doc.add( 'FEATURE.gst', int( not options.disable_gst )) doc.add( 'FEATURE.ff.mpeg2', int( options.enable_ff_mpeg2 )) + doc.add( 'FEATURE.fdk_aac', int( options.enable_fdk_aac )) doc.add( 'FEATURE.opencl', int( options.enable_opencl )) doc.add( 'FEATURE.hwd', int( options.enable_hwd )) doc.add( 'FEATURE.xcode', int( not (Tools.xcodebuild.fail or options.disable_xcode or options.cross) )) diff --git a/make/include/main.defs b/make/include/main.defs index 5a7519e50..45d375c36 100644 --- a/make/include/main.defs +++ b/make/include/main.defs @@ -39,6 +39,10 @@ ifneq (,$(filter $(BUILD.system),darwin cygwin mingw)) MODULES += contrib/libsamplerate endif +ifeq (1,$(FEATURE.fdk_aac)) + MODULES += contrib/fdk-aac +endif + MODULES += contrib/lame MODULES += contrib/faac MODULES += contrib/ffmpeg diff --git a/pkg/appcast.xml.m4 b/pkg/appcast.xml.m4 index 3e20171fc..afab8ffdd 100644 --- a/pkg/appcast.xml.m4 +++ b/pkg/appcast.xml.m4 @@ -27,7 +27,7 @@ dnl url="http://handbrake.fr/rotation.php?file=__APPCAST_dmg" length="__APPCAST_dmg_size" type="application/octet-stream"/> - 10.5.0 + 10.6.0 diff --git a/scripts/manicure.rb b/scripts/manicure.rb index 1b331272c..9e83750bf 100755 --- a/scripts/manicure.rb +++ b/scripts/manicure.rb @@ -349,18 +349,28 @@ class Display audioEncoders << "copy:dtshd" when /AAC Pass/ audioEncoders << "copy:aac" + when "AAC (FDK)" + audioEncoders << "fdk_aac" + when "AAC (faac)" + audioEncoders << "faac" when "AAC (ffmpeg)" audioEncoders << "ffaac" - when /AAC/ - audioEncoders << "faac" + when "AAC (CoreAudio)" + audioEncoders << "ca_aac" + when "HE-AAC (FDK)" + audioEncoders << "fdk_haac" + when "HE-AAC (CoreAudio)" + audioEncoders << "ca_haac" when /Vorbis/ audioEncoders << "vorbis" when /MP3 Pass/ audioEncoders << "copy:mp3" when /MP3/ audioEncoders << "lame" - when /FLAC/ + when "FLAC (ffmpeg)" audioEncoders << "ffflac" + when "FLAC (24-bit)" + audioEncoders << "ffflac24" when /Auto Pass/ audioEncoders << "copy" end @@ -723,18 +733,28 @@ class Display audioEncoders << "copy:dtshd" when /AAC Pass/ audioEncoders << "copy:aac" + when "AAC (FDK)" + audioEncoders << "fdk_aac" + when "AAC (faac)" + audioEncoders << "faac" when "AAC (ffmpeg)" audioEncoders << "ffaac" - when /AAC/ - audioEncoders << "faac" + when "AAC (CoreAudio)" + audioEncoders << "ca_aac" + when "HE-AAC (FDK)" + audioEncoders << "fdk_haac" + when "HE-AAC (CoreAudio)" + audioEncoders << "ca_haac" when /Vorbis/ audioEncoders << "vorbis" when /MP3 Pass/ audioEncoders << "copy:mp3" when /MP3/ audioEncoders << "lame" - when /FLAC/ + when "FLAC (ffmpeg)" audioEncoders << "ffflac" + when "FLAC (24-bit)" + audioEncoders << "ffflac24" when /Auto Pass/ audioEncoders << "copy" end @@ -998,7 +1018,7 @@ class Display def generateAPIcalls(hash) # Makes a C version of the preset ready for coding into the CLI - commandString = "if (!strcmp(preset_name, \"" << hash["PresetName"] << "\"))\n{\n " + commandString = "if (!strcasecmp(preset_name, \"" << hash["PresetName"] << "\"))\n{\n " #Filename suffix commandString << "if( !mux )\n " @@ -1099,18 +1119,28 @@ class Display audioEncoders << "copy:dtshd" when /AAC Pass/ audioEncoders << "copy:aac" + when "AAC (FDK)" + audioEncoders << "fdk_aac" + when "AAC (faac)" + audioEncoders << "faac" when "AAC (ffmpeg)" audioEncoders << "ffaac" - when /AAC/ - audioEncoders << "faac" + when "AAC (CoreAudio)" + audioEncoders << "ca_aac" + when "HE-AAC (FDK)" + audioEncoders << "fdk_haac" + when "HE-AAC (CoreAudio)" + audioEncoders << "ca_haac" when /Vorbis/ audioEncoders << "vorbis" when /MP3 Pass/ audioEncoders << "copy:mp3" when /MP3/ audioEncoders << "lame" - when /FLAC/ + when "FLAC (ffmpeg)" audioEncoders << "ffflac" + when "FLAC (24-bit)" + audioEncoders << "ffflac24" when /Auto Pass/ audioEncoders << "copy" end @@ -1215,24 +1245,33 @@ class Display case hash["AudioEncoderFallback"] when /AC3/ - audioEncoderFallback << "HB_ACODEC_AC3" + audioEncoderFallback << "ffac3" + when "AAC (FDK)" + audioEncoderFallback << "fdk_aac" + when "AAC (faac)" + audioEncoderFallback << "faac" when "AAC (ffmpeg)" - audioEncoderFallback << "HB_ACODEC_FFAAC" - when /AAC/ - audioEncoderFallback << "HB_ACODEC_FAAC" + audioEncoderFallback << "ffaac" + when "AAC (CoreAudio)" + audioEncoderFallback << "ca_aac" + when "HE-AAC (FDK)" + audioEncoderFallback << "fdk_haac" + when "HE-AAC (CoreAudio)" + audioEncoderFallback << "ca_haac" when /Vorbis/ - audioEncoderFallback << "HB_ACODEC_VORBIS" + audioEncoderFallback << "vorbis" when /MP3/ - audioEncoderFallback << "HB_ACODEC_LAME" - when /FLAC/ - audioEncoderFallback << "HB_ACODEC_FFFLAC" + audioEncoderFallback << "lame" + when "FLAC (ffmpeg)" + audioEncoderFallback << "ffflac" + when "FLAC (24-bit)" + audioEncoderFallback << "ffflac24" end if audioEncoderFallback.size > 0 - commandString << "if( !acodec_fallback )\n " + commandString << "if( acodec_fallback == NULL )\n " commandString << "{\n " - commandString << " acodec_fallback = " << audioEncoderFallback - commandString << ";\n " + commandString << " acodec_fallback = \"" << audioEncoderFallback << "\";\n " commandString << "}\n " end @@ -1526,18 +1565,28 @@ class Display audioEncoders << "copy:dtshd" when /AAC Pass/ audioEncoders << "copy:aac" + when "AAC (FDK)" + audioEncoders << "fdk_aac" + when "AAC (faac)" + audioEncoders << "faac" when "AAC (ffmpeg)" audioEncoders << "ffaac" - when /AAC/ - audioEncoders << "faac" + when "AAC (CoreAudio)" + audioEncoders << "ca_aac" + when "HE-AAC (FDK)" + audioEncoders << "fdk_haac" + when "HE-AAC (CoreAudio)" + audioEncoders << "ca_haac" when /Vorbis/ audioEncoders << "vorbis" when /MP3 Pass/ audioEncoders << "copy:mp3" when /MP3/ audioEncoders << "lame" - when /FLAC/ + when "FLAC (ffmpeg)" audioEncoders << "ffflac" + when "FLAC (24-bit)" + audioEncoders << "ffflac24" when /Auto Pass/ audioEncoders << "copy" end diff --git a/test/module.defs b/test/module.defs index 0b42129ab..17dc7d7d4 100644 --- a/test/module.defs +++ b/test/module.defs @@ -19,6 +19,10 @@ TEST.GCC.l = \ samplerate swscale theoraenc theoradec vorbis vorbisenc x264 \ bluray xml2 bz2 z +ifeq (1,$(FEATURE.fdk_aac)) +TEST.GCC.l += fdk-aac +endif + TEST.install.exe = $(DESTDIR)$(PREFIX/)bin/$(notdir $(TEST.exe)) ############################################################################### diff --git a/test/test.c b/test/test.c index 60b1b8c47..a9cc46bd1 100644 --- a/test/test.c +++ b/test/test.c @@ -32,12 +32,6 @@ #endif /* Options */ -#if defined( __APPLE_CC__ ) -#define EXTRA_VLC_DYLD_PATH "/Applications/VLC.app/Contents/MacOS/lib" -#define DEFAULT_DYLD_PATH "/usr/local/lib:/usr/lib" - -static int no_vlc_dylib = 0; -#endif static int debug = HB_DEBUG_ALL; static int update = 0; static int dvdnav = 1; @@ -602,15 +596,15 @@ static int HandleEvents( hb_handle_t * h ) /* Show what title is currently being scanned */ if (p.preview_cur) { - fprintf(stdout, "\rScanning title %d of %d, preview %d, %.2f %%", + fprintf(stderr, "\rScanning title %d of %d, preview %d, %.2f %%", p.title_cur, p.title_count, p.preview_cur, 100 * p.progress); } else { - fprintf(stdout, "\rScanning title %d of %d, %.2f %%", + fprintf(stderr, "\rScanning title %d of %d, %.2f %%", p.title_cur, p.title_count, 100 * p.progress); } - fflush(stdout); + fflush(stderr); break; #undef p @@ -720,7 +714,7 @@ static int HandleEvents( hb_handle_t * h ) { fprintf( stderr, "+ Using preset: %s\n", preset_name); - if (!strcmp(preset_name, "Universal")) + if (!strcasecmp(preset_name, "Universal")) { if( !mux ) { @@ -754,7 +748,22 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0,0.0"); } + if( allowed_audio_copy == -1 ) + { + allowed_audio_copy = 0; + allowed_audio_copy |= HB_ACODEC_AAC_PASS; + allowed_audio_copy |= HB_ACODEC_AC3_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_HD_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_PASS; + allowed_audio_copy |= HB_ACODEC_MP3_PASS; + allowed_audio_copy &= HB_ACODEC_PASS_MASK; + } + if( acodec_fallback == NULL ) + { + acodec_fallback = "ffac3"; + } maxWidth = 720; + maxHeight = 576; if (x264_preset == NULL) { x264_preset = strdup("fast"); @@ -774,7 +783,7 @@ static int HandleEvents( hb_handle_t * h ) modulus = 2; job->chapter_markers = 1; } - if (!strcmp(preset_name, "iPod")) + if (!strcasecmp(preset_name, "iPod")) { if( !mux ) { @@ -809,7 +818,22 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0"); } + if( allowed_audio_copy == -1 ) + { + allowed_audio_copy = 0; + allowed_audio_copy |= HB_ACODEC_AAC_PASS; + allowed_audio_copy |= HB_ACODEC_AC3_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_HD_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_PASS; + allowed_audio_copy |= HB_ACODEC_MP3_PASS; + allowed_audio_copy &= HB_ACODEC_PASS_MASK; + } + if( acodec_fallback == NULL ) + { + acodec_fallback = "ffac3"; + } maxWidth = 320; + maxHeight = 240; if (x264_preset == NULL) { x264_preset = strdup("medium"); @@ -825,7 +849,7 @@ static int HandleEvents( hb_handle_t * h ) modulus = 2; job->chapter_markers = 1; } - if (!strcmp(preset_name, "iPhone & iPod Touch")) + if (!strcasecmp(preset_name, "iPhone & iPod touch")) { if( !mux ) { @@ -834,7 +858,7 @@ static int HandleEvents( hb_handle_t * h ) job->largeFileSize = 1; vcodec = HB_VCODEC_X264; job->vquality = 22.0; - job->vrate_base = 900900; + job->vrate_base = 900000; job->cfr = 2; if( !atracks ) { @@ -860,7 +884,22 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0"); } + if( allowed_audio_copy == -1 ) + { + allowed_audio_copy = 0; + allowed_audio_copy |= HB_ACODEC_AAC_PASS; + allowed_audio_copy |= HB_ACODEC_AC3_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_HD_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_PASS; + allowed_audio_copy |= HB_ACODEC_MP3_PASS; + allowed_audio_copy &= HB_ACODEC_PASS_MASK; + } + if( acodec_fallback == NULL ) + { + acodec_fallback = "ffac3"; + } maxWidth = 960; + maxHeight = 640; if (x264_preset == NULL) { x264_preset = strdup("medium"); @@ -880,7 +919,7 @@ static int HandleEvents( hb_handle_t * h ) modulus = 2; job->chapter_markers = 1; } - if (!strcmp(preset_name, "iPad")) + if (!strcasecmp(preset_name, "iPad")) { if( !mux ) { @@ -889,7 +928,7 @@ static int HandleEvents( hb_handle_t * h ) job->largeFileSize = 1; vcodec = HB_VCODEC_X264; job->vquality = 20.0; - job->vrate_base = 900900; + job->vrate_base = 900000; job->cfr = 2; if( !atracks ) { @@ -915,7 +954,22 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0"); } + if( allowed_audio_copy == -1 ) + { + allowed_audio_copy = 0; + allowed_audio_copy |= HB_ACODEC_AAC_PASS; + allowed_audio_copy |= HB_ACODEC_AC3_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_HD_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_PASS; + allowed_audio_copy |= HB_ACODEC_MP3_PASS; + allowed_audio_copy &= HB_ACODEC_PASS_MASK; + } + if( acodec_fallback == NULL ) + { + acodec_fallback = "ffac3"; + } maxWidth = 1280; + maxHeight = 720; if (x264_preset == NULL) { x264_preset = strdup("medium"); @@ -935,7 +989,7 @@ static int HandleEvents( hb_handle_t * h ) modulus = 2; job->chapter_markers = 1; } - if (!strcmp(preset_name, "AppleTV")) + if (!strcasecmp(preset_name, "AppleTV")) { if( !mux ) { @@ -970,7 +1024,22 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0,0.0"); } + if( allowed_audio_copy == -1 ) + { + allowed_audio_copy = 0; + allowed_audio_copy |= HB_ACODEC_AAC_PASS; + allowed_audio_copy |= HB_ACODEC_AC3_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_HD_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_PASS; + allowed_audio_copy |= HB_ACODEC_MP3_PASS; + allowed_audio_copy &= HB_ACODEC_PASS_MASK; + } + if( acodec_fallback == NULL ) + { + acodec_fallback = "ffac3"; + } maxWidth = 960; + maxHeight = 720; if (x264_preset == NULL) { x264_preset = strdup("medium"); @@ -985,7 +1054,7 @@ static int HandleEvents( hb_handle_t * h ) } if (advanced_opts == NULL) { - advanced_opts = strdup("cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500"); + advanced_opts = strdup("qpmin=4:cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500"); } if( !anamorphic_mode ) { @@ -994,7 +1063,7 @@ static int HandleEvents( hb_handle_t * h ) modulus = 2; job->chapter_markers = 1; } - if (!strcmp(preset_name, "AppleTV 2")) + if (!strcasecmp(preset_name, "AppleTV 2")) { if( !mux ) { @@ -1003,7 +1072,7 @@ static int HandleEvents( hb_handle_t * h ) job->largeFileSize = 1; vcodec = HB_VCODEC_X264; job->vquality = 20.0; - job->vrate_base = 900900; + job->vrate_base = 900000; job->cfr = 2; if( !atracks ) { @@ -1029,7 +1098,22 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0,0.0"); } + if( allowed_audio_copy == -1 ) + { + allowed_audio_copy = 0; + allowed_audio_copy |= HB_ACODEC_AAC_PASS; + allowed_audio_copy |= HB_ACODEC_AC3_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_HD_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_PASS; + allowed_audio_copy |= HB_ACODEC_MP3_PASS; + allowed_audio_copy &= HB_ACODEC_PASS_MASK; + } + if( acodec_fallback == NULL ) + { + acodec_fallback = "ffac3"; + } maxWidth = 1280; + maxHeight = 720; if (x264_preset == NULL) { x264_preset = strdup("medium"); @@ -1049,7 +1133,7 @@ static int HandleEvents( hb_handle_t * h ) modulus = 2; job->chapter_markers = 1; } - if (!strcmp(preset_name, "AppleTV 3")) + if (!strcasecmp(preset_name, "AppleTV 3")) { if( !mux ) { @@ -1084,7 +1168,22 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0,0.0"); } + if( allowed_audio_copy == -1 ) + { + allowed_audio_copy = 0; + allowed_audio_copy |= HB_ACODEC_AAC_PASS; + allowed_audio_copy |= HB_ACODEC_AC3_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_HD_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_PASS; + allowed_audio_copy |= HB_ACODEC_MP3_PASS; + allowed_audio_copy &= HB_ACODEC_PASS_MASK; + } + if( acodec_fallback == NULL ) + { + acodec_fallback = "ffac3"; + } maxWidth = 1920; + maxHeight = 1080; if (x264_preset == NULL) { x264_preset = strdup("medium"); @@ -1106,7 +1205,7 @@ static int HandleEvents( hb_handle_t * h ) modulus = 2; job->chapter_markers = 1; } - if (!strcmp(preset_name, "Android")) + if (!strcasecmp(preset_name, "Android")) { if( !mux ) { @@ -1114,7 +1213,7 @@ static int HandleEvents( hb_handle_t * h ) } vcodec = HB_VCODEC_X264; job->vquality = 22.0; - job->vrate_base = 900900; + job->vrate_base = 900000; job->cfr = 2; if( !atracks ) { @@ -1140,7 +1239,22 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0"); } + if( allowed_audio_copy == -1 ) + { + allowed_audio_copy = 0; + allowed_audio_copy |= HB_ACODEC_AAC_PASS; + allowed_audio_copy |= HB_ACODEC_AC3_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_HD_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_PASS; + allowed_audio_copy |= HB_ACODEC_MP3_PASS; + allowed_audio_copy &= HB_ACODEC_PASS_MASK; + } + if( acodec_fallback == NULL ) + { + acodec_fallback = "ffac3"; + } maxWidth = 720; + maxHeight = 576; if (x264_preset == NULL) { x264_preset = strdup("medium"); @@ -1151,7 +1265,7 @@ static int HandleEvents( hb_handle_t * h ) } if (h264_level == NULL) { - h264_level = strdup("2.2"); + h264_level = strdup("3.0"); } if( !anamorphic_mode ) { @@ -1159,7 +1273,7 @@ static int HandleEvents( hb_handle_t * h ) } modulus = 2; } - if (!strcmp(preset_name, "Android Tablet")) + if (!strcasecmp(preset_name, "Android Tablet")) { if( !mux ) { @@ -1167,7 +1281,7 @@ static int HandleEvents( hb_handle_t * h ) } vcodec = HB_VCODEC_X264; job->vquality = 22.0; - job->vrate_base = 900900; + job->vrate_base = 900000; job->cfr = 2; if( !atracks ) { @@ -1193,7 +1307,22 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0"); } + if( allowed_audio_copy == -1 ) + { + allowed_audio_copy = 0; + allowed_audio_copy |= HB_ACODEC_AAC_PASS; + allowed_audio_copy |= HB_ACODEC_AC3_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_HD_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_PASS; + allowed_audio_copy |= HB_ACODEC_MP3_PASS; + allowed_audio_copy &= HB_ACODEC_PASS_MASK; + } + if( acodec_fallback == NULL ) + { + acodec_fallback = "ffac3"; + } maxWidth = 1280; + maxHeight = 720; if (x264_preset == NULL) { x264_preset = strdup("medium"); @@ -1212,7 +1341,7 @@ static int HandleEvents( hb_handle_t * h ) } modulus = 2; } - if (!strcmp(preset_name, "Normal")) + if (!strcasecmp(preset_name, "Normal")) { if( !mux ) { @@ -1244,6 +1373,20 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0"); } + if( allowed_audio_copy == -1 ) + { + allowed_audio_copy = 0; + allowed_audio_copy |= HB_ACODEC_AAC_PASS; + allowed_audio_copy |= HB_ACODEC_AC3_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_HD_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_PASS; + allowed_audio_copy |= HB_ACODEC_MP3_PASS; + allowed_audio_copy &= HB_ACODEC_PASS_MASK; + } + if( acodec_fallback == NULL ) + { + acodec_fallback = "ffac3"; + } if (x264_preset == NULL) { x264_preset = strdup("veryfast"); @@ -1263,7 +1406,7 @@ static int HandleEvents( hb_handle_t * h ) modulus = 2; job->chapter_markers = 1; } - if (!strcmp(preset_name, "High Profile")) + if (!strcasecmp(preset_name, "High Profile")) { if( !mux ) { @@ -1296,6 +1439,20 @@ static int HandleEvents( hb_handle_t * h ) { dynamic_range_compression = strdup("0.0,0.0"); } + if( allowed_audio_copy == -1 ) + { + allowed_audio_copy = 0; + allowed_audio_copy |= HB_ACODEC_AAC_PASS; + allowed_audio_copy |= HB_ACODEC_AC3_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_HD_PASS; + allowed_audio_copy |= HB_ACODEC_DCA_PASS; + allowed_audio_copy |= HB_ACODEC_MP3_PASS; + allowed_audio_copy &= HB_ACODEC_PASS_MASK; + } + if( acodec_fallback == NULL ) + { + acodec_fallback = "ffac3"; + } if (x264_preset == NULL) { x264_preset = strdup("medium"); @@ -3192,21 +3349,20 @@ static void ShowPresets() fprintf( stderr, "%s - %s - %s\n", HB_PROJECT_TITLE, HB_PROJECT_BUILD_TITLE, HB_PROJECT_URL_WEBSITE ); printf("\n< Devices\n"); - printf("\n + Universal: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -X 720 --loose-anamorphic --modulus 2 -m --x264-preset fast --h264-profile baseline --h264-level 3.0\n"); - printf("\n + iPod: -e x264 -q 22.0 -r 30 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 -I -X 320 --modulus 2 -m --x264-preset medium --h264-profile baseline --h264-level 1.3\n"); - printf("\n + iPhone & iPod Touch: -e x264 -q 22.0 -r 29.97 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 -4 -X 960 --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 3.1\n"); - printf("\n + iPad: -e x264 -q 20.0 -r 29.97 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 -4 -X 1280 --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 3.1\n"); - printf("\n + AppleTV: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 -X 960 --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 3.1 -x cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500\n"); - printf("\n + AppleTV 2: -e x264 -q 20.0 -r 29.97 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 -X 1280 --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 3.1\n"); - printf("\n + AppleTV 3: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 -X 1920 --decomb=fast --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 4.0\n"); - printf("\n + Android: -e x264 -q 22.0 -r 29.97 --pfr -a 1 -E faac -B 128 -6 dpl2 -R Auto -D 0.0 -f mp4 -X 720 --loose-anamorphic --modulus 2 --x264-preset medium --h264-profile main --h264-level 2.2\n"); - printf("\n + Android Tablet: -e x264 -q 22.0 -r 29.97 --pfr -a 1 -E faac -B 128 -6 dpl2 -R Auto -D 0.0 -f mp4 -X 1280 --loose-anamorphic --modulus 2 --x264-preset medium --h264-profile main --h264-level 3.1\n"); + printf("\n + Universal: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -X 720 -Y 576 --loose-anamorphic --modulus 2 -m --x264-preset fast --h264-profile baseline --h264-level 3.0\n"); + printf("\n + iPod: -e x264 -q 22.0 -r 30 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -I -X 320 -Y 240 --modulus 2 -m --x264-preset medium --h264-profile baseline --h264-level 1.3\n"); + printf("\n + iPhone & iPod touch: -e x264 -q 22.0 -r 30 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 960 -Y 640 --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 3.1\n"); + printf("\n + iPad: -e x264 -q 20.0 -r 30 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 1280 -Y 720 --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 3.1\n"); + printf("\n + AppleTV: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 960 -Y 720 --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 3.1 -x qpmin=4:cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500\n"); + printf("\n + AppleTV 2: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 1280 -Y 720 --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 3.1\n"); + printf("\n + AppleTV 3: -e x264 -q 20.0 -r 30 --pfr -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 -X 1920 -Y 1080 --decomb=fast --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 4.0\n"); + printf("\n + Android: -e x264 -q 22.0 -r 30 --pfr -a 1 -E faac -B 128 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -X 720 -Y 576 --loose-anamorphic --modulus 2 --x264-preset medium --h264-profile main --h264-level 3.0\n"); + printf("\n + Android Tablet: -e x264 -q 22.0 -r 30 --pfr -a 1 -E faac -B 128 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -X 1280 -Y 720 --loose-anamorphic --modulus 2 --x264-preset medium --h264-profile main --h264-level 3.1\n"); printf("\n>\n"); printf("\n< Regular\n"); - printf("\n + Normal: -e x264 -q 20.0 -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 -f mp4 --loose-anamorphic --modulus 2 -m --x264-preset veryfast --h264-profile main --h264-level 4.0\n"); - printf("\n + High Profile: -e x264 -q 20.0 -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 --decomb --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 4.1\n"); + printf("\n + Normal: -e x264 -q 20.0 -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 --loose-anamorphic --modulus 2 -m --x264-preset veryfast --h264-profile main --h264-level 4.0\n"); + printf("\n + High Profile: -e x264 -q 20.0 -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 -4 --decomb --loose-anamorphic --modulus 2 -m --x264-preset medium --h264-profile high --h264-level 4.1\n"); printf("\n>\n"); - } static char * hb_strndup( char * str, int len ) @@ -3420,9 +3576,6 @@ static int ParseOptions( int argc, char ** argv ) { "vfr", no_argument, &cfr, 0 }, { "cfr", no_argument, &cfr, 1 }, { "pfr", no_argument, &cfr, 2 }, -#if defined( __APPLE_CC__ ) - { "no-vlc-dylib-path", no_argument, &no_vlc_dylib, 1 }, -#endif { "audio-copy-mask", required_argument, NULL, ALLOWED_AUDIO_COPY }, { "audio-fallback", required_argument, NULL, AUDIO_FALLBACK }, { 0, 0, 0, 0 } @@ -3987,72 +4140,6 @@ static int ParseOptions( int argc, char ** argv ) static int CheckOptions( int argc, char ** argv ) { -#if defined( __APPLE_CC__ ) - // If OSX, add VLC dylib path and exec to make it stick. - char *dylib_path; - - if ( !no_vlc_dylib ) - { - dylib_path = getenv("DYLD_FALLBACK_LIBRARY_PATH"); - if ( dylib_path == NULL || - strstr( dylib_path, "/Applications/VLC.app/Contents/MacOS/lib" ) == NULL ) - { - char *path = NULL; - char *home; - int result = -1; - - home = getenv("HOME"); - - if ( dylib_path == NULL ) - { - // Set the system default of $HOME/lib:/usr/local/lib:/usr/lib - // And add our extra path - if ( home != NULL ) - { - path = hb_strdup_printf("%s/lib:%s:%s:%s%s", home, - DEFAULT_DYLD_PATH, - EXTRA_VLC_DYLD_PATH, - home, EXTRA_VLC_DYLD_PATH); - } - else - { - path = hb_strdup_printf("%s:%s", DEFAULT_DYLD_PATH, EXTRA_VLC_DYLD_PATH); - } - if ( path != NULL ) - result = setenv("DYLD_FALLBACK_LIBRARY_PATH", path, 1); - } - else - { - // add our extra path - if ( home != NULL ) - { - path = hb_strdup_printf("%s:%s:%s%s", dylib_path, EXTRA_VLC_DYLD_PATH, - home, EXTRA_VLC_DYLD_PATH); - } - else - { - path = hb_strdup_printf("%s:%s", dylib_path, EXTRA_VLC_DYLD_PATH); - } - if ( path != NULL ) - result = setenv("DYLD_FALLBACK_LIBRARY_PATH", path, 1); - } - if ( result == 0 ) - { - const char ** new_argv; - int i; - - new_argv = (const char**)malloc( (argc + 2) * sizeof(char*) ); - new_argv[0] = argv[0]; - new_argv[1] = "--no-vlc-dylib-path"; - for (i = 1; i < argc; i++) - new_argv[i+1] = argv[i]; - new_argv[i+1] = NULL; - execv(new_argv[0], (char* const*)new_argv); - } - } - } -#endif - if( update ) { return 0; diff --git a/win/CS/HandBrake.ApplicationServices/EventArgs/ScanProgressEventArgs.cs b/win/CS/HandBrake.ApplicationServices/EventArgs/ScanProgressEventArgs.cs index fd0d01fe3..ff84bd7d5 100644 --- a/win/CS/HandBrake.ApplicationServices/EventArgs/ScanProgressEventArgs.cs +++ b/win/CS/HandBrake.ApplicationServices/EventArgs/ScanProgressEventArgs.cs @@ -29,5 +29,11 @@ namespace HandBrake.ApplicationServices.EventArgs /// [DataMember] public int Titles { get; set; } + + /// + /// Gets or sets the percentage. + /// + [DataMember] + public decimal Percentage { get; set; } } } diff --git a/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs b/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs index 3ddae9b1f..31c1d8cec 100644 --- a/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs +++ b/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs @@ -81,6 +81,17 @@ namespace HandBrake.ApplicationServices.Isolation } } + /// + /// Gets the log index. + /// + public int LogIndex + { + get + { + return -1; + } + } + /// /// Gets a value indicating whether IsEncoding. /// diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Parser.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Parser.cs index f17a6a51b..7cb7100fc 100644 --- a/win/CS/HandBrake.ApplicationServices/Parsing/Parser.cs +++ b/win/CS/HandBrake.ApplicationServices/Parsing/Parser.cs @@ -28,7 +28,8 @@ namespace HandBrake.ApplicationServices.Parsing /// The object who's raising the event /// The title number currently being processed /// The total number of titiles to be processed - public delegate void ScanProgressEventHandler(object sender, int currentTitle, int titleCount); + /// Percentage complete. + public delegate void ScanProgressEventHandler(object sender, int currentTitle, int titleCount, decimal percentage); /// /// A delegate to handle encode progress updates // EXPERIMENTAL @@ -97,18 +98,18 @@ namespace HandBrake.ApplicationServices.Parsing { string tmp = base.ReadLine(); - buffer.Append(tmp + Environment.NewLine); - Match m = null; - if (tmp.Contains("Scanning title")) - m = Regex.Match(tmp, "^Scanning title ([0-9]*) of ([0-9]*)"); + if (tmp != null && tmp.Contains("Scanning title")) + m = Regex.Match(tmp, "^Scanning title ([0-9]*) of ([0-9]*)([a-z0-9 ,]*), ([0-9.]*)"); + else if (!string.IsNullOrEmpty(tmp)) + buffer.Append(tmp + Environment.NewLine); if (OnReadLine != null) OnReadLine(this, tmp); if (m != null) if (m.Success && OnScanProgress != null) - OnScanProgress(this, int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value)); + OnScanProgress(this, int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value), decimal.Parse(m.Groups[4].Value, CultureInfo.InvariantCulture)); return tmp; } diff --git a/win/CS/HandBrake.ApplicationServices/Properties/AssemblyInfo.cs.tmpl b/win/CS/HandBrake.ApplicationServices/Properties/AssemblyInfo.cs.tmpl index c9a9da245..99c4ed362 100644 --- a/win/CS/HandBrake.ApplicationServices/Properties/AssemblyInfo.cs.tmpl +++ b/win/CS/HandBrake.ApplicationServices/Properties/AssemblyInfo.cs.tmpl @@ -38,5 +38,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.9.6.$WCREV$")] +[assembly: AssemblyVersion("0.9.9.$WCREV$")] [assembly: NeutralResourcesLanguage("")] diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs index 866edb794..555b004f2 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs @@ -15,8 +15,6 @@ namespace HandBrake.ApplicationServices.Services.Base using System.Text; using System.Text.RegularExpressions; - using Caliburn.Micro; - using HandBrake.ApplicationServices.EventArgs; using HandBrake.ApplicationServices.Exceptions; using HandBrake.ApplicationServices.Model; @@ -40,11 +38,6 @@ namespace HandBrake.ApplicationServices.Services.Base /// private readonly IUserSettingService userSettingService; - /// - /// Windows 7 API Pack wrapper - /// - private readonly Win7 windowsSeven = new Win7(); - /// /// The Log File Header /// @@ -76,6 +69,8 @@ namespace HandBrake.ApplicationServices.Services.Base GeneralUtilities.CreateCliLogHeader( userSettingService.GetUserSetting(ASUserSettingConstants.HandBrakeVersion), userSettingService.GetUserSetting(ASUserSettingConstants.HandBrakeBuild)); + + this.LogIndex = 0; } #region Events @@ -119,24 +114,18 @@ namespace HandBrake.ApplicationServices.Services.Base } /// - /// Gets LogBuffer. + /// Gets the log index. /// - public StringBuilder LogBuffer - { - get - { - return this.logBuffer; - } - } + public int LogIndex { get; private set; } /// - /// Gets WindowsSeven. + /// Gets LogBuffer. /// - public Win7 WindowsSeven + public StringBuilder LogBuffer { get { - return this.windowsSeven; + return this.logBuffer; } } @@ -152,15 +141,11 @@ namespace HandBrake.ApplicationServices.Services.Base /// public void InvokeEncodeStatusChanged(EncodeProgressEventArgs e) { - Execute.OnUIThread( - () => - { - EncodeProgessStatus handler = this.EncodeStatusChanged; - if (handler != null) - { - handler(this, e); - } - }); + EncodeProgessStatus handler = this.EncodeStatusChanged; + if (handler != null) + { + handler(this, e); + } } /// @@ -171,15 +156,13 @@ namespace HandBrake.ApplicationServices.Services.Base /// public void InvokeEncodeCompleted(EncodeCompletedEventArgs e) { - Execute.OnUIThread( - () => - { - EncodeCompletedStatus handler = this.EncodeCompleted; - if (handler != null) - { - handler(this, e); - } - }); + EncodeCompletedStatus handler = this.EncodeCompleted; + if (handler != null) + { + handler(this, e); + } + + this.LogIndex = 0; // Reset } /// @@ -190,14 +173,11 @@ namespace HandBrake.ApplicationServices.Services.Base /// public void InvokeEncodeStarted(EventArgs e) { - Execute.OnUIThread(() => - { - EventHandler handler = this.EncodeStarted; - if (handler != null) - { - handler(this, e); - } - }); + EventHandler handler = this.EncodeStarted; + if (handler != null) + { + handler(this, e); + } } #endregion @@ -261,7 +241,6 @@ namespace HandBrake.ApplicationServices.Services.Base } } - /// /// Pase the CLI status output (from standard output) /// @@ -393,6 +372,8 @@ namespace HandBrake.ApplicationServices.Services.Base { try { + this.LogIndex = this.LogIndex + 1; + lock (this.LogBuffer) { this.LogBuffer.AppendLine(message); diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs index 577067050..b4f572521 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs @@ -11,7 +11,6 @@ namespace HandBrake.ApplicationServices.Services { using System; using System.Diagnostics; - using System.Globalization; using System.IO; using System.Windows.Forms; @@ -66,7 +65,7 @@ namespace HandBrake.ApplicationServices.Services public Encode(IUserSettingService userSettingService) : base(userSettingService) { - this.userSettingService = userSettingService; + this.userSettingService = userSettingService; } #region Properties @@ -135,7 +134,7 @@ namespace HandBrake.ApplicationServices.Services userSettingService.GetUserSetting(ASUserSettingConstants.PreviewScanCount), userSettingService.GetUserSetting(ASUserSettingConstants.Verbosity), userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav)) - : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task), + : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task), userSettingService.GetUserSetting(ASUserSettingConstants.PreviewScanCount), userSettingService.GetUserSetting(ASUserSettingConstants.Verbosity), userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav)); @@ -263,21 +262,16 @@ namespace HandBrake.ApplicationServices.Services } Execute.OnUIThread(() => + { + if (this.userSettingService.GetUserSetting(ASUserSettingConstants.PreventSleep)) { - if (this.WindowsSeven.IsWindowsSeven) - { - this.WindowsSeven.SetTaskBarProgressToNoProgress(); - } - - if (this.userSettingService.GetUserSetting(ASUserSettingConstants.PreventSleep)) - { - Win32.AllowSleep(); - } + Win32.AllowSleep(); + } + }); - this.currentTask.Status = QueueItemStatus.Completed; - this.IsEncoding = false; - this.InvokeEncodeCompleted(new EncodeCompletedEventArgs(true, null, string.Empty)); - }); + this.currentTask.Status = QueueItemStatus.Completed; + this.IsEncoding = false; + this.InvokeEncodeCompleted(new EncodeCompletedEventArgs(true, null, string.Empty)); } /// @@ -296,14 +290,14 @@ namespace HandBrake.ApplicationServices.Services { if (!String.IsNullOrEmpty(e.Data)) { - if (initShutdown && this.LogBuffer.Length < 25000000) + if (initShutdown && this.LogBuffer.Length < 25000000) { initShutdown = false; // Reset this flag. } if (this.LogBuffer.Length > 25000000 && !initShutdown) // Approx 23.8MB and make sure it's only printed once { - this.ProcessLogMessage("ERROR: Initiating automatic shutdown of encode process. The size of the log file inidcates that there is an error! "); + this.ProcessLogMessage("ERROR: Initiating automatic shutdown of encode process. The size of the log file indicates that there is an error! "); initShutdown = true; this.Stop(); } @@ -328,28 +322,14 @@ namespace HandBrake.ApplicationServices.Services EncodeProgressEventArgs eventArgs = this.ReadEncodeStatus(e.Data, this.startTime); if (eventArgs != null) { - Execute.OnUIThread( - () => - { - if (!this.IsEncoding) - { - // We can get events out of order since the CLI progress is monitored on a background thread. - // So make sure we don't send a status update after an encode complete event. - return; - } - - this.InvokeEncodeStatusChanged(eventArgs); - - if (this.WindowsSeven.IsWindowsSeven) - { - int percent; - int.TryParse( - Math.Round(eventArgs.PercentComplete).ToString(CultureInfo.InvariantCulture), - out percent); - - this.WindowsSeven.SetTaskBarProgress(percent); - } - }); + if (!this.IsEncoding) + { + // We can get events out of order since the CLI progress is monitored on a background thread. + // So make sure we don't send a status update after an encode complete event. + return; + } + + this.InvokeEncodeStatusChanged(eventArgs); } } } diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs index 915d66788..fbb59ec2b 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs @@ -66,6 +66,11 @@ namespace HandBrake.ApplicationServices.Services.Interfaces /// string ActivityLog { get; } + /// + /// Gets the log index. The current log row counter. + /// + int LogIndex { get; } + /// /// Start with a LibHb EncodeJob Object /// diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs index 0d1998a59..33453dad8 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs @@ -254,14 +254,6 @@ namespace HandBrake.ApplicationServices.Services }; this.InvokeEncodeStatusChanged(args); - - if (this.WindowsSeven.IsWindowsSeven) - { - int percent; - int.TryParse(Math.Round(e.FractionComplete).ToString(CultureInfo.InvariantCulture), out percent); - - this.WindowsSeven.SetTaskBarProgress(percent); - } } /// @@ -282,11 +274,6 @@ namespace HandBrake.ApplicationServices.Services ? new EncodeCompletedEventArgs(false, null, string.Empty) : new EncodeCompletedEventArgs(true, null, string.Empty)); - if (this.WindowsSeven.IsWindowsSeven) - { - this.WindowsSeven.SetTaskBarProgressToNoProgress(); - } - if (this.userSettingService.GetUserSetting(ASUserSettingConstants.PreventSleep)) { Win32.AllowSleep(); diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs index cc99b916b..40329f14d 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs @@ -370,12 +370,14 @@ namespace HandBrake.ApplicationServices.Services /// the sender /// the current title being scanned /// the total number of titles - private void OnScanProgress(object sender, int currentTitle, int titleCount) + /// The Percentage + private void OnScanProgress(object sender, int currentTitle, int titleCount, decimal percentage) { ScanProgressEventArgs eventArgs = new ScanProgressEventArgs { CurrentTitle = currentTitle, - Titles = titleCount + Titles = titleCount, + Percentage = percentage }; if (this.ScanStatusChanged != null) diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs index 93d15dda0..833c6d989 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs @@ -24,7 +24,7 @@ namespace HandBrake.ApplicationServices.Utilities { IDictionary languageMap = new Dictionary { - {"Any", "und"}, + {"(Any)", "und"}, {"Afar", "aar"}, {"Abkhazian", "abk"}, {"Afrikaans", "afr"}, diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs index 3990704fe..7536fd261 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HandBrake Team")] [assembly: AssemblyProduct("HandBrake.Interop")] -[assembly: AssemblyCopyright("Copyright © HandBrake Team 2011")] +[assembly: AssemblyCopyright("Copyright © HandBrake Team 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/win/CS/HandBrake.Server/Properties/AssemblyInfo.cs b/win/CS/HandBrake.Server/Properties/AssemblyInfo.cs index 872727ded..48e4f9485 100644 --- a/win/CS/HandBrake.Server/Properties/AssemblyInfo.cs +++ b/win/CS/HandBrake.Server/Properties/AssemblyInfo.cs @@ -6,11 +6,11 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("HandBrake.Server")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("An application that decouples libhb from the UI.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HandBrake Team")] [assembly: AssemblyProduct("HandBrake.Server")] -[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/win/CS/HandBrakeWPF/Installer/Installer.nsi b/win/CS/HandBrakeWPF/Installer/Installer.nsi index 3110e6703..fd1b72b5b 100644 --- a/win/CS/HandBrakeWPF/Installer/Installer.nsi +++ b/win/CS/HandBrakeWPF/Installer/Installer.nsi @@ -8,8 +8,8 @@ ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "HandBrake" -!define PRODUCT_VERSION "0.9.8" -!define PRODUCT_VERSION_NUMBER "0.9.8" +!define PRODUCT_VERSION "0.9.9" +!define PRODUCT_VERSION_NUMBER "0.9.9" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Handbrake.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" diff --git a/win/CS/HandBrakeWPF/Installer/Installer64.nsi b/win/CS/HandBrakeWPF/Installer/Installer64.nsi index 663c6fdcf..6840fb270 100644 --- a/win/CS/HandBrakeWPF/Installer/Installer64.nsi +++ b/win/CS/HandBrakeWPF/Installer/Installer64.nsi @@ -8,8 +8,8 @@ ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "HandBrake" -!define PRODUCT_VERSION "0.9.8" -!define PRODUCT_VERSION_NUMBER "0.9.8" +!define PRODUCT_VERSION "0.9.9" +!define PRODUCT_VERSION_NUMBER "0.9.9" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Handbrake.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" diff --git a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs index a30401a56..a202e0bbb 100644 --- a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs +++ b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("HandBrake")] -[assembly: AssemblyDescription("HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video transcoder.")] +[assembly: AssemblyDescription("HandBrake is an open-source, GPL-licensed, multiplatform,video transcoder.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HandBrake Team")] [assembly: AssemblyProduct("HandBrake")] @@ -56,5 +56,5 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.9.8.4532")] +[assembly: AssemblyVersion("0.9.9.5314")] [assembly: NeutralResourcesLanguage("")] \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.tmpl b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.tmpl index 8d77fdd8a..d42127e97 100644 --- a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.tmpl +++ b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs.tmpl @@ -56,5 +56,5 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.9.8.$WCREV$")] +[assembly: AssemblyVersion("0.9.9.$WCREV$")] [assembly: NeutralResourcesLanguage("")] \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs index 8f424b65a..2dd1814ee 100644 --- a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs +++ b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs @@ -126,6 +126,17 @@ namespace HandBrakeWPF.Services } } + /// + /// Gets the log index. + /// + public int LogIndex + { + get + { + return this.encodeService.LogIndex; + } + } + /// /// Gets a value indicating whether IsEncoding. /// diff --git a/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs index e578d9688..f1da43828 100644 --- a/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs @@ -9,6 +9,8 @@ namespace HandBrakeWPF.ViewModels { + using System.Collections.Generic; + using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Parsing; using HandBrake.Interop.Model.Encoding; @@ -20,6 +22,11 @@ namespace HandBrakeWPF.ViewModels /// public class EncoderOptionsViewModel : ViewModelBase, IEncoderOptionsViewModel, ITabInterface { + /// + /// The cached options. + /// + private readonly Dictionary cachedOptions = new Dictionary(); + /// /// Initializes a new instance of the class. /// @@ -33,6 +40,16 @@ namespace HandBrakeWPF.ViewModels /// public EncodeTask Task { get; set; } + /// + /// Gets or sets the preset. + /// + public Preset Preset { get; set; } + + /// + /// Gets or sets the current video encoder. + /// + public VideoEncoder CurrentVideoEncoder { get; set; } + /// /// Gets or sets the options string. /// @@ -64,6 +81,7 @@ namespace HandBrakeWPF.ViewModels public void SetSource(Title selectedTitle, Preset currentPreset, EncodeTask task) { this.Task = task; + this.Preset = currentPreset; this.NotifyOfPropertyChange(() => this.AdvancedOptionsString); } @@ -79,6 +97,7 @@ namespace HandBrakeWPF.ViewModels public void SetPreset(Preset preset, EncodeTask task) { this.Task = task; + this.Preset = preset; this.AdvancedOptionsString = preset.Task.AdvancedEncoderOptions; } @@ -102,6 +121,28 @@ namespace HandBrakeWPF.ViewModels /// public void SetEncoder(VideoEncoder encoder) { + // Cache the existing string so it can be reused if the user changes the encoder back. + if (!string.IsNullOrEmpty(this.AdvancedOptionsString)) + { + this.cachedOptions[CurrentVideoEncoder] = this.AdvancedOptionsString; + } + + this.CurrentVideoEncoder = encoder; + + // Set the option from the cached version if we have one. + string advacnedOptionsString; + if (cachedOptions.TryGetValue(encoder, out advacnedOptionsString) + && !string.IsNullOrEmpty(advacnedOptionsString)) + { + this.AdvancedOptionsString = advacnedOptionsString; + } + else + { + this.AdvancedOptionsString = this.Preset != null && this.Preset.Task != null + && !string.IsNullOrEmpty(this.Preset.Task.AdvancedEncoderOptions) + ? this.Preset.Task.AdvancedEncoderOptions + : string.Empty; + } } /// diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ILogViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ILogViewModel.cs index 6aa1020d4..6c7a7a2c8 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ILogViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ILogViewModel.cs @@ -14,5 +14,9 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// public interface ILogViewModel { + /// + /// Gets or sets the selected tab. + /// + int SelectedTab { get; set; } } } \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs index 4c97ab412..ad76a56b2 100644 --- a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs @@ -10,7 +10,6 @@ namespace HandBrakeWPF.ViewModels { using System; - using System.Collections.Generic; using System.Diagnostics; using System.Windows; @@ -37,9 +36,15 @@ namespace HandBrakeWPF.ViewModels private readonly IScanServiceWrapper scanService; /// - /// Backing field for the selected mode + /// The selected tab. /// - private int selectedMode; + private int selectedTab; + + /// + /// The encode log index. + /// + private int encodeLogIndex; + #endregion /// @@ -56,46 +61,44 @@ namespace HandBrakeWPF.ViewModels this.encodeService = encodeService; this.scanService = scanService; this.Title = "Log Viewer"; - - this.SelectedMode = this.encodeService.IsEncoding ? 0 : 1; + this.encodeLogIndex = 0; } /// - /// Gets Log. + /// Gets or sets the selected tab. /// - public string Log + public int SelectedTab { get { - return this.SelectedMode == 0 ? this.encodeService.ActivityLog : this.scanService.ActivityLog; + return this.selectedTab; + } + set + { + this.selectedTab = value; + this.NotifyOfPropertyChange(() => this.SelectedTab); } } /// - /// Gets LogModes. + /// Gets Log. /// - public IEnumerable LogModes + public string ScanLog { get { - return new List { "Encode Log", "Scan Log" }; + return this.scanService.ActivityLog; } } /// - /// Gets or sets SelectedMode. + /// Gets the encodelog. /// - public int SelectedMode + public string EncodeLog { get { - return selectedMode; - } - set - { - selectedMode = value; - this.NotifyOfPropertyChange(() => this.SelectedMode); - this.ChangeLogDisplay(); + return this.encodeService.ActivityLog; } } @@ -115,7 +118,7 @@ namespace HandBrakeWPF.ViewModels /// public void CopyLog() { - Clipboard.SetDataObject(this.Log, true); + Clipboard.SetDataObject(this.SelectedTab == 1 ? this.ScanLog : this.EncodeLog, true); } /// @@ -123,13 +126,16 @@ namespace HandBrakeWPF.ViewModels /// protected override void OnActivate() { - this.scanService.ScanStared += ScanServiceScanStared; this.scanService.ScanCompleted += ScanServiceScanCompleted; - this.encodeService.EncodeStarted += EncodeServiceEncodeStarted; this.encodeService.EncodeCompleted += EncodeServiceEncodeCompleted; this.encodeService.EncodeStatusChanged += this.EncodeServiceEncodeStatusChanged; this.scanService.ScanStatusChanged += this.ScanServiceScanStatusChanged; + this.scanService.ScanStared += this.scanService_ScanStared; + this.encodeService.EncodeStarted += this.encodeService_EncodeStarted; base.OnActivate(); + + this.NotifyOfPropertyChange(() => this.ScanLog); + this.NotifyOfPropertyChange(() => this.EncodeLog); } /// @@ -143,7 +149,7 @@ namespace HandBrakeWPF.ViewModels /// private void ScanServiceScanStatusChanged(object sender, ScanProgressEventArgs e) { - this.NotifyOfPropertyChange(() => this.Log); + this.NotifyOfPropertyChange(() => this.ScanLog); } /// @@ -157,7 +163,12 @@ namespace HandBrakeWPF.ViewModels /// private void EncodeServiceEncodeStatusChanged(object sender, EncodeProgressEventArgs e) { - this.NotifyOfPropertyChange(() => this.Log); + if (encodeLogIndex != this.encodeService.LogIndex || this.encodeService.LogIndex == -1) + { + this.NotifyOfPropertyChange(() => this.EncodeLog); + } + + encodeLogIndex = this.encodeService.LogIndex; } /// @@ -168,26 +179,18 @@ namespace HandBrakeWPF.ViewModels /// protected override void OnDeactivate(bool close) { - this.scanService.ScanStared -= ScanServiceScanStared; this.scanService.ScanCompleted -= ScanServiceScanCompleted; - this.encodeService.EncodeStarted -= EncodeServiceEncodeStarted; this.encodeService.EncodeCompleted -= EncodeServiceEncodeCompleted; this.encodeService.EncodeStatusChanged -= this.EncodeServiceEncodeStatusChanged; this.scanService.ScanStatusChanged -= this.ScanServiceScanStatusChanged; + this.scanService.ScanStared -= this.scanService_ScanStared; + this.encodeService.EncodeStarted -= this.encodeService_EncodeStarted; base.OnDeactivate(close); } /// - /// Change the Log Display - /// - private void ChangeLogDisplay() - { - this.NotifyOfPropertyChange(() => this.Log); - } - - /// - /// Encode Started Event Handler + /// Scan Completed Event Handler. /// /// /// The sender. @@ -195,13 +198,13 @@ namespace HandBrakeWPF.ViewModels /// /// The e. /// - private void EncodeServiceEncodeStarted(object sender, EventArgs e) + private void ScanServiceScanCompleted(object sender, ScanCompletedEventArgs e) { - this.SelectedMode = 0; + this.NotifyOfPropertyChange(() => this.ScanLog); } /// - /// Scan Started Event Handler + /// Encode Completed Event Handler. /// /// /// The sender. @@ -209,13 +212,13 @@ namespace HandBrakeWPF.ViewModels /// /// The e. /// - private void ScanServiceScanStared(object sender, EventArgs e) + private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e) { - this.SelectedMode = 1; + this.NotifyOfPropertyChange(() => this.EncodeLog); } /// - /// Scan Completed Event Handler. + /// The encode service encode started. /// /// /// The sender. @@ -223,13 +226,13 @@ namespace HandBrakeWPF.ViewModels /// /// The e. /// - private void ScanServiceScanCompleted(object sender, ScanCompletedEventArgs e) + private void encodeService_EncodeStarted(object sender, EventArgs e) { - this.NotifyOfPropertyChange(() => this.Log); + this.SelectedTab = 0; } /// - /// Encode Completed Event Handler. + /// The scan service scan stared. /// /// /// The sender. @@ -237,9 +240,9 @@ namespace HandBrakeWPF.ViewModels /// /// The e. /// - private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e) + private void scanService_ScanStared(object sender, EventArgs e) { - this.NotifyOfPropertyChange(() => this.Log); + this.SelectedTab = 1; } } } \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 4875fd6bf..04d466062 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -94,6 +94,11 @@ namespace HandBrakeWPF.ViewModels /// private readonly IEncodeServiceWrapper encodeService; + /// + /// Windows 7 API Pack wrapper + /// + private readonly Win7 windowsSeven = new Win7(); + /// /// HandBrakes Main Window Title /// @@ -173,6 +178,11 @@ namespace HandBrakeWPF.ViewModels /// The Source Menu Backing Field /// private IEnumerable sourceMenu; + + /// + /// The last percentage complete value. + /// + private int lastEncodePercentage; #endregion /// @@ -1002,11 +1012,15 @@ namespace HandBrakeWPF.ViewModels if (window != null) { + ILogViewModel logvm = (ILogViewModel)window.DataContext; + logvm.SelectedTab = this.IsEncoding ? 0 : 1; window.Activate(); } else { - this.WindowManager.ShowWindow(IoC.Get()); + ILogViewModel logvm = IoC.Get(); + logvm.SelectedTab = this.IsEncoding ? 0 : 1; + this.WindowManager.ShowWindow(logvm); } } @@ -1749,8 +1763,8 @@ namespace HandBrakeWPF.ViewModels /// private void ScanStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.ScanProgressEventArgs e) { - this.SourceLabel = "Scanning Title " + e.CurrentTitle + " of " + e.Titles; - this.StatusLabel = "Scanning Title " + e.CurrentTitle + " of " + e.Titles; + this.SourceLabel = string.Format("Scanning Title {0} of {1} ({2}%)", e.CurrentTitle, e.Titles, e.Percentage); + this.StatusLabel = string.Format("Scanning Title {0} of {1} ({2}%)", e.CurrentTitle, e.Titles, e.Percentage); } /// @@ -1847,6 +1861,12 @@ namespace HandBrakeWPF.ViewModels /// private void EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e) { + int percent; + int.TryParse( + Math.Round(e.PercentComplete).ToString(CultureInfo.InvariantCulture), + out percent); + + Execute.OnUIThread( () => { @@ -1861,6 +1881,13 @@ namespace HandBrakeWPF.ViewModels e.EstimatedTimeLeft, e.ElapsedTime, this.queueProcessor.Count); + + if (lastEncodePercentage != percent && this.windowsSeven.IsWindowsSeven) + { + this.windowsSeven.SetTaskBarProgress(percent); + } + + lastEncodePercentage = percent; } }); } @@ -1902,6 +1929,11 @@ namespace HandBrakeWPF.ViewModels { this.ProgramStatusLabel = "Queue Finished"; this.IsEncoding = false; + + if (this.windowsSeven.IsWindowsSeven) + { + this.windowsSeven.SetTaskBarProgressToNoProgress(); + } }); } diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index b611e14d6..4f2bc251b 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -1536,7 +1536,7 @@ namespace HandBrakeWPF.ViewModels this.preferredLanguages.Add(item); // In the available languages should be no "Any" and no selected language. - if ((item != "Any") && (!this.userSettingService.GetUserSetting(UserSettingConstants.SelectedLanguages).Contains(item))) + if ((item != "(Any)") && (!this.userSettingService.GetUserSetting(UserSettingConstants.SelectedLanguages).Contains(item))) { this.availableLanguages.Add(item); } diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index 4f344db08..79532b9ee 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -101,7 +101,7 @@ namespace HandBrakeWPF.ViewModels this.errorService = errorService; this.Title = "Queue"; this.JobsPending = "No encodes pending"; - this.JobStatus = "There are no jobs currently encoding"; + this.JobStatus = "There are no jobs currently encoding"; } #endregion @@ -263,9 +263,9 @@ namespace HandBrakeWPF.ViewModels { MessageBoxResult result = this.errorService.ShowMessageBox( - "This encode is currently in progress. If you delete it, the encode will be stoped. Are you sure you wish to proceed?", - "Warning", - MessageBoxButton.YesNo, + "This encode is currently in progress. If you delete it, the encode will be stoped. Are you sure you wish to proceed?", + "Warning", + MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) @@ -330,7 +330,7 @@ namespace HandBrakeWPF.ViewModels /// public void Import() { - VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "HandBrake Queue Files (*.hbq)|*.hbq", CheckFileExists = true }; + VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "HandBrake Queue Files (*.hbq)|*.hbq", CheckFileExists = true }; dialog.ShowDialog(); this.queueProcessor.RestoreQueue(dialog.FileName); @@ -374,7 +374,7 @@ namespace HandBrakeWPF.ViewModels { this.Load(); - this.WhenDoneAction = this.userSettingService.GetUserSetting(ASUserSettingConstants.WhenCompleteAction); + this.WhenDoneAction = this.userSettingService.GetUserSetting(ASUserSettingConstants.WhenCompleteAction); this.queueProcessor.JobProcessingStarted += this.queueProcessor_JobProcessingStarted; this.queueProcessor.QueueCompleted += this.queueProcessor_QueueCompleted; @@ -414,19 +414,23 @@ namespace HandBrakeWPF.ViewModels private void EncodeService_EncodeStatusChanged( object sender, EncodeProgressEventArgs e) { - if (this.IsEncoding) + Caliburn.Micro.Execute.OnUIThread(() => { - this.JobStatus = - string.Format( - "Encoding: Pass {0} of {1}, {2:00.00}%, FPS: {3:000.0}, Avg FPS: {4:000.0}, Time Remaining: {5}, Elapsed: {6:hh\\:mm\\:ss}", - e.Task, - e.TaskCount, - e.PercentComplete, - e.CurrentFrameRate, - e.AverageFrameRate, - e.EstimatedTimeLeft, - e.ElapsedTime); - } + if (this.IsEncoding) + { + this.JobStatus = + string.Format( + "Encoding: Pass {0} of {1}, {2:00.00}%, FPS: {3:000.0}, Avg FPS: {4:000.0}, Time Remaining: {5}, Elapsed: {6:hh\\:mm\\:ss}", + e.Task, + e.TaskCount, + e.PercentComplete, + e.CurrentFrameRate, + e.AverageFrameRate, + e.EstimatedTimeLeft, + e.ElapsedTime); + } + + }); } /// diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index 3fcca18aa..9149fde39 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -14,12 +14,9 @@ namespace HandBrakeWPF.ViewModels using System.IO; using System.Linq; - using Caliburn.Micro; - using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Model.Encoding; using HandBrake.ApplicationServices.Parsing; - using HandBrake.ApplicationServices.Services.Interfaces; using HandBrake.ApplicationServices.Utilities; using HandBrakeWPF.Commands; @@ -52,13 +49,7 @@ namespace HandBrakeWPF.ViewModels /// /// Initializes a new instance of the class. /// - /// - /// The window manager. - /// - /// - /// The user Setting Service. - /// - public SubtitlesViewModel(IWindowManager windowManager, IUserSettingService userSettingService) + public SubtitlesViewModel() { this.Task = new EncodeTask(); diff --git a/win/CS/HandBrakeWPF/Views/ChaptersView.xaml b/win/CS/HandBrakeWPF/Views/ChaptersView.xaml index a5fa6a6da..0895579f5 100644 --- a/win/CS/HandBrakeWPF/Views/ChaptersView.xaml +++ b/win/CS/HandBrakeWPF/Views/ChaptersView.xaml @@ -29,6 +29,11 @@ VerticalAlignment="Stretch" HorizontalAlignment="Stretch" AutoGenerateColumns="False" CanUserSortColumns="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserAddRows="False" CanUserDeleteRows="False"> + + + diff --git a/win/CS/HandBrakeWPF/Views/LogView.xaml b/win/CS/HandBrakeWPF/Views/LogView.xaml index cb6687251..f8b2c9327 100644 --- a/win/CS/HandBrakeWPF/Views/LogView.xaml +++ b/win/CS/HandBrakeWPF/Views/LogView.xaml @@ -20,21 +20,7 @@ ToolBarTray.IsLocked="True" Loaded="ToolBarLoaded" > - - - - - - - +