]> granicus.if.org Git - handbrake/commitdiff
Merging Trunk into OpenCL Branch.
authorsr55 <sr55.hb@outlook.com>
Sun, 24 Feb 2013 14:09:48 +0000 (14:09 +0000)
committersr55 <sr55.hb@outlook.com>
Sun, 24 Feb 2013 14:09:48 +0000 (14:09 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/opencl@5264 b64f7644-9d1e-0410-96f1-a4d463321fa5

74 files changed:
contrib/bzip2/module.defs
contrib/ffmpeg/A05-truehd-downmix.patch [new file with mode: 0644]
contrib/ffmpeg/module.defs
contrib/libdvdnav/module.defs
contrib/libsamplerate/module.defs
contrib/mp4v2/module.defs
gtk/src/ghb.ui
libhb/common.c
libhb/common.h
libhb/decavcodec.c
libhb/encavcodecaudio.c
libhb/hb.c
libhb/internal.h
libhb/ports.c
libhb/ports.h
libhb/work.c
macosx/Controller.m
macosx/English.lproj/Preferences.xib
macosx/HBAudioController.m
macosx/HBPreviewController.m
macosx/PictureController.h
macosx/PictureController.m
make/variant/mingw.defs
test/test.c
win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/EncodeCompletedEventArgs.cs [moved from win/CS/HandBrake.Interop/HandBrakeInterop/EncodeCompletedEventArgs.cs with 91% similarity]
win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/EncodeProgressEventArgs.cs [moved from win/CS/HandBrake.Interop/HandBrakeInterop/EncodeProgressEventArgs.cs with 91% similarity]
win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/MessageLoggedEventArgs.cs [moved from win/CS/HandBrake.Interop/HandBrakeInterop/MessageLoggedEventArgs.cs with 88% similarity]
win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/ScanProgressEventArgs.cs [moved from win/CS/HandBrake.Interop/HandBrakeInterop/ScanProgressEventArgs.cs with 91% similarity]
win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj
win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Interfaces/IHandBrakeInstance.cs
win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs
win/CS/HandBrake.Interop/HandBrakeInterop/LanguageCodes.cs
win/CS/HandBrake.Interop/HandBrakeInterop/MarshalingConstants.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Model/BitrateLimits.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Model/RangeLimits.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Model/Size.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Model/SourceSubtitle.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Model/SourceType.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Model/SrtSubtitle.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Model/Subtitles.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Model/VideoRangeType.cs
win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs
win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs
win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Chapter.cs
win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/InputType.cs
win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Subtitle.cs
win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/SubtitleSource.cs
win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/SubtitleType.cs
win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Utilities.cs
win/CS/HandBrake.Interop/HandBrakeInterop/libgcc_s_sjlj-1.dll [deleted file]
win/CS/HandBrakeWPF/HandBrakeWPF.csproj
win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs [new file with mode: 0644]
win/CS/HandBrakeWPF/ViewModels/Interfaces/IEncoderOptionsViewModel.cs [new file with mode: 0644]
win/CS/HandBrakeWPF/ViewModels/Interfaces/IX264ViewModel.cs [new file with mode: 0644]
win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs [new file with mode: 0644]
win/CS/HandBrakeWPF/Views/AdvancedView.xaml
win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml [new file with mode: 0644]
win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml.cs [new file with mode: 0644]
win/CS/HandBrakeWPF/Views/OptionsView.xaml
win/CS/HandBrakeWPF/Views/X264View.xaml [new file with mode: 0644]
win/CS/HandBrakeWPF/Views/X264View.xaml.cs [new file with mode: 0644]

index 728e28189cf3dca8a0b18deb8324af71766e6e25..0a7463e20fdc8ef448881b9bc911dc3fbd25f386 100644 (file)
@@ -6,10 +6,10 @@ BZIP2.EXTRACT.tarbase = bzip2
 BZIP2.CONFIGURE = $(TOUCH.exe) $@
 
 BZIP2.BUILD.extra = \
-    CC=$(BZIP2.GCC.gcc) \
-    CFLAGS="$(call fn.ARGS,BZIP2.GCC,*archs *sysroot *minver)" \
+    PREFIX="$(BZIP2.CONFIGURE.prefix)" \
+    CC="$(BZIP2.GCC.gcc)" \
+    $(BZIP2.CONFIGURE.env.CFLAGS) \
     RANLIB="$(RANLIB.exe)"
-    PREFIX=$(call fn.ABSOLUTE,$(CONTRIB.build/))
 
 BZIP2.BUILD.ntargets = libbz2.a
 
diff --git a/contrib/ffmpeg/A05-truehd-downmix.patch b/contrib/ffmpeg/A05-truehd-downmix.patch
new file mode 100644 (file)
index 0000000..3534461
--- /dev/null
@@ -0,0 +1,46 @@
+diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
+index 3852f6e..86aecf7 100644
+--- a/libavcodec/mlpdec.c
++++ b/libavcodec/mlpdec.c
+@@ -394,14 +394,24 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
+         return AVERROR_INVALIDDATA;
+     }
+-    if (m->avctx->request_channels > 0
+-        && s->max_channel + 1 >= m->avctx->request_channels
+-        && substr < m->max_decoded_substream) {
++#if FF_API_REQUEST_CHANNELS
++    if (m->avctx->request_channels > 0 &&
++        m->avctx->request_channels <= s->max_channel + 1 &&
++        m->max_decoded_substream > substr) {
+         av_log(m->avctx, AV_LOG_DEBUG,
+-               "Extracting %d channel downmix from substream %d. "
++               "Extracting %d-channel downmix from substream %d. "
+                "Further substreams will be skipped.\n",
+                s->max_channel + 1, substr);
+         m->max_decoded_substream = substr;
++    } else
++#endif
++    if (m->avctx->request_channel_layout == s->ch_layout &&
++        m->max_decoded_substream > substr) {
++        av_log(m->avctx, AV_LOG_DEBUG,
++               "Extracting %d-channel downmix (0x%"PRIx64") from substream %d. "
++               "Further substreams will be skipped.\n",
++               s->max_channel + 1, s->ch_layout, substr);
++        m->max_decoded_substream = substr;
+     }
+     s->noise_shift   = get_bits(gbp,  4);
+@@ -463,8 +473,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
+         cp->huff_lsbs        = 24;
+     }
+-    if (substr == m->max_decoded_substream)
+-        m->avctx->channels = s->max_matrix_channel + 1;
++    if (substr == m->max_decoded_substream) {
++        m->avctx->channels       = s->max_matrix_channel + 1;
++        m->avctx->channel_layout = s->ch_layout;
++    }
+     return 0;
+ }
index 435ce778bd4ebe9562532f7dc6b4fd5d9636355b..85a8299fe6c9e89b482aa4d6d09e82453dd071d0 100644 (file)
@@ -34,7 +34,7 @@ FFMPEG.CONFIGURE.extra = \
 ## 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
-    FFMPEG.GCC.args.extra = -fno-common
+    FFMPEG.GCC.args.extra += -fno-common
 else ifeq (darwin,$(BUILD.system))
     ## section for darwin-archs
     FFMPEG.CONFIGURE.extra += --enable-pthreads --enable-cross-compile --arch=$(BUILD.machine) --target-os=darwin
index 6f596d4090f4c1760892f1913ec25527e592c588..473a76237bcf83ae1f749f5f898faa66d02ac6d4 100644 (file)
@@ -5,11 +5,7 @@ LIBDVDNAV.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libdvdnav-s
 LIBDVDNAV.EXTRACT.tarbase = libdvdnav
 
 ifneq (max,$(LIBDVDNAV.GCC.g))
-ifeq (none,$(LIBDVDNAV.GCC.O))
-    LIBDVDNAV.CONFIGURE.env.CFLAGS   = CFLAGS="$(call fn.ARGS,LIBDVDNAV.GCC,*sysroot *minver ?extra .O) -DNDEBUG"
-else
-    LIBDVDNAV.CONFIGURE.env.CFLAGS   = CFLAGS="$(call fn.ARGS,LIBDVDNAV.GCC,*sysroot *minver ?extra) -DNDEBUG"
-endif
+    LIBDVDNAV.GCC.D += NDEBUG
 endif
 
 LIBDVDNAV.CONFIGURE.bootstrap = rm -fr aclocal.m4 autom4te.cache; autoreconf -fiv;
index c99ae3abf7754a4535cbccd2b317d2b086169250..468aa4739ab02002e13066645b83a546becc7194 100644 (file)
@@ -3,3 +3,6 @@ $(eval $(call import.CONTRIB.defs,LIBSAMPLERATE))
 
 LIBSAMPLERATE.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libsamplerate-0.1.4.tar.gz
 LIBSAMPLERATE.EXTRACT.tarbase = libsamplerate
+
+# Disable to avoid Carbon.h dependency on OSX
+LIBSAMPLERATE.CONFIGURE.extra = --disable-sndfile
index 0254d43ffe995f77e57fb982afc43c01e50e51f4..39aa2233daf099f2b7f7339313dc045f9adab326 100644 (file)
@@ -4,8 +4,8 @@ $(eval $(call import.CONTRIB.defs,MP4V2))
 MP4V2.FETCH.url = http://download.handbrake.fr/handbrake/contrib/mp4v2-trunk-r355.tar.bz2
 
 ## propagate more flags
-MP4V2.CONFIGURE.env.CFLAGS = CFLAGS="$(call fn.ARGS,MP4V2.GCC,*archs *sysroot *minver *D .g .O)"
-MP4V2.CONFIGURE.env.CXXFLAGS = CXXFLAGS="$(call fn.ARGS,MP4V2.GCC,*archs *sysroot *minver *D .g .O)"
+MP4V2.CONFIGURE.env.CFLAGS = CFLAGS="$(call fn.ARGS,MP4V2.GCC,*archs *sysroot *minver ?extra *D .g .O)"
+MP4V2.CONFIGURE.env.CXXFLAGS = CXXFLAGS="$(call fn.ARGS,MP4V2.GCC,*archs *sysroot *minver ?extra *D .g .O)"
 
 ## save some build-time by disabling utils
 MP4V2.CONFIGURE.extra += --disable-util
index c697849fa42a8c91fc3efc7304a54eb997b9ed66..ba8f46856dca3d8f2cd717b244771612da3ab7ed 100644 (file)
@@ -213,10 +213,10 @@ This setting allows you to synchronize the files.</property>
   </object>
   <object class="GtkAdjustment" id="adjustment21">
     <property name="value">15</property>
-    <property name="lower">5</property>
-    <property name="upper">60</property>
-    <property name="step_increment">5</property>
-    <property name="page_increment">10</property>
+    <property name="lower">15</property>
+    <property name="upper">240</property>
+    <property name="step_increment">15</property>
+    <property name="page_increment">15</property>
     <property name="page_size">0</property>
   </object>
   <object class="GtkAdjustment" id="adjustment22">
@@ -339,7 +339,7 @@ This setting allows you to synchronize the files.</property>
     <property name="value">0</property>
   </object>
   <object class="GtkAdjustment" id="preview_count_adj">
-    <property name="upper">30</property>
+    <property name="upper">60</property>
     <property name="lower">5</property>
     <property name="page_increment">10</property>
     <property name="step_increment">5</property>
index b5d296dee72597fd904037215b32a02d90f7d74f..7caae40a41cb26fd25c729eef8c9487779b1d535 100644 (file)
@@ -83,6 +83,17 @@ int hb_audio_bitrates_count = sizeof(hb_audio_bitrates) / sizeof(hb_rate_t);
 
 static hb_error_handler_t *error_handler = NULL;
 
+hb_dither_t hb_audio_dithers[] =
+{
+    { "default",                       "auto",          AV_RESAMPLE_DITHER_NONE - 1,      },
+    { "none",                          "none",          AV_RESAMPLE_DITHER_NONE,          },
+    { "rectangular",                   "rectangular",   AV_RESAMPLE_DITHER_RECTANGULAR,   },
+    { "triangular",                    "triangular",    AV_RESAMPLE_DITHER_TRIANGULAR,    },
+    { "triangular with high pass",     "triangular_hp", AV_RESAMPLE_DITHER_TRIANGULAR_HP, },
+    { "triangular with noise shaping", "triangular_ns", AV_RESAMPLE_DITHER_TRIANGULAR_NS, },
+};
+int hb_audio_dithers_count = sizeof(hb_audio_dithers) / sizeof(hb_dither_t);
+
 hb_mixdown_t hb_audio_mixdowns[] =
 {
     { "None",               "HB_AMIXDOWN_NONE",      "none",       HB_AMIXDOWN_NONE      },
@@ -138,6 +149,8 @@ hb_rate_t*    hb_get_audio_rates()          { return hb_audio_rates;          }
 int           hb_get_audio_rates_count()    { return hb_audio_rates_count;    }
 hb_rate_t*    hb_get_audio_bitrates()       { return hb_audio_bitrates;       }
 int           hb_get_audio_bitrates_count() { return hb_audio_bitrates_count; }
+hb_dither_t*  hb_get_audio_dithers()        { return hb_audio_dithers;        }
+int           hb_get_audio_dithers_count()  { return hb_audio_dithers_count;  }
 hb_mixdown_t* hb_get_audio_mixdowns()       { return hb_audio_mixdowns;       }
 int           hb_get_audio_mixdowns_count() { return hb_audio_mixdowns_count; }
 hb_encoder_t* hb_get_video_encoders()       { return hb_video_encoders;       }
@@ -145,6 +158,47 @@ int           hb_get_video_encoders_count() { return hb_video_encoders_count; }
 hb_encoder_t* hb_get_audio_encoders()       { return hb_audio_encoders;       }
 int           hb_get_audio_encoders_count() { return hb_audio_encoders_count; }
 
+int hb_audio_dither_get_default()
+{
+    // "auto"
+    return hb_audio_dithers[0].method;
+}
+
+int hb_audio_dither_get_default_method()
+{
+    /*
+     * input could be s16 (possibly already dithered) converted to flt, so
+     * let's use a "low-risk" dither algorithm (standard triangular).
+     */
+    return AV_RESAMPLE_DITHER_TRIANGULAR;
+}
+
+int hb_audio_dither_is_supported(uint32_t codec)
+{
+    // encoder's input sample format must be s16(p)
+    switch (codec)
+    {
+        case HB_ACODEC_FFFLAC:
+            return 1;
+        default:
+            return 0;
+    }
+}
+
+const char* hb_audio_dither_get_description(int method)
+{
+    int i;
+    for (i = 0; i < hb_audio_dithers_count; i++)
+    {
+        if (hb_audio_dithers[i].method == method)
+        {
+            return hb_audio_dithers[i].description;
+        }
+    }
+    return "";
+}
+
+
 int hb_mixdown_is_supported(int mixdown, uint32_t codec, uint64_t layout)
 {
     return (hb_mixdown_has_codec_support(mixdown, codec) &&
@@ -2205,6 +2259,7 @@ void hb_audio_config_init(hb_audio_config_t * audiocfg)
     audiocfg->out.dynamic_range_compression = 0;
     audiocfg->out.gain = 0;
     audiocfg->out.normalize_mix_level = 0;
+    audiocfg->out.dither_method = hb_audio_dither_get_default();
     audiocfg->out.name = NULL;
 }
 
@@ -2255,6 +2310,7 @@ int hb_audio_add(const hb_job_t * job, const hb_audio_config_t * audiocfg)
         audio->config.out.normalize_mix_level = 0;
         audio->config.out.compression_level = -1;
         audio->config.out.quality = HB_INVALID_AUDIO_QUALITY;
+        audio->config.out.dither_method = AV_RESAMPLE_DITHER_NONE;
     }
     else
     {
@@ -2268,6 +2324,7 @@ int hb_audio_add(const hb_job_t * job, const hb_audio_config_t * audiocfg)
         audio->config.out.mixdown = audiocfg->out.mixdown;
         audio->config.out.gain = audiocfg->out.gain;
         audio->config.out.normalize_mix_level = audiocfg->out.normalize_mix_level;
+        audio->config.out.dither_method = audiocfg->out.dither_method;
     }
     if (audiocfg->out.name && *audiocfg->out.name)
     {
index 1f3d6fd8159e9608d6625399095352a211676608..9c54f7a9de77146a4cdec174ce673b2c3a9d1c2e 100644 (file)
@@ -72,6 +72,7 @@
 typedef struct hb_handle_s hb_handle_t;
 typedef struct hb_list_s hb_list_t;
 typedef struct hb_rate_s hb_rate_t;
+typedef struct hb_dither_s hb_dither_t;
 typedef struct hb_mixdown_s hb_mixdown_t;
 typedef struct hb_encoder_s hb_encoder_t;
 typedef struct hb_job_s  hb_job_t;
@@ -178,6 +179,13 @@ struct hb_rate_s
     int         rate;
 };
 
+struct hb_dither_s
+{
+    const char *description;
+    const char *short_name;
+    int         method;
+};
+
 struct hb_mixdown_s
 {
     const char *human_readable_name;
@@ -215,6 +223,8 @@ extern int          hb_audio_rates_count;
 extern int          hb_audio_rates_default;
 extern hb_rate_t    hb_audio_bitrates[];
 extern int          hb_audio_bitrates_count;
+extern hb_dither_t  hb_audio_dithers[];
+extern int          hb_audio_dithers_count;
 extern hb_mixdown_t hb_audio_mixdowns[];
 extern int          hb_audio_mixdowns_count;
 extern hb_encoder_t hb_video_encoders[];
@@ -230,6 +240,8 @@ int           hb_get_audio_rates_count();
 int           hb_get_audio_rates_default();
 hb_rate_t*    hb_get_audio_bitrates();
 int           hb_get_audio_bitrates_count();
+hb_dither_t*  hb_get_audio_dithers();
+int           hb_get_audio_dithers_count();
 hb_mixdown_t* hb_get_audio_mixdowns();
 int           hb_get_audio_mixdowns_count();
 hb_encoder_t* hb_get_video_encoders();
@@ -237,6 +249,11 @@ int           hb_get_video_encoders_count();
 hb_encoder_t* hb_get_audio_encoders();
 int           hb_get_audio_encoders_count();
 
+int         hb_audio_dither_get_default();
+int         hb_audio_dither_get_default_method();
+int         hb_audio_dither_is_supported(uint32_t codec);
+const char* hb_audio_dither_get_description(int method);
+
 int         hb_mixdown_is_supported(int mixdown, uint32_t codec, uint64_t layout);
 int         hb_mixdown_has_codec_support(int mixdown, uint32_t codec);
 int         hb_mixdown_has_remix_support(int mixdown, uint64_t layout);
@@ -525,6 +542,7 @@ struct hb_audio_config_s
         double   dynamic_range_compression; /* Amount of DRC applied to this track */
         double   gain; /* Gain (in dB), negative is quieter */
         int      normalize_mix_level; /* mix level normalization (boolean) */
+        int      dither_method; /* dither algorithm */
         char *   name; /* Output track name */
     } out;
 
index 71c08901603092076810ea7623da43a40012dc9c..d748c41db78f6ddccce3b5c218b4d6d25dc39ee0 100644 (file)
@@ -193,6 +193,19 @@ static int decavcodecaInit( hb_work_object_t * w, hb_job_t * job )
         pv->title = w->title;
     pv->list = hb_list_init();
 
+    codec = avcodec_find_decoder(w->codec_param);
+    pv->context = avcodec_alloc_context3(codec);
+    if (pv->title->opaque_priv != NULL)
+    {
+        AVFormatContext *ic = (AVFormatContext*)pv->title->opaque_priv;
+        avcodec_copy_context(pv->context, ic->streams[w->audio->id]->codec);
+    }
+    else
+    {
+        pv->parser = av_parser_init(w->codec_param);
+    }
+    hb_ff_set_sample_fmt(pv->context, codec, AV_SAMPLE_FMT_FLT);
+
     /* Downmixing & sample_fmt conversion */
     if (!(w->audio->config.out.codec & HB_ACODEC_PASS_FLAG))
     {
@@ -205,26 +218,37 @@ static int decavcodecaInit( hb_work_object_t * w, hb_job_t * job )
             hb_error("decavcodecaInit: hb_audio_resample_init() failed");
             return 1;
         }
+        // some decoders can downmix using embedded coefficients,
+        // or dedicated audio substreams for a specific channel layout
+        switch (w->audio->config.out.mixdown)
+        {
+            case HB_AMIXDOWN_MONO:
+                if (w->codec_param == AV_CODEC_ID_TRUEHD)
+                {
+                    // libavcodec can't decode TrueHD Mono (bug #356)
+                    // work around it by requesting Stereo and downmixing
+                    pv->context->request_channels       = 2;
+                    pv->context->request_channel_layout = AV_CH_LAYOUT_STEREO;
+                    break;
+                }
+                pv->context->request_channel_layout = AV_CH_LAYOUT_MONO;
+                break;
+            // request 5.1 before downmixing to dpl1/dpl2
+            case HB_AMIXDOWN_DOLBY:
+            case HB_AMIXDOWN_DOLBYPLII:
+                pv->context->request_channel_layout = AV_CH_LAYOUT_5POINT1;
+                break;
+            // request the layout corresponding to the selected mixdown
+            default:
+                pv->context->request_channel_layout =
+                    hb_ff_mixdown_xlat(w->audio->config.out.mixdown, NULL);
+                break;
+        }
     }
 
-    codec = avcodec_find_decoder( w->codec_param );
-    if ( pv->title->opaque_priv )
-    {
-        AVFormatContext *ic = (AVFormatContext*)pv->title->opaque_priv;
-        pv->context = avcodec_alloc_context3(codec);
-        avcodec_copy_context( pv->context, ic->streams[w->audio->id]->codec);
-        hb_ff_set_sample_fmt( pv->context, codec, AV_SAMPLE_FMT_FLT );
-    }
-    else
-    {
-        pv->parser = av_parser_init( w->codec_param );
-
-        pv->context = avcodec_alloc_context3(codec);
-        hb_ff_set_sample_fmt( pv->context, codec, AV_SAMPLE_FMT_FLT );
-    }
-    if ( hb_avcodec_open( pv->context, codec, NULL, 0 ) )
+    if (hb_avcodec_open(pv->context, codec, NULL, 0))
     {
-        hb_log( "decavcodecaInit: avcodec_open failed" );
+        hb_log("decavcodecaInit: avcodec_open failed");
         return 1;
     }
 
@@ -437,19 +461,32 @@ static int decavcodecaBSInfo( hb_work_object_t *w, const hb_buffer_t *buf,
     unsigned char *pbuffer;
     int pos, pbuffer_size;
 
-    while ( buf && !ret )
+    while (buf != NULL && !ret)
     {
         pos = 0;
-        while ( pos < buf->size )
+        while (pos < buf->size)
         {
-            int len;
+            int len, truehd_mono = 0;
 
-            if ( parser != NULL )
+            if (parser != NULL)
             {
-                len = av_parser_parse2( parser, context, &pbuffer,
-                                        &pbuffer_size, buf->data + pos,
-                                        buf->size - pos, buf->s.start,
-                                        buf->s.start, 0 );
+                len = av_parser_parse2(parser, context, &pbuffer, &pbuffer_size,
+                                       buf->data + pos, buf->size - pos,
+                                       buf->s.start, buf->s.start, 0);
+                if (context->codec_id == AV_CODEC_ID_TRUEHD &&
+                    context->channel_layout == AV_CH_LAYOUT_MONO)
+                {
+                    // libavcodec can't decode TrueHD Mono (bug #356)
+                    // work around it by requesting Stereo before decoding
+                    truehd_mono                     = 1;
+                    context->request_channels       = 2;
+                    context->request_channel_layout = AV_CH_LAYOUT_STEREO;
+                }
+                else
+                {
+                    context->request_channels       = 0;
+                    context->request_channel_layout = 0;
+                }
             }
             else
             {
@@ -457,7 +494,7 @@ static int decavcodecaBSInfo( hb_work_object_t *w, const hb_buffer_t *buf,
                 len = pbuffer_size = buf->size;
             }
             pos += len;
-            if ( pbuffer_size > 0 )
+            if (pbuffer_size > 0)
             {
                 int got_frame;
                 AVFrame frame = { { 0 } };
@@ -466,17 +503,24 @@ static int decavcodecaBSInfo( hb_work_object_t *w, const hb_buffer_t *buf,
                 avp.data = pbuffer;
                 avp.size = pbuffer_size;
 
-                len = avcodec_decode_audio4( context, &frame, &got_frame, &avp );
-                if ( len > 0 && context->sample_rate > 0 )
+                len = avcodec_decode_audio4(context, &frame, &got_frame, &avp);
+                if (len > 0 && context->sample_rate > 0)
                 {
-                    info->bitrate = context->bit_rate;
-                    info->rate = context->sample_rate;
-                    info->rate_base = 1;
-                    info->channel_layout =
-                        hb_ff_layout_xlat(context->channel_layout,
-                                          context->channels);
+                    info->rate_base          = 1;
+                    info->rate               = context->sample_rate;
+                    info->bitrate            = context->bit_rate;
+                    info->samples_per_frame  = frame.nb_samples;
+                    if (truehd_mono)
+                    {
+                        info->channel_layout = AV_CH_LAYOUT_MONO;
+                    }
+                    else
+                    {
+                        info->channel_layout =
+                            hb_ff_layout_xlat(context->channel_layout,
+                                              context->channels);
+                    }
                     ret = 1;
-                    info->samples_per_frame = frame.nb_samples;
                     break;
                 }
             }
index 669691dc11199e490d65988ee451c7a987744787..ecd75ff983a6a28f7fdd3b49540fb6ee3f7bf718 100644 (file)
@@ -148,6 +148,16 @@ static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job)
                        context->channel_layout, 0);
         av_opt_set_int(pv->avresample, "out_channel_layout",
                        context->channel_layout, 0);
+        if (hb_audio_dither_is_supported(audio->config.out.codec))
+        {
+            // dithering needs the sample rate
+            av_opt_set_int(pv->avresample, "in_sample_rate",
+                           context->sample_rate, 0);
+            av_opt_set_int(pv->avresample, "out_sample_rate",
+                           context->sample_rate, 0);
+            av_opt_set_int(pv->avresample, "dither_method",
+                           audio->config.out.dither_method, 0);
+        }
         if (avresample_open(pv->avresample))
         {
             hb_error("encavcodecaInit: avresample_open() failed");
index fca34bacc1f4987ce2b6adfaf2b148f4463d9ec5..51821273773f4c9d3301facc430f73ac99610798 100644 (file)
@@ -64,7 +64,10 @@ struct hb_handle_s
        on multi-pass encodes where frames get dropped.     */
     hb_interjob_t * interjob;
 
-};
+    // Power Management opaque pointer
+    // For OSX, it's an IOPMAssertionID*
+    void          * hb_system_sleep_opaque;
+} ;
 
 hb_work_object_t * hb_objects = NULL;
 int hb_instance_counter = 0;
@@ -407,6 +410,9 @@ hb_handle_t * hb_init( int verbose, int update_check )
     /* Check for an update on the website if asked to */
     h->build = -1;
 
+    /* Initialize opaque for PowerManagement purposes */
+    h->hb_system_sleep_opaque = hb_system_sleep_opaque_init();
+
     if( update_check )
     {
         hb_log( "hb_init: checking for updates" );
@@ -511,6 +517,9 @@ hb_handle_t * hb_init_dl( int verbose, int update_check )
     /* Check for an update on the website if asked to */
     h->build = -1;
 
+    /* Initialize opaque for PowerManagement purposes */
+    h->hb_system_sleep_opaque = hb_system_sleep_opaque_init();
+
     if( update_check )
     {
         hb_log( "hb_init: checking for updates" );
@@ -1541,7 +1550,7 @@ void hb_start( hb_handle_t * h )
     h->paused = 0;
 
     h->work_die    = 0;
-    h->work_thread = hb_work_init( h->jobs, &h->work_die, &h->work_error, &h->current_job );
+    h->work_thread = hb_work_init( h, h->jobs, &h->work_die, &h->work_error, &h->current_job );
 }
 
 /**
@@ -1560,6 +1569,8 @@ void hb_pause( hb_handle_t * h )
         hb_lock( h->state_lock );
         h->state.state = HB_STATE_PAUSED;
         hb_unlock( h->state_lock );
+
+        hb_allow_sleep( h );
     }
 }
 
@@ -1571,6 +1582,8 @@ void hb_resume( hb_handle_t * h )
 {
     if( h->paused )
     {
+        hb_prevent_sleep( h );
+
 #define job hb_current_job( h )
         if( job->st_pause_date != -1 )
         {
@@ -1876,6 +1889,16 @@ void hb_set_state( hb_handle_t * h, hb_state_t * s )
     hb_unlock( h->pause_lock );
 }
 
+void hb_prevent_sleep( hb_handle_t * h )
+{
+    hb_system_sleep_prevent( h->hb_system_sleep_opaque );
+}
+
+void hb_allow_sleep( hb_handle_t * h )
+{
+    hb_system_sleep_allow( h->hb_system_sleep_opaque );
+}
+
 /* Passes a pointer to persistent data */
 hb_interjob_t * hb_interjob_get( hb_handle_t * h )
 {
index 81cc8680fef980064836fcd96f5386d260cb3e98..8bf9fa533eb18be2b84539da9ebe9372957eb7bf 100644 (file)
@@ -39,6 +39,8 @@ void         hb_title_close( hb_title_t ** );
  **********************************************************************/
 int  hb_get_pid( hb_handle_t * );
 void hb_set_state( hb_handle_t *, hb_state_t * );
+void hb_prevent_sleep( hb_handle_t * );
+void hb_allow_sleep( hb_handle_t * );
 
 /***********************************************************************
  * fifo.c
@@ -229,7 +231,7 @@ hb_thread_t * hb_scan_init( hb_handle_t *, volatile int * die,
                             const char * path, int title_index, 
                             hb_title_set_t * title_set, int preview_count, 
                             int store_previews, uint64_t min_duration );
-hb_thread_t * hb_work_init( hb_list_t * jobs,
+hb_thread_t * hb_work_init( hb_handle_t * handle, hb_list_t * jobs,
                             volatile int * die, int * error, hb_job_t ** job );
 void ReadLoop( void * _w );
 hb_work_object_t * hb_muxer_init( hb_job_t * );
index f10c9d96c40b6468778fee4a821393d566f1c693..11952c05214e4467b28eeac484cc8c471920425e 100644 (file)
 #include <sys/ioctl.h>
 #endif
 
+#ifdef __APPLE__
+#include <IOKit/pwr_mgt/IOPMLib.h>
+#endif
+
 #include <stddef.h>
 #include <unistd.h>
 
@@ -781,3 +785,70 @@ char *strtok_r(char *s, const char *delim, char **save_ptr)
     return token;
 }
 #endif
+
+/************************************************************************
+* OS Sleep Allow / Prevent
+***********************************************************************/
+
+#ifdef __APPLE__
+// 128 chars limit for IOPMAssertionCreateWithName
+static CFStringRef reasonForActivity= CFSTR("HandBrake is currently scanning and/or encoding");
+#endif
+
+void* hb_system_sleep_opaque_init()
+{
+    void* opaque;
+#ifdef __APPLE__
+    opaque = calloc( sizeof( IOPMAssertionID ), 1);
+    IOPMAssertionID * assertionID = (IOPMAssertionID *)opaque;
+    *assertionID = -1;
+#endif
+
+    return opaque;
+}
+
+void hb_system_sleep_opaque_close(void **_opaque)
+{
+#ifdef __APPLE__
+    IOPMAssertionID * assertionID = (IOPMAssertionID *) *_opaque;
+    free( assertionID );
+#endif
+    *_opaque = NULL;
+}
+
+void hb_system_sleep_allow(void *opaque)
+{
+#ifdef __APPLE__
+    IOPMAssertionID * assertionID = (IOPMAssertionID *)opaque;
+
+    if (*assertionID == -1)
+        return;
+
+    IOReturn success = IOPMAssertionRelease(*assertionID);
+
+    if (success == kIOReturnSuccess) {
+        hb_deep_log( 3, "osxsleep: IOPM assertion %d successfully released, sleep allowed", *assertionID );
+        *assertionID = -1;
+    } else {
+        hb_log( "osxsleep: error while trying to unset power management assertion" );
+    }
+#endif
+}
+
+void hb_system_sleep_prevent(void *opaque)
+{
+#ifdef __APPLE__
+    IOPMAssertionID * assertionID = (IOPMAssertionID *)opaque;
+
+    if (*assertionID != -1)
+        return;
+
+    IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep,
+                                                   kIOPMAssertionLevelOn, reasonForActivity, assertionID);
+    if (success == kIOReturnSuccess) {
+        hb_deep_log( 3, "IOPM assertion %d successfully created, prevent sleep", *assertionID);
+    } else {
+        hb_log( "osxsleep: error while trying to set power management assertion" );
+    }
+#endif
+}
index 23879fcb16642d660266a0687f02257cbfaccce0..9f7da2b14f8a354dad1f2162d8e2864c63789a52 100644 (file)
@@ -102,6 +102,14 @@ int        hb_net_send( hb_net_t *, char * );
 int        hb_net_recv( hb_net_t *, char *, int );
 void       hb_net_close( hb_net_t ** );
 
+/************************************************************************
+* OS Sleep Allow / Prevent
+***********************************************************************/
+void     * hb_system_sleep_opaque_init();
+void       hb_system_sleep_opaque_close( void ** opaque );
+void       hb_system_sleep_allow( void * opaque );
+void       hb_system_sleep_prevent( void * opaque );
+
 #endif /* __LIBHB__ */
 
 #endif
index dc50d502b75b38cb05118f8217eb29f7ac5851ae..10f7fca46b2551d0a50ff25bfe22c6fcfdbba3ca 100644 (file)
 
 typedef struct
 {
-    hb_list_t * jobs;
-    hb_job_t  ** current_job;
-    int       * error;
+    hb_handle_t  * handle;
+    hb_list_t    * jobs;
+    hb_job_t    ** current_job;
+    int          * error;
     volatile int * die;
 
 } hb_work_t;
@@ -41,14 +42,15 @@ static void filter_loop( void * );
  * @param die Handle to user inititated exit indicator.
  * @param error Handle to error indicator.
  */
-hb_thread_t * hb_work_init( hb_list_t * jobs, volatile int * die, int * error, hb_job_t ** job )
+hb_thread_t * hb_work_init( hb_handle_t * handle, hb_list_t * jobs, volatile int * die, int * error, hb_job_t ** job )
 {
     hb_work_t * work = calloc( sizeof( hb_work_t ), 1 );
 
-    work->jobs      = jobs;
+    work->handle      = handle;
+    work->jobs        = jobs;
     work->current_job = job;
-    work->die       = die;
-    work->error     = error;
+    work->die         = die;
+    work->error       = error;
 
     return hb_thread_init( "work", work_func, work, HB_LOW_PRIORITY );
 }
@@ -82,16 +84,22 @@ static void work_func( void * _work )
 
     hb_log( "%d job(s) to process", hb_list_count( work->jobs ) );
 
+    hb_prevent_sleep( work->handle );
+
     while( !*work->die && ( job = hb_list_item( work->jobs, 0 ) ) )
     {
         hb_list_rem( work->jobs, job );
         job->die = work->die;
         *(work->current_job) = job;
+
         InitWorkState( job->h );
         do_job( job );
+
         *(work->current_job) = NULL;
     }
 
+    hb_allow_sleep( work->handle );
+
     *(work->error) = HB_ERROR_NONE;
 
     free( work );
@@ -479,6 +487,11 @@ void hb_display_job_info( hb_job_t * job )
                 {
                     hb_log( "   + dynamic range compression: %f", audio->config.out.dynamic_range_compression );
                 }
+                if (hb_audio_dither_is_supported(audio->config.out.codec))
+                {
+                    hb_log("   + dither: %s",
+                           hb_audio_dither_get_description(audio->config.out.dither_method));
+                }
                 for( j = 0; j < hb_audio_encoders_count; j++ )
                 {
                     if( hb_audio_encoders[j].encoder == audio->config.out.codec )
@@ -1005,6 +1018,25 @@ static void do_job( hb_job_t * job )
                     audio->config.out.bitrate = best_bitrate;
                 }
             }
+
+            /* sense-check the requested dither */
+            if (hb_audio_dither_is_supported(audio->config.out.codec))
+            {
+                if (audio->config.out.dither_method ==
+                    hb_audio_dither_get_default())
+                {
+                    /* "auto", enable with default settings */
+                    audio->config.out.dither_method =
+                        hb_audio_dither_get_default_method();
+                }
+            }
+            else if (audio->config.out.dither_method !=
+                     hb_audio_dither_get_default())
+            {
+                /* specific dither requested but dithering not supported */
+                hb_log("work: track %d, dithering not supported by codec",
+                       audio->config.out.track);
+            }
         }
     }
 
