2 * Adds advanced firefogg support (let you control and structure advanced controls over many aspects of video encoding)
5 //@@todo put all msg text into loadGM json
8 "fogg-help-sticky" : "Help (click to stick)",
9 "fogg-cg-preset" : "Preset: <strong>$1<\/strong>",
10 "fogg-cg-quality" : "Basic quality and resolution control",
11 "fogg-cg-meta" : "Metadata for the clip",
12 "fogg-cg-range" : "Encoding range",
13 "fogg-cg-advVideo" : "Advanced video encoding controls",
14 "fogg-cg-advAudio" : "Advanced audio encoding controls",
15 "fogg-preset-custom" : "Custom settings",
16 "fogg-webvideo-desc" : "Web video Theora, Vorbis 400 kbit\/s and 400px maximum width",
17 "fogg-savebandwith-desc" : "Low bandwith Theora, Vorbis 164 kbit\/s and 200px maximum width",
18 "fogg-highquality-desc" : "High quality Theora, Vorbis 1080px maximum width",
19 "fogg-videoQuality-title" : "Video quality",
20 "fogg-videoQuality-help" : "Used to set the <i>visual quality<\/i> of the encoded video (not used if you set bitrate in advanced controls below).",
21 "fogg-starttime-title" : "Start second",
22 "fogg-starttime-help" : "Only encode from time in seconds",
23 "fogg-endtime-title" : "End second",
24 "fogg-endtime-help" : "Only encode to time in seconds",
25 "fogg-audioQuality-title" : "Audio quality",
26 "fogg-audioQuality-help" : "Used to set the <i>acoustic quality<\/i> of the encoded audio (not used if you set bitrate in advanced controls below).",
27 "fogg-videoCodec-title" : "Video codec",
28 "fogg-videoCodec-help" : "Used to select the clip video codec. Presently only Theora is supported. More about the <a target=\"_new\" href=\"http:\/\/en.wikipedia.org\/wiki\/Theora\">Theora codec<\/a>.",
29 "fogg-audioCodec-title" : "Audio codec",
30 "fogg-audioCodec-help" : "Used to set the clip audio codec. Presently only Vorbis is supported. More about the <a target=\"_new\" href=\"http:\/\/en.wikipedia.org\/wiki\/Vorbis\">vorbis codec<\/a>",
31 "fogg-width-title" : "Video width",
32 "fogg-width-help" : "Resize to given width.",
33 "fogg-height-title" : "Video height",
34 "fogg-height-help" : "Resize to given height.",
35 "fogg-videoBitrate-title" : "Video bitrate",
36 "fogg-videoBitrate-help" : "Video bitrate sets the encoding bitrate for video in (kb\/s)",
37 "fogg-twopass-title" : "Two pass encoding",
38 "fogg-twopass-help" : "Two pass encoding enables more constant quality by making two passes over the video file",
39 "fogg-framerate-title" : "Frame rate",
40 "fogg-framerate-help" : "The video frame rate. More about <a target=\"_new\" href=\"http:\/\/en.wikipedia.org\/wiki\/Frame_rate\">frame rate<\/a>.",
41 "fogg-aspect-title" : "Aspect ratio",
42 "fogg-aspect-help" : "The video aspect ratio can be fraction 4:3 or 16:9. More about <a target=\"_new\" href=\"http:\/\/en.wikipedia.org\/wiki\/Aspect_ratio_%28image%29\">aspect ratios<\/a>.",
43 "fogg-keyframeInterval-title" : "Key frame interval",
44 "fogg-keyframeInterval-help" : "The keyframe interval in frames. Note: Most codecs force keyframes if the difference between frames is greater than keyframe encode size. More about <a href=\"http:\/\/en.wikipedia.org\/wiki\/I-frame\">keyframes<\/a>.",
45 "fogg-denoise-title" : "Denoise filter",
46 "fogg-denoise-help" : "Denoise input video. More about <a href=\"http:\/\/en.wikipedia.org\/wiki\/Video_denoising\">denoise<\/a>.",
47 "fogg-novideo-title" : "No video",
48 "fogg-novideo-help" : "disable video in the output",
49 "fogg-audioBitrate-title" : "Audio bitrate",
50 "fogg-samplerate-title" : "Audio sampling rate",
51 "fogg-samplerate-help" : "set output samplerate (in Hz).",
52 "fogg-noaudio-title" : "No audio",
53 "fogg-noaudio-help" : "disable audio in the output",
54 "fogg-title-title" : "Title",
55 "fogg-title-help" : "A title for your clip",
56 "fogg-artist-title" : "Creator name",
57 "fogg-artist-help" : "The creator of this clip",
58 "fogg-date-title" : "Date",
59 "fogg-date-help" : "The date the footage was created or released",
60 "fogg-location-title" : "Location",
61 "fogg-location-help" : "The location of the footage",
62 "fogg-organization-title" : "Organization",
63 "fogg-organization-help" : "Name of organization (studio)",
64 "fogg-copyright-title" : "Copyright",
65 "fogg-copyright-help" : "The copyright of the clip",
66 "fogg-license-title" : "License",
67 "fogg-license-help" : "The license of the clip (preferably a Creative Commons URL).",
68 "fogg-contact-title" : "Contact",
69 "fogg-contact-help" : "Contact link"
72 var mvAdvFirefogg = function( iObj
){
73 return this.init( iObj
);
75 var default_mvAdvFirefogg_config
= {
76 //which config groups to include
77 'config_groups' : ['preset', 'range', 'quality', 'meta', 'advVideo', 'advAudio'],
79 //if you want to load any custom presets must follow the mvAdvFirefogg.presetConf json outline below
80 'custom_presets' : {},
82 //any firefog config properties that may need to be excluded from options
83 'exclude_settings' : [],
85 //the control container (where we put all the controls)
86 'target_control_container':false
89 mvAdvFirefogg
.prototype = {
90 //the global groupings and titles for for configuration options :
91 config_groups
: [ 'preset', 'range', 'quality', 'meta', 'advVideo', 'advAudio'],
93 //local instance encoder config:
94 default_local_settings
:{
97 'selectVal': ['webvideo'],
101 'descKey': 'fogg-preset-custom',
105 'desc': gM('fogg-webvideo-desc'),
108 'videoBitrate' : 544,
110 'noUpscaling' : true,
114 'desc': gM('fogg-savebandwith-desc'),
117 'videoBitrate' : 164,
119 'samplerate' : 22050,
126 'desc': gM('fogg-highquality-desc'),
131 'noUpscaling' : true,
138 //core firefogg default encoder configuration
139 //see encoder options here: http://www.firefogg.org/dev/index.html
142 default_encoder_config
: {
143 //base quality settings:
146 'range' : {'min':0,'max':10},
160 'range' : {'min':-1,'max':10},
166 'selectVal' : ['theora'],
172 'selectVal' : ['vorbis'],
177 'range' : {'min':0,'max':1080},
183 'range' : {'min':0,'max':1080},
188 //advanced Video control configs:
190 'range' : {'min':1, 'max':16778},
192 'group' : "advVideo",
200 'selectVal' : ['12', '16', {'24000:1001':'23.97'}, '24', '25', {'30000:1001':'29.97'}, '30'],
207 'selectVal' : ['4:3', '16:9'],
212 'range' : {'min':0,'max':65536},
213 'numberType': 'force keyframe every $1 frames',
226 //advanced Audio control Config:
228 'range' : {'min':32,'max':500},
229 'numberType': '$1 kbs',
234 'selectVal' : [{'22050':'22 kHz'}, {'44100':'44 khz'}, {'48000':'48 khz'}],
235 'formatSelect' : function(val
){
236 return (Math
.round(val
/100)*10) + ' Hz';
277 init:function( iObj
){
278 //setup a "supported" iObj:
280 if( typeof default_mvAdvFirefogg_config
[i
] != 'undefined' ){
284 //inherit the base mvFirefogg class:
285 var myFogg
= new mvFirefogg( iObj
);
286 for(var i
in myFogg
){
287 if( typeof this[i
] != 'undefined'){
288 this[ 'basefogg_' + i
] = myFogg
[i
];
290 this[ i
] = myFogg
[i
];
294 setupForm:function(){
295 //call base firefogg form setup
296 basefogg_setupForm();
298 //gennerate the control html
299 this.doControlHTML();
301 //setup control bindings:
302 this.doControlBindings();
305 doControlHTML: function(){
306 js_log("adv doControlHTML");
308 //load presets from cookie:
309 this.loadEncSettings();
311 //add base control buttons:
312 this.basefogg_doControlHTML();
314 //build the config group outpouts
316 $j
.each(this.config_groups
, function(inx
, group_key
){
318 '<h3><a href="#" class="gd_'+group_key
+'" >' + gM('fogg-cg-'+group_key
) + '</a></h3>'+
320 //output that group control options:
321 gdout
+='<table width="' + ($j(_this
.selector
).width()-60) + '" ><tr><td width="35%"></td><td width="65%"></td></tr>';
322 //output the special prset output
323 if(group_key
=='preset'){
324 gdout
+= _this
.proccessPresetControl();
326 for(var cK
in _this
.default_encoder_config
){
327 var cConf
= _this
.default_encoder_config
[cK
];
328 if(cConf
.group
== group_key
){
329 gdout
+= _this
.proccessCkControlHTML( cK
);
337 //add the control container:
338 if(!this.target_control_container
){
339 this.target_control_container
= this.selector
+ ' .control_container';
340 //set the target contorl container to height
341 $j(this.selector
).append( '<p><div class="control_container"></div>' );
343 //hide the container and add the output
344 $j(this.target_control_container
).hide();
345 $j(this.target_control_container
).html( gdout
);
348 //custom advanced target rewrites:
349 getTargetHtml:function(target
){
350 if( target
=='target_btn_select_file' ||
351 target
=='target_btn_select_new_file'||
352 target
=='target_btn_save_local_file'){
353 var icon
= (target
=='target_btn_save_local_file')?'ui-icon-video':'ui-icon-folder-open';
354 return '<a class="ui-state-default ui-corner-all ui-icon_link '+
355 target
+'" href="#"><span class="ui-icon ' + icon
+ '"/>' +
356 gM( 'fogg-' + target
.substring(11) ) +
358 }else if( target
=='target_btn_select_url'){
359 //return the btnHtml:
360 return $j
.btnHtml( gM( 'fogg-' + target
.substring(11) ), target
, 'link');
362 }else if( target
=='target_use_latest_fox' ||
363 target
=='target_please_install' ||
364 target
== 'target_passthrough_mode'){
365 return '<div style="margin-top:1em;padding: 0pt 0.7em;" class="ui-state-error ui-corner-all ' +
367 '<p><span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-alert"/>'+
368 gM( 'fogg-' + target
.substring(7)) +'</p>'+
370 }else if( target
== 'target_input_file_name'){
371 return '<br><br><input style="" class="text ui-widget-content ui-corner-all ' + target
+ '" '+
372 'type="text" value="' + gM( 'fogg-' + target
.substring(11)) + '" size="60" /> ';
374 js_log('call : basefogg_getTargetHtml');
375 return this.basefogg_getTargetHtml(target
);
378 proccessPresetControl:function(){
381 js_log('proccessPresetControl::');
382 if(typeof this.local_settings
.pSet
!= 'undefined' ){
383 out
+= '<select class="_preset_select">';
384 $j
.each(this.local_settings
.pSet
, function(pKey
, pSet
){
385 var pDesc
= (pSet
.descKey
) ? gM(pSet
.descKey
) : pSet
.desc
;
386 var sel
= (_this
.local_settings
.d
== pKey
)?' selected':'';
387 out
+='<option value="'+pKey
+'" '+sel
+'>'+ pDesc
+'</option>';
393 proccessCkControlHTML:function( cK
){
394 var cConf
= this.default_encoder_config
[cK
];
396 out
+='<tr><td valign="top">'+
397 '<label for="_' + cK
+ '">' +
398 gM( 'fogg-' + cK
+ '-title') + ':' +
399 '<span title="' + gM('fogg-help-sticky') + '" class="help_'+ cK
+ ' ui-icon ui-icon-info" style="float:left"></span>'+
400 '</label></td><td valign="top">';
401 //if we don't value for this:
402 var dv
= ( this.default_encoder_config
[cK
].d
) ? this.default_encoder_config
[cK
].d
: '';
403 //switch on the config type
404 switch( cConf
.type
){
409 var size
= ( cConf
.type
=='string' ||cConf
.type
== 'date' )?'14':'4';
410 out
+= '<input size="' + size
+ '" type="text" class="_' + cK
+ ' text ui-widget-content ui-corner-all" value="' + dv
+ '" >' ;
413 var checked_attr
= (dv
===true)?' checked="true"':'';
414 out
+='<input type="checkbox" class="_'+cK
+ ' ui-widget-content ui-corner-all" ' + checked_attr
+ '>';
417 var strMax
= this.default_encoder_config
[ cK
].range
.max
+ '';
418 maxdigits
= strMax
.length
+1;
419 out
+= '<input type="text" maxlength="'+maxdigits
+'" size="' +maxdigits
+ '" '+
420 'class="_'+cK
+ ' text ui-widget-content ui-corner-all" style="display:inline;border:0; color:#f6931f; font-weight:bold;" ' +
421 'value="' + dv
+ '" >' +
422 '<div class="slider_' + cK
+ '"></div>';
425 out
+= '<select class="_' + cK
+ '">'+
426 '<option value=""> </option>';
427 for(var i
in cConf
.selectVal
){
428 var val
= cConf
.selectVal
[i
];
429 if(typeof val
== 'string'){
430 var sel
= ( cConf
.selectVal
[i
] == val
)?' selected':'';
431 out
+= '<option value="'+val
+'"'+sel
+'>'+val
+'</option>';
432 }else if(typeof val
== 'object'){
436 var sel
= ( cConf
.selectVal
[i
] == key
)?' selected':'';
438 out
+= '<option value="'+key
+'"'+sel
+'>'+hr_val
+'</option>';
444 //output the help row:
445 out
+='<div class="helpRow_' + cK
+ '">'+
446 '<span class="helpClose_' + cK
+ ' ui-icon ui-icon-circle-close" '+
447 'title="Close Help"'+
448 'style="float:left"/>'+
449 gM('fogg-'+ cK
+ '-help') +
451 out
+='</td></tr><tr><td colspan="2" height="10"></td></tr>';
454 selectByUrl:function(){
455 var urlValue
= prompt("Please enter the source media url you would like to transcode from.","http://");
458 this.sourceMode
= 'url';
459 this.sourceUrl
= urlValue
;
460 this.selectFoggActions();
461 this.autoEncoderSettings();
462 //update the input target
463 $j(this.target_input_file_name
).unbind().val( urlValue
).removeAttr('readonly');
466 doControlBindings:function(){
468 _this
.basefogg_doControlBindings();
469 //show the select by url if present:
470 /*$j( this.target_btn_select_url ).unbind(
471 ).attr('disabled', false
472 ).css({'display':'inline'}
479 //hide the base advanced controls untill a file is selected:
480 $j(this.target_control_container
).hide();
483 //do some display tweeks:
484 js_log('tw:' + $j(this.selector
).width() +
485 'ssf:' + $j(this.target_btn_select_new_file
).width() +
486 'sf:' + $j(this.target_btn_save_local_file
).width() );
489 $j(this.target_input_file_name
).width( 250 );
491 //special preset action:
492 $j(this.selector
+ ' ._preset_select').change(function(){
493 _this
.updatePresetSelection( $j(this).val() );
496 //bind control actions
497 for(var cK
in this.default_encoder_config
){
498 var cConf
= this.default_encoder_config
[cK
];
500 //initial state is hidden:
501 $j( this.selector
+ ' .helpRow_' + cK
).hide();
502 $j(this.selector
+ ' .help_' + cK
).click(function(){
503 //get the ckId (assume its the last class)
504 var cK
= _this
.getClassId(this, 'help_');
507 $j(_this
.selector
+ ' .helpRow_' + cK
).hide('slow');
508 helpState
[cK
] = false;
510 $j(_this
.selector
+ ' .helpRow_' + cK
).show('slow');
511 helpState
[cK
] = true;
516 //get the ckId (assume its the last class)
517 var cK
= _this
.getClassId(this, 'help_');
518 $j( _this
.selector
+ ' .helpRow_' + cK
).show('slow');
520 var cK
= _this
.getClassId(this, 'help_');
522 $j( _this
.selector
+ ' .helpRow_' + cK
).hide('slow')
525 $j( _this
.selector
+ ' .helpClose_' + cK
).click(function(){
526 js_log("close help: " +cK
);
527 //get the ckId (assume its the last class)
528 var cK
= _this
.getClassId(this, 'helpClose_');
529 $j(_this
.selector
+ ' .helpRow_' + cK
).hide('slow');
530 helpState
[cK
] = false;
532 }).css('cursor', 'pointer');
534 //setup bindings for change values: (validate input)
536 switch( cConf
.type
){
538 $j(_this
.selector
+ ' ._'+cK
).click(function(){
539 _this
.updateLocalValue( _this
.getClassId(this), $j(this).is(":checked") );
540 _this
.updatePresetSelection('custom');
547 //@@check if we have a validate function on the string
548 $j(_this
.selector
+ ' ._'+cK
).change(function(){
549 $j(this).val( _this
.updateLocalValue(
550 _this
.getClassId(this),
552 _this
.updatePresetSelection('custom');
556 $j(_this
.selector
+ ' ._'+cK
).datepicker({
559 dateFormat
: 'd MM, yy',
560 onSelect: function(dateText
) {
561 _this
.updateInterfaceValue(_this
.getClassId(this), dateText
);
566 $j(this.selector
+ ' .slider_' + cK
).slider({
569 step
: (cConf
.step
)?cConf
.step
:1,
570 value
: $j( this.selector
+' ._' + cK
).val(),
571 min
: this.default_encoder_config
[ cK
].range
.min
,
572 max
: this.default_encoder_config
[ cK
].range
.max
,
573 slide: function(event
, ui
) {
574 $j( _this
.selector
+ ' ._' + _this
.getClassId(this, 'slider_') ).val( ui
.value
);
576 //maintain source video aspect ratio:
577 if(_this
.getClassId(this, 'slider_') == 'width'){
578 var hv
= parseInt((_this
.sourceFileInfo
.video
[0]['height']/_this
.sourceFileInfo
.video
[0]['width'])* ui
.value
);
579 //update the height value: the new hight value is > that orginal the slider:
580 if(hv
> _this
.updateInterfaceValue('height', hv
))
583 if(_this
.getClassId(this, 'slider_') == 'height'){
584 var wv
= parseInt((_this
.sourceFileInfo
.video
[0]['width']/_this
.sourceFileInfo
.video
[0]['height'])* ui
.value
);
585 //update the height value: the new hight value is > that orginal the slider:
586 if(wv
> _this
.updateInterfaceValue('width', wv
))
590 change: function(event
, ui
){
591 //update the local settings
592 _this
.updateLocalValue( _this
.getClassId(this, 'slider_'), ui
.value
);
593 _this
.updatePresetSelection('custom');
596 $j( this.selector
+' ._' + cK
).change(function(){
597 var scid
= _this
.getClassId(this);
598 var valdVal
= _this
.updateLocalValue(scid
.substr(1),$j(this).val() );
599 _this
.updatePresetSelection('custom');
600 //(validate user form input)
601 $j(this).val(valdVal
);
603 js_log("update: " + _this
.selector
+ ' .slider' + scid
);
604 $j(_this
.selector
+ ' .slider'+ scid
).slider('option', 'value', valdVal
);
610 $j(this.target_control_container
).accordion({
617 //do config value updates if any
618 this.updateValuesInHtml();
620 updatePresetSelection:function( pKey
){
621 //update the local key:
622 this.local_settings
.d
= pKey
;
623 //js_log('update preset desc: '+ pKey);
625 if(this.local_settings
.pSet
[ pKey
].desc
){
626 pset_desc
= this.local_settings
.pSet
[ pKey
].desc
;
628 pset_desc
= gM('fogg-preset-'+ pKey
);
630 //update the preset title:
631 $j( this.selector
+ ' .gd_preset' ).html(
632 gM('fogg-cg-preset', pset_desc
)
634 //update the selector
635 $j(this.selector
+ ' ._preset_select').val(pKey
);
638 * updates the interface
640 updateInterfaceValue:function(confKey
, val
){
645 //js_log('updateInterfaceValue:: ' + confKey + ' v:' + val + ' cv:'+ _this.selector + '._'+ confKey+' len:' + $j(_this.selector + ' ._'+confKey).length );
647 if(typeof this.default_encoder_config
[confKey
] == 'undefined'){
648 js_error('error: missing default key: '+ confKey
);
652 //update the local value (if not already up-to-date
653 if( this.local_settings
.pSet
['custom']['conf'][confKey
] != val
){
654 val
= this.updateLocalValue(confKey
, val
);
656 //update the text filed:
657 $j(_this
.selector
+ ' ._'+confKey
).val( val
);
658 //update the interaface widget:
659 switch(this.default_encoder_config
[confKey
].type
){
661 $j(_this
.selector
+ ' .slider_' + confKey
).slider('option',
662 'value', $j(_this
.selector
+ ' ._'+ confKey
).val() );
667 updateLocalValue:function(confKey
, value
){
668 //update the local value (return the value we acutally set)
669 if(typeof this.default_encoder_config
[confKey
] == 'undefined'){
670 js_log("Error:could not update conf key:" + confKey
)
673 dec
= this.default_encoder_config
[confKey
];
675 value
= parseInt(value
);
676 var min
= ( dec
.range
.local_min
) ? dec
.range
.local_min
:dec
.range
.min
;
679 var max
= ( dec
.range
.local_max
) ? dec
.range
.local_max
: dec
.range
.max
684 value
= parseInt(value
);
688 if((value % dec.step)!=0){
689 value = value - (value % dec.step);
693 js_log('update:local_settings:custom:conf:'+ confKey
+ ' = ' + value
);
694 this.local_settings
.pSet
['custom']['conf'][confKey
] = value
;
698 getLocalValue:function(confKey
){
699 return this.local_settings
.pSet
['custom']['conf'][confKey
];
701 getClassId:function(elm
, rmstr
){
702 var elmclass
= $j(elm
).attr("class").split(' ').slice(0,1).toString();
704 return elmclass
.replace( rmstr
, '' );
706 //strip leading underscore:
707 return (elmclass
[0]=='_')?elmclass
.substr(1):elmclass
;
711 * sets up the autoEncoder settings
713 autoEncoderSettings:function(){
715 //do the base encoder settings setup:
716 this.basefogg_autoEncoderSettings();
718 //special case see if we already have ogg video in adv encoder expose encode settings anyway:
719 if( _this
.isOggFormat() ){
720 _this
.encoder_settings
['passthrough'] = false;
723 //make sure we are "encoding" if not display not a video file eror:
724 if( this.encoder_settings
['passthrough'] ){
725 js_log("in passthrough mode (hide control)");
727 //dispaly not encodable video
728 $j(this.target_control_container
).hide('slow');
729 $j(this.target_passthrough_mode
).show('slow');
733 $j(this.target_control_container
).show('slow');
734 $j(this.target_passthrough_mode
).hide('slow');
736 //do setup settings based on local_settings /default_encoder_config with sourceFileInfo
737 //see: http://firefogg.org/dev/sourceInfo_example.html
738 var setValues = function(k
, val
, maxVal
) {
740 //update the value if unset:
741 _this
.updateLocalValue(k
, val
);
744 //update the local range:
745 if(_this
.default_encoder_config
[k
].range
){
746 _this
.default_encoder_config
[k
].range
.local_max
= maxVal
;
750 //container level settings
751 for(var i
in this.sourceFileInfo
){
752 var val
= this.sourceFileInfo
[i
];
756 //do nothing with these:
759 maxVal
= (val
*2 > this.default_encoder_config
[k
])?this.default_encoder_config
[k
]:val
*2;
762 setValues(k
, val
, maxVal
);
764 //video stream settings
765 for(var i
in this.sourceFileInfo
.video
[0]){
766 var val
= this.sourceFileInfo
.video
[0][i
];
776 setValues(k
, val
, maxVal
);
778 //audio stream settings, assumes for now thare is only one stream
779 for(var i
in this.sourceFileInfo
.audio
[0]){
780 var val
= this.sourceFileInfo
.audio
[0][i
];
786 maxVal
= (val
*2 > this.default_encoder_config
[k
])?this.default_encoder_config
[k
]:val
*2;
789 setValues(k
, val
, maxVal
);
792 //set all values to new default ranges & update slider:
793 $j
.each(this.default_encoder_config
, function(inx
, val
){
794 if($j(_this
.selector
+ ' ._'+inx
).length
!=0){
795 if(typeof val
.range
!= 'undefined'){
797 var new_max
= (val
.range
.local_max
)?val
.range
.local_max
: val
.range
.max
798 $j( _this
.selector
+ ' .slider_'+inx
).slider('option', 'max', new_max
);
800 //update slider/input value:
801 _this
.updateInterfaceValue(inx
, _this
.local_settings
.pSet
['custom']['conf'][inx
]);
806 this.updateValuesInHtml();
809 //update the encoder settings (from local settings)
810 pKey
= this.local_settings
.d
;
811 this.encoder_settings
= this.local_settings
.pSet
[ pKey
].conf
;
812 this.basefogg_doEncode();
814 updateValuesInHtml:function(){
815 js_log('updateValuesInHtml::');
817 var pKey
= this.local_settings
.d
;
818 this.updatePresetSelection( pKey
);
820 //set the actual HTML & widgets based on any local settings values:
821 $j
.each(_this
.local_settings
.pSet
['custom']['conf'], function(inx
, val
){
822 if($j(_this
.selector
+ ' ._'+inx
).length
!=0){
823 $j(_this
.selector
+ ' ._'+inx
).val( val
);
827 //restors settings from a cookie if you have them)
828 loadEncSettings:function( force
){
829 if($j
.cookie('fogg_encoder_config')){
830 js_log("load:fogg_encoder_config from cookie ");
831 this.local_settings
= JSON
.parse( $j
.cookie('fogg_settings') );
833 //set to default if not loaded yet:
834 if( this.local_settings
&& this.local_settings
.pSet
&& this.local_settings
.pSet
['custom']['conf']){
835 js_log('local settings already populated');
837 this.local_settings
= this.default_local_settings
;
841 //clear preset settings:
842 clearSettings:function(force
){
845 //save settings to the cookie
846 saveEncSettings:function(){
847 $j
.cookie('fogg_settings', JSON
.stringify( this.local_settings
) );