r59811 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59810‎ | r59811 | r59812 >
Date:00:12, 8 December 2009
Author:dale
Status:deferred
Tags:
Comment:
* some more fixes for r59278 breakage
Modified paths:
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvAdvFirefogg.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvAdvFirefogg.js
@@ -1,4 +1,4 @@
2 -/*
 2+/**
33 * Advanced Firefogg support. Lets you control many aspects of video encoding.
44 */
55
@@ -278,7 +278,7 @@
279279 /**
280280 * Initialise this object
281281 */
282 - init: function( options ) {
 282+ init: function( options ) {
283283 // Set up a supported object:
284284 for ( var key in options ) {
285285 if ( typeof default_mvAdvFirefogg_config[key] != 'undefined' ) {
@@ -340,12 +340,12 @@
341341 $j( this.selector ).append( '<p><div class="control_container"></div>' );
342342 }
343343 // Hide the container and add the output
344 - $j( this.target_control_container ).hide();
 344+ $j( this.target_control_container ).hide();
345345 $j( this.target_control_container ).html( gdout );
346346 },
347347
348348 // Custom advanced target rewrites
349 - getControlHtml: function( target ) {
 349+ getControlHtml: function( target ) {
350350 switch ( target ) {
351351 case 'target_btn_select_file':
352352 case 'target_btn_select_new_file':
@@ -361,14 +361,13 @@
362362 target + '" href="#"><span class="ui-icon ' + icon + '"/>' +
363363 linkText +
364364 '</a>';
365 - case 'target_btn_select_url':
 365+ case 'target_btn_select_url':
366366 return $j.btnHtml( gM( 'fogg-select_url' ), target, 'link' );
367367 case 'target_use_latest_firefox':
368368 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 ' +
373372 'style="margin-top:1em;padding: 0pt 0.7em;" ' +
374373 'class="ui-state-error ui-corner-all ' +
375374 target + '">' +
@@ -384,8 +383,8 @@
385384 'class="text ui-widget-content ui-corner-all ' + target + '" ' +
386385 'type="text" value="' + text + '" size="60" /> ';
387386 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 );
390389 }
391390 },
392391
@@ -565,7 +564,7 @@
566565 )
567566 .hover(
568567 function() {
569 - // get the config key (assume it's the last class)
 568+ // get the config key ( assume it's the last class )
570569 var configKey = _this.getClassId( this, 'help_' );
571570 $j( _this.selector + ' .helpRow_' + configKey ).show( 'slow' );
572571 },
@@ -623,7 +622,7 @@
624623 });
625624 break;
626625 case 'slider':
627 - var sliderId = _this.getClassId( this, 'slider_' );
 626+ //var sliderId = _this.getClassId( this, 'slider_' );
628627 $j( this.selector + ' .slider_' + configKey ).slider({
629628 range: "min",
630629 animate: true,
@@ -808,12 +807,14 @@
809808
810809 // Call the base function
811810 // Note that settings will be a reference and can be modified
812 - var settings = this.basefogg_getEncoderSettings();
 811+ this.basefogg_getEncoderSettings();
 812+
813813
814814 // Allow re-encoding of files that are already ogg (unlike in the base class)
815815 if ( this.isOggFormat() ) {
816 - settings['passthrough'] = false;
 816+ this.current_encoder_settings['passthrough'] = false;
817817 }
 818+ return this.current_encoder_settings;
818819 },
819820
820821 /**
@@ -887,7 +888,7 @@
888889 }
889890 setValues( k, val, maxVal );
890891 }
891 - // audio stream settings, assumes for now thare is only one stream
 892+ // audio stream settings, assumes for now there is only one stream
892893 for ( var i in fileInfo.audio[0] ) {
893894 var val = fileInfo.audio[0][i];
894895 var k = false;
@@ -923,11 +924,11 @@
924925 this.updateValuesInHtml();
925926 },
926927
927 - doEncode: function() {
 928+ doEncode: function( progressCallback, doneCallback ) {
928929 // update the encoder settings (from local settings)
929930 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 );
932933 },
933934
934935 /**
@@ -936,7 +937,7 @@
937938 updateValuesInHtml: function() {
938939 js_log( 'updateValuesInHtml::' );
939940 var _this = this;
940 - var pKey = this.local_settings['default'];
 941+ var pKey = this.local_settings[ 'default' ];
941942 this.updatePresetSelection( pKey );
942943
943944 // set the actual HTML & widgets based on any local settings values:
@@ -944,7 +945,7 @@
945946 if ( $j( _this.selector + ' ._' + inx ).length != 0 ) {
946947 $j( _this.selector + ' ._' + inx ).val( val );
947948 }
948 - });
 949+ } );
949950 },
950951
951952 /**
@@ -970,6 +971,7 @@
971972 * FIXME: not called, does nothing
972973 */
973974 clearSettings: function( force ) {
 975+
974976 },
975977
976978 /**
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js
@@ -214,8 +214,8 @@
215215 'type="text" ' +
216216 'value="' + msg + '"/> ';
217217 } 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-' ) );
220220 return '<div style="" class="' + target + '" >' + msg + '</div> ';
221221 } else {
222222 js_error( 'Invalid target: ' + target );
@@ -378,6 +378,7 @@
379379 inputTag += '/><span id="' + id + '"></span>';
380380
381381 js_log( 'set input: ' + inputTag );
 382+
382383 $j( this.selector ).replaceWith( inputTag );
383384
384385 this.target_input_file_name = 'input[name=' + $j( this.selector ).attr( 'name' ) + ']';
@@ -573,9 +574,9 @@
574575 _this.fogg = new Firefogg();
575576 _this.selectSourceFile();
576577 } );
577 -
 578+
578579 var settings = this.getEncoderSettings();
579 -
 580+
580581 // If we're in passthrough mode, update the interface (if not a form)
581582 if ( settings['passthrough'] == true && _this.form_type == 'local' ) {
582583 $j( _this.target_passthrough_mode ).show();
@@ -590,6 +591,7 @@
591592 // Update the input file name box and show it
592593 js_log( " should update: " + _this.target_input_file_name +
593594 ' to: ' + _this.fogg.sourceFilename );
 595+
594596 $j( _this.target_input_file_name )
595597 .val( _this.fogg.sourceFilename )
596598 .show();
@@ -657,7 +659,7 @@
658660 return false;
659661 }
660662
661 - // We have a source file, now do the encode
 663+ // We have a source file, now do the encode
662664 this.doEncode(
663665 function /* onProgress */ ( progress ) {
664666 _this.updateProgress( progress );
@@ -722,11 +724,8 @@
723725 */
724726 getEncoderSettings: function() {
725727 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) ;
731730 // Grab the extension
732731 var sf = this.fogg.sourceFilename;
733732 if ( !sf ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r59278Rework of libAddMedia. The changes are entirely untested and there may be bug...tstarling07:23, 20 November 2009

Status & tagging log