index 1a4b1fa8d98bcb1e31d2f8ac181f775ca0102366..61a77076cfe622e046c9f69d5942d60122f88dc9 100644 (file)
@@ -5769,7 +5769,7 @@ the user is using "Custom" settings by determining the sender*/
     // width or height may have changed, unparse
     [self x264PresetsChangedDisplayExpandedOptions:nil];
     
-    //[fPictureController reloadStillPreview]; 
+    [fPictureController decombDeinterlacePreviewImage];
 }
 
 
index 0316a9982c35cc13aa2640f100d98b782119fb73..ab9a908bf858540fefd80218751250ac0b8286c2 100644 (file)
@@ -2,10 +2,10 @@
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
        <data>
                <int key="IBDocument.SystemTarget">1050</int>
-               <string key="IBDocument.SystemVersion">11C74</string>
+               <string key="IBDocument.SystemVersion">11G63</string>
                <string key="IBDocument.InterfaceBuilderVersion">1938</string>
-               <string key="IBDocument.AppKitVersion">1138.23</string>
-               <string key="IBDocument.HIToolboxVersion">567.00</string>
+               <string key="IBDocument.AppKitVersion">1138.51</string>
+               <string key="IBDocument.HIToolboxVersion">569.00</string>
                <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
                        <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
                        <string key="NS.object.0">1938</string>
@@ -67,7 +67,7 @@
                                        <reference key="NSWindow"/>
                                        <reference key="NSNextKeyView"/>
                                </object>
-                               <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
+                               <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
                                <string key="NSMinSize">{213, 129}</string>
                                <string key="NSMaxSize">{10000000000000, 10000000000000}</string>
                                <bool key="NSWindowIsRestorable">YES</bool>
                                <string key="NSExtension">NSControl</string>
                        </object>
                        <object class="NSCustomView" id="520288288">
-                               <nil key="NSNextResponder"/>
+                               <reference key="NSNextResponder"/>
                                <int key="NSvFlags">256</int>
                                <object class="NSMutableArray" key="NSSubviews">
                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                <int key="NSvFlags">268</int>
                                                <string key="NSFrame">{{34, 42}, {432, 17}}</string>
                                                <reference key="NSSuperview" ref="520288288"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="374363387">
                                                        <int key="NSCellFlags">67239488</int>
                                        </object>
                                </object>
                                <string key="NSFrameSize">{496, 82}</string>
+                               <reference key="NSSuperview"/>
+                               <reference key="NSWindow"/>
+                               <reference key="NSNextKeyView" ref="539748933"/>
                                <string key="NSClassName">NSView</string>
                                <string key="NSExtension">NSResponder</string>
                        </object>
                                <string key="NSExtension">NSResponder</string>
                        </object>
                        <object class="NSCustomView" id="23728330">
