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
--- /dev/null
+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;
+ }
## 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
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;
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
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
</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">
<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>
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 },
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; }
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) &&
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;
}
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
{
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)
{
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;
int rate;
};
+struct hb_dither_s
+{
+ const char *description;
+ const char *short_name;
+ int method;
+};
+
struct hb_mixdown_s
{
const char *human_readable_name;
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[];
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();
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);
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;
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))
{
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;
}
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
{
len = pbuffer_size = buf->size;
}
pos += len;
- if ( pbuffer_size > 0 )
+ if (pbuffer_size > 0)
{
int got_frame;
AVFrame frame = { { 0 } };
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;
}
}
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");
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;
/* 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" );
/* 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" );
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 );
}
/**
hb_lock( h->state_lock );
h->state.state = HB_STATE_PAUSED;
hb_unlock( h->state_lock );
+
+ hb_allow_sleep( h );
}
}
{
if( h->paused )
{
+ hb_prevent_sleep( h );
+
#define job hb_current_job( h )
if( job->st_pause_date != -1 )
{
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 )
{
**********************************************************************/
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
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 * );
#include <sys/ioctl.h>
#endif
+#ifdef __APPLE__
+#include <IOKit/pwr_mgt/IOPMLib.h>
+#endif
+
#include <stddef.h>
#include <unistd.h>
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
+}
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
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;
* @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 );
}
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 );
{
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 )
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);
+ }
}
}
// width or height may have changed, unparse
[self x264PresetsChangedDisplayExpandedOptions:nil];
- //[fPictureController reloadStillPreview];
+ [fPictureController decombDeinterlacePreviewImage];
}
<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>
<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>
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);
[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 ***
- (IBAction) modeDecombDeinterlaceSliderChanged: (id) sender;
- (IBAction) deblockSliderChanged: (id) sender;
+- (void) decombDeinterlacePreviewImage;
+
- (int) detelecine;
- (NSString*) detelecineCustomString;
- (void) setDetelecine: (int) setting;
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];
- }
}
fPictureFilterSettings.grayscale = [fGrayscaleCheck state];
+ [self decombDeinterlacePreviewImage];
+
if (sender != nil)
{
[fHBController pictureSettingsDidChange];
}
-
+- (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
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
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;
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);
str_vfree(abitrates);
str_vfree(acompressions);
str_vfree(aqualities);
+ str_vfree(audio_dither);
free(acodecs);
free(arates);
free(atracks);
}
/* 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;
" 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"
#define H264_LEVEL 286
#define NO_OPENCL 287
#define NORMALIZE_MIX 288
+ #define AUDIO_DITHER 288
for( ;; )
{
{ "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 },
audio_gain = strdup( optarg );
}
break;
+ case AUDIO_DITHER:
+ if (optarg != NULL)
+ {
+ audio_dither = str_split(optarg, ',');
+ }
+ break;
case NORMALIZE_MIX:
if( optarg != NULL )
{
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;
{\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
{\r
this.IsEncoding = false;\r
this.instance.StopEncode();\r
- } \r
- catch(Exception)\r
+ }\r
+ catch (Exception)\r
{\r
// Do Nothing.\r
}\r
/// <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
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
/// <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
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
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
/// </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
// </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
// </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
// </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
// </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
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
/// <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
\r
if (this.ScanCompleted != null)\r
{\r
- this.ScanCompleted(this, new EventArgs());\r
+ this.ScanCompleted(this, new System.EventArgs());\r
}\r
}\r
}\r
</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
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
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
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
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
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
namespace HandBrake.Interop\r
{\r
using System.Collections.Generic;\r
+ using System.Linq;\r
\r
/// <summary>\r
/// Contains utilities for converting language codes.\r
{\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
\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
-// --------------------------------------------------------------------------------------------------------------------
-// <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; }
}
}
\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
// <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
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
-// --------------------------------------------------------------------------------------------------------------------
-// <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
\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
\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
\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
\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
{\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
{\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
\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
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
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
/// <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
{\r
using System.ComponentModel.DataAnnotations;\r
\r
+ /// <summary>\r
+ /// The input type.\r
+ /// </summary>\r
public enum InputType\r
{\r
[Display(Name = "File")]\r
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
\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
\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
{\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
{\r
using HandBrake.Interop.Model.Encoding;\r
\r
+ /// <summary>\r
+ /// The utilities.\r
+ /// </summary>\r
public static class Utilities\r
{\r
/// <summary>\r
/// The b.\r
/// </param>\r
/// <returns>\r
+ /// The greatest common factor\r
/// </returns>\r
public static int GreatestCommonFactor(int a, int b)\r
{\r
{\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
<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
\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
\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
/// </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
/// </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
/// </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
/// </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
/// </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
/// </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
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\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
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\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
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\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
}\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
\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
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
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
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
/// <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
/// <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
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
{\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
set\r
{\r
this.isEncoding = value;\r
+ this.CanPlay = !value;\r
+ this.NotifyOfPropertyChange(() => this.CanPlay);\r
this.NotifyOfPropertyChange(() => this.IsEncoding);\r
}\r
}\r
/// </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
}\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
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
{\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
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\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
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
--- /dev/null
+<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
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\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
<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
--- /dev/null
+<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
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\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