r50434 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50433‎ | r50434 | r50435 >
Date:12:04, 10 May 2009
Author:j
Status:deferred
Tags:
Comment:
enable passthrough mode, requres firefogg from bzr right now
Modified paths:
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvFirefogg.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvFirefogg.js
@@ -6,7 +6,8 @@
77 var default_firefogg_options = {
88 'upload_done_action':'redirect',
99 'fogg_enabled':false,
10 - 'api_url':null
 10+ 'api_url':null,
 11+ 'passthrough': false
1112 }
1213 var mvFirefogg = function(initObj){
1314 return this.init( initObj );
@@ -19,8 +20,12 @@
2021 'maxSize': 400,
2122 'videoBitrate': 400,
2223 'noUpscaling':true
23 - },
24 -
 24+ },
 25+ ogg_extensions: ['ogg', 'ogv', 'oga'],
 26+ video_extensions: ['avi', 'mov', 'mp4', 'mp2', 'mpeg', 'mpeg2', 'mpeg4', 'dv', 'wmv'],
 27+ passthrough_extensions: ['png', 'gif', 'jpg', 'jpeg'], //@@todo allow server to set this
 28+ passthrough: false,
 29+
2530 init: function( iObj ){
2631 if(!iObj)
2732 iObj = {};
@@ -123,18 +128,19 @@
124129 if( sf.lastIndexOf('.') != -1){
125130 ext = sf.substring( sf.lastIndexOf('.')+1 ).toLowerCase();
126131 }
127 - //set upload warning
128 - if( ext == 'ogg' || ext == 'ogv' ){
 132+ //set upload warning
 133+ if( $j.inArray(ext, _this.ogg_extensions) > -1 ){
129134 $j('#wgfogg_waring_ogg_upload').show();
130135 return false;
131 - }else if( ext == 'avi' || ext == 'mov' || ext == 'mp4' || ext=='mp2' ||
132 - ext == 'mpeg' || ext == 'mpeg2' || ext == 'mpeg4' ||
133 - ext == 'dv' || ext=='wmv' ){
 136+ }else if( $j.inArray(ext, _this.video_extensions) > -1 ){
134137 //hide ogg warning
135138 $j('#wgfogg_waring_ogg_upload').hide();
136139 var extreg = new RegExp(ext + '$', 'i');
137140 sf = sf.replace(extreg, 'ogg');
138141 $j('#wpDestFile').val( sf );
 142+ }else if( $j.inArray(ext, _this.passthrough_extensions) > -1 ){
 143+ $j('#wpDestFile').val( sf );
 144+ _this.passthrough = true;
139145 }else{
140146 //not video extension error:
141147 $j('#wgfogg_waring_bad_extension').show();
@@ -184,11 +190,10 @@
185191 if( sf.lastIndexOf('.') != -1){
186192 ext = sf.substring( sf.lastIndexOf('.') ).toLowerCase();
187193 }
188 - if ( ext != '.ogg' && ext != '.ogv' ) {
 194+ if(!_this.passthrough && $j.inArray(ext.substr(1), _this.ogg_extensions) == -1 ){
189195 var extreg = new RegExp(ext + '$', 'i');
190196 _this.formData['wpDestFile'] = sf.replace(extreg, '.ogg');
191197 }
192 -
193198 //add chunk response hook to build the resultURL when uploading chunks
194199
195200 //build the api url:
@@ -208,8 +213,11 @@
209214
210215 js_log('do fogg upload call: '+ _this.api_url + ' :: ' + JSON.stringify( aReq ) );
211216
212 -
213 - _this.fogg.upload( JSON.stringify( _this.encoder_settings ), _this.api_url , JSON.stringify( aReq ) );
 217+ var enc_settings = _this.encoder_settings;
 218+ if( _this.passthrough ){
 219+ enc_settings = {'passthrough': true};
 220+ }
 221+ _this.fogg.upload( JSON.stringify( enc_settings ), _this.api_url , JSON.stringify( aReq ) );
214222
215223 //update upload status:
216224 _this.doUploadStatus();

Status & tagging log