-                               <nil key="NSNextResponder"/>
+                               <reference key="NSNextResponder"/>
                                <int key="NSvFlags">256</int>
                                <object class="NSMutableArray" key="NSSubviews">
                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                <int key="NSvFlags">268</int>
                                                <string key="NSFrame">{{302, 172}, {48, 19}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="701867067"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="607341761">
                                                        <int key="NSCellFlags">-1804468671</int>
                                                <int key="NSvFlags">256</int>
                                                <string key="NSFrame">{{17, 207}, {280, 14}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="822080053"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="1064438472">
                                                        <int key="NSCellFlags">67239424</int>
                                                <int key="NSvFlags">256</int>
                                                <string key="NSFrame">{{48, 175}, {249, 14}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="62457548"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="552368920">
                                                        <int key="NSCellFlags">67239424</int>
                                                <int key="NSvFlags">256</int>
                                                <string key="NSFrame">{{99, 145}, {198, 14}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="772611942"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="978611587">
                                                        <int key="NSCellFlags">67239424</int>
                                                <int key="NSvFlags">256</int>
                                                <string key="NSFrame">{{137, 53}, {160, 15}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="895206300"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="271531935">
                                                        <int key="NSCellFlags">67239424</int>
                                                <int key="NSvFlags">256</int>
                                                <string key="NSFrame">{{108, 76}, {27, 14}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="907177043"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="483848741">
                                                        <int key="NSCellFlags">67239424</int>
                                                <int key="NSvFlags">256</int>
                                                <string key="NSFrame">{{70, 110}, {65, 14}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="745324926"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="1062716368">
                                                        <int key="NSCellFlags">67239424</int>
                                                <int key="NSvFlags">256</int>
                                                <string key="NSFrame">{{137, 74}, {304, 18}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="173328305"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSButtonCell" key="NSCell" id="869757541">
                                                        <int key="NSCellFlags">67239424</int>
                                                <int key="NSvFlags">256</int>
                                                <string key="NSFrame">{{137, 108}, {220, 18}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="899831697"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSButtonCell" key="NSCell" id="884409108">
                                                        <int key="NSCellFlags">67239424</int>
                                                <int key="NSvFlags">256</int>
                                                <string key="NSFrame">{{137, 18}, {217, 18}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSButtonCell" key="NSCell" id="562265695">
                                                        <int key="NSCellFlags">67239424</int>
                                                <int key="NSvFlags">268</int>
                                                <string key="NSFrame">{{299, 140}, {73, 22}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="898312631"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSPopUpButtonCell" key="NSCell" id="413609467">
                                                        <int key="NSCellFlags">-2076049856</int>
                                                        <string key="NSKeyEquivalent"/>
                                                        <int key="NSPeriodicDelay">400</int>
                                                        <int key="NSPeriodicInterval">75</int>
-                                                       <object class="NSMenuItem" key="NSMenuItem" id="165310533">
-                                                               <reference key="NSMenu" ref="743346318"/>
-                                                               <string key="NSTitle">10</string>
-                                                               <string key="NSKeyEquiv"/>
-                                                               <int key="NSKeyEquivModMask">1048576</int>
-                                                               <int key="NSMnemonicLoc">2147483647</int>
-                                                               <int key="NSState">1</int>
-                                                               <reference key="NSOnImage" ref="13790404"/>
-                                                               <reference key="NSMixedImage" ref="218367874"/>
-                                                               <string key="NSAction">_popUpItemAction:</string>
-                                                               <reference key="NSTarget" ref="413609467"/>
-                                                       </object>
+                                                       <nil key="NSMenuItem"/>
                                                        <bool key="NSMenuItemRespectAlignment">YES</bool>
                                                        <object class="NSMenu" key="NSMenu" id="743346318">
                                                                <string key="NSTitle">OtherViews</string>
                                                                <object class="NSMutableArray" key="NSMenuItems">
                                                                        <bool key="EncodedWithXMLCoder">YES</bool>
-                                                                       <reference ref="165310533"/>
+                                                                       <object class="NSMenuItem" id="165310533">
+                                                                               <reference key="NSMenu" ref="743346318"/>
+                                                                               <string key="NSTitle">10</string>
+                                                                               <string key="NSKeyEquiv"/>
+                                                                               <int key="NSKeyEquivModMask">1048576</int>
+                                                                               <int key="NSMnemonicLoc">2147483647</int>
+                                                                               <reference key="NSOnImage" ref="13790404"/>
+                                                                               <reference key="NSMixedImage" ref="218367874"/>
+                                                                               <string key="NSAction">_popUpItemAction:</string>
+                                                                               <reference key="NSTarget" ref="413609467"/>
+                                                                       </object>
                                                                        <object class="NSMenuItem" id="477590220">
                                                                                <reference key="NSMenu" ref="743346318"/>
                                                                                <string key="NSTitle">15</string>
                                                                                <string key="NSAction">_popUpItemAction:</string>
                                                                                <reference key="NSTarget" ref="413609467"/>
                                                                        </object>
+                                                                       <object class="NSMenuItem" id="889335378">
+                                                                               <reference key="NSMenu" ref="743346318"/>
+                                                                               <string key="NSTitle">35</string>
+                                                                               <string key="NSKeyEquiv"/>
+                                                                               <int key="NSMnemonicLoc">2147483647</int>
+                                                                               <reference key="NSOnImage" ref="13790404"/>
+                                                                               <reference key="NSMixedImage" ref="218367874"/>
+                                                                               <string key="NSAction">_popUpItemAction:</string>
+                                                                               <reference key="NSTarget" ref="413609467"/>
+                                                                       </object>
+                                                                       <object class="NSMenuItem" id="98863414">
+                                                                               <reference key="NSMenu" ref="743346318"/>
+                                                                               <string key="NSTitle">40</string>
+                                                                               <string key="NSKeyEquiv"/>
+                                                                               <int key="NSMnemonicLoc">2147483647</int>
+                                                                               <reference key="NSOnImage" ref="13790404"/>
+                                                                               <reference key="NSMixedImage" ref="218367874"/>
+                                                                               <string key="NSAction">_popUpItemAction:</string>
+                                                                               <reference key="NSTarget" ref="413609467"/>
+                                                                       </object>
+                                                                       <object class="NSMenuItem" id="310764806">
+                                                                               <reference key="NSMenu" ref="743346318"/>
+                                                                               <string key="NSTitle">45</string>
+                                                                               <string key="NSKeyEquiv"/>
+                                                                               <int key="NSMnemonicLoc">2147483647</int>
+                                                                               <reference key="NSOnImage" ref="13790404"/>
+                                                                               <reference key="NSMixedImage" ref="218367874"/>
+                                                                               <string key="NSAction">_popUpItemAction:</string>
+                                                                               <reference key="NSTarget" ref="413609467"/>
+                                                                       </object>
+                                                                       <object class="NSMenuItem" id="1052421538">
+                                                                               <reference key="NSMenu" ref="743346318"/>
+                                                                               <string key="NSTitle">50</string>
+                                                                               <string key="NSKeyEquiv"/>
+                                                                               <int key="NSMnemonicLoc">2147483647</int>
+                                                                               <reference key="NSOnImage" ref="13790404"/>
+                                                                               <reference key="NSMixedImage" ref="218367874"/>
+                                                                               <string key="NSAction">_popUpItemAction:</string>
+                                                                               <reference key="NSTarget" ref="413609467"/>
+                                                                       </object>
+                                                                       <object class="NSMenuItem" id="814398830">
+                                                                               <reference key="NSMenu" ref="743346318"/>
+                                                                               <string key="NSTitle">55</string>
+                                                                               <string key="NSKeyEquiv"/>
+                                                                               <int key="NSMnemonicLoc">2147483647</int>
+                                                                               <reference key="NSOnImage" ref="13790404"/>
+                                                                               <reference key="NSMixedImage" ref="218367874"/>
+                                                                               <string key="NSAction">_popUpItemAction:</string>
+                                                                               <reference key="NSTarget" ref="413609467"/>
+                                                                       </object>
+                                                                       <object class="NSMenuItem" id="526914817">
+                                                                               <reference key="NSMenu" ref="743346318"/>
+                                                                               <string key="NSTitle">60</string>
+                                                                               <string key="NSKeyEquiv"/>
+                                                                               <int key="NSMnemonicLoc">2147483647</int>
+                                                                               <reference key="NSOnImage" ref="13790404"/>
+                                                                               <reference key="NSMixedImage" ref="218367874"/>
+                                                                               <string key="NSAction">_popUpItemAction:</string>
+                                                                               <reference key="NSTarget" ref="413609467"/>
+                                                                       </object>
                                                                </object>
                                                        </object>
+                                                       <int key="NSSelectedIndex">-1</int>
                                                        <int key="NSPreferredEdge">1</int>
                                                        <bool key="NSUsesItemFromMenu">YES</bool>
                                                        <bool key="NSAltersState">YES</bool>
                                                <int key="NSvFlags">268</int>
                                                <string key="NSFrame">{{299, 202}, {76, 22}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="469378299"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSPopUpButtonCell" key="NSCell" id="434430620">
                                                        <int key="NSCellFlags">-2076049856</int>
                                                <int key="NSvFlags">268</int>
                                                <string key="NSFrame">{{303, 49}, {66, 22}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="200780219"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSPopUpButtonCell" key="NSCell" id="290473288">
                                                        <int key="NSCellFlags">-2076049856</int>
                                                <int key="NSvFlags">256</int>
                                                <string key="NSFrame">{{89, 20}, {46, 14}}</string>
                                                <reference key="NSSuperview" ref="23728330"/>
+                                               <reference key="NSWindow"/>
+                                               <reference key="NSNextKeyView" ref="712613872"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="221545613">
                                                        <int key="NSCellFlags">67239424</int>
                                        </object>
                                </object>
                                <string key="NSFrameSize">{495, 241}</string>
+                               <reference key="NSSuperview"/>
+                               <reference key="NSWindow"/>
+                               <reference key="NSNextKeyView" ref="226601760"/>
                                <object class="NSMutableString" key="NSClassName">
                                        <characters key="NS.bytes">NSView</characters>
                                </object>
                                                        <reference ref="444551526"/>
                                                        <reference ref="498458317"/>
                                                        <reference ref="327639789"/>
+                                                       <reference ref="889335378"/>
+                                                       <reference ref="98863414"/>
+                                                       <reference ref="310764806"/>
+                                                       <reference ref="1052421538"/>
+                                                       <reference ref="814398830"/>
+                                                       <reference ref="526914817"/>
                                                </object>
                                                <reference key="parent" ref="413609467"/>
                                        </object>
                                                <reference key="object" ref="37767182"/>
                                                <reference key="parent" ref="113289239"/>
                                        </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">514</int>
+                                               <reference key="object" ref="889335378"/>
+                                               <reference key="parent" ref="743346318"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">515</int>
+                                               <reference key="object" ref="98863414"/>
+                                               <reference key="parent" ref="743346318"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">516</int>
+                                               <reference key="object" ref="310764806"/>
+                                               <reference key="parent" ref="743346318"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">517</int>
+                                               <reference key="object" ref="1052421538"/>
+                                               <reference key="parent" ref="743346318"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">518</int>
+                                               <reference key="object" ref="814398830"/>
+                                               <reference key="parent" ref="743346318"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">519</int>
+                                               <reference key="object" ref="526914817"/>
+                                               <reference key="parent" ref="743346318"/>
+                                       </object>
                                </object>
                        </object>
                        <object class="NSMutableDictionary" key="flattenedProperties">
                                        <string>509.IBPluginDependency</string>
                                        <string>510.IBPluginDependency</string>
                                        <string>511.IBPluginDependency</string>
+                                       <string>514.IBPluginDependency</string>
+                                       <string>515.IBPluginDependency</string>
+                                       <string>516.IBPluginDependency</string>
+                                       <string>517.IBPluginDependency</string>
+                                       <string>518.IBPluginDependency</string>
+                                       <string>519.IBPluginDependency</string>
                                        <string>6.IBPluginDependency</string>
                                        <string>61.IBPluginDependency</string>
                                </object>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                </object>
                        </object>
                        <object class="NSMutableDictionary" key="unlocalizedProperties">
                                <reference key="dict.values" ref="0"/>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">513</int>
+                       <int key="maxID">519</int>
                </object>
                <object class="IBClassDescriber" key="IBDocument.Classes">
                        <object class="NSMutableArray" key="referencedPartialClassDescriptions">
                        </object>
                        <object class="NSMutableArray" key="dict.values">
                                <bool key="EncodedWithXMLCoder">YES</bool>
-                               <string>{9, 8}</string>
-                               <string>{7, 2}</string>
+                               <string>{11, 11}</string>
+                               <string>{10, 3}</string>
                                <string>{15, 15}</string>
                        </object>
                </object>
index b9b80bd53b399851f1832f40600b4ace825604ea..5e4a32508fc797dc9caaf90a6f97f2ae85ec88b4 100644 (file)
@@ -165,10 +165,12 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification";
             audio->out.codec = [[[anAudio codec] objectForKey: keyAudioCodec] intValue];
             audio->out.compression_level = hb_get_default_audio_compression(audio->out.codec);
             audio->out.mixdown = [[[anAudio mixdown] objectForKey: keyAudioMixdown] intValue];
+            audio->out.normalize_mix_level = 0;
             audio->out.bitrate = [[[anAudio bitRate] objectForKey: keyAudioBitrate] intValue];
             audio->out.samplerate = [sampleRateToUse intValue];
             audio->out.dynamic_range_compression = [[anAudio drc] floatValue];
             audio->out.gain = [[anAudio gain] floatValue];
+            audio->out.dither_method = hb_audio_dither_get_default();
 
             hb_audio_add(aJob, audio);
             free(audio);
index ba664059b285d7927b0c7a0c7fff619c3edec069..fe605450b3ecb2124c144bcc44f148380eb54b51 100644 (file)
     [fPreviewMovieLengthPopUp addItemWithTitle: @"90"];
     [fPreviewMovieLengthPopUp addItemWithTitle: @"105"];
     [fPreviewMovieLengthPopUp addItemWithTitle: @"120"];
+    [fPreviewMovieLengthPopUp addItemWithTitle: @"135"];
+    [fPreviewMovieLengthPopUp addItemWithTitle: @"150"];
+    [fPreviewMovieLengthPopUp addItemWithTitle: @"165"];
+    [fPreviewMovieLengthPopUp addItemWithTitle: @"180"];
+    [fPreviewMovieLengthPopUp addItemWithTitle: @"195"];
+    [fPreviewMovieLengthPopUp addItemWithTitle: @"210"];
+    [fPreviewMovieLengthPopUp addItemWithTitle: @"225"];
+    [fPreviewMovieLengthPopUp addItemWithTitle: @"240"];
 
        [fMovieView setHidden:YES];
     [fMovieView setDelegate:self];
             [fPictureSlider setIntegerValue:fPicture < [fPictureSlider maxValue] ? fPicture + 1 : fPicture];
             [self pictureSliderChanged:self];
         }
-        [super keyDown:event];
+        else
+            [super keyDown:event];
     }
-
-    [super keyDown:event];
+    else
+        [super keyDown:event];
 }
 
 #pragma mark *** QTTime Utilities ***
index 56dbe5f21fa8c94d749bb6895c10b01ec1fcd653..f738ba24eb01a342e4760328a35bdd5252d81cfd 100644 (file)
 - (IBAction) modeDecombDeinterlaceSliderChanged: (id) sender;
 - (IBAction) deblockSliderChanged: (id) sender;
 
+- (void) decombDeinterlacePreviewImage;
+
 - (int) detelecine;
 - (NSString*) detelecineCustomString;
 - (void) setDetelecine: (int) setting;
index 027523f017a504d75338a093ca0e0eae0a413a3a..b15cd9b8c53a343c2db6ad03d2b7599ebf6b87b4 100644 (file)
    hb_job_t * job = fTitle->job; 
    
    [fPreviewController SetTitle:fTitle];
-    /* Sanity Check Here for < 16 px preview to avoid
-     crashing hb_get_preview. In fact, just for kicks
-     lets getting previews at a min limit of 32, since
-     no human can see any meaningful detail below that */
-    if (job->width >= 64 && job->height >= 64)
-    {
-       
-         // Purge the existing picture previews so they get recreated the next time
-        // they are needed.
-      //  [fPreviewController purgeImageCache];
-        /* We actually call displayPreview now from pictureSliderChanged which keeps
-         * our picture preview slider in sync with the previews being shown
-         */
-
-    //[fPreviewController pictureSliderChanged:nil];
-    }
     
 }
 
@@ -1233,6 +1217,8 @@ are maintained across different sources */
     
     fPictureFilterSettings.grayscale = [fGrayscaleCheck state];
     
+    [self decombDeinterlacePreviewImage];
+    
     if (sender != nil)
     {
         [fHBController pictureSettingsDidChange];
@@ -1241,7 +1227,41 @@ are maintained across different sources */
 
 }
 
-
+- (void) decombDeinterlacePreviewImage
+{
+    if ([fDecombDeinterlaceSlider floatValue] < 0.50)
+    {
+        /* Since Libhb only shows a deinterlaced preview image via deinterlace .. for decomb we
+         do a quick switch to get libhb to show a deinterlaced image if needed even though deinterlace
+         has not been changed by the user. so we temporarily switch deinterace accoring to decomb then
+         call reloadStillPreview quickly and then switch deinterlace back to its proper state.
+         */
+        
+        // decomb is chosen
+        if (fPictureFilterSettings.decomb > 0)
+        {
+            /* Temporarily turn on deinterlacing .... */
+            fTitle->job->deinterlace  = 1;
+            /* Grab a still preview ... */
+            [self reloadStillPreview];
+            /* ... then reset deinterlace back to where specified in the ui */
+            fTitle->job->deinterlace  = [fDeinterlacePopUp indexOfSelectedItem];
+            
+        }
+        else
+        {
+            [self reloadStillPreview];   
+        }
+        
+    }
+    else
+    {
+        fTitle->job->deinterlace  = [fDeinterlacePopUp indexOfSelectedItem];
+        [self reloadStillPreview];
+    }
+    
+    
+}
 #pragma mark -
 
 - (IBAction) deblockSliderChanged: (id) sender
index f521e24f5fda9f02058d15b0d8e584f556f1fa9a..d369e343a6b96c434d92e922650f11dc03616d5f 100644 (file)
@@ -8,3 +8,5 @@ GCC.args.g.none = -g0
 GCC.args.g.min  = -g1
 GCC.args.g.std  = -g2
 GCC.args.g.max  = -g3
+
+GCC.args.extra += -mno-ms-bitfields
\ No newline at end of file
index 57156c726fd07544df0e7d01b5a3afbcbc80d7b9..3dbbde1100724ec093087806f5aa1bb0f07b7682 100644 (file)
@@ -72,6 +72,7 @@ static int    allowed_audio_copy = -1;
 static char * mixdowns    = NULL;
 static char * dynamic_range_compression = NULL;
 static char * audio_gain  = NULL;
+static char ** audio_dither = NULL;
 static char ** normalize_mix_level  = NULL;
 static char * atracks     = NULL;
 static char * arates      = NULL;
@@ -159,6 +160,7 @@ static int  ParseOptions( int argc, char ** argv );
 static int  CheckOptions( int argc, char ** argv );
 static int  HandleEvents( hb_handle_t * h );
 
+static       int   get_dither_for_string(const char *dither);
 static       int   get_acodec_for_string(const char *codec);
 static const char* get_string_for_acodec(int acodec);
 
@@ -364,6 +366,7 @@ int main( int argc, char ** argv )
     str_vfree(abitrates);
     str_vfree(acompressions);
     str_vfree(aqualities);
+    str_vfree(audio_dither);
     free(acodecs);
     free(arates);
     free(atracks);
@@ -2109,6 +2112,58 @@ static int HandleEvents( hb_handle_t * h )
             }
             /* Audio Gain */
 
+            /* Audio Dither */
+            if (audio_dither != NULL)
+            {
+                int dither_method = hb_audio_dither_get_default();
+                for (i = 0; audio_dither[i] != NULL; i++)
+                {
+                    dither_method = get_dither_for_string(audio_dither[i]);
+                    audio = hb_list_audio_config_item(job->list_audio, i);
+                    if (audio != NULL)
+                    {
+                        if (hb_audio_dither_is_supported(audio->out.codec))
+                        {
+                            audio->out.dither_method = dither_method;
+                        }
+                        else if (dither_method != hb_audio_dither_get_default())
+                        {
+                            fprintf(stderr,
+                                    "Ignoring dither %s, not supported by codec\n",
+                                    audio_dither[i]);
+                        }
+                    }
+                    else
+                    {
+                        fprintf(stderr, "Ignoring dither %s, no audio tracks\n",
+                                audio_dither[i]);
+                    }
+                }
+                if (i < num_audio_tracks && i == 1)
+                {
+                    /*
+                     * We have fewer inputs than audio tracks, and we only have
+                     * one input: use that for all tracks.
+                     */
+                    while (i < num_audio_tracks)
+                    {
+                        audio = hb_list_audio_config_item(job->list_audio, i);
+                        if (hb_audio_dither_is_supported(audio->out.codec))
+                        {
+                            audio->out.dither_method = dither_method;
+                        }
+                        else if (dither_method != hb_audio_dither_get_default())
+                        {
+                            fprintf(stderr,
+                                    "Ignoring dither %s, not supported by codec\n",
+                                    audio_dither[0]);
+                        }
+                        i++;
+                    }
+                }
+            }
+            /* Audio Dither */
+
             /* Audio Mix Normalization */
             i = 0;
             int norm = 0;
@@ -2965,6 +3020,36 @@ static void ShowHelp()
     "                            NOT work with audio passthru (copy). Values are in\n"
     "                            dB.  Negative values attenuate, positive values\n"
     "                            amplify. A 1 dB difference is barely audible.\n"
+    "        --adither <string>  Apply dithering to the audio before encoding.\n"
+    "                            Separated by commas for more than one audio track.\n"
+    "                            Only supported by some encoders (");
+    for (i = j = 0; i < hb_audio_encoders_count; i++)
+    {
+        if (hb_audio_dither_is_supported(hb_audio_encoders[i].encoder))
+        {
+            if (j)
+                fprintf(out, "/");
+            fprintf(out, "%s", hb_audio_encoders[i].short_name);
+            j = 1;
+        }
+    }
+    fprintf(out, ").\n");
+    fprintf(out,
+    "                            Options:\n");
+    for (i = 0; i < hb_audio_dithers_count; i++)
+    {
+        if (hb_audio_dithers[i].method == hb_audio_dither_get_default())
+        {
+            fprintf(out, "                               %s (default)\n",
+                    hb_audio_dithers[i].short_name);
+        }
+        else
+        {
+            fprintf(out, "                               %s\n",
+                    hb_audio_dithers[i].short_name);
+        }
+    }
+    fprintf(out,
     "    -A, --aname <string>    Audio track name(s),\n"
     "                            Separated by commas for more than one audio track.\n"
     "\n"
@@ -3229,6 +3314,7 @@ static int ParseOptions( int argc, char ** argv )
     #define H264_LEVEL          286
        #define NO_OPENCL           287
     #define NORMALIZE_MIX       288
+    #define AUDIO_DITHER        288
     
     for( ;; )
     {
@@ -3261,6 +3347,7 @@ static int ParseOptions( int argc, char ** argv )
             { "normalize-mix", required_argument, NULL,  NORMALIZE_MIX },
             { "drc",         required_argument, NULL,    'D' },
             { "gain",        required_argument, NULL,    AUDIO_GAIN },
+            { "adither",     required_argument, NULL,    AUDIO_DITHER },
             { "subtitle",    required_argument, NULL,    's' },
             { "subtitle-forced", optional_argument,   NULL,    'F' },
             { "subtitle-burned", optional_argument,   NULL,    SUB_BURNED },
@@ -3487,6 +3574,12 @@ static int ParseOptions( int argc, char ** argv )
                     audio_gain = strdup( optarg );
                 }
                 break;
+            case AUDIO_DITHER:
+                if (optarg != NULL)
+                {
+                    audio_dither = str_split(optarg, ',');
+                }
+                break;
             case NORMALIZE_MIX:
                 if( optarg != NULL )
                 {
@@ -4014,6 +4107,19 @@ static int CheckOptions( int argc, char ** argv )
     return 0;
 }
 
+static int get_dither_for_string(const char *dither)
+{
+    int i;
+    for (i = 0; i < hb_audio_dithers_count; i++)
+    {
+        if (!strcasecmp(hb_audio_dithers[i].short_name, dither))
+        {
+            return hb_audio_dithers[i].method;
+        }
+    }
+    return hb_audio_dither_get_default();
+}
+
 static int get_acodec_for_string(const char *codec)
 {
     int i;
index 320b96f1ba4f2226b845b6c8e7d3bdf822a9c9a4..0d1998a5994eea1050c8b43b2e89605aebc98f34 100644 (file)
@@ -11,12 +11,14 @@ namespace HandBrake.ApplicationServices.Services
 {\r
     using System;\r
     using System.Diagnostics;\r
+    using System.Globalization;\r
 \r
     using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Services.Base;\r
     using HandBrake.ApplicationServices.Services.Interfaces;\r
     using HandBrake.ApplicationServices.Utilities;\r
     using HandBrake.Interop;\r
+    using HandBrake.Interop.EventArgs;\r
     using HandBrake.Interop.Interfaces;\r
     using HandBrake.Interop.Model;\r
 \r
@@ -174,8 +176,8 @@ namespace HandBrake.ApplicationServices.Services
             {\r
                 this.IsEncoding = false;\r
                 this.instance.StopEncode();\r
-            } \r
-            catch(Exception)\r
+            }\r
+            catch (Exception)\r
             {\r
                 // Do Nothing.\r
             }\r
@@ -239,7 +241,7 @@ namespace HandBrake.ApplicationServices.Services
         /// <param name="e">\r
         /// The Interop.EncodeProgressEventArgs.\r
         /// </param>\r
-        private void InstanceEncodeProgress(object sender, Interop.EncodeProgressEventArgs e)\r
+        private void InstanceEncodeProgress(object sender, Interop.EventArgs.EncodeProgressEventArgs e)\r
         {\r
            EncodeProgressEventArgs args = new EncodeProgressEventArgs\r
             {\r
@@ -256,7 +258,7 @@ namespace HandBrake.ApplicationServices.Services
             if (this.WindowsSeven.IsWindowsSeven)\r
             {\r
                 int percent;\r
-                int.TryParse(Math.Round(e.FractionComplete).ToString(), out percent);\r
+                int.TryParse(Math.Round(e.FractionComplete).ToString(CultureInfo.InvariantCulture), out percent);\r
 \r
                 this.WindowsSeven.SetTaskBarProgress(percent);\r
             }\r
@@ -271,7 +273,7 @@ namespace HandBrake.ApplicationServices.Services
         /// <param name="e">\r
         /// The e.\r
         /// </param>\r
-        private void InstanceEncodeCompleted(object sender, Interop.EncodeCompletedEventArgs e)\r
+        private void InstanceEncodeCompleted(object sender, Interop.EventArgs.EncodeCompletedEventArgs e)\r
         {\r
             this.IsEncoding = false;\r
 \r
index c3598d922f69e93d083fd9c22add296be0cbda54..8dfb5ca126f61853d2bc97fee7776bc3302858de 100644 (file)
@@ -20,10 +20,11 @@ namespace HandBrake.ApplicationServices.Services
     using HandBrake.ApplicationServices.Services.Interfaces;\r
     using HandBrake.ApplicationServices.Utilities;\r
     using HandBrake.Interop;\r
+    using HandBrake.Interop.EventArgs;\r
     using HandBrake.Interop.Interfaces;\r
 \r
     using AudioTrack = HandBrake.ApplicationServices.Parsing.Audio;\r
-    using ScanProgressEventArgs = HandBrake.Interop.ScanProgressEventArgs;\r
+    using ScanProgressEventArgs = HandBrake.Interop.EventArgs.ScanProgressEventArgs;\r
     using Size = System.Drawing.Size;\r
 \r
     /// <summary>\r
index 00fc4e4e87d78051e256bd4f9d0242d906562ee5..1dc2a1e744c2ee5113a665f4acc74d954e08c36f 100644 (file)
@@ -17,12 +17,15 @@ namespace HandBrake.Interop
        using HandBrake.Interop.SourceData;\r
        using HandBrake.Interop.Model;\r
 \r
+    /// <summary>\r
+    /// The converters.\r
+    /// </summary>\r
     public static class Converters\r
        {\r
                /// <summary>\r
                /// Video Frame Rates\r
                /// </summary>\r
-               private static Dictionary<double, int> vrates = new Dictionary<double, int>\r
+               private static readonly Dictionary<double, int> VideoRates = new Dictionary<double, int>\r
                {\r
                        {5, 5400000},\r
                        {10, 2700000},\r
@@ -52,12 +55,12 @@ namespace HandBrake.Interop
                /// </exception>\r
                public static int FramerateToVrate(double framerate)\r
                {\r
-                       if (!vrates.ContainsKey(framerate))\r
+                       if (!VideoRates.ContainsKey(framerate))\r
                        {\r
                                throw new ArgumentException("Framerate not recognized.", "framerate");\r
                        }\r
 \r
-                       return vrates[framerate];\r
+                       return VideoRates[framerate];\r
                }\r
 \r
                /// <summary>\r
similarity index 91%
rename from win/CS/HandBrake.Interop/HandBrakeInterop/EncodeCompletedEventArgs.cs
rename to win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/EncodeCompletedEventArgs.cs
index aa71b3a14fc417d9454849f90a17020f99e62c20..2169c6e4d014bb000f4a44a8eefb37a70ba2b631 100644 (file)
@@ -7,9 +7,9 @@
 // </summary>\r
 // --------------------------------------------------------------------------------------------------------------------\r
 \r
-namespace HandBrake.Interop\r
+namespace HandBrake.Interop.EventArgs\r
 {\r
-       using System;\r
+    using System;\r
 \r
     /// <summary>\r
     /// Encode Completed Event Args\r
similarity index 91%
rename from win/CS/HandBrake.Interop/HandBrakeInterop/EncodeProgressEventArgs.cs
rename to win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/EncodeProgressEventArgs.cs
index 73802fafd4a6794af5a62aea765ba7465ba42f47..9e2883e3b8d716f9c37ff1f976484fbb250006bd 100644 (file)
@@ -7,11 +7,11 @@
 // </summary>\r
 // --------------------------------------------------------------------------------------------------------------------\r
 \r
-namespace HandBrake.Interop\r
+namespace HandBrake.Interop.EventArgs\r
 {\r
-       using System;\r
+    using System;\r
 \r
-    /// <summary>\r
+    /// <summary>s\r
     /// Encode Progress Event Args\r
     /// </summary>\r
     public class EncodeProgressEventArgs : EventArgs\r
similarity index 88%
rename from win/CS/HandBrake.Interop/HandBrakeInterop/MessageLoggedEventArgs.cs
rename to win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/MessageLoggedEventArgs.cs
index fd33c9ef3bd7cbfe7618f8b2ae00d84c218201fa..0649c52f421c09a263c322674d07b2d19cd794f8 100644 (file)
@@ -7,11 +7,11 @@
 // </summary>\r
 // --------------------------------------------------------------------------------------------------------------------\r
 \r
-namespace HandBrake.Interop\r
+namespace HandBrake.Interop.EventArgs\r
 {\r
-       using System;\r
+    using System;\r
 \r
-       /// <summary>\r
+    /// <summary>\r
        /// The Message Logged Event Args\r
        /// </summary>\r
        public class MessageLoggedEventArgs : EventArgs\r
similarity index 91%
rename from win/CS/HandBrake.Interop/HandBrakeInterop/ScanProgressEventArgs.cs
rename to win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/ScanProgressEventArgs.cs
index ce20a4f9d695a8a4e2c93639e29ff2f22a5f7200..b342c8f12a0474fd958683d205558881a2a4850f 100644 (file)
@@ -7,9 +7,9 @@
 // </summary>\r
 // --------------------------------------------------------------------------------------------------------------------\r
 \r
-namespace HandBrake.Interop\r
+namespace HandBrake.Interop.EventArgs\r
 {\r
-       using System;\r
+    using System;\r
 \r
     /// <summary>\r
     /// The Scan Progress Event Args\r
index 06bf022f3477915e07ab5ac7926ae5d297b6789f..ecfc79ebffc11e7cad92fdeb1f39c6e6e000aa89 100644 (file)
@@ -17,6 +17,7 @@ namespace HandBrake.Interop
        using System.Runtime.InteropServices;\r
        using System.Windows.Media.Imaging;\r
 \r
+       using HandBrake.Interop.EventArgs;\r
        using HandBrake.Interop.HbLib;\r
        using HandBrake.Interop.Interfaces;\r
        using HandBrake.Interop.Model;\r
@@ -124,7 +125,7 @@ namespace HandBrake.Interop
                /// <summary>\r
                /// Fires when a scan has completed.\r
                /// </summary>\r
-               public event EventHandler<EventArgs> ScanCompleted;\r
+               public event EventHandler<System.EventArgs> ScanCompleted;\r
 \r
                /// <summary>\r
                /// Fires for progress updates when encoding.\r
@@ -785,7 +786,7 @@ namespace HandBrake.Interop
 \r
                                if (this.ScanCompleted != null)\r
                                {\r
-                                       this.ScanCompleted(this, new EventArgs());\r
+                                       this.ScanCompleted(this, new System.EventArgs());\r
                                }\r
                        }\r
                }\r
index 3fbeace49a9a05d1a37629aa2546147572444447..6de4a9adb7668779d22733501418515003b7c1fd 100644 (file)
   </ItemGroup>\r
   <ItemGroup>\r
     <Compile Include="Converters.cs" />\r
-    <Compile Include="EncodeCompletedEventArgs.cs" />\r
-    <Compile Include="EncodeProgressEventArgs.cs" />\r
+    <Compile Include="EventArgs\EncodeCompletedEventArgs.cs" />\r
+    <Compile Include="EventArgs\EncodeProgressEventArgs.cs" />\r
     <Compile Include="HandBrakeUtils.cs" />\r
     <Compile Include="HandBrakeInstance.cs" />\r
     <Compile Include="HbLib\HBFunctions.cs" />\r
     <Compile Include="Language.cs" />\r
     <Compile Include="LanguageCodes.cs" />\r
     <Compile Include="MarshalingConstants.cs" />\r
-    <Compile Include="MessageLoggedEventArgs.cs" />\r
+    <Compile Include="EventArgs\MessageLoggedEventArgs.cs" />\r
     <Compile Include="Model\Cropping.cs" />\r
     <Compile Include="Model\EncodeJob.cs" />\r
     <Compile Include="Model\Encoders.cs" />\r
     <Compile Include="Model\VideoRangeType.cs" />\r
     <Compile Include="NativeList.cs" />\r
     <Compile Include="Properties\AssemblyInfo.cs" />\r
-    <Compile Include="ScanProgressEventArgs.cs" />\r
+    <Compile Include="EventArgs\ScanProgressEventArgs.cs" />\r
     <Compile Include="SourceData\AudioCodec.cs" />\r
     <Compile Include="SourceData\AudioTrack.cs" />\r
     <Compile Include="SourceData\Chapter.cs" />\r
index 6fde37c57cfa342b81637a484bd5bc202b31f140..568e41a319da96e1bdf631e92c8d3803e8088852 100644 (file)
@@ -12,6 +12,8 @@ namespace HandBrake.Interop
        using System;\r
        using System.Collections.Generic;\r
        using System.Runtime.InteropServices;\r
+\r
+       using HandBrake.Interop.EventArgs;\r
        using HandBrake.Interop.HbLib;\r
        using HandBrake.Interop.Model;\r
        using HandBrake.Interop.Model.Encoding;\r
index 4d6a127bd448d835d9dde8fe8dc44285d49654eb..1b0f8b354a9b17dbe17a2bb6654dd8c819ad25f7 100644 (file)
@@ -13,6 +13,7 @@ namespace HandBrake.Interop.Interfaces
     using System.Collections.Generic;\r
     using System.Windows.Media.Imaging;\r
 \r
+    using HandBrake.Interop.EventArgs;\r
     using HandBrake.Interop.Model;\r
     using HandBrake.Interop.SourceData;\r
 \r
index de73dd607a4affdeb43f1998d65fd3d03399c884..8bf68b2e16981beaab3f7b41978754d197bcabb3 100644 (file)
@@ -106,12 +106,9 @@ namespace HandBrake.Interop
                        IntPtr nativeListInternal = Marshal.AllocHGlobal(capacity * intSize);\r
                        returnList.AllocatedMemory.Add(nativeListInternal);\r
 \r
-                       hb_list_s nativeListStruct = new hb_list_s();\r
-                       nativeListStruct.items = nativeListInternal;\r
-                       nativeListStruct.items_alloc = capacity;\r
-                       nativeListStruct.items_count = 0;\r
+                       hb_list_s nativeListStruct = new hb_list_s { items = nativeListInternal, items_alloc = capacity, items_count = 0 };\r
 \r
-                       IntPtr nativeListStructPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(hb_list_s)));\r
+                   IntPtr nativeListStructPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(hb_list_s)));\r
                        Marshal.StructureToPtr(nativeListStruct, nativeListStructPtr, false);\r
 \r
                        returnList.ListPtr = nativeListStructPtr;\r
@@ -135,12 +132,14 @@ namespace HandBrake.Interop
                                Marshal.WriteIntPtr(nativeListInternal, i * intSize, list[i]);\r
                        }\r
 \r
-                       hb_list_s nativeListStruct = new hb_list_s();\r
-                       nativeListStruct.items = nativeListInternal;\r
-                       nativeListStruct.items_alloc = list.Count;\r
-                       nativeListStruct.items_count = list.Count;\r
+                       hb_list_s nativeListStruct = new hb_list_s\r
+                                                        {\r
+                                                            items = nativeListInternal,\r
+                                                            items_alloc = list.Count,\r
+                                                            items_count = list.Count\r
+                                                        };\r
 \r
-                       IntPtr nativeListStructPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(hb_list_s)));\r
+                   IntPtr nativeListStructPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(hb_list_s)));\r
                        Marshal.StructureToPtr(nativeListStruct, nativeListStructPtr, false);\r
 \r
                        returnList.ListPtr = nativeListStructPtr;\r
@@ -169,12 +168,14 @@ namespace HandBrake.Interop
                                Marshal.WriteIntPtr(nativeListInternal, i * intSize, itemPtr);\r
                        }\r
 \r
-                       hb_list_s nativeListStruct = new hb_list_s();\r
-                       nativeListStruct.items = nativeListInternal;\r
-                       nativeListStruct.items_alloc = list.Count;\r
-                       nativeListStruct.items_count = list.Count;\r
+                       hb_list_s nativeListStruct = new hb_list_s\r
+                                                        {\r
+                                                            items = nativeListInternal,\r
+                                                            items_alloc = list.Count,\r
+                                                            items_count = list.Count\r
+                                                        };\r
 \r
-                       IntPtr nativeListStructPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(hb_list_s)));\r
+                   IntPtr nativeListStructPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(hb_list_s)));\r
                        Marshal.StructureToPtr(nativeListStruct, nativeListStructPtr, false);\r
 \r
                        returnList.ListPtr = nativeListStructPtr;\r
index 373dcb81639da27b20298d7b2336861c936912c0..7fbb7be1f205d90932c9004ea876fad7ecb00e4a 100644 (file)
@@ -10,6 +10,7 @@
 namespace HandBrake.Interop\r
 {\r
     using System.Collections.Generic;\r
+    using System.Linq;\r
 \r
     /// <summary>\r
        /// Contains utilities for converting language codes.\r
@@ -232,14 +233,7 @@ namespace HandBrake.Interop
                {\r
                        get\r
                        {\r
-                               List<Language> languages = new List<Language>();\r
-\r
-                               foreach (string languageCode in LanguageMap.Keys)\r
-                               {\r
-                                       languages.Add(new Language(languageCode));\r
-                               }\r
-\r
-                               return languages;\r
+                           return LanguageMap.Keys.Select(languageCode => new Language(languageCode)).ToList();\r
                        }\r
                }\r
 \r
index 82948f05a7698f784b104bc6654b54909173046a..05261251adeff405ca54a117d266c78a950f8c80 100644 (file)
@@ -9,7 +9,10 @@
 \r
 namespace HandBrake.Interop\r
 {\r
-       public static class MarshalingConstants\r
+    /// <summary>\r
+    /// The marshaling constants.\r
+    /// </summary>\r
+    public static class MarshalingConstants\r
        {\r
 #if X64\r
                public const int JobPaddingBytes = 49264;\r
index 8e6a49582e2340e04f846a6e4656554c553b5982..ed990596096c7c121e1346dcffec5d44f3b52ab7 100644 (file)
@@ -1,15 +1,27 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="BitrateLimits.cs" company="HandBrake Project (http://handbrake.fr)">
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="BitrateLimits.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   Defines the BitrateLimits type.\r
+// </summary>\r
 // --------------------------------------------------------------------------------------------------------------------
 
 namespace HandBrake.Interop.Model
-{
-       public class BitrateLimits
-       {
-               public int Low { get; set; }
-
-               public int High { get; set; }
+{\r
+    /// <summary>\r
+    /// The bitrate limits.\r
+    /// </summary>\r
+    public class BitrateLimits
+       {\r
+        /// <summary>\r
+        /// Gets or sets the low.\r
+        /// </summary>\r
+        public int Low { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the high.\r
+        /// </summary>\r
+        public int High { get; set; }
        }
 }
index 80c28c383bbdb45472b8ac9b56eaa40157c2ca64..9b6ed825ef1d97a5fc43723cf37836aa89f962ff 100644 (file)
 \r
 namespace HandBrake.Interop.Model\r
 {\r
-       using System;\r
-       using System.Collections.Generic;\r
-       using System.Xml.Serialization;\r
-\r
-       using HandBrake.Interop.Model.Encoding;\r
-\r
-       public class EncodeJob\r
-       {\r
-               public SourceType SourceType { get; set; }\r
-               public string SourcePath { get; set; }\r
-\r
-               /// <summary>\r
-               /// Gets or sets the 1-based index of the title to encode.\r
-               /// </summary>\r
-               public int Title { get; set; }\r
-\r
-               /// <summary>\r
-               /// Gets or sets the angle to encode. 0 for default, 1+ for specified angle.\r
-               /// </summary>\r
-               public int Angle { get; set; }\r
-\r
-               public VideoRangeType RangeType { get; set; }\r
-               public int ChapterStart { get; set; }\r
-               public int ChapterEnd { get; set; }\r
-\r
-               public double SecondsStart { get; set; }\r
-               public double SecondsEnd { get; set; }\r
-\r
-               public int FramesStart { get; set; }\r
-               public int FramesEnd { get; set; }\r
-\r
-               /// <summary>\r
-               /// Gets or sets the list of chosen audio tracks (1-based)\r
-               /// </summary>\r
-               public List<int> ChosenAudioTracks { get; set; }\r
-               public Subtitles Subtitles { get; set; }\r
-               public bool UseDefaultChapterNames { get; set; }\r
-               public List<string> CustomChapterNames { get; set; }\r
-\r
-               public string OutputPath { get; set; }\r
-\r
-               public EncodingProfile EncodingProfile { get; set; }\r
-\r
-               // The length of video to encode.\r
-               [XmlIgnore]\r
-               public TimeSpan Length { get; set; }\r
-\r
-               [XmlElement("Length")]\r
-               public string XmlLength\r
-               {\r
-                       get { return this.Length.ToString(); }\r
-                       set { this.Length = TimeSpan.Parse(value); }\r
-               }\r
-\r
-               public EncodeJob Clone()\r
-               {\r
-                       EncodeJob clone = new EncodeJob\r
-                       {\r
-                               SourceType = this.SourceType,\r
-                               SourcePath = this.SourcePath,\r
-                               Title = this.Title,\r
-                               Angle = this.Angle,\r
-                               RangeType = this.RangeType,\r
-                               ChapterStart = this.ChapterStart,\r
-                               ChapterEnd = this.ChapterEnd,\r
-                               SecondsStart = this.SecondsStart,\r
-                               SecondsEnd = this.SecondsEnd,\r
-                               FramesStart = this.FramesStart,\r
-                               FramesEnd = this.FramesEnd,\r
-                               ChosenAudioTracks = new List<int>(this.ChosenAudioTracks),\r
-                               Subtitles = this.Subtitles,\r
-                               UseDefaultChapterNames = this.UseDefaultChapterNames,\r
-                               OutputPath = this.OutputPath,\r
-                               EncodingProfile = this.EncodingProfile,\r
-                               Length = this.Length\r
-                       };\r
-\r
-                       return clone;\r
-               }\r
-       }\r
-}\r
+    using System;\r
+    using System.Collections.Generic;\r
+    using System.Xml.Serialization;\r
+\r
+    using HandBrake.Interop.Model.Encoding;\r
+\r
+    /// <summary>\r
+    /// The encode job.\r
+    /// </summary>\r
+    public class EncodeJob\r
+    {\r
+        #region Properties\r
+\r
+        /// <summary>\r
+        ///     Gets or sets the angle to encode. 0 for default, 1+ for specified angle.\r
+        /// </summary>\r
+        public int Angle { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the chapter end.\r
+        /// </summary>\r
+        public int ChapterEnd { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the chapter start.\r
+        /// </summary>\r
+        public int ChapterStart { get; set; }\r
+\r
+        /// <summary>\r
+        ///     Gets or sets the list of chosen audio tracks (1-based)\r
+        /// </summary>\r
+        public List<int> ChosenAudioTracks { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the custom chapter names.\r
+        /// </summary>\r
+        public List<string> CustomChapterNames { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the encoding profile.\r
+        /// </summary>\r
+        public EncodingProfile EncodingProfile { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the frames end.\r
+        /// </summary>\r
+        public int FramesEnd { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the frames start.\r
+        /// </summary>\r
+        public int FramesStart { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the length. The length of video to encode.\r
+        /// </summary>\r
+        [XmlIgnore]\r
+        public TimeSpan Length { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the output path.\r
+        /// </summary>\r
+        public string OutputPath { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the range type.\r
+        /// </summary>\r
+        public VideoRangeType RangeType { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the seconds end.\r
+        /// </summary>\r
+        public double SecondsEnd { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the seconds start.\r
+        /// </summary>\r
+        public double SecondsStart { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the source path.\r
+        /// </summary>\r
+        public string SourcePath { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the source type.\r
+        /// </summary>\r
+        public SourceType SourceType { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the subtitles.\r
+        /// </summary>\r
+        public Subtitles Subtitles { get; set; }\r
+\r
+        /// <summary>\r
+        ///     Gets or sets the 1-based index of the title to encode.\r
+        /// </summary>\r
+        public int Title { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether use default chapter names.\r
+        /// </summary>\r
+        public bool UseDefaultChapterNames { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the xml length.\r
+        /// </summary>\r
+        [XmlElement("Length")]\r
+        public string XmlLength\r
+        {\r
+            get\r
+            {\r
+                return this.Length.ToString();\r
+            }\r
+            set\r
+            {\r
+                this.Length = TimeSpan.Parse(value);\r
+            }\r
+        }\r
+\r
+        #endregion\r
+\r
+        #region Public Methods\r
+\r
+        /// <summary>\r
+        /// The clone.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The <see cref="EncodeJob"/>.\r
+        /// </returns>\r
+        public EncodeJob Clone()\r
+        {\r
+            var clone = new EncodeJob\r
+                            {\r
+                                SourceType = this.SourceType, \r
+                                SourcePath = this.SourcePath, \r
+                                Title = this.Title, \r
+                                Angle = this.Angle, \r
+                                RangeType = this.RangeType, \r
+                                ChapterStart = this.ChapterStart, \r
+                                ChapterEnd = this.ChapterEnd, \r
+                                SecondsStart = this.SecondsStart, \r
+                                SecondsEnd = this.SecondsEnd, \r
+                                FramesStart = this.FramesStart, \r
+                                FramesEnd = this.FramesEnd, \r
+                                ChosenAudioTracks = new List<int>(this.ChosenAudioTracks), \r
+                                Subtitles = this.Subtitles, \r
+                                UseDefaultChapterNames = this.UseDefaultChapterNames, \r
+                                OutputPath = this.OutputPath, \r
+                                EncodingProfile = this.EncodingProfile, \r
+                                Length = this.Length\r
+                            };\r
+\r
+            return clone;\r
+        }\r
+\r
+        #endregion\r
+    }\r
+}
\ No newline at end of file
index a5406a70a8288bf2db51dd4ff0686310618bea84..9f877cd9bdb372ed4ff9dddaab110dadbf0f14e4 100644 (file)
@@ -2,6 +2,9 @@
 // <copyright file="Encoders.cs" company="HandBrake Project (http://handbrake.fr)">\r
 //   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
 // </copyright>\r
+// <summary>\r
+//   The encoders.\r
+// </summary>\r
 // --------------------------------------------------------------------------------------------------------------------\r
 \r
 namespace HandBrake.Interop.Model\r
@@ -9,17 +12,35 @@ namespace HandBrake.Interop.Model
        using System;\r
        using System.Collections.Generic;\r
        using System.Linq;\r
-       using System.Runtime.InteropServices;\r
+\r
        using HandBrake.Interop.HbLib;\r
        using HandBrake.Interop.Model.Encoding;\r
        using HandBrake.Interop.SourceData;\r
 \r
-       public static class Encoders\r
+    /// <summary>\r
+    /// The encoders.\r
+    /// </summary>\r
+    public static class Encoders\r
        {\r
-               private static List<HBAudioEncoder> audioEncoders;\r
-               private static List<HBVideoEncoder> videoEncoders;\r
-               private static List<HBMixdown> mixdowns;\r
-               private static List<int> audioBitrates; \r
+           /// <summary>\r
+           /// The audio encoders.\r
+           /// </summary>\r
+           private static List<HBAudioEncoder> audioEncoders;\r
+\r
+           /// <summary>\r
+           /// The video encoders.\r
+           /// </summary>\r
+           private static List<HBVideoEncoder> videoEncoders;\r
+\r
+           /// <summary>\r
+           /// The mixdowns.\r
+           /// </summary>\r
+           private static List<HBMixdown> mixdowns;\r
+\r
+           /// <summary>\r
+           /// The audio bitrates.\r
+           /// </summary>\r
+           private static List<int> audioBitrates; \r
 \r
                /// <summary>\r
                /// Gets a list of supported audio encoders.\r
index 6055e8eed3952d67787704de039f3be3705614fc..2c30b2b448f794a8d70e6be0a2e60eb746bc15bd 100644 (file)
@@ -1,16 +1,41 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="RangeLimits.cs" company="HandBrake Project (http://handbrake.fr)">
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.Interop.Model
-{
-       public class RangeLimits
-       {
-               public float Low { get; set; }
-               public float High { get; set; }
-               public float Granularity { get; set; }
-               public bool Ascending { get; set; }
-       }
-}
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="RangeLimits.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   The range limits.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.Interop.Model\r
+{\r
+    /// <summary>\r
+    /// The range limits.\r
+    /// </summary>\r
+    public class RangeLimits\r
+    {\r
+        #region Properties\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether ascending.\r
+        /// </summary>\r
+        public bool Ascending { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the granularity.\r
+        /// </summary>\r
+        public float Granularity { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the high.\r
+        /// </summary>\r
+        public float High { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the low.\r
+        /// </summary>\r
+        public float Low { get; set; }\r
+\r
+        #endregion\r
+    }\r
+}
\ No newline at end of file
index a06894cc5b35d375ff53a7d347b128bef1518493..dcc58e0e3c6dd2262b558e54b93cdda0753f81ff 100644 (file)
@@ -9,15 +9,42 @@
 \r
 namespace HandBrake.Interop.Model\r
 {\r
-       public class Size\r
-       {\r
-               public Size(int width, int height)\r
-               {\r
-                       this.Width = width;\r
-                       this.Height = height;\r
-               }\r
+    /// <summary>\r
+    /// The size.\r
+    /// </summary>\r
+    public class Size\r
+    {\r
+        #region Constructors and Destructors\r
 \r
-               public int Width { get; set; }\r
-               public int Height { get; set; }\r
-       }\r
-}\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="Size"/> class.\r
+        /// </summary>\r
+        /// <param name="width">\r
+        /// The width.\r
+        /// </param>\r
+        /// <param name="height">\r
+        /// The height.\r
+        /// </param>\r
+        public Size(int width, int height)\r
+        {\r
+            this.Width = width;\r
+            this.Height = height;\r
+        }\r
+\r
+        #endregion\r
+\r
+        #region Properties\r
+\r
+        /// <summary>\r
+        /// Gets or sets the height.\r
+        /// </summary>\r
+        public int Height { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the width.\r
+        /// </summary>\r
+        public int Width { get; set; }\r
+\r
+        #endregion\r
+    }\r
+}
\ No newline at end of file
index 13344dd589688c4aefe9c7ac8915445db9111edf..2912dec1e694529b79109624b594302244b662d2 100644 (file)
@@ -9,25 +9,54 @@
 \r
 namespace HandBrake.Interop.Model\r
 {\r
-       public class SourceSubtitle\r
-       {\r
-               /// <summary>\r
-               /// Gets or sets the 1-based subtitle track number. 0 means foreign audio search.\r
-               /// </summary>\r
-               public int TrackNumber { get; set; }\r
-               public bool Default { get; set; }\r
-               public bool Forced { get; set; }\r
-               public bool BurnedIn { get; set; }\r
-\r
-               public SourceSubtitle Clone()\r
-               {\r
-                       return new SourceSubtitle\r
-                       {\r
-                               TrackNumber = this.TrackNumber,\r
-                               Default = this.Default,\r
-                               Forced = this.Forced,\r
-                               BurnedIn = this.BurnedIn\r
-                       };\r
-               }\r
-       }\r
-}\r
+    /// <summary>\r
+    /// The source subtitle.\r
+    /// </summary>\r
+    public class SourceSubtitle\r
+    {\r
+        #region Properties\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether burned in.\r
+        /// </summary>\r
+        public bool BurnedIn { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether default.\r
+        /// </summary>\r
+        public bool Default { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether forced.\r
+        /// </summary>\r
+        public bool Forced { get; set; }\r
+\r
+        /// <summary>\r
+        ///     Gets or sets the 1-based subtitle track number. 0 means foreign audio search.\r
+        /// </summary>\r
+        public int TrackNumber { get; set; }\r
+\r
+        #endregion\r
+\r
+        #region Public Methods\r
+\r
+        /// <summary>\r
+        /// The clone.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The <see cref="SourceSubtitle"/>.\r
+        /// </returns>\r
+        public SourceSubtitle Clone()\r
+        {\r
+            return new SourceSubtitle\r
+                       {\r
+                           TrackNumber = this.TrackNumber, \r
+                           Default = this.Default, \r
+                           Forced = this.Forced, \r
+                           BurnedIn = this.BurnedIn\r
+                       };\r
+        }\r
+\r
+        #endregion\r
+    }\r
+}
\ No newline at end of file
index 9ea7a07af32006d7a58a3076821d3e32da44a914..e5a49bcd13aac970fa6ba9daf5537b1070e2a84f 100644 (file)
@@ -9,11 +9,29 @@
 \r
 namespace HandBrake.Interop.Model\r
 {\r
-       public enum SourceType\r
-       {\r
-               None = 0,\r
-               File,\r
-               VideoFolder,\r
-               Dvd\r
-       }\r
+    /// <summary>\r
+    /// The source type.\r
+    /// </summary>\r
+    public enum SourceType\r
+    {\r
+        /// <summary>\r
+        /// The none.\r
+        /// </summary>\r
+        None = 0, \r
+\r
+        /// <summary>\r
+        /// The file.\r
+        /// </summary>\r
+        File, \r
+\r
+        /// <summary>\r
+        /// The video folder.\r
+        /// </summary>\r
+        VideoFolder, \r
+\r
+        /// <summary>\r
+        /// The dvd.\r
+        /// </summary>\r
+        Dvd\r
+    }\r
 }
\ No newline at end of file
index 945cc236a830b4ad9220d0ff105ee7cc7414e12c..46cc45f57a2272ffb920777c27487dc03eb85a42 100644 (file)
@@ -9,24 +9,60 @@
 \r
 namespace HandBrake.Interop.Model\r
 {\r
-       public class SrtSubtitle\r
-       {\r
-               public bool Default { get; set; }\r
-               public string FileName { get; set; }\r
-               public string LanguageCode { get; set; }\r
-               public string CharacterCode { get; set; }\r
-               public int Offset { get; set; }\r
-\r
-               public SrtSubtitle Clone()\r
-               {\r
-                       return new SrtSubtitle\r
-                       {\r
-                               Default = this.Default,\r
-                               FileName = this.FileName,\r
-                               LanguageCode = this.LanguageCode,\r
-                               CharacterCode = this.CharacterCode,\r
-                               Offset = this.Offset\r
-                       };\r
-               }\r
-       }\r
-}\r
+    /// <summary>\r
+    /// The srt subtitle.\r
+    /// </summary>\r
+    public class SrtSubtitle\r
+    {\r
+        #region Properties\r
+\r
+        /// <summary>\r
+        /// Gets or sets the character code.\r
+        /// </summary>\r
+        public string CharacterCode { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether default.\r
+        /// </summary>\r
+        public bool Default { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the file name.\r
+        /// </summary>\r
+        public string FileName { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the language code.\r
+        /// </summary>\r
+        public string LanguageCode { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the offset.\r
+        /// </summary>\r
+        public int Offset { get; set; }\r
+\r
+        #endregion\r
+\r
+        #region Public Methods\r
+\r
+        /// <summary>\r
+        /// The clone.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The <see cref="SrtSubtitle"/>.\r
+        /// </returns>\r
+        public SrtSubtitle Clone()\r
+        {\r
+            return new SrtSubtitle\r
+                       {\r
+                           Default = this.Default, \r
+                           FileName = this.FileName, \r
+                           LanguageCode = this.LanguageCode, \r
+                           CharacterCode = this.CharacterCode, \r
+                           Offset = this.Offset\r
+                       };\r
+        }\r
+\r
+        #endregion\r
+    }\r
+}
\ No newline at end of file
index 4289375c0f224fc193a3bbaf419bef17972bcd17..843d0d4428b8d0e60790d29a50d5cb3fc8313a92 100644 (file)
@@ -11,9 +11,23 @@ namespace HandBrake.Interop.Model
 {\r
     using System.Collections.Generic;\r
 \r
+    /// <summary>\r
+    /// The subtitles.\r
+    /// </summary>\r
     public class Subtitles\r
-       {\r
-               public List<SrtSubtitle> SrtSubtitles { get; set; }\r
-               public List<SourceSubtitle> SourceSubtitles { get; set; }\r
-       }\r
-}\r
+    {\r
+        #region Properties\r
+\r
+        /// <summary>\r
+        /// Gets or sets the source subtitles.\r
+        /// </summary>\r
+        public List<SourceSubtitle> SourceSubtitles { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the srt subtitles.\r
+        /// </summary>\r
+        public List<SrtSubtitle> SrtSubtitles { get; set; }\r
+\r
+        #endregion\r
+    }\r
+}
\ No newline at end of file
index 2a42928a5d968728aa521a1e2f56d21afa66529b..a99005e77e0770b72105489b4ce930178f409fc4 100644 (file)
@@ -11,15 +11,27 @@ namespace HandBrake.Interop.Model
 {\r
     using System.ComponentModel.DataAnnotations;\r
 \r
+    /// <summary>\r
+    /// The video range type.\r
+    /// </summary>\r
     public enum VideoRangeType\r
-       {\r
-               [Display(Name = "Chapters")]\r
-               Chapters,\r
+    {\r
+        /// <summary>\r
+        /// The chapters.\r
+        /// </summary>\r
+        [Display(Name = "Chapters")]\r
+        Chapters, \r
 \r
-               [Display(Name = "Seconds")]\r
-               Seconds,\r
+        /// <summary>\r
+        /// The seconds.\r
+        /// </summary>\r
+        [Display(Name = "Seconds")]\r
+        Seconds, \r
 \r
-               [Display(Name = "Frames")]\r
-               Frames\r
-       }\r
-}\r
+        /// <summary>\r
+        /// The frames.\r
+        /// </summary>\r
+        [Display(Name = "Frames")]\r
+        Frames\r
+    }\r
+}
\ No newline at end of file
index ad797c53dcb49f5a9e403933884aac3350b55cb8..dce9473113c652477d6e829de43bbf01b53266d3 100644 (file)
@@ -9,21 +9,45 @@
 \r
 namespace HandBrake.Interop.SourceData\r
 {\r
-       // Only contains 2 real codecs at the moment as those are what we care about. More will be added later.\r
-       public enum AudioCodec\r
-       {\r
-               Ac3,\r
+    /// <summary>\r
+    /// The audio codec.\r
+    /// Only contains 2 real codecs at the moment as those are what we care about. More will be added later.\r
+    /// </summary>\r
+    public enum AudioCodec\r
+    {\r
+        /// <summary>\r
+        /// The ac 3.\r
+        /// </summary>\r
+        Ac3, \r
 \r
-               Dts,\r
+        /// <summary>\r
+        /// The dts.\r
+        /// </summary>\r
+        Dts, \r
 \r
-               DtsHD,\r
+        /// <summary>\r
+        /// The dts hd.\r
+        /// </summary>\r
+        DtsHD, \r
 \r
-               Mp3,\r
+        /// <summary>\r
+        /// The mp 3.\r
+        /// </summary>\r
+        Mp3, \r
 \r
-               Aac,\r
+        /// <summary>\r
+        /// The aac.\r
+        /// </summary>\r
+        Aac, \r
 \r
-               Other,\r
+        /// <summary>\r
+        /// The other.\r
+        /// </summary>\r
+        Other, \r
 \r
+        /// <summary>\r
+        /// The flac.\r
+        /// </summary>\r
         Flac\r
-       }\r
-}\r
+    }\r
+}
\ No newline at end of file
index 2e78951da980c3fc4b69fd8c5e1f8deb6047f635..e20ff3003e8e8d58aec3f6fae05709f22aa3693e 100644 (file)
@@ -90,16 +90,23 @@ namespace HandBrake.Interop.SourceData
                        return this.GetDisplayString(true);\r
                }\r
 \r
-               private string GetDisplayString(bool includeTrackNumber)\r
-               {\r
-                       if (includeTrackNumber)\r
+           /// <summary>\r
+           /// The get display string.\r
+           /// </summary>\r
+           /// <param name="includeTrackNumber">\r
+           /// The include track number.\r
+           /// </param>\r
+           /// <returns>\r
+           /// The <see cref="string"/>.\r
+           /// </returns>\r
+           private string GetDisplayString(bool includeTrackNumber)\r
+           {\r
+               if (includeTrackNumber)\r
                        {\r
                                return this.TrackNumber + " " + this.Description;\r
                        }\r
-                       else\r
-                       {\r
-                               return this.Description;\r
-                       }\r
-               }\r
+               \r
+            return this.Description;\r
+           }\r
        }\r
 }
\ No newline at end of file
index 49d2e2b852b5ad8afb8791710f551d659e283a80..efec79d75ab4921e529ed4cad9a6cc2a392ecd10 100644 (file)
@@ -10,6 +10,7 @@
 namespace HandBrake.Interop.SourceData\r
 {\r
     using System;\r
+    using System.Globalization;\r
 \r
     /// <summary>\r
        /// An object representing a Chapter aosciated with a Title, in a DVD\r
@@ -32,7 +33,7 @@ namespace HandBrake.Interop.SourceData
                /// <returns>A string formatted as: {chapter #}</returns>\r
                public override string ToString()\r
                {\r
-                       return this.ChapterNumber.ToString();\r
+                       return this.ChapterNumber.ToString(CultureInfo.InvariantCulture);\r
                }\r
        }\r
 }
\ No newline at end of file
index a00e084bbcdd5e12dbd6ac0a11373cae8cdf61b4..aec1945337c176a131e9c14f08b79259740e2798 100644 (file)
@@ -11,6 +11,9 @@ namespace HandBrake.Interop.SourceData
 {\r
     using System.ComponentModel.DataAnnotations;\r
 \r
+    /// <summary>\r
+    /// The input type.\r
+    /// </summary>\r
     public enum InputType\r
        {\r
                [Display(Name = "File")]\r
index a8ddd8b2f3dcc3e4251e25c9d73da145523132cb..570bc174e7a85937be5d0a50abf5073f09271642 100644 (file)
@@ -48,7 +48,10 @@ namespace HandBrake.Interop.SourceData
                        return string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.SubtitleSource);\r
                }\r
 \r
-               public string Display\r
+        /// <summary>\r
+        /// Gets the display.\r
+        /// </summary>\r
+        public string Display\r
                {\r
                        get\r
                        {\r
index f0a0b0a38f225b6d2b29a8ce715e894cf06a9221..e169e8882eb27f2323492b960b1b246bc92137cc 100644 (file)
@@ -9,7 +9,10 @@
 \r
 namespace HandBrake.Interop.SourceData\r
 {\r
-       public enum SubtitleSource\r
+    /// <summary>\r
+    /// The subtitle source.\r
+    /// </summary>\r
+    public enum SubtitleSource\r
        {\r
                VobSub,\r
                SRT,\r
index e419c445161ab57420cebd8a2016be30d1ed06a7..422f9001dac213ca565030bc03739db660f86cec 100644 (file)
@@ -9,7 +9,10 @@
 \r
 namespace HandBrake.Interop.SourceData\r
 {\r
-       public enum SubtitleType\r
+    /// <summary>\r
+    /// The subtitle type.\r
+    /// </summary>\r
+    public enum SubtitleType\r
        {\r
                Picture,\r
                Text\r
index fbe8e8532966bee42e6c9086d481cc7c5c8bce02..57201e847d6d7ba55c10fd7f1d76995ea9c5a11f 100644 (file)
@@ -140,7 +140,7 @@ namespace HandBrake.Interop.SourceData
                {\r
                        get\r
                        {\r
-                               return (int)Math.Ceiling(((double)this.Duration.TotalSeconds) * this.Framerate);\r
+                               return (int)Math.Ceiling(this.Duration.TotalSeconds * this.Framerate);\r
                        }\r
                }\r
 \r
index 084005d68655edfd58eea7413a8ac1b0fe40fff4..11246230c27ff67d9156d55dfa583c47d5dd59b2 100644 (file)
@@ -11,6 +11,9 @@ namespace HandBrake.Interop
 {\r
     using HandBrake.Interop.Model.Encoding;\r
 \r
+    /// <summary>\r
+    /// The utilities.\r
+    /// </summary>\r
     public static class Utilities\r
        {\r
         /// <summary>\r
@@ -23,6 +26,7 @@ namespace HandBrake.Interop
         /// The b.\r
         /// </param>\r
         /// <returns>\r
+        /// The greatest common factor\r
         /// </returns>\r
         public static int GreatestCommonFactor(int a, int b)\r
                {\r
@@ -40,10 +44,8 @@ namespace HandBrake.Interop
                        {\r
                                return GreatestCommonFactor(a % b, b);\r
                        }\r
-                       else\r
-                       {\r
-                               return GreatestCommonFactor(a, b % a);\r
-                       }\r
+            \r
+            return GreatestCommonFactor(a, b % a);\r
                }\r
 \r
                /// <summary>\r
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/libgcc_s_sjlj-1.dll b/win/CS/HandBrake.Interop/HandBrakeInterop/libgcc_s_sjlj-1.dll
deleted file mode 100644 (file)
index b86e5df..0000000
Binary files a/win/CS/HandBrake.Interop/HandBrakeInterop/libgcc_s_sjlj-1.dll and /dev/null differ
index 71bac458bb39f2be15706b6439883e8b56ad0ede..7622293d2503ad0bd9dbea229fcbb3602437d9c5 100644 (file)
     <Compile Include="Services\NotificationService.cs" />\r
     <Compile Include="Services\ScanServiceWrapper.cs" />\r
     <Compile Include="Services\UpdateService.cs" />\r
+    <Compile Include="ViewModels\AdvancedViewModel.cs" />\r
+    <Compile Include="ViewModels\EncoderOptionsViewModel.cs" />\r
+    <Compile Include="ViewModels\Interfaces\IEncoderOptionsViewModel.cs" />\r
+    <Compile Include="ViewModels\Interfaces\IX264ViewModel.cs" />\r
     <Compile Include="ViewModels\Interfaces\IQueueSelectionViewModel.cs" />\r
     <Compile Include="ViewModels\QueueSelectionViewModel.cs" />\r
+    <Compile Include="Views\AdvancedView.xaml.cs">\r
+      <DependentUpon>AdvancedView.xaml</DependentUpon>\r
+    </Compile>\r
+    <Compile Include="Views\EncoderOptionsView.xaml.cs">\r
+      <DependentUpon>EncoderOptionsView.xaml</DependentUpon>\r
+    </Compile>\r
     <Compile Include="Views\QueueSelectionView.xaml.cs">\r
       <DependentUpon>QueueSelectionView.xaml</DependentUpon>\r
     </Compile>\r
     <Compile Include="ViewModels\AboutViewModel.cs" />\r
     <Compile Include="ViewModels\AddPresetViewModel.cs" />\r
     <Compile Include="ViewModels\AudioViewModel.cs" />\r
-    <Compile Include="ViewModels\AdvancedViewModel.cs" />\r
+    <Compile Include="ViewModels\X264ViewModel.cs" />\r
     <Compile Include="ViewModels\Interfaces\ITabInterface.cs" />\r
     <Compile Include="ViewModels\VideoViewModel.cs" />\r
     <Compile Include="ViewModels\FiltersViewModel.cs" />\r
       <SubType>Code</SubType>\r
     </Compile>\r
     <Compile Include="ViewModels\MainViewModel.cs" />\r
-    <Compile Include="Views\AdvancedView.xaml.cs">\r
-      <DependentUpon>AdvancedView.xaml</DependentUpon>\r
+    <Compile Include="Views\X264View.xaml.cs">\r
+      <DependentUpon>X264View.xaml</DependentUpon>\r
     </Compile>\r
     <Compile Include="Views\AudioView.xaml.cs">\r
       <DependentUpon>AudioView.xaml</DependentUpon>\r
       <SubType>Designer</SubType>\r
       <Generator>MSBuild:Compile</Generator>\r
     </Page>\r
+    <Page Include="Views\AdvancedView.xaml">\r
+      <Generator>MSBuild:Compile</Generator>\r
+      <SubType>Designer</SubType>\r
+    </Page>\r
+    <Page Include="Views\EncoderOptionsView.xaml">\r
+      <Generator>MSBuild:Compile</Generator>\r
+      <SubType>Designer</SubType>\r
+    </Page>\r
     <Page Include="Views\QueueSelectionView.xaml">\r
       <Generator>MSBuild:Compile</Generator>\r
       <SubType>Designer</SubType>\r
       <SubType>Designer</SubType>\r
       <Generator>MSBuild:Compile</Generator>\r
     </Page>\r
-    <Page Include="Views\AdvancedView.xaml">\r
+    <Page Include="Views\X264View.xaml">\r
       <SubType>Designer</SubType>\r
       <Generator>MSBuild:Compile</Generator>\r
     </Page>\r
index 97930ba4d1e38c2da162b9d164e07fcbddd82ed2..ae0369d7f8baa40b583be6c9998454c16a2c977e 100644 (file)
@@ -83,7 +83,9 @@ namespace HandBrakeWPF.Startup
 \r
             // Tab Components\r
             this.windsorContainer.Register(Component.For<IAudioViewModel>().ImplementedBy<AudioViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
+            this.windsorContainer.Register(Component.For<IX264ViewModel>().ImplementedBy<X264ViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
             this.windsorContainer.Register(Component.For<IAdvancedViewModel>().ImplementedBy<AdvancedViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
+            this.windsorContainer.Register(Component.For<IEncoderOptionsViewModel>().ImplementedBy<EncoderOptionsViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
             this.windsorContainer.Register(Component.For<IPictureSettingsViewModel>().ImplementedBy<PictureSettingsViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
             this.windsorContainer.Register(Component.For<IChaptersViewModel>().ImplementedBy<ChaptersViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
             this.windsorContainer.Register(Component.For<ISubtitlesViewModel>().ImplementedBy<SubtitlesViewModel>().LifeStyle.Is(LifestyleType.Singleton));\r
index 1c0f9de67103930cdd257432d352817a2d90c764..470a27be22cd5236b9b25ec50bce4a6a39830cbc 100644 (file)
@@ -9,18 +9,10 @@
 \r
 namespace HandBrakeWPF.ViewModels\r
 {\r
-    using System;\r
-    using System.Collections.Generic;\r
-    using System.Globalization;\r
-    using System.Linq;\r
-\r
     using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Parsing;\r
     using HandBrake.Interop.Model.Encoding;\r
 \r
-    using HandBrakeWPF.Commands.Interfaces;\r
-    using HandBrakeWPF.Helpers;\r
-    using HandBrakeWPF.Model;\r
     using HandBrakeWPF.ViewModels.Interfaces;\r
 \r
     /// <summary>\r
@@ -28,920 +20,68 @@ namespace HandBrakeWPF.ViewModels
     /// </summary>\r
     public class AdvancedViewModel : ViewModelBase, IAdvancedViewModel\r
     {\r
-        /// <summary>\r
-        /// The advanced encoder options command.\r
-        /// </summary>\r
-        private readonly IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand;\r
-\r
         #region Constants and Fields\r
 \r
-        /// <summary>\r
-        /// AdvancedOptionsCache;\r
-        /// </summary>\r
-        private string optionsCache = string.Empty;\r
-\r
         /// <summary>\r
         /// Backing field for displaying x264 options\r
         /// </summary>\r
         private bool? displayX264Options;\r
 \r
         /// <summary>\r
-        /// The adaptive b frames.\r
-        /// </summary>\r
-        private AdvancedChoice adaptiveBFrames;\r
-\r
-        /// <summary>\r
-        /// The adaptive quantization strength.\r
-        /// </summary>\r
-        private double adaptiveQuantizationStrength;\r
-\r
-        /// <summary>\r
-        /// The analysis.\r
-        /// </summary>\r
-        private AdvancedChoice analysis;\r
-\r
-        /// <summary>\r
-        /// The b frames.\r
-        /// </summary>\r
-        private AdvancedChoice bFrames;\r
-\r
-        /// <summary>\r
-        /// The cabac entropy coding.\r
-        /// </summary>\r
-        private bool cabacEntropyCoding;\r
-\r
-        /// <summary>\r
-        /// The deblocking strength.\r
-        /// </summary>\r
-        private AdvancedChoice deblockingStrength;\r
-\r
-        /// <summary>\r
-        /// The deblocking threshold.\r
-        /// </summary>\r
-        private AdvancedChoice deblockingThreshold;\r
-\r
-        /// <summary>\r
-        /// The direct prediction.\r
-        /// </summary>\r
-        private AdvancedChoice directPrediction;\r
-\r
-        /// <summary>\r
-        /// The eight by eight dct.\r
+        /// The show x 264 panel.\r
         /// </summary>\r
-        private bool eightByEightDct;\r
-\r
-        /// <summary>\r
-        /// The motion estimation method.\r
-        /// </summary>\r
-        private AdvancedChoice motionEstimationMethod;\r
-\r
-        /// <summary>\r
-        /// The motion estimation range.\r
-        /// </summary>\r
-        private int motionEstimationRange;\r
-\r
-        /// <summary>\r
-        /// The no dct decimate.\r
-        /// </summary>\r
-        private bool noDctDecimate;\r
-\r
-        /// <summary>\r
-        /// The psychovisual rate distortion.\r
-        /// </summary>\r
-        private double psychovisualRateDistortion;\r
-\r
-        /// <summary>\r
-        /// The psychovisual trellis.\r
-        /// </summary>\r
-        private double psychovisualTrellis;\r
-\r
-        /// <summary>\r
-        /// The pyramidal b frames.\r
-        /// </summary>\r
-        private AdvancedChoice pyramidalBFrames;\r
-\r
-        /// <summary>\r
-        /// The reference frames.\r
-        /// </summary>\r
-        private AdvancedChoice referenceFrames;\r
-\r
-        /// <summary>\r
-        /// The subpixel motion estimation.\r
-        /// </summary>\r
-        private AdvancedChoice subpixelMotionEstimation;\r
-\r
-        /// <summary>\r
-        /// The trellis.\r
-        /// </summary>\r
-        private AdvancedChoice trellis;\r
-\r
-        /// <summary>\r
-        /// X264 options that have UI elements that correspond to them.\r
-        /// </summary>\r
-        private HashSet<string> uiOptions = new HashSet<string>\r
-            {\r
-                "ref",\r
-                "bframes",\r
-                "b-adapt",\r
-                "direct",\r
-                "weightp",\r
-                "b-pyramid",\r
-                "me",\r
-                "subme",\r
-                "subq",\r
-                "merange",\r
-                "analyse",\r
-                "8x8dct",\r
-                "cabac",\r
-                "trellis",\r
-                "aq-strength",\r
-                "psy-rd",\r
-                "no-dct-decimate",\r
-                "deblock"\r
-            };\r
-\r
-        /// <summary>\r
-        /// The weighted p frames.\r
-        /// </summary>\r
-        private bool weightedPFrames;\r
-\r
-        #endregion\r
-\r
-        #region Constructors and Destructors\r
-\r
-        /// <summary>\r
-        /// Initializes a new instance of the <see cref="AdvancedViewModel"/> class.\r
-        /// </summary>\r
-        /// <param name="advancedEncoderOptionsCommand">\r
-        /// The advanced Encoder Options Command.\r
-        /// </param>\r
-        public AdvancedViewModel(IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand)\r
-        {\r
-            this.advancedEncoderOptionsCommand = advancedEncoderOptionsCommand;\r
-            this.Task = new EncodeTask();\r
-            this.UpdateUIFromAdvancedOptions();\r
-        }\r
-\r
-        /// <summary>\r
-        /// The task object property changed.\r
-        /// </summary>\r
-        /// <param name="sender">\r
-        /// The sender.\r
-        /// </param>\r
-        /// <param name="e">\r
-        /// The PropertyChangedEventArgs.\r
-        /// </param>\r
-        private void Task_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)\r
-        {\r
-            if (e.PropertyName == UserSettingConstants.ShowAdvancedTab)\r
-            {\r
-                ShowX264AdvancedOptions = this.Task.ShowAdvancedTab;\r
-                this.NotifyOfPropertyChange(() => ShowX264AdvancedOptions);\r
-            }\r
-        }\r
+        private bool showX264Panel;\r
 \r
         #endregion\r
 \r
         #region Properties\r
 \r
         /// <summary>\r
-        /// Gets or sets a value indicating whether show x 264 advanced options.\r
+        /// Gets or sets the x 264 view model.\r
         /// </summary>\r
-        public bool ShowX264AdvancedOptions { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets a value indicating whether DisplayX264Options.\r
-        /// </summary>\r
-        public bool? DisplayX264Options\r
-        {\r
-            get\r
-            {\r
-                return this.displayX264Options;\r
-            }\r
-            set\r
-            {\r
-                this.displayX264Options = value;\r
-\r
-                if (this.displayX264Options == false)\r
-                {\r
-                    this.ShowX264AdvancedOptions = false;\r
-                }\r
-\r
-                if (this.displayX264Options == true && this.Task.ShowAdvancedTab)\r
-                {\r
-                    this.ShowX264AdvancedOptions = true;\r
-                }\r
-\r
-                this.NotifyOfPropertyChange(() => this.DisplayX264Options);\r
-                this.NotifyOfPropertyChange(() => this.ShowX264AdvancedOptions);\r
-            }\r
-        }\r
+        public IX264ViewModel X264ViewModel { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets or sets AdaptiveBFrames.\r
+        /// Gets or sets the encoder options view model.\r
         /// </summary>\r
-        public AdvancedChoice AdaptiveBFrames\r
-        {\r
-            get\r
-            {\r
-                return this.adaptiveBFrames;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.adaptiveBFrames = value;\r
-                this.NotifyOfPropertyChange(() => this.AdaptiveBFrames);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
+        public IEncoderOptionsViewModel EncoderOptionsViewModel { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets or sets AdaptiveQuantizationStrength.\r
+        /// Gets or sets a value indicating whether show x 264 panel.\r
         /// </summary>\r
-        public double AdaptiveQuantizationStrength\r
+        public bool ShowX264Panel\r
         {\r
             get\r
             {\r
-                return this.adaptiveQuantizationStrength;\r
+                return this.showX264Panel;\r
             }\r
-\r
             set\r
             {\r
-                this.adaptiveQuantizationStrength = value;\r
-                this.NotifyOfPropertyChange(() => this.AdaptiveQuantizationStrength);\r
-                this.UpdateOptionsString();\r
+                this.showX264Panel = value;\r
+                this.NotifyOfPropertyChange(() => this.ShowX264Panel);\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets AdvancedOptionsString.\r
-        /// </summary>\r
-        public string AdvancedOptionsString\r
-        {\r
-            get\r
-            {\r
-                return this.Task.AdvancedEncoderOptions;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.Task.AdvancedEncoderOptions = value;\r
-                this.UpdateUIFromAdvancedOptions();\r
-                this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);\r
-\r
-                // Reset the video tab if the user is using this tab.\r
-                if (!string.IsNullOrEmpty(this.Task.AdvancedEncoderOptions))\r
-                {\r
-                    this.advancedEncoderOptionsCommand.ExecuteClearVideo();\r
-                }\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets Analysis.\r
-        /// </summary>\r
-        public AdvancedChoice Analysis\r
-        {\r
-            get\r
-            {\r
-                return this.analysis;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.analysis = value;\r
-                this.NotifyOfPropertyChange(() => this.Analysis);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets a value indicating whether AutomaticChange.\r
-        /// </summary>\r
-        public bool AutomaticChange { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets BFrames.\r
-        /// </summary>\r
-        public AdvancedChoice BFrames\r
-        {\r
-            get\r
-            {\r
-                return this.bFrames;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.bFrames = value;\r
-                this.NotifyOfPropertyChange(() => this.BFrames);\r
-                this.NotifyOfPropertyChange(() => this.BFramesOptionsVisible);\r
-                this.NotifyOfPropertyChange(() => this.PyramidalBFramesVisible);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets a value indicating whether BFramesOptionsVisible.\r
-        /// </summary>\r
-        public bool BFramesOptionsVisible\r
-        {\r
-            get\r
-            {\r
-                return this.BFrames.Value != "0";\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets a value indicating whether CabacEntropyCoding.\r
-        /// </summary>\r
-        public bool CabacEntropyCoding\r
-        {\r
-            get\r
-            {\r
-                return this.cabacEntropyCoding;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.cabacEntropyCoding = value;\r
-                this.NotifyOfPropertyChange(() => this.CabacEntropyCoding);\r
-                this.NotifyOfPropertyChange(() => this.PsychovisualTrellisVisible);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets DeblockingStrength.\r
-        /// </summary>\r
-        public AdvancedChoice DeblockingStrength\r
-        {\r
-            get\r
-            {\r
-                return this.deblockingStrength;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.deblockingStrength = value;\r
-                this.NotifyOfPropertyChange(() => this.DeblockingStrength);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets DeblockingThreshold.\r
-        /// </summary>\r
-        public AdvancedChoice DeblockingThreshold\r
-        {\r
-            get\r
-            {\r
-                return this.deblockingThreshold;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.deblockingThreshold = value;\r
-                this.NotifyOfPropertyChange(() => this.DeblockingThreshold);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets DirectPrediction.\r
-        /// </summary>\r
-        public AdvancedChoice DirectPrediction\r
-        {\r
-            get\r
-            {\r
-                return this.directPrediction;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.directPrediction = value;\r
-                this.NotifyOfPropertyChange(() => this.DirectPrediction);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets a value indicating whether EightByEightDct.\r
-        /// </summary>\r
-        public bool EightByEightDct\r
-        {\r
-            get\r
-            {\r
-                return this.eightByEightDct;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.eightByEightDct = value;\r
-                this.NotifyOfPropertyChange(() => this.EightByEightDct);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets MotionEstimationMethod.\r
-        /// </summary>\r
-        public AdvancedChoice MotionEstimationMethod\r
-        {\r
-            get\r
-            {\r
-                return this.motionEstimationMethod;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.motionEstimationMethod = value;\r
-                this.NotifyOfPropertyChange(() => this.MotionEstimationMethod);\r
-\r
-                if ((MotionEstimationMethod.Value == "hex" || MotionEstimationMethod.Value == "dia") && (motionEstimationRange > 16))\r
-                {\r
-                    this.motionEstimationRange = 16;\r
-                    this.NotifyOfPropertyChange(() => this.MotionEstimationRange);\r
-                }\r
-\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets MotionEstimationRange.\r
-        /// </summary>\r
-        public int MotionEstimationRange\r
-        {\r
-            get\r
-            {\r
-                return this.motionEstimationRange;\r
-            }\r
-\r
-            set\r
-            {\r
-                if ((MotionEstimationMethod.Value == "hex" || MotionEstimationMethod.Value == "dia") && (value > 16))\r
-                {\r
-                    this.motionEstimationRange = 16;\r
-                }\r
-                else if (value < 4)\r
-                {\r
-                    this.motionEstimationRange = 4;\r
-                }\r
-                else\r
-                {\r
-                    this.motionEstimationRange = value;\r
-                }\r
-\r
-                this.NotifyOfPropertyChange(() => this.MotionEstimationRange);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets a value indicating whether NoDctDecimate.\r
-        /// </summary>\r
-        public bool NoDctDecimate\r
-        {\r
-            get\r
-            {\r
-                return this.noDctDecimate;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.noDctDecimate = value;\r
-                this.NotifyOfPropertyChange(() => this.NoDctDecimate);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets PsychovisualRateDistortion.\r
-        /// </summary>\r
-        public double PsychovisualRateDistortion\r
-        {\r
-            get\r
-            {\r
-                return this.psychovisualRateDistortion;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.psychovisualRateDistortion = value;\r
-                this.NotifyOfPropertyChange(() => this.PsychovisualRateDistortion);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets PsychovisualTrellis.\r
-        /// </summary>\r
-        public double PsychovisualTrellis\r
-        {\r
-            get\r
-            {\r
-                return this.psychovisualTrellis;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.psychovisualTrellis = value;\r
-                this.NotifyOfPropertyChange(() => this.PsychovisualTrellis);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets a value indicating whether PsychovisualTrellisVisible.\r
-        /// </summary>\r
-        public bool PsychovisualTrellisVisible\r
-        {\r
-            get\r
-            {\r
-                return this.CabacEntropyCoding && this.Trellis.Value != "0";\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets a value indicating whether PsychovisualRateDistortionVisible.\r
-        /// </summary>\r
-        public bool PsychovisualRateDistortionVisible\r
-        {\r
-            get\r
-            {\r
-                int value;\r
-                int.TryParse(this.SubpixelMotionEstimation.Value.Trim(), out value);\r
-                return value >= 6;\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets PyramidalBFrames.\r
-        /// </summary>\r
-        public AdvancedChoice PyramidalBFrames\r
-        {\r
-            get\r
-            {\r
-                return this.pyramidalBFrames;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.pyramidalBFrames = value;\r
-                this.NotifyOfPropertyChange(() => this.PyramidalBFrames);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets a value indicating whether PyramidalBFramesVisible.\r
-        /// </summary>\r
-        public bool PyramidalBFramesVisible\r
-        {\r
-            get\r
-            {\r
-                return int.Parse(this.BFrames.Value) > 1;\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets ReferenceFrames.\r
-        /// </summary>\r
-        public AdvancedChoice ReferenceFrames\r
-        {\r
-            get\r
-            {\r
-                return this.referenceFrames;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.referenceFrames = value;\r
-                this.NotifyOfPropertyChange(() => this.ReferenceFrames);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets SubpixelMotionEstimation.\r
-        /// </summary>\r
-        public AdvancedChoice SubpixelMotionEstimation\r
-        {\r
-            get\r
-            {\r
-                return this.subpixelMotionEstimation;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.subpixelMotionEstimation = value;\r
-                this.NotifyOfPropertyChange(() => this.SubpixelMotionEstimation);\r
-                this.NotifyOfPropertyChange(() => this.PsychovisualRateDistortionVisible);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets Task.\r
-        /// </summary>\r
-        public EncodeTask Task { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets Trellis.\r
-        /// </summary>\r
-        public AdvancedChoice Trellis\r
-        {\r
-            get\r
-            {\r
-                return this.trellis;\r
-            }\r
-\r
-            set\r
-            {\r
-                this.trellis = value;\r
-                this.NotifyOfPropertyChange(() => this.Trellis);\r
-                this.NotifyOfPropertyChange(() => this.PsychovisualTrellisVisible);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets a value indicating whether WeightedPFrames.\r
+        /// Gets or sets a value indicating whether DisplayX264Options.\r
         /// </summary>\r
-        public bool WeightedPFrames\r
+        public bool? ShowSimplePanel\r
         {\r
             get\r
             {\r
-                return this.weightedPFrames;\r
+                return this.displayX264Options;\r
             }\r
-\r
             set\r
             {\r
-                this.weightedPFrames = value;\r
-                this.NotifyOfPropertyChange(() => this.WeightedPFrames);\r
-                this.UpdateOptionsString();\r
-            }\r
-        }\r
-\r
-        #endregion\r
-\r
-        #region Public Methods\r
-\r
-        /// <summary>\r
-        /// The update ui from advanced options.\r
-        /// </summary>\r
-        public void UpdateUIFromAdvancedOptions()\r
-        {\r
-            this.AutomaticChange = true;\r
-\r
-            // Reset UI to defaults, and re-apply options.\r
-            this.SetAdvancedToDefaults();\r
-\r
-            if (this.Task.AdvancedEncoderOptions == null)\r
-            {\r
-                this.AutomaticChange = false;\r
-                return;\r
-            }\r
-\r
-            // Check the updated options string. Update UI for any recognized options.\r
-            string[] newOptionsSegments = this.Task.AdvancedEncoderOptions.Split(':');\r
-            foreach (string newOptionsSegment in newOptionsSegments)\r
-            {\r
-                int equalsIndex = newOptionsSegment.IndexOf('=');\r
-                if (equalsIndex >= 0)\r
-                {\r
-                    string optionName = newOptionsSegment.Substring(0, equalsIndex);\r
-                    string optionValue = newOptionsSegment.Substring(equalsIndex + 1);\r
-\r
-                    if (optionName != string.Empty && optionValue != string.Empty)\r
-                    {\r
-                        AdvancedChoice newChoice;\r
-                        int parseInt;\r
-                        double parseDouble;\r
-                        string[] subParts;\r
-\r
-                        switch (optionName)\r
-                        {\r
-                            case "ref":\r
-                                if (int.TryParse(optionValue, out parseInt))\r
-                                {\r
-                                    newChoice =\r
-                                        AdvancedChoicesHelper.ReferenceFrames.SingleOrDefault(\r
-                                            choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));\r
-                                    if (newChoice != null)\r
-                                    {\r
-                                        this.ReferenceFrames = newChoice;\r
-                                    }\r
-                                }\r
-\r
-                                break;\r
-                            case "bframes":\r
-                                if (int.TryParse(optionValue, out parseInt))\r
-                                {\r
-                                    newChoice =\r
-                                        AdvancedChoicesHelper.BFrames.SingleOrDefault(\r
-                                            choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));\r
-                                    if (newChoice != null)\r
-                                    {\r
-                                        this.BFrames = newChoice;\r
-                                    }\r
-                                }\r
-\r
-                                break;\r
-                            case "b-adapt":\r
-                                newChoice =\r
-                                    AdvancedChoicesHelper.AdaptiveBFrames.SingleOrDefault(\r
-                                        choice => choice.Value == optionValue);\r
-                                if (newChoice != null)\r
-                                {\r
-                                    this.AdaptiveBFrames = newChoice;\r
-                                }\r
-\r
-                                break;\r
-                            case "direct":\r
-                                newChoice =\r
-                                    AdvancedChoicesHelper.DirectPrediction.SingleOrDefault(\r
-                                        choice => choice.Value == optionValue);\r
-                                if (newChoice != null)\r
-                                {\r
-                                    this.DirectPrediction = newChoice;\r
-                                }\r
-\r
-                                break;\r
-                            case "weightp":\r
-                                if (optionValue == "0")\r
-                                {\r
-                                    this.WeightedPFrames = false;\r
-                                }\r
-                                else if (optionValue == "1")\r
-                                {\r
-                                    this.WeightedPFrames = true;\r
-                                }\r
-\r
-                                break;\r
-                            case "b-pyramid":\r
-                                newChoice =\r
-                                    AdvancedChoicesHelper.PyramidalBFrames.SingleOrDefault(\r
-                                        choice => choice.Value == optionValue);\r
-                                if (newChoice != null)\r
-                                {\r
-                                    this.PyramidalBFrames = newChoice;\r
-                                }\r
-\r
-                                break;\r
-                            case "me":\r
-                                newChoice =\r
-                                    AdvancedChoicesHelper.MotionEstimationMethod.SingleOrDefault(\r
-                                        choice => choice.Value == optionValue);\r
-                                if (newChoice != null)\r
-                                {\r
-                                    this.MotionEstimationMethod = newChoice;\r
-                                }\r
-\r
-                                break;\r
-                            case "subme":\r
-                            case "subq":\r
-                                if (int.TryParse(optionValue, out parseInt))\r
-                                {\r
-                                    newChoice =\r
-                                        AdvancedChoicesHelper.SubpixelMotionEstimation.SingleOrDefault(\r
-                                            choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));\r
-                                    if (newChoice != null)\r
-                                    {\r
-                                        this.SubpixelMotionEstimation = newChoice;\r
-                                    }\r
-                                }\r
-\r
-                                break;\r
-                            case "merange":\r
-                                if (int.TryParse(optionValue, out parseInt))\r
-                                {\r
-                                    this.MotionEstimationRange = parseInt;\r
-                                }\r
-\r
-                                break;\r
-                            case "analyse":\r
-                                newChoice =\r
-                                    AdvancedChoicesHelper.Analysis.SingleOrDefault(\r
-                                        choice => choice.Value == optionValue);\r
-                                if (newChoice != null)\r
-                                {\r
-                                    this.Analysis = newChoice;\r
-                                }\r
-\r
-                                break;\r
-                            case "8x8dct":\r
-                                if (optionValue == "0")\r
-                                {\r
-                                    this.EightByEightDct = false;\r
-                                }\r
-                                else if (optionValue == "1")\r
-                                {\r
-                                    this.EightByEightDct = true;\r
-                                }\r
-\r
-                                break;\r
-                            case "cabac":\r
-                                if (optionValue == "0")\r
-                                {\r
-                                    this.CabacEntropyCoding = false;\r
-                                }\r
-                                else if (optionValue == "1")\r
-                                {\r
-                                    this.CabacEntropyCoding = true;\r
-                                }\r
-\r
-                                break;\r
-                            case "trellis":\r
-                                if (int.TryParse(optionValue, out parseInt))\r
-                                {\r
-                                    newChoice =\r
-                                        AdvancedChoicesHelper.Trellis.SingleOrDefault(\r
-                                            choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));\r
-                                    if (newChoice != null)\r
-                                    {\r
-                                        this.Trellis = newChoice;\r
-                                    }\r
-                                }\r
-\r
-                                break;\r
-                            case "aq-strength":\r
-                                if (double.TryParse(optionValue, NumberStyles.Any, CultureInfo.InvariantCulture, out parseDouble) && parseDouble >= 0.0 &&\r
-                                    parseDouble <= 2.0)\r
-                                {\r
-                                    this.AdaptiveQuantizationStrength = Math.Round(parseDouble, 1);\r
-                                }\r
-\r
-                                break;\r
-                            case "psy-rd":\r
-                                subParts = optionValue.Split(',');\r
-                                if (subParts.Length == 2)\r
-                                {\r
-                                    double psyRD, psyTrellis;\r
-                                    if (double.TryParse(subParts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out psyRD) &&\r
-                                        double.TryParse(subParts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out psyTrellis))\r
-                                    {\r
-                                        if (psyRD >= 0.0 && psyRD <= 2.0 && psyTrellis >= 0.0 && psyTrellis <= 1.0)\r
-                                        {\r
-                                            this.PsychovisualRateDistortion = Math.Round(psyRD, 1);\r
-                                            this.PsychovisualTrellis = Math.Round(psyTrellis, 2);\r
-                                        }\r
-                                    }\r
-                                }\r
-\r
-                                break;\r
-                            case "no-dct-decimate":\r
-                                if (optionValue == "0")\r
-                                {\r
-                                    this.NoDctDecimate = false;\r
-                                }\r
-                                else if (optionValue == "1")\r
-                                {\r
-                                    this.NoDctDecimate = true;\r
-                                }\r
-\r
-                                break;\r
-                            case "deblock":\r
-                                subParts = optionValue.Split(',');\r
-                                if (subParts.Length == 2)\r
-                                {\r
-                                    int dbStrength, dbThreshold;\r
-                                    if (int.TryParse(subParts[0], out dbStrength) &&\r
-                                        int.TryParse(subParts[1], out dbThreshold))\r
-                                    {\r
-                                        newChoice =\r
-                                            AdvancedChoicesHelper.DeblockingStrength.SingleOrDefault(\r
-                                                choice => choice.Value == subParts[0]);\r
-                                        if (newChoice != null)\r
-                                        {\r
-                                            this.DeblockingStrength = newChoice;\r
-                                        }\r
-\r
-                                        newChoice =\r
-                                            AdvancedChoicesHelper.DeblockingThreshold.SingleOrDefault(\r
-                                                choice => choice.Value == subParts[1]);\r
-                                        if (newChoice != null)\r
-                                        {\r
-                                            this.DeblockingThreshold = newChoice;\r
-                                        }\r
-                                    }\r
-                                }\r
-\r
-                                break;\r
-                        }\r
-                    }\r
-                }\r
+                this.displayX264Options = value;\r
+                this.NotifyOfPropertyChange(() => this.ShowSimplePanel);\r
             }\r
-\r
-            this.AutomaticChange = false;\r
         }\r
 \r
         #endregion\r
 \r
         #region Implemented Interfaces\r
 \r
-        #region IAdvancedViewModel\r
-\r
         /// <summary>\r
         /// The set encoder.\r
         /// </summary>\r
@@ -950,28 +90,19 @@ namespace HandBrakeWPF.ViewModels
         /// </param>\r
         public void SetEncoder(VideoEncoder encoder)\r
         {\r
-            // If we are switching from x264, cache it's settings.\r
-            if (this.DisplayX264Options.HasValue && this.DisplayX264Options.Value )\r
-            {\r
-                this.optionsCache = this.AdvancedOptionsString;\r
-            }\r
+            this.EncoderOptionsViewModel.SetEncoder(encoder);\r
+            this.X264ViewModel.SetEncoder(encoder);\r
 \r
-            // UI Set for new encoder.\r
             if (encoder == VideoEncoder.X264)\r
             {\r
-                this.AdvancedOptionsString = optionsCache;\r
-                this.DisplayX264Options = true;\r
-            }\r
-            else if (encoder == VideoEncoder.Theora)\r
-            {\r
-                this.AdvancedOptionsString = string.Empty;\r
-                this.DisplayX264Options = null;\r
+                this.ShowX264Panel = true;\r
+                this.ShowSimplePanel = false;\r
             }\r
             else\r
             {\r
-                this.AdvancedOptionsString = string.Empty;\r
-                this.DisplayX264Options = false;\r
-            }     \r
+                this.ShowX264Panel = false;\r
+                this.ShowSimplePanel = true;\r
+            }  \r
         }\r
 \r
         /// <summary>\r
@@ -979,13 +110,10 @@ namespace HandBrakeWPF.ViewModels
         /// </summary>\r
         public void Clear()\r
         {\r
-            this.AdvancedOptionsString = string.Empty;\r
+            this.EncoderOptionsViewModel.Clear();\r
+            this.X264ViewModel.Clear();\r
         }\r
 \r
-        #endregion\r
-\r
-        #region ITabInterface\r
-\r
         /// <summary>\r
         /// Setup this tab for the specified preset.\r
         /// </summary>\r
@@ -997,10 +125,8 @@ namespace HandBrakeWPF.ViewModels
         /// </param>\r
         public void SetPreset(Preset preset, EncodeTask task)\r
         {\r
-            this.Task.PropertyChanged -= this.Task_PropertyChanged;\r
-            this.Task = task;\r
-            this.Task.PropertyChanged += this.Task_PropertyChanged;\r
-            this.AdvancedOptionsString = preset.Task.AdvancedEncoderOptions;\r
+            this.EncoderOptionsViewModel.SetPreset(preset, task);\r
+            this.X264ViewModel.SetPreset(preset, task);\r
         }\r
 \r
         /// <summary>\r
@@ -1011,9 +137,10 @@ namespace HandBrakeWPF.ViewModels
         /// </param>\r
         public void UpdateTask(EncodeTask task)\r
         {\r
-            this.Task = task;\r
+            this.EncoderOptionsViewModel.UpdateTask(task);\r
+            this.X264ViewModel.UpdateTask(task);\r
+\r
             this.SetEncoder(task.VideoEncoder);\r
-            this.AdvancedOptionsString = task.AdvancedEncoderOptions;\r
         }\r
 \r
         /// <summary>\r
@@ -1030,184 +157,8 @@ namespace HandBrakeWPF.ViewModels
         /// </param>\r
         public void SetSource(Title title, Preset preset, EncodeTask task)\r
         {\r
-            this.Task = task;\r
-            this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);\r
-        }\r
-\r
-        #endregion\r
-\r
-        #endregion\r
-\r
-        #region Methods\r
-\r
-        /// <summary>\r
-        /// The set advanced to defaults.\r
-        /// </summary>\r
-        private void SetAdvancedToDefaults()\r
-        {\r
-            this.ReferenceFrames = AdvancedChoicesHelper.ReferenceFrames.SingleOrDefault(choice => choice.IsDefault);\r
-            this.BFrames = AdvancedChoicesHelper.BFrames.SingleOrDefault(choice => choice.IsDefault);\r
-            this.AdaptiveBFrames = AdvancedChoicesHelper.AdaptiveBFrames.SingleOrDefault(choice => choice.IsDefault);\r
-            this.DirectPrediction = AdvancedChoicesHelper.DirectPrediction.SingleOrDefault(choice => choice.IsDefault);\r
-            this.WeightedPFrames = true;\r
-            this.PyramidalBFrames = AdvancedChoicesHelper.PyramidalBFrames.SingleOrDefault(choice => choice.IsDefault);\r
-            this.MotionEstimationMethod =\r
-                AdvancedChoicesHelper.MotionEstimationMethod.SingleOrDefault(choice => choice.IsDefault);\r
-            this.SubpixelMotionEstimation =\r
-                AdvancedChoicesHelper.SubpixelMotionEstimation.SingleOrDefault(choice => choice.IsDefault);\r
-            this.MotionEstimationRange = 16;\r
-            this.Analysis = AdvancedChoicesHelper.Analysis.SingleOrDefault(choice => choice.IsDefault);\r
-            this.EightByEightDct = true;\r
-            this.CabacEntropyCoding = true;\r
-            this.Trellis = AdvancedChoicesHelper.Trellis.SingleOrDefault(choice => choice.IsDefault);\r
-            this.AdaptiveQuantizationStrength = 1.0;\r
-            this.PsychovisualRateDistortion = 1.0;\r
-            this.PsychovisualTrellis = 0.0;\r
-            this.DeblockingStrength =\r
-                AdvancedChoicesHelper.DeblockingStrength.SingleOrDefault(choice => choice.IsDefault);\r
-            this.DeblockingThreshold =\r
-                AdvancedChoicesHelper.DeblockingThreshold.SingleOrDefault(choice => choice.IsDefault);\r
-            this.NoDctDecimate = false;\r
-        }\r
-\r
-        /// <summary>\r
-        /// Update the x264 options string from a UI change.\r
-        /// </summary>\r
-        private void UpdateOptionsString()\r
-        {\r
-            if (this.AutomaticChange)\r
-            {\r
-                return;\r
-            }\r
-\r
-            List<string> newOptions = new List<string>();\r
-\r
-            // First add any parts of the options string that don't correspond to the UI\r
-            if (this.AdvancedOptionsString != null)\r
-            {\r
-                string[] existingSegments = this.AdvancedOptionsString.Split(':');\r
-                foreach (string existingSegment in existingSegments)\r
-                {\r
-                    string optionName = existingSegment;\r
-                    int equalsIndex = existingSegment.IndexOf('=');\r
-                    if (equalsIndex >= 0)\r
-                    {\r
-                        optionName = existingSegment.Substring(0, existingSegment.IndexOf("=", System.StringComparison.Ordinal));\r
-                    }\r
-\r
-                    if (!this.uiOptions.Contains(optionName) && optionName != string.Empty)\r
-                    {\r
-                        newOptions.Add(existingSegment);\r
-                    }\r
-                }\r
-            }\r
-\r
-            // Now add everything from the UI\r
-            if (!this.ReferenceFrames.IsDefault)\r
-            {\r
-                newOptions.Add("ref=" + this.ReferenceFrames.Value);\r
-            }\r
-\r
-            if (!this.BFrames.IsDefault)\r
-            {\r
-                newOptions.Add("bframes=" + this.BFrames.Value);\r
-            }\r
-\r
-            if (this.BFrames.Value != "0")\r
-            {\r
-                if (!this.AdaptiveBFrames.IsDefault)\r
-                {\r
-                    newOptions.Add("b-adapt=" + this.AdaptiveBFrames.Value);\r
-                }\r
-\r
-                if (!this.DirectPrediction.IsDefault)\r
-                {\r
-                    newOptions.Add("direct=" + this.DirectPrediction.Value);\r
-                }\r
-\r
-                if (this.BFrames.Value != "1" && !this.PyramidalBFrames.IsDefault)\r
-                {\r
-                    newOptions.Add("b-pyramid=" + this.PyramidalBFrames.Value);\r
-                }\r
-            }\r
-\r
-            if (!this.WeightedPFrames)\r
-            {\r
-                newOptions.Add("weightp=0");\r
-            }\r
-\r
-            if (!this.MotionEstimationMethod.IsDefault)\r
-            {\r
-                newOptions.Add("me=" + this.MotionEstimationMethod.Value);\r
-            }\r
-\r
-            if (!this.SubpixelMotionEstimation.IsDefault)\r
-            {\r
-                newOptions.Add("subme=" + this.SubpixelMotionEstimation.Value);\r
-            }\r
-\r
-            if (this.MotionEstimationRange != 16)\r
-            {\r
-                newOptions.Add("merange=" + this.MotionEstimationRange);\r
-            }\r
-\r
-            if (!this.Analysis.IsDefault)\r
-            {\r
-                newOptions.Add("analyse=" + this.Analysis.Value);\r
-            }\r
-\r
-            if (this.Analysis.Value != "none" && !this.EightByEightDct)\r
-            {\r
-                newOptions.Add("8x8dct=0");\r
-            }\r
-\r
-            if (!this.CabacEntropyCoding)\r
-            {\r
-                newOptions.Add("cabac=0");\r
-            }\r
-\r
-            if (!this.Trellis.IsDefault)\r
-            {\r
-                newOptions.Add("trellis=" + this.Trellis.Value);\r
-            }\r
-\r
-            double psTrellis = 0.0;\r
-            if (this.CabacEntropyCoding && this.Trellis.Value != "0")\r
-            {\r
-                psTrellis = this.PsychovisualTrellis;\r
-            }\r
-\r
-            if (this.AdaptiveQuantizationStrength != 1.0)\r
-            {\r
-                newOptions.Add(\r
-                    "aq-strength=" + this.AdaptiveQuantizationStrength.ToString("F1", CultureInfo.InvariantCulture));\r
-            }\r
-\r
-            if (this.PsychovisualRateDistortion != 1.0 || psTrellis > 0.0)\r
-            {\r
-                newOptions.Add(\r
-                    "psy-rd=" + this.PsychovisualRateDistortion.ToString("F1", CultureInfo.InvariantCulture) + "," +\r
-                    psTrellis.ToString("F2", CultureInfo.InvariantCulture));\r
-            }\r
-\r
-            if (this.NoDctDecimate)\r
-            {\r
-                newOptions.Add("no-dct-decimate=1");\r
-            }\r
-\r
-            if (!this.DeblockingStrength.IsDefault || !this.DeblockingThreshold.IsDefault)\r
-            {\r
-                newOptions.Add("deblock=" + this.DeblockingStrength.Value + "," + this.DeblockingThreshold.Value);\r
-            }\r
-\r
-            this.Task.AdvancedEncoderOptions = string.Join(":", newOptions);\r
-            this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);\r
-\r
-            // Reset the video tab if the user is using this tab.\r
-            if (!string.IsNullOrEmpty(this.Task.AdvancedEncoderOptions))\r
-            {\r
-                this.advancedEncoderOptionsCommand.ExecuteClearVideo();\r
-            }\r
+            this.EncoderOptionsViewModel.SetSource(title, preset, task);\r
+            this.X264ViewModel.SetSource(title, preset, task);\r
         }\r
 \r
         #endregion\r
diff --git a/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs
new file mode 100644 (file)
index 0000000..e578d96
--- /dev/null
@@ -0,0 +1,114 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="EncoderOptionsViewModel.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   The Simple Encoder options screen\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.ViewModels\r
+{\r
+    using HandBrake.ApplicationServices.Model;\r
+    using HandBrake.ApplicationServices.Parsing;\r
+    using HandBrake.Interop.Model.Encoding;\r
+\r
+    using HandBrakeWPF.ViewModels.Interfaces;\r
+\r
+    /// <summary>\r
+    /// The Simple Encoder options screen\r
+    /// </summary>\r
+    public class EncoderOptionsViewModel : ViewModelBase, IEncoderOptionsViewModel, ITabInterface\r
+    {\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="EncoderOptionsViewModel"/> class.\r
+        /// </summary>\r
+        public EncoderOptionsViewModel()\r
+        {\r
+            this.Task = new EncodeTask();\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the task.\r
+        /// </summary>\r
+        public EncodeTask Task { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets the options string.\r
+        /// </summary>\r
+        public string AdvancedOptionsString\r
+        {\r
+            get\r
+            {\r
+                return this.Task.AdvancedEncoderOptions;\r
+            }\r
+            set\r
+            {\r
+                this.Task.AdvancedEncoderOptions = value;\r
+                this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// The set source.\r
+        /// </summary>\r
+        /// <param name="selectedTitle">\r
+        /// The selected title.\r
+        /// </param>\r
+        /// <param name="currentPreset">\r
+        /// The current preset.\r
+        /// </param>\r
+        /// <param name="task">\r
+        /// The task.\r
+        /// </param>\r
+        public void SetSource(Title selectedTitle, Preset currentPreset, EncodeTask task)\r
+        {\r
+            this.Task = task;\r
+            this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The set preset.\r
+        /// </summary>\r
+        /// <param name="preset">\r
+        /// The preset.\r
+        /// </param>\r
+        /// <param name="task">\r
+        /// The task.\r
+        /// </param>\r
+        public void SetPreset(Preset preset, EncodeTask task)\r
+        {\r
+            this.Task = task;\r
+            this.AdvancedOptionsString = preset.Task.AdvancedEncoderOptions;\r
+        }\r
+\r
+        /// <summary>\r
+        /// The update task.\r
+        /// </summary>\r
+        /// <param name="task">\r
+        /// The task.\r
+        /// </param>\r
+        public void UpdateTask(EncodeTask task)\r
+        {        \r
+            this.Task = task;\r
+            this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);\r
+        }\r
+\r
+        /// <summary>\r
+        /// The set encoder.\r
+        /// </summary>\r
+        /// <param name="encoder">\r
+        /// The encoder.\r
+        /// </param>\r
+        public void SetEncoder(VideoEncoder encoder)\r
+        {\r
+        }\r
+\r
+        /// <summary>\r
+        /// The clear.\r
+        /// </summary>\r
+        public void Clear()\r
+        {\r
+        }\r
+    }\r
+}\r
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IEncoderOptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IEncoderOptionsViewModel.cs
new file mode 100644 (file)
index 0000000..10f1270
--- /dev/null
@@ -0,0 +1,32 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="IEncoderOptionsViewModel.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   The Simple Encoder Options Tab\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.ViewModels.Interfaces\r
+{\r
+    using HandBrake.Interop.Model.Encoding;\r
+\r
+    /// <summary>\r
+    /// The Simple Encoder Options Tab\r
+    /// </summary>\r
+    public interface IEncoderOptionsViewModel : ITabInterface    \r
+    {\r
+        /// <summary>\r
+        /// Set the currently selected encoder.\r
+        /// </summary>\r
+        /// <param name="encoder">\r
+        /// The Video Encoder.\r
+        /// </param>\r
+        void SetEncoder(VideoEncoder encoder);\r
+\r
+        /// <summary>\r
+        /// Clear out the settings.\r
+        /// </summary>\r
+        void Clear();\r
+    }\r
+}\r
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IX264ViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IX264ViewModel.cs
new file mode 100644 (file)
index 0000000..70b72af
--- /dev/null
@@ -0,0 +1,32 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="IX264ViewModel.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   Defines the IX264ViewModel type.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.ViewModels.Interfaces\r
+{\r
+    using HandBrake.Interop.Model.Encoding;\r
+\r
+    /// <summary>\r
+    /// The Advanced View Model Interface\r
+    /// </summary>\r
+    public interface IX264ViewModel : ITabInterface\r
+    {\r
+        /// <summary>\r
+        /// Set the currently selected encoder.\r
+        /// </summary>\r
+        /// <param name="encoder">\r
+        /// The Video Encoder.\r
+        /// </param>\r
+        void SetEncoder(VideoEncoder encoder);\r
+\r
+        /// <summary>\r
+        /// Clear out the settings.\r
+        /// </summary>\r
+        void Clear();\r
+    }\r
+}\r
index fe52f88cecd780cbf8747d5ca570de4e3117e95c..33f27c72bc367724370e6382101b6baaf63025b0 100644 (file)
@@ -706,6 +706,7 @@ namespace HandBrakeWPF.ViewModels
                     }\r
 \r
                     // Use the Path on the Title, or the Source Scan path if one doesn't exist.\r
+                    this.SourceLabel = this.SourceName;\r
                     this.CurrentTask.Source = !string.IsNullOrEmpty(this.selectedTitle.SourceName) ? this.selectedTitle.SourceName : this.ScannedSource.ScanPath;\r
                     this.CurrentTask.Title = value.TitleNumber;\r
                     this.NotifyOfPropertyChange(() => this.StartEndRangeItems);\r
@@ -1619,16 +1620,7 @@ namespace HandBrakeWPF.ViewModels
 \r
                     // Cleanup\r
                     this.ShowStatusWindow = false;\r
-\r
-                    if (this.SelectedTitle != null && !string.IsNullOrEmpty(this.SelectedTitle.SourceName))\r
-                    {\r
-                        this.SourceLabel = this.SelectedTitle.SourceName;\r
-                    }\r
-                    else\r
-                    {\r
-                        this.SourceLabel = this.SourceName;\r
-                    }\r
-\r
+                    this.SourceLabel = this.SourceName;\r
                     this.StatusLabel = "Scan Completed";\r
                 });\r
         }\r
@@ -1801,15 +1793,7 @@ namespace HandBrakeWPF.ViewModels
                     this.ShowStatusWindow = false;\r
                     if (e.Successful)\r
                     {\r
-                        if (this.SelectedTitle != null && !string.IsNullOrEmpty(this.SelectedTitle.SourceName))\r
-                        {\r
-                            this.SourceLabel = this.SelectedTitle.SourceName;\r
-                        }\r
-                        else\r
-                        {\r
-                            this.SourceLabel = this.SourceName;\r
-                        }\r
-\r
+                        this.SourceLabel = this.SourceName;\r
                         this.StatusLabel = "Scan Completed";\r
                     }\r
                     else if (!e.Successful && e.Exception == null)\r
index 8e771fb6670bccb0521555cde9436bbbffc846d7..b611e14d65fe76a639d74086b27a3963f38cfb41 100644 (file)
@@ -1614,6 +1614,12 @@ namespace HandBrakeWPF.ViewModels
             this.PreviewPicturesToScan.Add(20);\r
             this.PreviewPicturesToScan.Add(25);\r
             this.PreviewPicturesToScan.Add(30);\r
+            this.PreviewPicturesToScan.Add(35);\r
+            this.PreviewPicturesToScan.Add(40);\r
+            this.PreviewPicturesToScan.Add(45);\r
+            this.PreviewPicturesToScan.Add(50);\r
+            this.PreviewPicturesToScan.Add(55);\r
+            this.PreviewPicturesToScan.Add(60);\r
             this.SelectedPreviewCount = this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount);\r
 \r
             // x264 step\r
index 7ebb886196218c6491f56bcc3f20b9ed333f1ad1..39bc48090a0a17a9fd9f21444c811d4442a74849 100644 (file)
@@ -22,6 +22,7 @@ namespace HandBrakeWPF.ViewModels
     using HandBrake.ApplicationServices.Model.Encoding;\r
     using HandBrake.ApplicationServices.Services.Interfaces;\r
 \r
+    using HandBrakeWPF.Services;\r
     using HandBrakeWPF.Services.Interfaces;\r
     using HandBrakeWPF.ViewModels.Interfaces;\r
 \r
@@ -35,7 +36,7 @@ namespace HandBrakeWPF.ViewModels
         /// <summary>\r
         /// Backing field for the encode service.\r
         /// </summary>\r
-        private readonly IEncode encodeService;\r
+        private readonly IEncodeServiceWrapper encodeService;\r
 \r
         /// <summary>\r
         /// The error service\r
@@ -74,18 +75,17 @@ namespace HandBrakeWPF.ViewModels
         /// <summary>\r
         /// Initializes a new instance of the <see cref="PreviewViewModel"/> class.\r
         /// </summary>\r
-        /// <param name="encodeService">\r
-        /// The encode Service.\r
-        /// </param>\r
         /// <param name="errorService">\r
         /// The error Service.\r
         /// </param>\r
         /// <param name="userSettingService">\r
         /// The user Setting Service.\r
         /// </param>\r
-        public PreviewViewModel(IEncodeServiceWrapper encodeService, IErrorService errorService, IUserSettingService userSettingService) \r
+        public PreviewViewModel(IErrorService errorService, IUserSettingService userSettingService)\r
         {\r
-            this.encodeService = encodeService;\r
+            // Preview needs a seperate instance rather than the shared singleton. This could maybe do with being refactored at some point\r
+            this.encodeService = new EncodeServiceWrapper(userSettingService); \r
+\r
             this.errorService = errorService;\r
             this.userSettingService = userSettingService;\r
             this.Title = "Preview";\r
@@ -93,6 +93,7 @@ namespace HandBrakeWPF.ViewModels
             this.PercentageValue = 0;\r
             this.StartAt = 1;\r
             this.Duration = 30;\r
+            this.CanPlay = true;\r
 \r
             UseSystemDefaultPlayer = userSettingService.GetUserSetting<bool>(UserSettingConstants.DefaultPlayer);\r
             this.Duration = userSettingService.GetUserSetting<int>(UserSettingConstants.LastPreviewDuration);\r
@@ -114,7 +115,7 @@ namespace HandBrakeWPF.ViewModels
         {\r
             get\r
             {\r
-                return new List<int> { 5, 10, 30, 45, 60, 75, 90, 105, 120 };\r
+                return new List<int> { 5, 10, 30, 45, 60, 75, 90, 105, 120, 150, 180, 210, 240 };\r
             }\r
         }\r
 \r
@@ -210,6 +211,8 @@ namespace HandBrakeWPF.ViewModels
             set\r
             {\r
                 this.isEncoding = value;\r
+                this.CanPlay = !value;\r
+                this.NotifyOfPropertyChange(() => this.CanPlay);\r
                 this.NotifyOfPropertyChange(() => this.IsEncoding);\r
             }\r
         }\r
@@ -219,6 +222,11 @@ namespace HandBrakeWPF.ViewModels
         /// </summary>\r
         public string CurrentlyPlaying { get; set; }\r
 \r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether can play.\r
+        /// </summary>\r
+        public bool CanPlay { get; set; }\r
+\r
         #endregion\r
 \r
         #region Public Methods\r
@@ -279,7 +287,7 @@ namespace HandBrakeWPF.ViewModels
             }\r
             else\r
             {\r
-                string directory =  Path.GetDirectoryName(encodeTask.Destination) ?? string.Empty;\r
+                string directory = Path.GetDirectoryName(encodeTask.Destination) ?? string.Empty;\r
                 string filename = Path.GetFileNameWithoutExtension(encodeTask.Destination);\r
                 string extension = Path.GetExtension(encodeTask.Destination);\r
                 string previewFilename = string.Format("{0}_preview{1}", filename, extension);\r
@@ -287,7 +295,7 @@ namespace HandBrakeWPF.ViewModels
                 encodeTask.Destination = previewFullPath;\r
                 this.CurrentlyPlaying = previewFullPath;\r
             }\r
-            \r
+\r
             // Setup the encode task as a preview encode\r
             encodeTask.IsPreviewEncode = true;\r
             encodeTask.PreviewEncodeStartAt = this.StartAt.ToString(CultureInfo.InvariantCulture);\r
@@ -415,6 +423,7 @@ namespace HandBrakeWPF.ViewModels
         {\r
             this.Percentage = "0.00%";\r
             this.PercentageValue = 0;\r
+            this.IsEncoding = false;\r
 \r
             this.encodeService.EncodeCompleted -= this.encodeService_EncodeCompleted;\r
             this.encodeService.EncodeStatusChanged -= this.encodeService_EncodeStatusChanged;\r
diff --git a/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs
new file mode 100644 (file)
index 0000000..e981b3e
--- /dev/null
@@ -0,0 +1,1155 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="X264ViewModel.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   The X264 Advanced View Model\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.ViewModels\r
+{\r
+    using System;\r
+    using System.Collections.Generic;\r
+    using System.Globalization;\r
+    using System.Linq;\r
+\r
+    using HandBrake.ApplicationServices.Model;\r
+    using HandBrake.ApplicationServices.Parsing;\r
+    using HandBrake.Interop.Model.Encoding;\r
+\r
+    using HandBrakeWPF.Commands.Interfaces;\r
+    using HandBrakeWPF.Helpers;\r
+    using HandBrakeWPF.Model;\r
+    using HandBrakeWPF.ViewModels.Interfaces;\r
+\r
+    /// <summary>\r
+    /// The Advanced View Model\r
+    /// </summary>\r
+    public class X264ViewModel : ViewModelBase, IX264ViewModel\r
+    {\r
+        /// <summary>\r
+        /// The advanced encoder options command.\r
+        /// </summary>\r
+        private readonly IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand;\r
+\r
+        #region Constants and Fields\r
+\r
+        /// <summary>\r
+        /// The adaptive b frames.\r
+        /// </summary>\r
+        private AdvancedChoice adaptiveBFrames;\r
+\r
+        /// <summary>\r
+        /// The adaptive quantization strength.\r
+        /// </summary>\r
+        private double adaptiveQuantizationStrength;\r
+\r
+        /// <summary>\r
+        /// The analysis.\r
+        /// </summary>\r
+        private AdvancedChoice analysis;\r
+\r
+        /// <summary>\r
+        /// The b frames.\r
+        /// </summary>\r
+        private AdvancedChoice bFrames;\r
+\r
+        /// <summary>\r
+        /// The cabac entropy coding.\r
+        /// </summary>\r
+        private bool cabacEntropyCoding;\r
+\r
+        /// <summary>\r
+        /// The deblocking strength.\r
+        /// </summary>\r
+        private AdvancedChoice deblockingStrength;\r
+\r
+        /// <summary>\r
+        /// The deblocking threshold.\r
+        /// </summary>\r
+        private AdvancedChoice deblockingThreshold;\r
+\r
+        /// <summary>\r
+        /// The direct prediction.\r
+        /// </summary>\r
+        private AdvancedChoice directPrediction;\r
+\r
+        /// <summary>\r
+        /// The eight by eight dct.\r
+        /// </summary>\r
+        private bool eightByEightDct;\r
+\r
+        /// <summary>\r
+        /// The motion estimation method.\r
+        /// </summary>\r
+        private AdvancedChoice motionEstimationMethod;\r
+\r
+        /// <summary>\r
+        /// The motion estimation range.\r
+        /// </summary>\r
+        private int motionEstimationRange;\r
+\r
+        /// <summary>\r
+        /// The no dct decimate.\r
+        /// </summary>\r
+        private bool noDctDecimate;\r
+\r
+        /// <summary>\r
+        /// The psychovisual rate distortion.\r
+        /// </summary>\r
+        private double psychovisualRateDistortion;\r
+\r
+        /// <summary>\r
+        /// The psychovisual trellis.\r
+        /// </summary>\r
+        private double psychovisualTrellis;\r
+\r
+        /// <summary>\r
+        /// The pyramidal b frames.\r
+        /// </summary>\r
+        private AdvancedChoice pyramidalBFrames;\r
+\r
+        /// <summary>\r
+        /// The reference frames.\r
+        /// </summary>\r
+        private AdvancedChoice referenceFrames;\r
+\r
+        /// <summary>\r
+        /// The subpixel motion estimation.\r
+        /// </summary>\r
+        private AdvancedChoice subpixelMotionEstimation;\r
+\r
+        /// <summary>\r
+        /// The trellis.\r
+        /// </summary>\r
+        private AdvancedChoice trellis;\r
+\r
+        /// <summary>\r
+        /// X264 options that have UI elements that correspond to them.\r
+        /// </summary>\r
+        private HashSet<string> uiOptions = new HashSet<string>\r
+            {\r
+                "ref",\r
+                "bframes",\r
+                "b-adapt",\r
+                "direct",\r
+                "weightp",\r
+                "b-pyramid",\r
+                "me",\r
+                "subme",\r
+                "subq",\r
+                "merange",\r
+                "analyse",\r
+                "8x8dct",\r
+                "cabac",\r
+                "trellis",\r
+                "aq-strength",\r
+                "psy-rd",\r
+                "no-dct-decimate",\r
+                "deblock"\r
+            };\r
+\r
+        /// <summary>\r
+        /// The weighted p frames.\r
+        /// </summary>\r
+        private bool weightedPFrames;\r
+\r
+        #endregion\r
+\r
+        #region Constructors and Destructors\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="X264ViewModel"/> class.\r
+        /// </summary>\r
+        /// <param name="advancedEncoderOptionsCommand">\r
+        /// The advanced Encoder Options Command.\r
+        /// </param>\r
+        public X264ViewModel(IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand)\r
+        {\r
+            this.advancedEncoderOptionsCommand = advancedEncoderOptionsCommand;\r
+            this.Task = new EncodeTask();\r
+            this.UpdateUIFromAdvancedOptions();\r
+        }\r
+\r
+        /// <summary>\r
+        /// The task object property changed.\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The PropertyChangedEventArgs.\r
+        /// </param>\r
+        private void Task_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)\r
+        {\r
+            if (e.PropertyName == UserSettingConstants.ShowAdvancedTab)\r
+            {\r
+                ShowX264AdvancedOptions = this.Task.ShowAdvancedTab;\r
+                this.NotifyOfPropertyChange(() => ShowX264AdvancedOptions);\r
+            }\r
+        }\r
+\r
+        #endregion\r
+\r
+        #region Properties\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether show x 264 advanced options.\r
+        /// </summary>\r
+        public bool ShowX264AdvancedOptions { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets AdaptiveBFrames.\r
+        /// </summary>\r
+        public AdvancedChoice AdaptiveBFrames\r
+        {\r
+            get\r
+            {\r
+                return this.adaptiveBFrames;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.adaptiveBFrames = value;\r
+                this.NotifyOfPropertyChange(() => this.AdaptiveBFrames);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets AdaptiveQuantizationStrength.\r
+        /// </summary>\r
+        public double AdaptiveQuantizationStrength\r
+        {\r
+            get\r
+            {\r
+                return this.adaptiveQuantizationStrength;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.adaptiveQuantizationStrength = value;\r
+                this.NotifyOfPropertyChange(() => this.AdaptiveQuantizationStrength);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets AdvancedOptionsString.\r
+        /// </summary>\r
+        public string AdvancedOptionsString\r
+        {\r
+            get\r
+            {\r
+                return this.Task.AdvancedEncoderOptions;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.Task.AdvancedEncoderOptions = value;\r
+                this.UpdateUIFromAdvancedOptions();\r
+                this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);\r
+\r
+                // Reset the video tab if the user is using this tab.\r
+                if (!string.IsNullOrEmpty(this.Task.AdvancedEncoderOptions))\r
+                {\r
+                    this.advancedEncoderOptionsCommand.ExecuteClearVideo();\r
+                }\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets Analysis.\r
+        /// </summary>\r
+        public AdvancedChoice Analysis\r
+        {\r
+            get\r
+            {\r
+                return this.analysis;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.analysis = value;\r
+                this.NotifyOfPropertyChange(() => this.Analysis);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether AutomaticChange.\r
+        /// </summary>\r
+        public bool AutomaticChange { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets BFrames.\r
+        /// </summary>\r
+        public AdvancedChoice BFrames\r
+        {\r
+            get\r
+            {\r
+                return this.bFrames;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.bFrames = value;\r
+                this.NotifyOfPropertyChange(() => this.BFrames);\r
+                this.NotifyOfPropertyChange(() => this.BFramesOptionsVisible);\r
+                this.NotifyOfPropertyChange(() => this.PyramidalBFramesVisible);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets a value indicating whether BFramesOptionsVisible.\r
+        /// </summary>\r
+        public bool BFramesOptionsVisible\r
+        {\r
+            get\r
+            {\r
+                return this.BFrames.Value != "0";\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether CabacEntropyCoding.\r
+        /// </summary>\r
+        public bool CabacEntropyCoding\r
+        {\r
+            get\r
+            {\r
+                return this.cabacEntropyCoding;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.cabacEntropyCoding = value;\r
+                this.NotifyOfPropertyChange(() => this.CabacEntropyCoding);\r
+                this.NotifyOfPropertyChange(() => this.PsychovisualTrellisVisible);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets DeblockingStrength.\r
+        /// </summary>\r
+        public AdvancedChoice DeblockingStrength\r
+        {\r
+            get\r
+            {\r
+                return this.deblockingStrength;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.deblockingStrength = value;\r
+                this.NotifyOfPropertyChange(() => this.DeblockingStrength);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets DeblockingThreshold.\r
+        /// </summary>\r
+        public AdvancedChoice DeblockingThreshold\r
+        {\r
+            get\r
+            {\r
+                return this.deblockingThreshold;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.deblockingThreshold = value;\r
+                this.NotifyOfPropertyChange(() => this.DeblockingThreshold);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets DirectPrediction.\r
+        /// </summary>\r
+        public AdvancedChoice DirectPrediction\r
+        {\r
+            get\r
+            {\r
+                return this.directPrediction;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.directPrediction = value;\r
+                this.NotifyOfPropertyChange(() => this.DirectPrediction);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether EightByEightDct.\r
+        /// </summary>\r
+        public bool EightByEightDct\r
+        {\r
+            get\r
+            {\r
+                return this.eightByEightDct;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.eightByEightDct = value;\r
+                this.NotifyOfPropertyChange(() => this.EightByEightDct);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets MotionEstimationMethod.\r
+        /// </summary>\r
+        public AdvancedChoice MotionEstimationMethod\r
+        {\r
+            get\r
+            {\r
+                return this.motionEstimationMethod;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.motionEstimationMethod = value;\r
+                this.NotifyOfPropertyChange(() => this.MotionEstimationMethod);\r
+\r
+                if ((MotionEstimationMethod.Value == "hex" || MotionEstimationMethod.Value == "dia") && (motionEstimationRange > 16))\r
+                {\r
+                    this.motionEstimationRange = 16;\r
+                    this.NotifyOfPropertyChange(() => this.MotionEstimationRange);\r
+                }\r
+\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets MotionEstimationRange.\r
+        /// </summary>\r
+        public int MotionEstimationRange\r
+        {\r
+            get\r
+            {\r
+                return this.motionEstimationRange;\r
+            }\r
+\r
+            set\r
+            {\r
+                if ((MotionEstimationMethod.Value == "hex" || MotionEstimationMethod.Value == "dia") && (value > 16))\r
+                {\r
+                    this.motionEstimationRange = 16;\r
+                }\r
+                else if (value < 4)\r
+                {\r
+                    this.motionEstimationRange = 4;\r
+                }\r
+                else\r
+                {\r
+                    this.motionEstimationRange = value;\r
+                }\r
+\r
+                this.NotifyOfPropertyChange(() => this.MotionEstimationRange);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether NoDctDecimate.\r
+        /// </summary>\r
+        public bool NoDctDecimate\r
+        {\r
+            get\r
+            {\r
+                return this.noDctDecimate;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.noDctDecimate = value;\r
+                this.NotifyOfPropertyChange(() => this.NoDctDecimate);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets PsychovisualRateDistortion.\r
+        /// </summary>\r
+        public double PsychovisualRateDistortion\r
+        {\r
+            get\r
+            {\r
+                return this.psychovisualRateDistortion;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.psychovisualRateDistortion = value;\r
+                this.NotifyOfPropertyChange(() => this.PsychovisualRateDistortion);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets PsychovisualTrellis.\r
+        /// </summary>\r
+        public double PsychovisualTrellis\r
+        {\r
+            get\r
+            {\r
+                return this.psychovisualTrellis;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.psychovisualTrellis = value;\r
+                this.NotifyOfPropertyChange(() => this.PsychovisualTrellis);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets a value indicating whether PsychovisualTrellisVisible.\r
+        /// </summary>\r
+        public bool PsychovisualTrellisVisible\r
+        {\r
+            get\r
+            {\r
+                return this.CabacEntropyCoding && this.Trellis.Value != "0";\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets a value indicating whether PsychovisualRateDistortionVisible.\r
+        /// </summary>\r
+        public bool PsychovisualRateDistortionVisible\r
+        {\r
+            get\r
+            {\r
+                int value;\r
+                int.TryParse(this.SubpixelMotionEstimation.Value.Trim(), out value);\r
+                return value >= 6;\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets PyramidalBFrames.\r
+        /// </summary>\r
+        public AdvancedChoice PyramidalBFrames\r
+        {\r
+            get\r
+            {\r
+                return this.pyramidalBFrames;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.pyramidalBFrames = value;\r
+                this.NotifyOfPropertyChange(() => this.PyramidalBFrames);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets a value indicating whether PyramidalBFramesVisible.\r
+        /// </summary>\r
+        public bool PyramidalBFramesVisible\r
+        {\r
+            get\r
+            {\r
+                return int.Parse(this.BFrames.Value) > 1;\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets ReferenceFrames.\r
+        /// </summary>\r
+        public AdvancedChoice ReferenceFrames\r
+        {\r
+            get\r
+            {\r
+                return this.referenceFrames;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.referenceFrames = value;\r
+                this.NotifyOfPropertyChange(() => this.ReferenceFrames);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets SubpixelMotionEstimation.\r
+        /// </summary>\r
+        public AdvancedChoice SubpixelMotionEstimation\r
+        {\r
+            get\r
+            {\r
+                return this.subpixelMotionEstimation;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.subpixelMotionEstimation = value;\r
+                this.NotifyOfPropertyChange(() => this.SubpixelMotionEstimation);\r
+                this.NotifyOfPropertyChange(() => this.PsychovisualRateDistortionVisible);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets Task.\r
+        /// </summary>\r
+        public EncodeTask Task { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets Trellis.\r
+        /// </summary>\r
+        public AdvancedChoice Trellis\r
+        {\r
+            get\r
+            {\r
+                return this.trellis;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.trellis = value;\r
+                this.NotifyOfPropertyChange(() => this.Trellis);\r
+                this.NotifyOfPropertyChange(() => this.PsychovisualTrellisVisible);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether WeightedPFrames.\r
+        /// </summary>\r
+        public bool WeightedPFrames\r
+        {\r
+            get\r
+            {\r
+                return this.weightedPFrames;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.weightedPFrames = value;\r
+                this.NotifyOfPropertyChange(() => this.WeightedPFrames);\r
+                this.UpdateOptionsString();\r
+            }\r
+        }\r
+\r
+        #endregion\r
+\r
+        #region Public Methods\r
+\r
+        /// <summary>\r
+        /// The update ui from advanced options.\r
+        /// </summary>\r
+        public void UpdateUIFromAdvancedOptions()\r
+        {\r
+            this.AutomaticChange = true;\r
+\r
+            // Reset UI to defaults, and re-apply options.\r
+            this.SetAdvancedToDefaults();\r
+\r
+            if (this.Task.AdvancedEncoderOptions == null)\r
+            {\r
+                this.AutomaticChange = false;\r
+                return;\r
+            }\r
+\r
+            // Check the updated options string. Update UI for any recognized options.\r
+            string[] newOptionsSegments = this.Task.AdvancedEncoderOptions.Split(':');\r
+            foreach (string newOptionsSegment in newOptionsSegments)\r
+            {\r
+                int equalsIndex = newOptionsSegment.IndexOf('=');\r
+                if (equalsIndex >= 0)\r
+                {\r
+                    string optionName = newOptionsSegment.Substring(0, equalsIndex);\r
+                    string optionValue = newOptionsSegment.Substring(equalsIndex + 1);\r
+\r
+                    if (optionName != string.Empty && optionValue != string.Empty)\r
+                    {\r
+                        AdvancedChoice newChoice;\r
+                        int parseInt;\r
+                        double parseDouble;\r
+                        string[] subParts;\r
+\r
+                        switch (optionName)\r
+                        {\r
+                            case "ref":\r
+                                if (int.TryParse(optionValue, out parseInt))\r
+                                {\r
+                                    newChoice =\r
+                                        AdvancedChoicesHelper.ReferenceFrames.SingleOrDefault(\r
+                                            choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));\r
+                                    if (newChoice != null)\r
+                                    {\r
+                                        this.ReferenceFrames = newChoice;\r
+                                    }\r
+                                }\r
+\r
+                                break;\r
+                            case "bframes":\r
+                                if (int.TryParse(optionValue, out parseInt))\r
+                                {\r
+                                    newChoice =\r
+                                        AdvancedChoicesHelper.BFrames.SingleOrDefault(\r
+                                            choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));\r
+                                    if (newChoice != null)\r
+                                    {\r
+                                        this.BFrames = newChoice;\r
+                                    }\r
+                                }\r
+\r
+                                break;\r
+                            case "b-adapt":\r
+                                newChoice =\r
+                                    AdvancedChoicesHelper.AdaptiveBFrames.SingleOrDefault(\r
+                                        choice => choice.Value == optionValue);\r
+                                if (newChoice != null)\r
+                                {\r
+                                    this.AdaptiveBFrames = newChoice;\r
+                                }\r
+\r
+                                break;\r
+                            case "direct":\r
+                                newChoice =\r
+                                    AdvancedChoicesHelper.DirectPrediction.SingleOrDefault(\r
+                                        choice => choice.Value == optionValue);\r
+                                if (newChoice != null)\r
+                                {\r
+                                    this.DirectPrediction = newChoice;\r
+                                }\r
+\r
+                                break;\r
+                            case "weightp":\r
+                                if (optionValue == "0")\r
+                                {\r
+                                    this.WeightedPFrames = false;\r
+                                }\r
+                                else if (optionValue == "1")\r
+                                {\r
+                                    this.WeightedPFrames = true;\r
+                                }\r
+\r
+                                break;\r
+                            case "b-pyramid":\r
+                                newChoice =\r
+                                    AdvancedChoicesHelper.PyramidalBFrames.SingleOrDefault(\r
+                                        choice => choice.Value == optionValue);\r
+                                if (newChoice != null)\r
+                                {\r
+                                    this.PyramidalBFrames = newChoice;\r
+                                }\r
+\r
+                                break;\r
+                            case "me":\r
+                                newChoice =\r
+                                    AdvancedChoicesHelper.MotionEstimationMethod.SingleOrDefault(\r
+                                        choice => choice.Value == optionValue);\r
+                                if (newChoice != null)\r
+                                {\r
+                                    this.MotionEstimationMethod = newChoice;\r
+                                }\r
+\r
+                                break;\r
+                            case "subme":\r
+                            case "subq":\r
+                                if (int.TryParse(optionValue, out parseInt))\r
+                                {\r
+                                    newChoice =\r
+                                        AdvancedChoicesHelper.SubpixelMotionEstimation.SingleOrDefault(\r
+                                            choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));\r
+                                    if (newChoice != null)\r
+                                    {\r
+                                        this.SubpixelMotionEstimation = newChoice;\r
+                                    }\r
+                                }\r
+\r
+                                break;\r
+                            case "merange":\r
+                                if (int.TryParse(optionValue, out parseInt))\r
+                                {\r
+                                    this.MotionEstimationRange = parseInt;\r
+                                }\r
+\r
+                                break;\r
+                            case "analyse":\r
+                                newChoice =\r
+                                    AdvancedChoicesHelper.Analysis.SingleOrDefault(\r
+                                        choice => choice.Value == optionValue);\r
+                                if (newChoice != null)\r
+                                {\r
+                                    this.Analysis = newChoice;\r
+                                }\r
+\r
+                                break;\r
+                            case "8x8dct":\r
+                                if (optionValue == "0")\r
+                                {\r
+                                    this.EightByEightDct = false;\r
+                                }\r
+                                else if (optionValue == "1")\r
+                                {\r
+                                    this.EightByEightDct = true;\r
+                                }\r
+\r
+                                break;\r
+                            case "cabac":\r
+                                if (optionValue == "0")\r
+                                {\r
+                                    this.CabacEntropyCoding = false;\r
+                                }\r
+                                else if (optionValue == "1")\r
+                                {\r
+                                    this.CabacEntropyCoding = true;\r
+                                }\r
+\r
+                                break;\r
+                            case "trellis":\r
+                                if (int.TryParse(optionValue, out parseInt))\r
+                                {\r
+                                    newChoice =\r
+                                        AdvancedChoicesHelper.Trellis.SingleOrDefault(\r
+                                            choice => choice.Value == parseInt.ToString(CultureInfo.InvariantCulture));\r
+                                    if (newChoice != null)\r
+                                    {\r
+                                        this.Trellis = newChoice;\r
+                                    }\r
+                                }\r
+\r
+                                break;\r
+                            case "aq-strength":\r
+                                if (double.TryParse(optionValue, NumberStyles.Any, CultureInfo.InvariantCulture, out parseDouble) && parseDouble >= 0.0 &&\r
+                                    parseDouble <= 2.0)\r
+                                {\r
+                                    this.AdaptiveQuantizationStrength = Math.Round(parseDouble, 1);\r
+                                }\r
+\r
+                                break;\r
+                            case "psy-rd":\r
+                                subParts = optionValue.Split(',');\r
+                                if (subParts.Length == 2)\r
+                                {\r
+                                    double psyRD, psyTrellis;\r
+                                    if (double.TryParse(subParts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out psyRD) &&\r
+                                        double.TryParse(subParts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out psyTrellis))\r
+                                    {\r
+                                        if (psyRD >= 0.0 && psyRD <= 2.0 && psyTrellis >= 0.0 && psyTrellis <= 1.0)\r
+                                        {\r
+                                            this.PsychovisualRateDistortion = Math.Round(psyRD, 1);\r
+                                            this.PsychovisualTrellis = Math.Round(psyTrellis, 2);\r
+                                        }\r
+                                    }\r
+                                }\r
+\r
+                                break;\r
+                            case "no-dct-decimate":\r
+                                if (optionValue == "0")\r
+                                {\r
+                                    this.NoDctDecimate = false;\r
+                                }\r
+                                else if (optionValue == "1")\r
+                                {\r
+                                    this.NoDctDecimate = true;\r
+                                }\r
+\r
+                                break;\r
+                            case "deblock":\r
+                                subParts = optionValue.Split(',');\r
+                                if (subParts.Length == 2)\r
+                                {\r
+                                    int dbStrength, dbThreshold;\r
+                                    if (int.TryParse(subParts[0], out dbStrength) &&\r
+                                        int.TryParse(subParts[1], out dbThreshold))\r
+                                    {\r
+                                        newChoice =\r
+                                            AdvancedChoicesHelper.DeblockingStrength.SingleOrDefault(\r
+                                                choice => choice.Value == subParts[0]);\r
+                                        if (newChoice != null)\r
+                                        {\r
+                                            this.DeblockingStrength = newChoice;\r
+                                        }\r
+\r
+                                        newChoice =\r
+                                            AdvancedChoicesHelper.DeblockingThreshold.SingleOrDefault(\r
+                                                choice => choice.Value == subParts[1]);\r
+                                        if (newChoice != null)\r
+                                        {\r
+                                            this.DeblockingThreshold = newChoice;\r
+                                        }\r
+                                    }\r
+                                }\r
+\r
+                                break;\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+\r
+            this.AutomaticChange = false;\r
+        }\r
+\r
+        #endregion\r
+\r
+        #region Implemented Interfaces\r
+\r
+        #region IAdvancedViewModel\r
+\r
+        /// <summary>\r
+        /// The set encoder.\r
+        /// </summary>\r
+        /// <param name="encoder">\r
+        /// The encoder.\r
+        /// </param>\r
+        public void SetEncoder(VideoEncoder encoder)\r
+        {   \r
+        }\r
+\r
+        /// <summary>\r
+        /// The clear.\r
+        /// </summary>\r
+        public void Clear()\r
+        {\r
+            this.AdvancedOptionsString = string.Empty;\r
+        }\r
+\r
+        #endregion\r
+\r
+        #region ITabInterface\r
+\r
+        /// <summary>\r
+        /// Setup this tab for the specified preset.\r
+        /// </summary>\r
+        /// <param name="preset">\r
+        /// The preset.\r
+        /// </param>\r
+        /// <param name="task">\r
+        /// The task.\r
+        /// </param>\r
+        public void SetPreset(Preset preset, EncodeTask task)\r
+        {\r
+            this.Task.PropertyChanged -= this.Task_PropertyChanged;\r
+            this.Task = task;\r
+            this.Task.PropertyChanged += this.Task_PropertyChanged;\r
+            this.AdvancedOptionsString = preset.Task.AdvancedEncoderOptions;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Update all the UI controls based on the encode task passed in.\r
+        /// </summary>\r
+        /// <param name="task">\r
+        /// The task.\r
+        /// </param>\r
+        public void UpdateTask(EncodeTask task)\r
+        {\r
+            this.Task = task;\r
+            this.SetEncoder(task.VideoEncoder);\r
+            this.AdvancedOptionsString = task.AdvancedEncoderOptions;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Setup this window for a new source\r
+        /// </summary>\r
+        /// <param name="title">\r
+        /// The title.\r
+        /// </param>\r
+        /// <param name="preset">\r
+        /// The preset.\r
+        /// </param>\r
+        /// <param name="task">\r
+        /// The task.\r
+        /// </param>\r
+        public void SetSource(Title title, Preset preset, EncodeTask task)\r
+        {\r
+            this.Task = task;\r
+            this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);\r
+        }\r
+\r
+        #endregion\r
+\r
+        #endregion\r
+\r
+        #region Methods\r
+\r
+        /// <summary>\r
+        /// The set advanced to defaults.\r
+        /// </summary>\r
+        private void SetAdvancedToDefaults()\r
+        {\r
+            this.ReferenceFrames = AdvancedChoicesHelper.ReferenceFrames.SingleOrDefault(choice => choice.IsDefault);\r
+            this.BFrames = AdvancedChoicesHelper.BFrames.SingleOrDefault(choice => choice.IsDefault);\r
+            this.AdaptiveBFrames = AdvancedChoicesHelper.AdaptiveBFrames.SingleOrDefault(choice => choice.IsDefault);\r
+            this.DirectPrediction = AdvancedChoicesHelper.DirectPrediction.SingleOrDefault(choice => choice.IsDefault);\r
+            this.WeightedPFrames = true;\r
+            this.PyramidalBFrames = AdvancedChoicesHelper.PyramidalBFrames.SingleOrDefault(choice => choice.IsDefault);\r
+            this.MotionEstimationMethod =\r
+                AdvancedChoicesHelper.MotionEstimationMethod.SingleOrDefault(choice => choice.IsDefault);\r
+            this.SubpixelMotionEstimation =\r
+                AdvancedChoicesHelper.SubpixelMotionEstimation.SingleOrDefault(choice => choice.IsDefault);\r
+            this.MotionEstimationRange = 16;\r
+            this.Analysis = AdvancedChoicesHelper.Analysis.SingleOrDefault(choice => choice.IsDefault);\r
+            this.EightByEightDct = true;\r
+            this.CabacEntropyCoding = true;\r
+            this.Trellis = AdvancedChoicesHelper.Trellis.SingleOrDefault(choice => choice.IsDefault);\r
+            this.AdaptiveQuantizationStrength = 1.0;\r
+            this.PsychovisualRateDistortion = 1.0;\r
+            this.PsychovisualTrellis = 0.0;\r
+            this.DeblockingStrength =\r
+                AdvancedChoicesHelper.DeblockingStrength.SingleOrDefault(choice => choice.IsDefault);\r
+            this.DeblockingThreshold =\r
+                AdvancedChoicesHelper.DeblockingThreshold.SingleOrDefault(choice => choice.IsDefault);\r
+            this.NoDctDecimate = false;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Update the x264 options string from a UI change.\r
+        /// </summary>\r
+        private void UpdateOptionsString()\r
+        {\r
+            if (this.AutomaticChange)\r
+            {\r
+                return;\r
+            }\r
+\r
+            List<string> newOptions = new List<string>();\r
+\r
+            // First add any parts of the options string that don't correspond to the UI\r
+            if (this.AdvancedOptionsString != null)\r
+            {\r
+                string[] existingSegments = this.AdvancedOptionsString.Split(':');\r
+                foreach (string existingSegment in existingSegments)\r
+                {\r
+                    string optionName = existingSegment;\r
+                    int equalsIndex = existingSegment.IndexOf('=');\r
+                    if (equalsIndex >= 0)\r
+                    {\r
+                        optionName = existingSegment.Substring(0, existingSegment.IndexOf("=", System.StringComparison.Ordinal));\r
+                    }\r
+\r
+                    if (!this.uiOptions.Contains(optionName) && optionName != string.Empty)\r
+                    {\r
+                        newOptions.Add(existingSegment);\r
+                    }\r
+                }\r
+            }\r
+\r
+            // Now add everything from the UI\r
+            if (!this.ReferenceFrames.IsDefault)\r
+            {\r
+                newOptions.Add("ref=" + this.ReferenceFrames.Value);\r
+            }\r
+\r
+            if (!this.BFrames.IsDefault)\r
+            {\r
+                newOptions.Add("bframes=" + this.BFrames.Value);\r
+            }\r
+\r
+            if (this.BFrames.Value != "0")\r
+            {\r
+                if (!this.AdaptiveBFrames.IsDefault)\r
+                {\r
+                    newOptions.Add("b-adapt=" + this.AdaptiveBFrames.Value);\r
+                }\r
+\r
+                if (!this.DirectPrediction.IsDefault)\r
+                {\r
+                    newOptions.Add("direct=" + this.DirectPrediction.Value);\r
+                }\r
+\r
+                if (this.BFrames.Value != "1" && !this.PyramidalBFrames.IsDefault)\r
+                {\r
+                    newOptions.Add("b-pyramid=" + this.PyramidalBFrames.Value);\r
+                }\r
+            }\r
+\r
+            if (!this.WeightedPFrames)\r
+            {\r
+                newOptions.Add("weightp=0");\r
+            }\r
+\r
+            if (!this.MotionEstimationMethod.IsDefault)\r
+            {\r
+                newOptions.Add("me=" + this.MotionEstimationMethod.Value);\r
+            }\r
+\r
+            if (!this.SubpixelMotionEstimation.IsDefault)\r
+            {\r
+                newOptions.Add("subme=" + this.SubpixelMotionEstimation.Value);\r
+            }\r
+\r
+            if (this.MotionEstimationRange != 16)\r
+            {\r
+                newOptions.Add("merange=" + this.MotionEstimationRange);\r
+            }\r
+\r
+            if (!this.Analysis.IsDefault)\r
+            {\r
+                newOptions.Add("analyse=" + this.Analysis.Value);\r
+            }\r
+\r
+            if (this.Analysis.Value != "none" && !this.EightByEightDct)\r
+            {\r
+                newOptions.Add("8x8dct=0");\r
+            }\r
+\r
+            if (!this.CabacEntropyCoding)\r
+            {\r
+                newOptions.Add("cabac=0");\r
+            }\r
+\r
+            if (!this.Trellis.IsDefault)\r
+            {\r
+                newOptions.Add("trellis=" + this.Trellis.Value);\r
+            }\r
+\r
+            double psTrellis = 0.0;\r
+            if (this.CabacEntropyCoding && this.Trellis.Value != "0")\r
+            {\r
+                psTrellis = this.PsychovisualTrellis;\r
+            }\r
+\r
+            if (this.AdaptiveQuantizationStrength != 1.0)\r
+            {\r
+                newOptions.Add(\r
+                    "aq-strength=" + this.AdaptiveQuantizationStrength.ToString("F1", CultureInfo.InvariantCulture));\r
+            }\r
+\r
+            if (this.PsychovisualRateDistortion != 1.0 || psTrellis > 0.0)\r
+            {\r
+                newOptions.Add(\r
+                    "psy-rd=" + this.PsychovisualRateDistortion.ToString("F1", CultureInfo.InvariantCulture) + "," +\r
+                    psTrellis.ToString("F2", CultureInfo.InvariantCulture));\r
+            }\r
+\r
+            if (this.NoDctDecimate)\r
+            {\r
+                newOptions.Add("no-dct-decimate=1");\r
+            }\r
+\r
+            if (!this.DeblockingStrength.IsDefault || !this.DeblockingThreshold.IsDefault)\r
+            {\r
+                newOptions.Add("deblock=" + this.DeblockingStrength.Value + "," + this.DeblockingThreshold.Value);\r
+            }\r
+\r
+            this.Task.AdvancedEncoderOptions = string.Join(":", newOptions);\r
+            this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);\r
+\r
+            // Reset the video tab if the user is using this tab.\r
+            if (!string.IsNullOrEmpty(this.Task.AdvancedEncoderOptions))\r
+            {\r
+                this.advancedEncoderOptionsCommand.ExecuteClearVideo();\r
+            }\r
+        }\r
+\r
+        #endregion\r
+    }\r
+}
\ No newline at end of file
index b0b7698d2b21e33cba7dee200dbb7b6d2351b574..99d05b099ff1048ea2babd300440bc2e86f0ffbd 100644 (file)
@@ -3,29 +3,12 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
              xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"\r
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"\r
-             xmlns:Helpers="clr-namespace:HandBrakeWPF.Helpers"\r
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"\r
-             xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"\r
-             xmlns:controls="clr-namespace:HandBrakeWPF.Controls"\r
              x:Name="advancedView"\r
              mc:Ignorable="d"\r
              >\r
     <UserControl.Resources>\r
-        <Converters:AdvancedVisibilityConverter x:Key="VisibilityConverter" />\r
         <Converters:BooleanToVisibilityConverter x:Key="BooleanVisibilityConverter" />\r
-        <Style x:Key="AdvancedLabel" TargetType="Label">\r
-            <Setter Property="HorizontalAlignment" Value="Right" />\r
-        </Style>\r
-\r
-        <Style x:Key="LongToolTipHolder" TargetType="FrameworkElement">\r
-            <Setter Property="ToolTipService.ShowDuration" Value="20000" />\r
-            <Setter Property="Margin" Value="0,2,0,2" />\r
-        </Style>\r
-\r
-        <Style x:Key="LongToolTip" TargetType="TextBlock">\r
-            <Setter Property="Width" Value="400" />\r
-            <Setter Property="TextWrapping" Value="Wrap" />\r
-        </Style>\r
 \r
       </UserControl.Resources>\r
     <Grid>\r
             <RowDefinition Height="Auto" />\r
             <RowDefinition Height="Auto" />\r
             <RowDefinition Height="Auto" />\r
-            <RowDefinition Height="*" />\r
         </Grid.RowDefinitions>\r
 \r
-        <!-- X264 Query  -->\r
-\r
-        <TextBlock Grid.Row="2" Margin="10,5,10,0"\r
-                           VerticalAlignment="Center"\r
-                           FontWeight="Bold"\r
-                           Text="x264 Encoder Options:"\r
-                   Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}"\r
-                           />\r
-        \r
-        <TextBox Grid.Row="3"\r
-                 Margin="10,2,10, 2"\r
-                 HorizontalAlignment="Stretch"\r
-                 VerticalAlignment="Stretch"\r
-                 Style="{StaticResource LongToolTipHolder}"\r
-                 ToolTip="{x:Static Properties:Resources.Advanced_EncoderOptions}"\r
-                 Text="{Binding AdvancedOptionsString,\r
-                                UpdateSourceTrigger=PropertyChanged}"\r
-                 TextWrapping="Wrap"\r
-                 Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}"\r
-                 />\r
-\r
-        <StackPanel Orientation="Vertical">\r
-\r
-            <!--  Other Encoders  -->\r
-            <Grid Visibility="{Binding DisplayX264Options, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=true}">\r
-                <Grid.RowDefinitions>\r
-                    <RowDefinition Height="Auto" />\r
-                    <RowDefinition Height="102" />\r
-                </Grid.RowDefinitions>\r
-                <TextBlock Margin="10,5,10,0"\r
-                           VerticalAlignment="Center"\r
-                           FontWeight="Bold"\r
-                           Text="Advanced Query"\r
-                           />\r
-                <TextBox Grid.Row="1"\r
-                         Margin="10,0,10,5"\r
-                         HorizontalAlignment="Stretch"\r
-                         VerticalAlignment="Stretch"\r
-                         Text="{Binding AdvancedOptionsString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"\r
-                         TextWrapping="Wrap"\r
-                         />\r
-            </Grid>\r
-\r
-            <!--  X264  -->\r
-            <TextBlock Text="{x:Static Properties:Resources.Advanced_NotInUse}"\r
-                       TextWrapping="Wrap" Width="480" Margin="0, 100, 0, 0" FontSize="12"\r
-                       Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=true}" />\r
-            \r
-            <Grid Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}">\r
-                <Grid.RowDefinitions>\r
-                    <RowDefinition Height="Auto" />\r
-                    <RowDefinition Height="*" />\r
-                </Grid.RowDefinitions>\r
-                <Grid.ColumnDefinitions>\r
-                    <ColumnDefinition Width="Auto" />\r
-                    <ColumnDefinition Width="Auto" />\r
-                </Grid.ColumnDefinitions>\r
-\r
-                <!--  Left Column  -->\r
-                <StackPanel Grid.Row="0"\r
-                            Grid.Column="0"\r
-                            Orientation="Vertical"\r
-                            >\r
-                    <!--  Encoding  -->\r
-                    <StackPanel Orientation="Vertical">\r
-                        <TextBlock Grid.Row="0"\r
-                                   Margin="10,5,0,0"\r
-                                   FontWeight="Bold"\r
-                                   Text="Encoding: "\r
-                                   />\r
-                        <Grid Margin="0,5,0,0"\r
-                              HorizontalAlignment="Left"\r
-                              VerticalAlignment="Top"\r
-                              >\r
-                            <Grid.RowDefinitions>\r
-                                <RowDefinition Height="Auto" />\r
-                                <RowDefinition Height="Auto" />\r
-                                <RowDefinition Height="Auto" />\r
-                                <RowDefinition Height="Auto" />\r
-                                <RowDefinition Height="Auto" />\r
-                                <RowDefinition Height="Auto" />\r
-                                <RowDefinition Height="Auto" />\r
-                                <RowDefinition Height="Auto" />\r
-                            </Grid.RowDefinitions>\r
-                            <Grid.ColumnDefinitions>\r
-                                <ColumnDefinition Width="Auto" />\r
-                                <ColumnDefinition Width="*" MinWidth="100" />\r
-                            </Grid.ColumnDefinitions>\r
-\r
-                            <Label Grid.Row="0"\r
-                                   Grid.Column="0"\r
-                                   Content="Reference Frames:"\r
-                                   Style="{StaticResource AdvancedLabel}"\r
-                                   />\r
-                            <ComboBox Grid.Row="0"\r
-                                      Grid.Column="1"\r
-                                      Height="22"\r
-                                      DisplayMemberPath="Label"\r
-                                      ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.ReferenceFrames}"\r
-                                      SelectedItem="{Binding ReferenceFrames}"\r
-                                      Style="{StaticResource LongToolTipHolder}"\r
-                                      >\r
-                                <ComboBox.ToolTip>\r
-                                    <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_ReferenceFramesToolTip}" />\r
-                                </ComboBox.ToolTip>\r
-                            </ComboBox>\r
-\r
-                            <Label Grid.Row="1"\r
-                                   Grid.Column="0"\r
-                                   Content="Maximum B-Frames:"\r
-                                   Style="{StaticResource AdvancedLabel}"\r
-                                   />\r
-                            <ComboBox Grid.Row="1"\r
-                                      Grid.Column="1"\r
-                                      Height="22"\r
-                                      DisplayMemberPath="Label"\r
-                                      ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.BFrames}"\r
-                                      SelectedItem="{Binding BFrames}"\r
-                                      Style="{StaticResource LongToolTipHolder}"\r
-                                      >\r
-                                <ComboBox.ToolTip>\r
-                                    <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_BFramesToolTip}" />\r
-                                </ComboBox.ToolTip>\r
-                            </ComboBox>\r
-\r
-\r
-                            <Label Grid.Row="4"\r
-                                   Grid.Column="0"\r
-                                   Height="28"\r
-                                   Content="CABAC:"\r
-                                   Style="{StaticResource AdvancedLabel}"\r
-                                   />\r
-                            <CheckBox Grid.Row="4"\r
-                                      Grid.Column="1"\r
-                                      Height="16"\r
-                                      IsChecked="{Binding CabacEntropyCoding}"\r
-                                      Style="{StaticResource LongToolTipHolder}"\r
-                                      >\r
-                                <CheckBox.ToolTip>\r
-                                    <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_CabacToolTip}" />\r
-                                </CheckBox.ToolTip>\r
-                            </CheckBox>\r
-\r
-                            <Label Grid.Row="5"\r
-                                   Grid.Column="0"\r
-                                   Height="28"\r
-                                   Content="8x8 Transform:"\r
-                                   Style="{StaticResource AdvancedLabel}"\r
-                                   />\r
-                            <CheckBox Grid.Row="5"\r
-                                      Grid.Column="1"\r
-                                      Height="16"\r
-                                      IsChecked="{Binding EightByEightDct}"\r
-                                      Style="{StaticResource LongToolTipHolder}">\r
-                                <CheckBox.ToolTip>\r
-                                    <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_EightByEightDctToolTip}" />\r
-                                </CheckBox.ToolTip>\r
-                            </CheckBox>\r
-\r
-                            <Label Grid.Row="6"\r
-                                   Grid.Column="0"\r
-                                   Content="Weighted P-Frames:"\r
-                                   Style="{StaticResource AdvancedLabel}"\r
-                                   />\r
-                            <CheckBox Grid.Row="6"\r
-                                      Grid.Column="1"\r
-                                      VerticalAlignment="Center"\r
-                                      IsChecked="{Binding WeightedPFrames}"\r
-                                      Style="{StaticResource LongToolTipHolder}"\r
-                                      >\r
-                                <CheckBox.ToolTip>\r
-                                    <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_WeightPToolTip}" />\r
-                                </CheckBox.ToolTip>\r
-                            </CheckBox>\r
-\r
-                            <Label Grid.Row="7"\r
-                                   Grid.Column="0"\r
-                                   Content="Pyramidal B-Frames:"\r
-                                   Style="{StaticResource AdvancedLabel}"\r
-                                   Visibility="{Binding PyramidalBFramesVisible,\r
-                                                        Converter={StaticResource VisibilityConverter}}"\r
-                                   />\r
-                            <ComboBox Grid.Row="7"\r
-                                      Grid.Column="1"\r
-                                      Height="22"\r
-                                      MaxWidth="100"\r
-                                      DisplayMemberPath="Label"\r
-                                      ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.PyramidalBFrames}"\r
-                                      SelectedItem="{Binding PyramidalBFrames}"\r
-                                      Style="{StaticResource LongToolTipHolder}"\r
-                                      Visibility="{Binding PyramidalBFramesVisible,\r
-                                                           Converter={StaticResource VisibilityConverter}}"\r
-                                      >\r
-                                <ComboBox.ToolTip>\r
-                                    <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_PyramidalBFramesToolTip}" />\r
-                                </ComboBox.ToolTip>\r
-                            </ComboBox>\r
-                        </Grid>\r
-                    </StackPanel>\r
-                </StackPanel>\r
-\r
-                <!--  Right Column  -->\r
-                <Grid Grid.Row="0" Grid.Column="1">\r
-                    <Grid.RowDefinitions>\r
-                        <RowDefinition Height="Auto" />\r
-                        <RowDefinition Height="Auto" />\r
-                        <RowDefinition Height="Auto" />\r
-                        <RowDefinition Height="*" />\r
-                    </Grid.RowDefinitions>\r
-                    <Grid.ColumnDefinitions>\r
-                        <ColumnDefinition Width="Auto" />\r
-                    </Grid.ColumnDefinitions>\r
-                    \r
-                    <!-- Analysis -->\r
-                    <TextBlock Text="Analysis: " Grid.Row="0" Margin="10,5,0,0" FontWeight="Bold"  />\r
-                    <Grid Grid.Row="1"  HorizontalAlignment="Left" VerticalAlignment="Top">\r
-                        <Grid.RowDefinitions>\r
-                            <RowDefinition Height="Auto" />\r
-                            <RowDefinition Height="Auto" />\r
-                            <RowDefinition Height="Auto" />\r
-                            <RowDefinition Height="Auto" />\r
-                            <RowDefinition Height="Auto" />\r
-                        </Grid.RowDefinitions>\r
-                        <Grid.ColumnDefinitions>\r
-                            <ColumnDefinition Width="Auto" />\r
-                            <ColumnDefinition Width="Auto" MinWidth="100" />\r
-                            <ColumnDefinition Width="Auto" />\r
-                            <ColumnDefinition Width="Auto" />\r
-                        </Grid.ColumnDefinitions>\r
-\r
-                        <Label Content="Adaptive B-Frames:"\r
-                               Style="{StaticResource AdvancedLabel}"\r
-                               Visibility="{Binding BFramesOptionsVisible,\r
-                                                    Converter={StaticResource VisibilityConverter}}" Height="26" VerticalAlignment="Top" />\r
-                        <ComboBox Grid.Row="0"\r
-                                  Grid.Column="1"\r
-                                  Width="120"\r
-                                  Height="22"\r
-                                  MaxWidth="120"\r
-                                  DisplayMemberPath="Label"\r
-                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.AdaptiveBFrames}"\r
-                                  SelectedItem="{Binding AdaptiveBFrames}"\r
-                                  Style="{StaticResource LongToolTipHolder}"\r
-                                  Visibility="{Binding BFramesOptionsVisible,\r
-                                                       Converter={StaticResource VisibilityConverter}}"\r
-                                  >\r
-                            <ComboBox.ToolTip>\r
-                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AdaptiveBFramesToolTip}" />\r
-                            </ComboBox.ToolTip>\r
-                        </ComboBox>\r
-\r
-                        <Label Grid.Row="1"\r
-                               Grid.Column="0"\r
-                               Content="Adaptive Direct Mode:"\r
-                               Style="{StaticResource AdvancedLabel}"\r
-                               Visibility="{Binding BFramesOptionsVisible,\r
-                                                    Converter={StaticResource VisibilityConverter}}"\r
-                               />\r
-                        <ComboBox Grid.Row="1"\r
-                                  Grid.Column="1"\r
-                                  Width="120"\r
-                                  Height="22"\r
-                                  MaxWidth="120"\r
-                                  DisplayMemberPath="Label"\r
-                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DirectPrediction}"\r
-                                  SelectedItem="{Binding DirectPrediction}"\r
-                                  Style="{StaticResource LongToolTipHolder}"\r
-                                  Visibility="{Binding BFramesOptionsVisible,\r
-                                                       Converter={StaticResource VisibilityConverter}}"\r
-                                  >\r
-                            <ComboBox.ToolTip>\r
-                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AdaptiveDirectModeToolTip}" />\r
-                            </ComboBox.ToolTip>\r
-                        </ComboBox>\r
-\r
-                        <Label Grid.Row="2"\r
-                               Grid.Column="0"\r
-                               Content="Motion Est Method:"\r
-                               Style="{StaticResource AdvancedLabel}"\r
-                               />\r
-                        <ComboBox Grid.Row="2"\r
-                                  Grid.Column="1"\r
-                                  Width="120"\r
-                                  Height="22"\r
-                                  MaxWidth="120"\r
-                                  DisplayMemberPath="Label"\r
-                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.MotionEstimationMethod}"\r
-                                  SelectedItem="{Binding MotionEstimationMethod}"\r
-                                  Style="{StaticResource LongToolTipHolder}"\r
-                                  >\r
-                            <ComboBox.ToolTip>\r
-                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_MotionEstimationMethodToolTip}" />\r
-                            </ComboBox.ToolTip>\r
-                        </ComboBox>\r
-\r
-                        <Label Grid.Row="3"\r
-                               Grid.Column="0"\r
-                               Content="Subpixel Motion Est:"\r
-                               Style="{StaticResource AdvancedLabel}"\r
-                               />\r
-                        <ComboBox Grid.Row="3"\r
-                                  Grid.Column="1"\r
-                                  Width="120"\r
-                                  Height="22"\r
-                                  MaxWidth="120"\r
-                                  DisplayMemberPath="Label"\r
-                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.SubpixelMotionEstimation}"\r
-                                  SelectedItem="{Binding SubpixelMotionEstimation}"\r
-                                  Style="{StaticResource LongToolTipHolder}"\r
-                                  >\r
-                            <ComboBox.ToolTip>\r
-                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_SubpixelMotionEstimationToolTip}" />\r
-                            </ComboBox.ToolTip>\r
-                        </ComboBox>\r
-\r
-                        <Label Grid.Row="4"\r
-                               Grid.Column="0"\r
-                               Content="Motion Est Range:"\r
-                               Style="{StaticResource AdvancedLabel}" />\r
-                        <controls:NumberBox Grid.Row="4"\r
-                                            Grid.Column="1"\r
-                                            Width="120"\r
-                                            Height="22"\r
-                                            MaxWidth="120"\r
-                                            Minimum="4" Maximum="64"   \r
-                                            Number="{Binding MotionEstimationRange, Mode=TwoWay}"\r
-                                            ToolTip="{x:Static Properties:Resources.Advanced_MotionEstimationRangeToolTip}" \r
-                                            />\r
-                        \r
-                        \r
-                        <!-- Column 2 -->\r
-                        <Label Grid.Row="0" Grid.Column="2"\r
-                               Height="28"\r
-                               HorizontalAlignment="Right"\r
-                               VerticalAlignment="Top"\r
-                               Content="Partition Type:"\r
-                               />\r
-                        <ComboBox Grid.Row="0" Grid.Column="3"\r
-                                  Width="100"\r
-                                  Height="23"\r
-                                  MaxWidth="100"\r
-                                  HorizontalAlignment="Right"\r
-                                  VerticalAlignment="Top"\r
-                                  DisplayMemberPath="Label"\r
-                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.Analysis}"\r
-                                  SelectedItem="{Binding Analysis}"\r
-                                  Style="{StaticResource LongToolTipHolder}"\r
-                                  >\r
-                            <ComboBox.ToolTip>\r
-                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AnalysisToolTip}" />\r
-                            </ComboBox.ToolTip>\r
-                        </ComboBox>\r
-\r
-                        <Label Grid.Row="1" Grid.Column="2" Height="28" HorizontalAlignment="Right" VerticalAlignment="Top" Content="Trellis:" />\r
-                        <ComboBox Grid.Row="1"\r
-                                  Grid.Column="3"\r
-                                  Width="100"\r
-                                  Height="23"\r
-                                  MaxWidth="100"\r
-                                  HorizontalAlignment="Right"\r
-                                  VerticalAlignment="Top"\r
-                                  DisplayMemberPath="Label"\r
-                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.Trellis}"\r
-                                  SelectedItem="{Binding Trellis}"\r
-                                  Style="{StaticResource LongToolTipHolder}">\r
-                            <ComboBox.ToolTip>\r
-                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_TrellisToolTip}" />\r
-                            </ComboBox.ToolTip>\r
-                        </ComboBox>\r
-                    </Grid>\r
-                    \r
-                    <!-- PhysoVisual -->\r
-                    <TextBlock Text="Psychovisual: " Grid.Row="2" Margin="10,5,0,0" FontWeight="Bold"  />\r
-                    <Grid Grid.Row="3"\r
-                          Height="90"\r
-                          HorizontalAlignment="Left"\r
-                          VerticalAlignment="Top"\r
-                          >\r
-                        <Grid.RowDefinitions>\r
-                            <RowDefinition Height="Auto" />\r
-                            <RowDefinition Height="Auto" />\r
-                            <RowDefinition Height="Auto" />\r
-                        </Grid.RowDefinitions>\r
-                        <Grid.ColumnDefinitions>\r
-                            <ColumnDefinition Width="Auto" />\r
-                            <ColumnDefinition Width="Auto" MinWidth="100" />\r
-                            <ColumnDefinition Width="Auto" />\r
-                            <ColumnDefinition Width="Auto" />\r
-                        </Grid.ColumnDefinitions>\r
-\r
-                        <Label Grid.Row="0" Grid.Column="0"\r
-                               Content="Adaptive Quant Strength:"\r
-                               Style="{StaticResource AdvancedLabel}"\r
-                               />\r
-                        <Slider Grid.Row="0" Grid.Column="1"\r
-                                IsSnapToTickEnabled="True"\r
-                                LargeChange="0.2"\r
-                                Maximum="2.0"\r
-                                 Width="150"\r
-                                Minimum="0.0"\r
-                                SmallChange="0.1"\r
-                                Style="{StaticResource LongToolTipHolder}"\r
-                                TickFrequency="0.1"\r
-                                TickPlacement="BottomRight"\r
-                                Value="{Binding AdaptiveQuantizationStrength}"\r
-                                >\r
-                            <Slider.ToolTip>\r
-                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AdaptiveQuantizationStrengthToolTip}" />\r
-                            </Slider.ToolTip>\r
-                        </Slider>\r
-\r
-                        <Label Grid.Row="1" Grid.Column="0"\r
-                               Content="Rate Distortion:"\r
-                               Style="{StaticResource AdvancedLabel}"\r
-                               Visibility="{Binding PsychovisualRateDistortionVisible,\r
-                                                    Converter={StaticResource VisibilityConverter}}"\r
-                               />\r
-                        <Slider Grid.Row="1" Grid.Column="1"\r
-                                IsSnapToTickEnabled="True"\r
-                                LargeChange="0.2"\r
-                                Maximum="2.0"\r
-                                Minimum="0.0"\r
-                                Width="150"\r
-                                SmallChange="0.1"\r
-                                Style="{StaticResource LongToolTipHolder}"\r
-                                TickFrequency="0.1"\r
-                                TickPlacement="BottomRight"\r
-                                Visibility="{Binding PsychovisualRateDistortionVisible,\r
-                                                     Converter={StaticResource VisibilityConverter}}"\r
-                                Value="{Binding PsychovisualRateDistortion}"\r
-                                >\r
-                            <Slider.ToolTip>\r
-                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_PsychovisualRateDistortionToolTip}" />\r
-                            </Slider.ToolTip>\r
-                        </Slider>\r
-\r
-                        <Label Grid.Row="2" Grid.Column="0"\r
-                               Content="Psychovisual Trellis:"\r
-                               Style="{StaticResource AdvancedLabel}"\r
-                               Visibility="{Binding PsychovisualTrellisVisible,\r
-                                                    Converter={StaticResource VisibilityConverter}}"\r
-                               />\r
-                        <Slider Grid.Row="2" Grid.Column="1"\r
-                                IsSnapToTickEnabled="True"\r
-                                LargeChange="0.2"\r
-                                Maximum="1.0"\r
-                                Minimum="0.0"\r
-                                Width="150"\r
-                                SmallChange="0.05"\r
-                                Style="{StaticResource LongToolTipHolder}"\r
-                                TickFrequency="0.05"\r
-                                TickPlacement="BottomRight"\r
-                                Visibility="{Binding PsychovisualTrellisVisible,\r
-                                                     Converter={StaticResource VisibilityConverter}}"\r
-                                Value="{Binding PsychovisualTrellis}"\r
-                                >\r
-                            <Slider.ToolTip>\r
-                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_PsychovisualTrellisToolTip}" />\r
-                            </Slider.ToolTip>\r
-                        </Slider>\r
-\r
-                        <Label Grid.Row="0" Grid.Column="2"  Width="110"\r
-                                   HorizontalAlignment="Left"\r
-                                   VerticalAlignment="Center"\r
-                                   HorizontalContentAlignment="Right"\r
-                                   Content="No DCT-Decimate:"\r
-                                   />\r
-                        <CheckBox Grid.Row="0" Grid.Column="3"  HorizontalAlignment="Left"\r
-                                      VerticalAlignment="Center"\r
-                                      IsChecked="{Binding NoDctDecimate}"\r
-                                      Style="{StaticResource LongToolTipHolder}"\r
-                                      >\r
-                            <CheckBox.ToolTip>\r
-                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_NoDctDecimateToolTip}" />\r
-                            </CheckBox.ToolTip>\r
-                        </CheckBox>\r
-\r
-                        <Label Grid.Row="1"\r
-                               Grid.Column="2"\r
-                               Height="28"\r
-                               HorizontalAlignment="Right"\r
-                               VerticalAlignment="Top"\r
-                               Content="Deblocking:"\r
-                               />\r
-                        <StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="3" Grid.RowSpan="2">\r
-                            <ComboBox\r
-                                  Width="85"\r
-                                  Height="23"\r
-                                  MaxWidth="85"\r
-                                  HorizontalAlignment="Right"\r
-                                  VerticalAlignment="Top"\r
-                                  DisplayMemberPath="Label"\r
-                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DeblockingStrength}"\r
-                                  SelectedItem="{Binding DeblockingStrength}"\r
-                                  Style="{StaticResource LongToolTipHolder}"\r
-                                  >\r
-                                <ComboBox.ToolTip>\r
-                                    <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_DeblockingToolTip}" />\r
-                                </ComboBox.ToolTip>\r
-                            </ComboBox>\r
-                            <ComboBox \r
-                                  Width="85"\r
-                                  Height="23"\r
-                                  MaxWidth="85"\r
-                                  Margin="0,5,0,0"\r
-                                  HorizontalAlignment="Right"\r
-                                  VerticalAlignment="Top"\r
-                                  DisplayMemberPath="Label"\r
-                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DeblockingThreshold}"\r
-                                  SelectedItem="{Binding DeblockingThreshold}"\r
-                                  Style="{StaticResource LongToolTipHolder}"\r
-                                  >\r
-                                <ComboBox.ToolTip>\r
-                                    <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_DeblockingToolTip}" />\r
-                                </ComboBox.ToolTip>\r
-                            </ComboBox>\r
-                        </StackPanel>\r
-                       \r
-                    </Grid>\r
+        <ContentControl x:Name="X264ViewModel"\r
+                        Visibility="{Binding ShowX264Panel, Converter={StaticResource BooleanVisibilityConverter}}" />\r
 \r
-                </Grid>\r
+        <ContentControl x:Name="EncoderOptionsViewModel" \r
+                        Visibility="{Binding ShowSimplePanel, Converter={StaticResource BooleanVisibilityConverter}}" />\r
 \r
-            </Grid>\r
 \r
-        </StackPanel>\r
     </Grid>\r
 </UserControl>
\ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml b/win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml
new file mode 100644 (file)
index 0000000..c4e64d6
--- /dev/null
@@ -0,0 +1,28 @@
+<UserControl x:Class="HandBrakeWPF.Views.EncoderOptionsView"\r
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\r
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"\r
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"\r
+             x:Name="x264View"\r
+             mc:Ignorable="d"\r
+             >\r
+    <Grid>\r
+        <Grid.RowDefinitions>\r
+            <RowDefinition Height="Auto" />\r
+            <RowDefinition Height="100" />\r
+        </Grid.RowDefinitions>\r
+\r
+        <TextBlock Margin="10,5,10,0" Grid.Row="0"\r
+                           VerticalAlignment="Center"\r
+                           FontWeight="Bold"\r
+                           Text="Advanced Query"\r
+                           />\r
+        <TextBox Grid.Row="1"\r
+                         Margin="10,5,10,5"\r
+                         HorizontalAlignment="Stretch"\r
+                         VerticalAlignment="Stretch"\r
+                         Text="{Binding AdvancedOptionsString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"\r
+                         TextWrapping="Wrap"\r
+                         />\r
+    </Grid>\r
+</UserControl>
\ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml.cs b/win/CS/HandBrakeWPF/Views/EncoderOptionsView.xaml.cs
new file mode 100644 (file)
index 0000000..003d827
--- /dev/null
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="EncoderOptionsView.xaml.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   Interaction logic for EncoderOptionsView.xaml\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.Views\r
+{\r
+    using System.Windows.Controls;\r
+\r
+    /// <summary>\r
+    /// Interaction logic for AdvancedView.xaml\r
+    /// </summary>\r
+    public partial class EncoderOptionsView : UserControl\r
+    {\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="EncoderOptionsView"/> class. \r
+        /// </summary>\r
+        public EncoderOptionsView()\r
+        {\r
+            InitializeComponent();\r
+        }\r
+    }\r
+}\r
index 389a80791fc6b7ce0aec237e0d2dd4cd0e337528..83735e41436127b13b1dbbe89adaeaafea7ead5e 100644 (file)
@@ -88,8 +88,6 @@
                         <StackPanel Orientation="Vertical" Grid.Column="1" Margin="20,0,0,0">\r
                             <CheckBox Content="Check for Updates" IsChecked="{Binding CheckForUpdates}" />\r
                             <ComboBox Name="checkForUpdateFrequency" ItemsSource="{Binding CheckForUpdatesFrequencies}" SelectedIndex="{Binding CheckForUpdatesFrequency}" Margin="25,0,0,5" HorizontalAlignment="Left" Width="120"></ComboBox>\r
-\r
-                            <CheckBox Content="Enable Tooltips"  Visibility="Collapsed"  IsChecked="{Binding EnableGuiTooltips}" />\r
                         </StackPanel>\r
                     </StackPanel>\r
 \r
                         <StackPanel Orientation="Vertical" Grid.Column="1" Margin="20,0,0,0">\r
                             <CheckBox Content="Prevent the system from sleeping while encoding" IsChecked="{Binding PreventSleep}" />\r
                             <CheckBox Content="Minimize to system tray (Requires Restart)" IsChecked="{Binding MinimiseToTray}" />\r
-                            <CheckBox Content="Display status messages from tray icon (balloon popups)"  Visibility="Collapsed"  IsChecked="{Binding DisplayStatusMessagesTrayIcon}" />\r
                             <CheckBox Content="Disable built-in preset update notification" IsChecked="{Binding DisablePresetUpdateCheckNotification}" />\r
                             <CheckBox Content="Always clear completed queue items after an encode completes" IsChecked="{Binding ClearQueueOnEncodeCompleted}" />\r
                             <CheckBox Content="Show Advanced Tab" IsChecked="{Binding ShowAdvancedTab}" />\r
diff --git a/win/CS/HandBrakeWPF/Views/X264View.xaml b/win/CS/HandBrakeWPF/Views/X264View.xaml
new file mode 100644 (file)
index 0000000..b1c97e5
--- /dev/null
@@ -0,0 +1,539 @@
+<UserControl x:Class="HandBrakeWPF.Views.X264View"\r
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\r
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
+             xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"\r
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"\r
+             xmlns:Helpers="clr-namespace:HandBrakeWPF.Helpers"\r
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"\r
+             xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"\r
+             xmlns:controls="clr-namespace:HandBrakeWPF.Controls"\r
+             x:Name="x264View"\r
+             mc:Ignorable="d"\r
+             >\r
+    <UserControl.Resources>\r
+        <Converters:AdvancedVisibilityConverter x:Key="VisibilityConverter" />\r
+        <Converters:BooleanToVisibilityConverter x:Key="BooleanVisibilityConverter" />\r
+        <Style x:Key="AdvancedLabel" TargetType="Label">\r
+            <Setter Property="HorizontalAlignment" Value="Right" />\r
+        </Style>\r
+\r
+        <Style x:Key="LongToolTipHolder" TargetType="FrameworkElement">\r
+            <Setter Property="ToolTipService.ShowDuration" Value="20000" />\r
+            <Setter Property="Margin" Value="0,2,0,2" />\r
+        </Style>\r
+\r
+        <Style x:Key="LongToolTip" TargetType="TextBlock">\r
+            <Setter Property="Width" Value="400" />\r
+            <Setter Property="TextWrapping" Value="Wrap" />\r
+        </Style>\r
+\r
+      </UserControl.Resources>\r
+    <Grid>\r
+        <Grid.RowDefinitions>\r
+            <RowDefinition Height="Auto" />\r
+            <RowDefinition Height="Auto" />\r
+            <RowDefinition Height="Auto" />\r
+            <RowDefinition Height="*" />\r
+        </Grid.RowDefinitions>\r
+\r
+        <!-- X264 Query  -->\r
+\r
+        <TextBlock Text="{x:Static Properties:Resources.Advanced_NotInUse}" Grid.Row="0"\r
+                       TextWrapping="Wrap" Width="480" Margin="0, 100, 0, 0" FontSize="12"\r
+                       Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=true}" />\r
+\r
+        <Grid Grid.Row="1" Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}">\r
+            <Grid.RowDefinitions>\r
+                <RowDefinition Height="Auto" />\r
+                <RowDefinition Height="*" />\r
+            </Grid.RowDefinitions>\r
+            <Grid.ColumnDefinitions>\r
+                <ColumnDefinition Width="Auto" />\r
+                <ColumnDefinition Width="Auto" />\r
+            </Grid.ColumnDefinitions>\r
+\r
+            <!--  Left Column  -->\r
+            <StackPanel Grid.Row="0"\r
+                            Grid.Column="0"\r
+                            Orientation="Vertical"\r
+                            >\r
+                <!--  Encoding  -->\r
+                <StackPanel Orientation="Vertical">\r
+                    <TextBlock Grid.Row="0"\r
+                                   Margin="10,5,0,0"\r
+                                   FontWeight="Bold"\r
+                                   Text="Encoding: "\r
+                                   />\r
+                    <Grid Margin="0,5,0,0"\r
+                              HorizontalAlignment="Left"\r
+                              VerticalAlignment="Top"\r
+                              >\r
+                        <Grid.RowDefinitions>\r
+                            <RowDefinition Height="Auto" />\r
+                            <RowDefinition Height="Auto" />\r
+                            <RowDefinition Height="Auto" />\r
+                            <RowDefinition Height="Auto" />\r
+                            <RowDefinition Height="Auto" />\r
+                            <RowDefinition Height="Auto" />\r
+                            <RowDefinition Height="Auto" />\r
+                            <RowDefinition Height="Auto" />\r
+                        </Grid.RowDefinitions>\r
+                        <Grid.ColumnDefinitions>\r
+                            <ColumnDefinition Width="Auto" />\r
+                            <ColumnDefinition Width="*" MinWidth="100" />\r
+                        </Grid.ColumnDefinitions>\r
+\r
+                        <Label Grid.Row="0"\r
+                                   Grid.Column="0"\r
+                                   Content="Reference Frames:"\r
+                                   Style="{StaticResource AdvancedLabel}"\r
+                                   />\r
+                        <ComboBox Grid.Row="0"\r
+                                      Grid.Column="1"\r
+                                      Height="22"\r
+                                      DisplayMemberPath="Label"\r
+                                      ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.ReferenceFrames}"\r
+                                      SelectedItem="{Binding ReferenceFrames}"\r
+                                      Style="{StaticResource LongToolTipHolder}"\r
+                                      >\r
+                            <ComboBox.ToolTip>\r
+                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_ReferenceFramesToolTip}" />\r
+                            </ComboBox.ToolTip>\r
+                        </ComboBox>\r
+\r
+                        <Label Grid.Row="1"\r
+                                   Grid.Column="0"\r
+                                   Content="Maximum B-Frames:"\r
+                                   Style="{StaticResource AdvancedLabel}"\r
+                                   />\r
+                        <ComboBox Grid.Row="1"\r
+                                      Grid.Column="1"\r
+                                      Height="22"\r
+                                      DisplayMemberPath="Label"\r
+                                      ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.BFrames}"\r
+                                      SelectedItem="{Binding BFrames}"\r
+                                      Style="{StaticResource LongToolTipHolder}"\r
+                                      >\r
+                            <ComboBox.ToolTip>\r
+                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_BFramesToolTip}" />\r
+                            </ComboBox.ToolTip>\r
+                        </ComboBox>\r
+\r
+\r
+                        <Label Grid.Row="4"\r
+                                   Grid.Column="0"\r
+                                   Height="28"\r
+                                   Content="CABAC:"\r
+                                   Style="{StaticResource AdvancedLabel}"\r
+                                   />\r
+                        <CheckBox Grid.Row="4"\r
+                                      Grid.Column="1"\r
+                                      Height="16"\r
+                                      IsChecked="{Binding CabacEntropyCoding}"\r
+                                      Style="{StaticResource LongToolTipHolder}"\r
+                                      >\r
+                            <CheckBox.ToolTip>\r
+                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_CabacToolTip}" />\r
+                            </CheckBox.ToolTip>\r
+                        </CheckBox>\r
+\r
+                        <Label Grid.Row="5"\r
+                                   Grid.Column="0"\r
+                                   Height="28"\r
+                                   Content="8x8 Transform:"\r
+                                   Style="{StaticResource AdvancedLabel}"\r
+                                   />\r
+                        <CheckBox Grid.Row="5"\r
+                                      Grid.Column="1"\r
+                                      Height="16"\r
+                                      IsChecked="{Binding EightByEightDct}"\r
+                                      Style="{StaticResource LongToolTipHolder}">\r
+                            <CheckBox.ToolTip>\r
+                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_EightByEightDctToolTip}" />\r
+                            </CheckBox.ToolTip>\r
+                        </CheckBox>\r
+\r
+                        <Label Grid.Row="6"\r
+                                   Grid.Column="0"\r
+                                   Content="Weighted P-Frames:"\r
+                                   Style="{StaticResource AdvancedLabel}"\r
+                                   />\r
+                        <CheckBox Grid.Row="6"\r
+                                      Grid.Column="1"\r
+                                      VerticalAlignment="Center"\r
+                                      IsChecked="{Binding WeightedPFrames}"\r
+                                      Style="{StaticResource LongToolTipHolder}"\r
+                                      >\r
+                            <CheckBox.ToolTip>\r
+                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_WeightPToolTip}" />\r
+                            </CheckBox.ToolTip>\r
+                        </CheckBox>\r
+\r
+                        <Label Grid.Row="7"\r
+                                   Grid.Column="0"\r
+                                   Content="Pyramidal B-Frames:"\r
+                                   Style="{StaticResource AdvancedLabel}"\r
+                                   Visibility="{Binding PyramidalBFramesVisible,\r
+                                                        Converter={StaticResource VisibilityConverter}}"\r
+                                   />\r
+                        <ComboBox Grid.Row="7"\r
+                                      Grid.Column="1"\r
+                                      Height="22"\r
+                                      MaxWidth="100"\r
+                                      DisplayMemberPath="Label"\r
+                                      ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.PyramidalBFrames}"\r
+                                      SelectedItem="{Binding PyramidalBFrames}"\r
+                                      Style="{StaticResource LongToolTipHolder}"\r
+                                      Visibility="{Binding PyramidalBFramesVisible,\r
+                                                           Converter={StaticResource VisibilityConverter}}"\r
+                                      >\r
+                            <ComboBox.ToolTip>\r
+                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_PyramidalBFramesToolTip}" />\r
+                            </ComboBox.ToolTip>\r
+                        </ComboBox>\r
+                    </Grid>\r
+                </StackPanel>\r
+            </StackPanel>\r
+\r
+            <!--  Right Column  -->\r
+            <Grid Grid.Row="0" Grid.Column="1">\r
+                <Grid.RowDefinitions>\r
+                    <RowDefinition Height="Auto" />\r
+                    <RowDefinition Height="Auto" />\r
+                    <RowDefinition Height="Auto" />\r
+                    <RowDefinition Height="*" />\r
+                </Grid.RowDefinitions>\r
+                <Grid.ColumnDefinitions>\r
+                    <ColumnDefinition Width="Auto" />\r
+                </Grid.ColumnDefinitions>\r
+\r
+                <!-- Analysis -->\r
+                <TextBlock Text="Analysis: " Grid.Row="0" Margin="10,5,0,0" FontWeight="Bold"  />\r
+                <Grid Grid.Row="1"  HorizontalAlignment="Left" VerticalAlignment="Top">\r
+                    <Grid.RowDefinitions>\r
+                        <RowDefinition Height="Auto" />\r
+                        <RowDefinition Height="Auto" />\r
+                        <RowDefinition Height="Auto" />\r
+                        <RowDefinition Height="Auto" />\r
+                        <RowDefinition Height="Auto" />\r
+                    </Grid.RowDefinitions>\r
+                    <Grid.ColumnDefinitions>\r
+                        <ColumnDefinition Width="Auto" />\r
+                        <ColumnDefinition Width="Auto" MinWidth="100" />\r
+                        <ColumnDefinition Width="Auto" />\r
+                        <ColumnDefinition Width="Auto" />\r
+                    </Grid.ColumnDefinitions>\r
+\r
+                    <Label Content="Adaptive B-Frames:"\r
+                               Style="{StaticResource AdvancedLabel}"\r
+                               Visibility="{Binding BFramesOptionsVisible,\r
+                                                    Converter={StaticResource VisibilityConverter}}" Height="26" VerticalAlignment="Top" />\r
+                    <ComboBox Grid.Row="0"\r
+                                  Grid.Column="1"\r
+                                  Width="120"\r
+                                  Height="22"\r
+                                  MaxWidth="120"\r
+                                  DisplayMemberPath="Label"\r
+                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.AdaptiveBFrames}"\r
+                                  SelectedItem="{Binding AdaptiveBFrames}"\r
+                                  Style="{StaticResource LongToolTipHolder}"\r
+                                  Visibility="{Binding BFramesOptionsVisible,\r
+                                                       Converter={StaticResource VisibilityConverter}}"\r
+                                  >\r
+                        <ComboBox.ToolTip>\r
+                            <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AdaptiveBFramesToolTip}" />\r
+                        </ComboBox.ToolTip>\r
+                    </ComboBox>\r
+\r
+                    <Label Grid.Row="1"\r
+                               Grid.Column="0"\r
+                               Content="Adaptive Direct Mode:"\r
+                               Style="{StaticResource AdvancedLabel}"\r
+                               Visibility="{Binding BFramesOptionsVisible,\r
+                                                    Converter={StaticResource VisibilityConverter}}"\r
+                               />\r
+                    <ComboBox Grid.Row="1"\r
+                                  Grid.Column="1"\r
+                                  Width="120"\r
+                                  Height="22"\r
+                                  MaxWidth="120"\r
+                                  DisplayMemberPath="Label"\r
+                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DirectPrediction}"\r
+                                  SelectedItem="{Binding DirectPrediction}"\r
+                                  Style="{StaticResource LongToolTipHolder}"\r
+                                  Visibility="{Binding BFramesOptionsVisible,\r
+                                                       Converter={StaticResource VisibilityConverter}}"\r
+                                  >\r
+                        <ComboBox.ToolTip>\r
+                            <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AdaptiveDirectModeToolTip}" />\r
+                        </ComboBox.ToolTip>\r
+                    </ComboBox>\r
+\r
+                    <Label Grid.Row="2"\r
+                               Grid.Column="0"\r
+                               Content="Motion Est Method:"\r
+                               Style="{StaticResource AdvancedLabel}"\r
+                               />\r
+                    <ComboBox Grid.Row="2"\r
+                                  Grid.Column="1"\r
+                                  Width="120"\r
+                                  Height="22"\r
+                                  MaxWidth="120"\r
+                                  DisplayMemberPath="Label"\r
+                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.MotionEstimationMethod}"\r
+                                  SelectedItem="{Binding MotionEstimationMethod}"\r
+                                  Style="{StaticResource LongToolTipHolder}"\r
+                                  >\r
+                        <ComboBox.ToolTip>\r
+                            <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_MotionEstimationMethodToolTip}" />\r
+                        </ComboBox.ToolTip>\r
+                    </ComboBox>\r
+\r
+                    <Label Grid.Row="3"\r
+                               Grid.Column="0"\r
+                               Content="Subpixel Motion Est:"\r
+                               Style="{StaticResource AdvancedLabel}"\r
+                               />\r
+                    <ComboBox Grid.Row="3"\r
+                                  Grid.Column="1"\r
+                                  Width="120"\r
+                                  Height="22"\r
+                                  MaxWidth="120"\r
+                                  DisplayMemberPath="Label"\r
+                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.SubpixelMotionEstimation}"\r
+                                  SelectedItem="{Binding SubpixelMotionEstimation}"\r
+                                  Style="{StaticResource LongToolTipHolder}"\r
+                                  >\r
+                        <ComboBox.ToolTip>\r
+                            <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_SubpixelMotionEstimationToolTip}" />\r
+                        </ComboBox.ToolTip>\r
+                    </ComboBox>\r
+\r
+                    <Label Grid.Row="4"\r
+                               Grid.Column="0"\r
+                               Content="Motion Est Range:"\r
+                               Style="{StaticResource AdvancedLabel}" />\r
+                    <controls:NumberBox Grid.Row="4"\r
+                                            Grid.Column="1"\r
+                                            Width="120"\r
+                                            Height="22"\r
+                                            MaxWidth="120"\r
+                                            Minimum="4" Maximum="64"   \r
+                                            Number="{Binding MotionEstimationRange, Mode=TwoWay}"\r
+                                            ToolTip="{x:Static Properties:Resources.Advanced_MotionEstimationRangeToolTip}" \r
+                                            />\r
+\r
+\r
+                    <!-- Column 2 -->\r
+                    <Label Grid.Row="0" Grid.Column="2"\r
+                               Height="28"\r
+                               HorizontalAlignment="Right"\r
+                               VerticalAlignment="Top"\r
+                               Content="Partition Type:"\r
+                               />\r
+                    <ComboBox Grid.Row="0" Grid.Column="3"\r
+                                  Width="100"\r
+                                  Height="23"\r
+                                  MaxWidth="100"\r
+                                  HorizontalAlignment="Right"\r
+                                  VerticalAlignment="Top"\r
+                                  DisplayMemberPath="Label"\r
+                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.Analysis}"\r
+                                  SelectedItem="{Binding Analysis}"\r
+                                  Style="{StaticResource LongToolTipHolder}"\r
+                                  >\r
+                        <ComboBox.ToolTip>\r
+                            <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AnalysisToolTip}" />\r
+                        </ComboBox.ToolTip>\r
+                    </ComboBox>\r
+\r
+                    <Label Grid.Row="1" Grid.Column="2" Height="28" HorizontalAlignment="Right" VerticalAlignment="Top" Content="Trellis:" />\r
+                    <ComboBox Grid.Row="1"\r
+                                  Grid.Column="3"\r
+                                  Width="100"\r
+                                  Height="23"\r
+                                  MaxWidth="100"\r
+                                  HorizontalAlignment="Right"\r
+                                  VerticalAlignment="Top"\r
+                                  DisplayMemberPath="Label"\r
+                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.Trellis}"\r
+                                  SelectedItem="{Binding Trellis}"\r
+                                  Style="{StaticResource LongToolTipHolder}">\r
+                        <ComboBox.ToolTip>\r
+                            <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_TrellisToolTip}" />\r
+                        </ComboBox.ToolTip>\r
+                    </ComboBox>\r
+                </Grid>\r
+\r
+                <!-- PhysoVisual -->\r
+                <TextBlock Text="Psychovisual: " Grid.Row="2" Margin="10,5,0,0" FontWeight="Bold"  />\r
+                <Grid Grid.Row="3"\r
+                          Height="90"\r
+                          HorizontalAlignment="Left"\r
+                          VerticalAlignment="Top"\r
+                          >\r
+                    <Grid.RowDefinitions>\r
+                        <RowDefinition Height="Auto" />\r
+                        <RowDefinition Height="Auto" />\r
+                        <RowDefinition Height="Auto" />\r
+                    </Grid.RowDefinitions>\r
+                    <Grid.ColumnDefinitions>\r
+                        <ColumnDefinition Width="Auto" />\r
+                        <ColumnDefinition Width="Auto" MinWidth="100" />\r
+                        <ColumnDefinition Width="Auto" />\r
+                        <ColumnDefinition Width="Auto" />\r
+                    </Grid.ColumnDefinitions>\r
+\r
+                    <Label Grid.Row="0" Grid.Column="0"\r
+                               Content="Adaptive Quant Strength:"\r
+                               Style="{StaticResource AdvancedLabel}"\r
+                               />\r
+                    <Slider Grid.Row="0" Grid.Column="1"\r
+                                IsSnapToTickEnabled="True"\r
+                                LargeChange="0.2"\r
+                                Maximum="2.0"\r
+                                 Width="150"\r
+                                Minimum="0.0"\r
+                                SmallChange="0.1"\r
+                                Style="{StaticResource LongToolTipHolder}"\r
+                                TickFrequency="0.1"\r
+                                TickPlacement="BottomRight"\r
+                                Value="{Binding AdaptiveQuantizationStrength}"\r
+                                >\r
+                        <Slider.ToolTip>\r
+                            <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_AdaptiveQuantizationStrengthToolTip}" />\r
+                        </Slider.ToolTip>\r
+                    </Slider>\r
+\r
+                    <Label Grid.Row="1" Grid.Column="0"\r
+                               Content="Rate Distortion:"\r
+                               Style="{StaticResource AdvancedLabel}"\r
+                               Visibility="{Binding PsychovisualRateDistortionVisible,\r
+                                                    Converter={StaticResource VisibilityConverter}}"\r
+                               />\r
+                    <Slider Grid.Row="1" Grid.Column="1"\r
+                                IsSnapToTickEnabled="True"\r
+                                LargeChange="0.2"\r
+                                Maximum="2.0"\r
+                                Minimum="0.0"\r
+                                Width="150"\r
+                                SmallChange="0.1"\r
+                                Style="{StaticResource LongToolTipHolder}"\r
+                                TickFrequency="0.1"\r
+                                TickPlacement="BottomRight"\r
+                                Visibility="{Binding PsychovisualRateDistortionVisible,\r
+                                                     Converter={StaticResource VisibilityConverter}}"\r
+                                Value="{Binding PsychovisualRateDistortion}"\r
+                                >\r
+                        <Slider.ToolTip>\r
+                            <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_PsychovisualRateDistortionToolTip}" />\r
+                        </Slider.ToolTip>\r
+                    </Slider>\r
+\r
+                    <Label Grid.Row="2" Grid.Column="0"\r
+                               Content="Psychovisual Trellis:"\r
+                               Style="{StaticResource AdvancedLabel}"\r
+                               Visibility="{Binding PsychovisualTrellisVisible,\r
+                                                    Converter={StaticResource VisibilityConverter}}"\r
+                               />\r
+                    <Slider Grid.Row="2" Grid.Column="1"\r
+                                IsSnapToTickEnabled="True"\r
+                                LargeChange="0.2"\r
+                                Maximum="1.0"\r
+                                Minimum="0.0"\r
+                                Width="150"\r
+                                SmallChange="0.05"\r
+                                Style="{StaticResource LongToolTipHolder}"\r
+                                TickFrequency="0.05"\r
+                                TickPlacement="BottomRight"\r
+                                Visibility="{Binding PsychovisualTrellisVisible,\r
+                                                     Converter={StaticResource VisibilityConverter}}"\r
+                                Value="{Binding PsychovisualTrellis}"\r
+                                >\r
+                        <Slider.ToolTip>\r
+                            <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_PsychovisualTrellisToolTip}" />\r
+                        </Slider.ToolTip>\r
+                    </Slider>\r
+\r
+                    <Label Grid.Row="0" Grid.Column="2"  Width="110"\r
+                                   HorizontalAlignment="Left"\r
+                                   VerticalAlignment="Center"\r
+                                   HorizontalContentAlignment="Right"\r
+                                   Content="No DCT-Decimate:"\r
+                                   />\r
+                    <CheckBox Grid.Row="0" Grid.Column="3"  HorizontalAlignment="Left"\r
+                                      VerticalAlignment="Center"\r
+                                      IsChecked="{Binding NoDctDecimate}"\r
+                                      Style="{StaticResource LongToolTipHolder}"\r
+                                      >\r
+                        <CheckBox.ToolTip>\r
+                            <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_NoDctDecimateToolTip}" />\r
+                        </CheckBox.ToolTip>\r
+                    </CheckBox>\r
+\r
+                    <Label Grid.Row="1"\r
+                               Grid.Column="2"\r
+                               Height="28"\r
+                               HorizontalAlignment="Right"\r
+                               VerticalAlignment="Top"\r
+                               Content="Deblocking:"\r
+                               />\r
+                    <StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="3" Grid.RowSpan="2">\r
+                        <ComboBox\r
+                                  Width="85"\r
+                                  Height="23"\r
+                                  MaxWidth="85"\r
+                                  HorizontalAlignment="Right"\r
+                                  VerticalAlignment="Top"\r
+                                  DisplayMemberPath="Label"\r
+                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DeblockingStrength}"\r
+                                  SelectedItem="{Binding DeblockingStrength}"\r
+                                  Style="{StaticResource LongToolTipHolder}"\r
+                                  >\r
+                            <ComboBox.ToolTip>\r
+                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_DeblockingToolTip}" />\r
+                            </ComboBox.ToolTip>\r
+                        </ComboBox>\r
+                        <ComboBox \r
+                                  Width="85"\r
+                                  Height="23"\r
+                                  MaxWidth="85"\r
+                                  Margin="0,5,0,0"\r
+                                  HorizontalAlignment="Right"\r
+                                  VerticalAlignment="Top"\r
+                                  DisplayMemberPath="Label"\r
+                                  ItemsSource="{x:Static Helpers:AdvancedChoicesHelper.DeblockingThreshold}"\r
+                                  SelectedItem="{Binding DeblockingThreshold}"\r
+                                  Style="{StaticResource LongToolTipHolder}"\r
+                                  >\r
+                            <ComboBox.ToolTip>\r
+                                <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Advanced_DeblockingToolTip}" />\r
+                            </ComboBox.ToolTip>\r
+                        </ComboBox>\r
+                    </StackPanel>\r
+\r
+                </Grid>\r
+\r
+            </Grid>\r
+\r
+        </Grid>\r
+        \r
+        <TextBlock Grid.Row="2" Margin="10,5,10,0"\r
+                   VerticalAlignment="Center"\r
+                   FontWeight="Bold"\r
+                   Text="x264 Encoder Options:"\r
+                   Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}" />\r
+        \r
+        <TextBox Grid.Row="3"\r
+                 Margin="10,2,10, 2"\r
+                 MinHeight="50"\r
+                 HorizontalAlignment="Stretch"\r
+                 VerticalAlignment="Stretch"\r
+                 Style="{StaticResource LongToolTipHolder}"\r
+                 ToolTip="{x:Static Properties:Resources.Advanced_EncoderOptions}"\r
+                 Text="{Binding AdvancedOptionsString, UpdateSourceTrigger=PropertyChanged}"\r
+                 TextWrapping="Wrap"\r
+                 Visibility="{Binding ShowX264AdvancedOptions, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=false}"\r
+                 />\r
+    </Grid>\r
+</UserControl>
\ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Views/X264View.xaml.cs b/win/CS/HandBrakeWPF/Views/X264View.xaml.cs
new file mode 100644 (file)
index 0000000..7c7f9be
--- /dev/null
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="AdvancedView.xaml.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   Interaction logic for AdvancedView.xaml\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.Views\r
+{\r
+    using System.Windows.Controls;\r
+\r
+    /// <summary>\r
+    /// Interaction logic for AdvancedView.xaml\r
+    /// </summary>\r
+    public partial class X264View : UserControl\r
+    {\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="AdvancedView"/> class.\r
+        /// </summary>\r
+        public X264View()\r
+        {\r
+            InitializeComponent();\r
+        }\r
+    }\r
+}\r