Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvAdvFirefogg.js |
— | — | @@ -1,4 +1,4 @@ |
2 | | -/* |
| 2 | +/** |
3 | 3 | * Advanced Firefogg support. Lets you control many aspects of video encoding. |
4 | 4 | */ |
5 | 5 | |
— | — | @@ -278,7 +278,7 @@ |
279 | 279 | /** |
280 | 280 | * Initialise this object |
281 | 281 | */ |
282 | | - init: function( options ) { |
| 282 | + init: function( options ) { |
283 | 283 | // Set up a supported object: |
284 | 284 | for ( var key in options ) { |
285 | 285 | if ( typeof default_mvAdvFirefogg_config[key] != 'undefined' ) { |
— | — | @@ -340,12 +340,12 @@ |
341 | 341 | $j( this.selector ).append( '<p><div class="control_container"></div>' ); |
342 | 342 | } |
343 | 343 | // Hide the container and add the output |
344 | | - $j( this.target_control_container ).hide(); |
| 344 | + $j( this.target_control_container ).hide(); |
345 | 345 | $j( this.target_control_container ).html( gdout ); |
346 | 346 | }, |
347 | 347 | |
348 | 348 | // Custom advanced target rewrites |
349 | | - getControlHtml: function( target ) { |
| 349 | + getControlHtml: function( target ) { |
350 | 350 | switch ( target ) { |
351 | 351 | case 'target_btn_select_file': |
352 | 352 | case 'target_btn_select_new_file': |
— | — | @@ -361,14 +361,13 @@ |
362 | 362 | target + '" href="#"><span class="ui-icon ' + icon + '"/>' + |
363 | 363 | linkText + |
364 | 364 | '</a>'; |
365 | | - case 'target_btn_select_url': |
| 365 | + case 'target_btn_select_url': |
366 | 366 | return $j.btnHtml( gM( 'fogg-select_url' ), target, 'link' ); |
367 | 367 | case 'target_use_latest_firefox': |
368 | 368 | case 'target_please_install': |
369 | | - case 'target_passthrough_mode': |
370 | | - var text = gM( target.replace( '/^target_', 'fogg-' ) ); |
371 | | - return |
372 | | - '<div ' + |
| 369 | + case 'target_passthrough_mode': |
| 370 | + var text = gM( target.replace( /^target_/, 'fogg-' ) ); |
| 371 | + return '<div ' + |
373 | 372 | 'style="margin-top:1em;padding: 0pt 0.7em;" ' + |
374 | 373 | 'class="ui-state-error ui-corner-all ' + |
375 | 374 | target + '">' + |
— | — | @@ -384,8 +383,8 @@ |
385 | 384 | 'class="text ui-widget-content ui-corner-all ' + target + '" ' + |
386 | 385 | 'type="text" value="' + text + '" size="60" /> '; |
387 | 386 | default: |
388 | | - js_log( 'call : basefogg_getTargetHtml' ); |
389 | | - return this.basefogg_getTargetHtml( target ); |
| 387 | + js_log( 'call : basefogg_getTargetHtml for:' + target ); |
| 388 | + return this.basefogg_getControlHtml( target ); |
390 | 389 | } |
391 | 390 | }, |
392 | 391 | |
— | — | @@ -565,7 +564,7 @@ |
566 | 565 | ) |
567 | 566 | .hover( |
568 | 567 | function() { |
569 | | - // get the config key (assume it's the last class) |
| 568 | + // get the config key ( assume it's the last class ) |
570 | 569 | var configKey = _this.getClassId( this, 'help_' ); |
571 | 570 | $j( _this.selector + ' .helpRow_' + configKey ).show( 'slow' ); |
572 | 571 | }, |
— | — | @@ -623,7 +622,7 @@ |
624 | 623 | }); |
625 | 624 | break; |
626 | 625 | case 'slider': |
627 | | - var sliderId = _this.getClassId( this, 'slider_' ); |
| 626 | + //var sliderId = _this.getClassId( this, 'slider_' ); |
628 | 627 | $j( this.selector + ' .slider_' + configKey ).slider({ |
629 | 628 | range: "min", |
630 | 629 | animate: true, |
— | — | @@ -808,12 +807,14 @@ |
809 | 808 | |
810 | 809 | // Call the base function |
811 | 810 | // Note that settings will be a reference and can be modified |
812 | | - var settings = this.basefogg_getEncoderSettings(); |
| 811 | + this.basefogg_getEncoderSettings(); |
| 812 | + |
813 | 813 | |
814 | 814 | // Allow re-encoding of files that are already ogg (unlike in the base class) |
815 | 815 | if ( this.isOggFormat() ) { |
816 | | - settings['passthrough'] = false; |
| 816 | + this.current_encoder_settings['passthrough'] = false; |
817 | 817 | } |
| 818 | + return this.current_encoder_settings; |
818 | 819 | }, |
819 | 820 | |
820 | 821 | /** |
— | — | @@ -887,7 +888,7 @@ |
888 | 889 | } |
889 | 890 | setValues( k, val, maxVal ); |
890 | 891 | } |
891 | | - // audio stream settings, assumes for now thare is only one stream |
| 892 | + // audio stream settings, assumes for now there is only one stream |
892 | 893 | for ( var i in fileInfo.audio[0] ) { |
893 | 894 | var val = fileInfo.audio[0][i]; |
894 | 895 | var k = false; |
— | — | @@ -923,11 +924,11 @@ |
924 | 925 | this.updateValuesInHtml(); |
925 | 926 | }, |
926 | 927 | |
927 | | - doEncode: function() { |
| 928 | + doEncode: function( progressCallback, doneCallback ) { |
928 | 929 | // update the encoder settings (from local settings) |
929 | 930 | pKey = this.local_settings['default']; |
930 | | - this.encoder_settings = this.local_settings.presets[ pKey ].conf; |
931 | | - this.basefogg_doEncode(); |
| 931 | + this.current_encoder_settings = this.local_settings.presets[ pKey ].conf; |
| 932 | + this.basefogg_doEncode( progressCallback, doneCallback ); |
932 | 933 | }, |
933 | 934 | |
934 | 935 | /** |
— | — | @@ -936,7 +937,7 @@ |
937 | 938 | updateValuesInHtml: function() { |
938 | 939 | js_log( 'updateValuesInHtml::' ); |
939 | 940 | var _this = this; |
940 | | - var pKey = this.local_settings['default']; |
| 941 | + var pKey = this.local_settings[ 'default' ]; |
941 | 942 | this.updatePresetSelection( pKey ); |
942 | 943 | |
943 | 944 | // set the actual HTML & widgets based on any local settings values: |
— | — | @@ -944,7 +945,7 @@ |
945 | 946 | if ( $j( _this.selector + ' ._' + inx ).length != 0 ) { |
946 | 947 | $j( _this.selector + ' ._' + inx ).val( val ); |
947 | 948 | } |
948 | | - }); |
| 949 | + } ); |
949 | 950 | }, |
950 | 951 | |
951 | 952 | /** |
— | — | @@ -970,6 +971,7 @@ |
971 | 972 | * FIXME: not called, does nothing |
972 | 973 | */ |
973 | 974 | clearSettings: function( force ) { |
| 975 | + |
974 | 976 | }, |
975 | 977 | |
976 | 978 | /** |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js |
— | — | @@ -214,8 +214,8 @@ |
215 | 215 | 'type="text" ' + |
216 | 216 | 'value="' + msg + '"/> '; |
217 | 217 | } else if ( /^target_/.test( target ) ) { |
218 | | - // Message |
219 | | - var msg = gM( target.replace( '/^target_/', 'fogg-' ) ); |
| 218 | + // Message |
| 219 | + var msg = gM( target.replace( /^target_/, 'fogg-' ) ); |
220 | 220 | return '<div style="" class="' + target + '" >' + msg + '</div> '; |
221 | 221 | } else { |
222 | 222 | js_error( 'Invalid target: ' + target ); |
— | — | @@ -378,6 +378,7 @@ |
379 | 379 | inputTag += '/><span id="' + id + '"></span>'; |
380 | 380 | |
381 | 381 | js_log( 'set input: ' + inputTag ); |
| 382 | + |
382 | 383 | $j( this.selector ).replaceWith( inputTag ); |
383 | 384 | |
384 | 385 | this.target_input_file_name = 'input[name=' + $j( this.selector ).attr( 'name' ) + ']'; |
— | — | @@ -573,9 +574,9 @@ |
574 | 575 | _this.fogg = new Firefogg(); |
575 | 576 | _this.selectSourceFile(); |
576 | 577 | } ); |
577 | | - |
| 578 | + |
578 | 579 | var settings = this.getEncoderSettings(); |
579 | | - |
| 580 | + |
580 | 581 | // If we're in passthrough mode, update the interface (if not a form) |
581 | 582 | if ( settings['passthrough'] == true && _this.form_type == 'local' ) { |
582 | 583 | $j( _this.target_passthrough_mode ).show(); |
— | — | @@ -590,6 +591,7 @@ |
591 | 592 | // Update the input file name box and show it |
592 | 593 | js_log( " should update: " + _this.target_input_file_name + |
593 | 594 | ' to: ' + _this.fogg.sourceFilename ); |
| 595 | + |
594 | 596 | $j( _this.target_input_file_name ) |
595 | 597 | .val( _this.fogg.sourceFilename ) |
596 | 598 | .show(); |
— | — | @@ -657,7 +659,7 @@ |
658 | 660 | return false; |
659 | 661 | } |
660 | 662 | |
661 | | - // We have a source file, now do the encode |
| 663 | + // We have a source file, now do the encode |
662 | 664 | this.doEncode( |
663 | 665 | function /* onProgress */ ( progress ) { |
664 | 666 | _this.updateProgress( progress ); |
— | — | @@ -722,11 +724,8 @@ |
723 | 725 | */ |
724 | 726 | getEncoderSettings: function() { |
725 | 727 | if ( this.current_encoder_settings == null ) { |
726 | | - // Clone the default settings |
727 | | - var defaults = function () { }; |
728 | | - defaults.prototype = this.default_encoder_settings; |
729 | | - var settings = new defaults(); |
730 | | - |
| 728 | + // Clone the default settings |
| 729 | + var settings = $j.extend( { }, this.default_encoder_settings) ; |
731 | 730 | // Grab the extension |
732 | 731 | var sf = this.fogg.sourceFilename; |
733 | 732 | if ( !sf ) { |