r68588 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68587‎ | r68588 | r68589 >
Date:21:04, 25 June 2010
Author:dale
Status:deferred
Tags:
Comment:
* sync with mwEmbedStandAlone
* added webm messages
Modified paths:
  • /trunk/extensions/AddMediaWizard/AddMedia/AddMedia.i18n.php (modified) (history)
  • /trunk/extensions/AddMediaWizard/AddMedia/mw.Firefogg.js (modified) (history)
  • /trunk/extensions/AddMediaWizard/AddMedia/mw.FirefoggGUI.js (modified) (history)
  • /trunk/extensions/AddMediaWizard/AddMedia/mw.RemoteSearchDriver.js (modified) (history)

Diff [purge]

Index: trunk/extensions/AddMediaWizard/AddMedia/mw.Firefogg.js
@@ -6,7 +6,7 @@
77 mw.addMessages({
88 "mwe-upload-transcoded-status" : "Transcoded",
99 "mwe-upload-transcode-in-progress" : "Transcode and upload in progress (do not close this window)",
10 - "fogg-transcoding" : "Encoding video to Ogg",
 10+ "fogg-transcoding" : "Encoding video",
1111 "fogg-select_file" : "Select file",
1212 "fogg-select_new_file" : "Select new file",
1313 "fogg-select_url" : "Select URL",
@@ -634,8 +634,7 @@
635635 if ( v.src != _this.fogg.previewUrl ) {
636636 mw.log( 'init preview with url:' + _this.fogg.previewUrl );
637637 v.src = _this.fogg.previewUrl;
638 -
639 - // Once it's loaded, seek to the end
 638+ // Once it's loaded, seek to the end ( for ogg )
640639 v.removeEventListener( "loadedmetadata", seekToEnd, true );
641640 v.addEventListener( "loadedmetadata", seekToEnd, true );
642641
@@ -647,7 +646,7 @@
648647 var previewTimer = setInterval( function() {
649648 if ( _this.fogg.status() != "encoding" ) {
650649 clearInterval( previewTimer );
651 - _this.show_preview == false; // Closure compiler marks this as irrelevant -papy
 650+ _this.show_preview == false;
652651 }
653652 if ( _this.show_preview == true ) {
654653 v.load();
@@ -784,7 +783,7 @@
785784 doLocalEncodeAndSave: function() {
786785 var _this = this;
787786 if ( !this.fogg ) {
788 - mw.log( 'doLocalEncodeAndSave: no Firefogg object!' );
 787+ mw.log( 'Error: doLocalEncodeAndSave: no Firefogg object!' );
789788 return false;
790789 }
791790 // Setup the interface progress indicator:
@@ -792,8 +791,9 @@
793792 'title' : gM( 'fogg-transcoding' ),
794793 'statusType' : 'transcode'
795794 } );
 795+
796796 // Add the preview controls if transcoding:
797 - if ( !_this.getEncoderSettings()[ 'passthrough' ] ) {
 797+ if ( !_this.getEncoderSettings()[ 'passthrough' ] && _this.current_encoder_settings['videoCodec'] != 'vp8' ) {
798798 _this.createPreviewControls();
799799 }
800800
@@ -801,6 +801,7 @@
802802 // Firefogg shows the "save as" dialog box, and sets the path chosen as
803803 // the destination for a later encode() call.
804804 if ( !this.fogg.saveVideoAs() ) {
 805+ _this.ui.close();
805806 // User clicked "cancel"
806807 return false;
807808 }
@@ -824,7 +825,7 @@
825826 var _this = this;
826827 _this.ui.setPrompt( gM( 'fogg-encoding-done' ),
827828 gM( 'fogg-encoding-done' ) + '<br>' +
828 - //show the video at full resolution upto 720px wide
 829+ // Show the video at full resolution upto 720px wide
829830 '<video controls="true" style="margin:auto" id="fogg_final_vid" '+
830831 'src="' +_this.fogg.previewUrl + '"></video>'
831832 );
@@ -895,7 +896,14 @@
896897 ' passthrough:' + settings['passthrough'] );
897898
898899 this.current_encoder_settings = settings;
 900+ }
 901+ //Update the format based on codec selection
 902+ if( this.current_encoder_settings['videoCodec'] == 'vp8' ){
 903+ this.fogg.setFormat('webm');
 904+ } else {
 905+ this.fogg.setFormat('ogg');
899906 }
 907+
900908 return this.current_encoder_settings;
901909 },
902910
@@ -1131,6 +1139,8 @@
11321140
11331141 var encoderSettings = this.getEncoderSettings();
11341142
 1143+ // Check for special encode settings that remap things.
 1144+
11351145 // Check if encoderSettings passthrough is on ( then skip the encode )
11361146 if( encoderSettings['passthrough'] == true) {
11371147 // Firefogg requires an encode request to setup a the file to be uploaded.
@@ -1147,7 +1157,10 @@
11481158 var encodingStatus = function() {
11491159 var status = _this.fogg.status();
11501160
1151 - if ( _this.show_preview == true && _this.fogg.state == 'encoding' ) {
 1161+ if ( _this.show_preview == true
 1162+ && _this.fogg.state == 'encoding'
 1163+ // No way to seek in VP8 atm
 1164+ && _this.current_encoder_settings['videoCodec'] != 'vp8') {
11521165 _this.renderPreview();
11531166 }
11541167
Index: trunk/extensions/AddMediaWizard/AddMedia/mw.FirefoggGUI.js
@@ -3,7 +3,8 @@
44 */
55
66 mw.addMessages({
7 - "fogg-save_local_file" : "Save Ogg",
 7+ "fogg-wont-upload-to-server" : "Note: Your video file will be locally encoded and not upload to any server",
 8+ "fogg-save_local_file" : "Encode to File",
89 "fogg-help-sticky" : "Help (click to stick)",
910 "fogg-cg-preset" : "Preset: <strong>$1<\/strong>",
1011 "fogg-cg-quality" : "Basic quality and resolution control",
@@ -12,9 +13,11 @@
1314 "fogg-cg-advVideo" : "Advanced video encoding controls",
1415 "fogg-cg-advAudio" : "Advanced audio encoding controls",
1516 "fogg-preset-custom" : "Custom settings",
16 - "fogg-webvideo-desc" : "Web video Theora, Vorbis 400 kbit\/s and 400px maximum width",
17 - "fogg-savebandwidth-desc" : "Low bandwidth Theora, Vorbis 164 kbit\/s and 200px maximum width",
18 - "fogg-highquality-desc" : "High quality Theora, Vorbis 1080px maximum width",
 17+ "fogg-webvideo-desc" : "Ogg Web video Theora, Vorbis 600 kbit\/s and 400px maximum width",
 18+ "fogg-savebandwidth-desc" : "Ogg Low bandwidth Theora, Vorbis 164 kbit\/s and 200px maximum width",
 19+ "fogg-highquality-desc" : "Ogg High quality Theora, Vorbis 1080px maximum width",
 20+ "fogg-webvideo-webm-desc" : "Webm Web video VP8 600 kbit\/s and 480px maximum width",
 21+ "fogg-highquality-webm-desc" : "Webm High quality VP8 1080px maximum width",
1922 "fogg-videoQuality-title" : "Video quality",
2023 "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).",
2124 "fogg-starttime-title" : "Start second",
@@ -24,7 +27,7 @@
2528 "fogg-audioQuality-title" : "Audio quality",
2629 "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).",
2730 "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>.",
 31+ "fogg-videoCodec-help" : "Select the clip video codec. More about the <a target=\"_new\" href=\"http:\/\/en.wikipedia.org\/wiki\/Theora\">Theora codec<\/a>. More about the <a target=\"_new\" href=\"http:\/\/en.wikipedia.org\/wiki\/Webm\">VP8 codec<\/a>",
2932 "fogg-audioCodec-title" : "Audio codec",
3033 "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>",
3134 "fogg-width-title" : "Video width",
@@ -121,7 +124,7 @@
122125 'custom': {
123126 'descKey': 'fogg-preset-custom',
124127 'conf': {}
125 - },
 128+ },
126129 'webvideo': {
127130 'desc': gM( 'fogg-webvideo-desc' ),
128131 'conf': {
@@ -151,11 +154,31 @@
152155 'audioQuality' : 3,
153156 'noUpscaling' : true
154157 }
 158+ },
 159+ 'webvideo_webm': {
 160+ 'desc': gM( 'fogg-webvideo-webm-desc' ),
 161+ 'conf': {
 162+ 'videoCodec' : 'vp8',
 163+ 'maxSize' : 480,
 164+ 'videoBitrate' : 544,
 165+ 'audioBitrate' : 96,
 166+ 'noUpscaling' : true
 167+ }
 168+ },
 169+ 'webvideo_webmhq': {
 170+ 'desc' : gM('fogg-highquality-webm-desc'),
 171+ 'conf' : {
 172+ 'videoCodec' : 'vp8',
 173+ 'maxSize' : 1080,
 174+ 'videoQuality' : 6,
 175+ 'audioQuality' : 3,
 176+ 'noUpscaling' : true
 177+ }
155178 }
156179 }
157180 },
158181
159 - // Customised configuration hashtable
 182+ // Customized configuration hashtable
160183 local_settings: {},
161184
162185 // Core Firefogg default encoder configuration
@@ -184,7 +207,7 @@
185208 },
186209 'videoCodec': {
187210 'default' : "theora",
188 - 'selectVal' : [ 'theora' ],
 211+ 'selectVal' : [ 'theora', 'vp8' ],
189212 'type' : "select",
190213 'group' : "quality"
191214 },
@@ -452,7 +475,6 @@
453476 '</span>' +
454477 '</label></td><td valign="top">';
455478 // Get the default value (or an empty string if there is no default)
456 -
457479 var defaultValue = this.default_encoder_config[configKey]['default'];
458480 if ( !defaultValue ) {
459481 defaultValue = '';
@@ -497,7 +519,7 @@
498520 for ( var i in configEntry.selectVal ) {
499521 var val = configEntry.selectVal[i];
500522 if ( typeof val == 'string' ) {
501 - var sel = ( configEntry.selectVal[i] == val ) ? ' selected' : '';
 523+ var sel = ( defaultValue == val ) ? ' selected' : '';
502524 out += '<option value="' + val + '"'+sel+'>' + val + '</option>';
503525 } else if ( typeof val == 'object' ) {
504526 for ( var key in val ) {
@@ -738,16 +760,17 @@
739761 /**
740762 * Update the UI due to a change in preset
741763 */
742 - updatePresetSelection: function( presetKey ) {
 764+ updatePresetSelection: function( presetKey ) {
743765 // Update the local configuration
744 - this.local_settings['default'] = presetKey;
 766+ this.local_settings['default'] = presetKey;
745767 mw.log( 'update preset desc: ' + presetKey );
746768 var presetDesc = '';
747769 if ( this.local_settings.presets[presetKey].desc ) {
748770 presetDesc = this.local_settings.presets[presetKey].desc;
749771 } else {
750772 presetDesc = gM( 'fogg-preset-' + presetKey );
751 - }
 773+ }
 774+
752775 // Update the preset title
753776 $j( this.selector + ' .gd_preset' )
754777 .html( gM( 'fogg-cg-preset', presetDesc ) );
@@ -755,7 +778,7 @@
756779 $j( this.selector + ' ._preset_select' ).val( presetKey );
757780 },
758781
759 - /*
 782+ /**
760783 * Update the interface due to a change in a particular config key
761784 */
762785 updateInterfaceValue: function( confKey, val ) {
@@ -852,9 +875,10 @@
853876 * into which a video has already been selected. Overrides the base method.
854877 */
855878 getEncoderSettings: function() {
856 - if ( this.current_encoder_settings != null ) {
857 - return this.current_encoder_settings;
858 - }
 879+ // update the encoder settings (from local settings)
 880+ var pKey = this.local_settings['default'];
 881+ // Update the current encoder settings:
 882+ this.current_encoder_settings = this.local_settings.presets[ pKey ].conf;
859883
860884 // Call the base function
861885 // Note that settings will be a reference and can be modified
@@ -981,10 +1005,7 @@
9821006 this.updateValuesInHtml();
9831007 },
9841008
985 - doEncode: function( progressCallback, doneCallback ) {
986 - // update the encoder settings (from local settings)
987 - pKey = this.local_settings['default'];
988 - this.current_encoder_settings = this.local_settings.presets[ pKey ].conf;
 1009+ doEncode: function( progressCallback, doneCallback ) {
9891010 this.basefogg_doEncode( progressCallback, doneCallback );
9901011 },
9911012
Index: trunk/extensions/AddMediaWizard/AddMedia/mw.RemoteSearchDriver.js
@@ -2937,7 +2937,7 @@
29382938 resource.mime.indexOf( 'video' ) != -1 ||
29392939 resource.mime.indexOf( '/ogg' ) != -1 )
29402940 {
2941 - // Re-load the player module ( will scan page for mw.getConfig( 'rewritePlayerTags' ) )
 2941+ // Re-load the player module ( will scan page for mw.getConfig( 'EmbedPlayer.RewriteTags' ) )
29422942 $j.embedPlayers();
29432943 }
29442944 }
Index: trunk/extensions/AddMediaWizard/AddMedia/AddMedia.i18n.php
@@ -31,7 +31,8 @@
3232 'mwe-filesource' => 'Source:',
3333 'mwe-filestatus' => 'Copyright status:',
3434 'mwe-loading-add-media-wiz' => 'Loading add media wizard',
35 - 'fogg-save_local_file' => 'Save Ogg',
 35+ 'fogg-wont-upload-to-server' => 'Note: Your video file will be locally encoded and not upload to any server',
 36+ 'fogg-save_local_file' => 'Encode to File',
3637 'fogg-help-sticky' => 'Help (click to stick)',
3738 'fogg-cg-preset' => 'Preset: <strong>$1</strong>',
3839 'fogg-cg-quality' => 'Basic quality and resolution control',
@@ -40,9 +41,11 @@
4142 'fogg-cg-advVideo' => 'Advanced video encoding controls',
4243 'fogg-cg-advAudio' => 'Advanced audio encoding controls',
4344 'fogg-preset-custom' => 'Custom settings',
44 - 'fogg-webvideo-desc' => 'Web video Theora, Vorbis 400 kbit/s and 400px maximum width',
45 - 'fogg-savebandwidth-desc' => 'Low bandwidth Theora, Vorbis 164 kbit/s and 200px maximum width',
46 - 'fogg-highquality-desc' => 'High quality Theora, Vorbis 1080px maximum width',
 45+ 'fogg-webvideo-desc' => 'Ogg Web video Theora, Vorbis 600 kbit\/s and 400px maximum width',
 46+ 'fogg-savebandwidth-desc' => 'Ogg Low bandwidth Theora, Vorbis 164 kbit\/s and 200px maximum width',
 47+ 'fogg-highquality-desc' => 'Ogg High quality Theora, Vorbis 1080px maximum width',
 48+ 'fogg-webvideo-webm-desc' => 'Webm Web video VP8 600 kbit\/s and 480px maximum width',
 49+ 'fogg-highquality-webm-desc' => 'Webm High quality VP8 1080px maximum width',
4750 'fogg-videoQuality-title' => 'Video quality',
4851 '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).',
4952 'fogg-starttime-title' => 'Start second',
@@ -52,7 +55,7 @@
5356 'fogg-audioQuality-title' => 'Audio quality',
5457 '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).',
5558 'fogg-videoCodec-title' => 'Video codec',
56 - '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>.',
 59+ 'fogg-videoCodec-help' => 'Select the clip video codec. More about the <a target=\"_new\" href=\"http:\/\/en.wikipedia.org\/wiki\/Theora\">Theora codec<\/a>. More about the <a target=\"_new\" href=\"http:\/\/en.wikipedia.org\/wiki\/Webm\">VP8 codec<\/a>',
5760 'fogg-audioCodec-title' => 'Audio codec',
5861 '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>',
5962 'fogg-width-title' => 'Video width',
@@ -195,7 +198,7 @@
196199 'rsd-search-timeout' => 'The search request did not complete. The server may be down experiencing heavy load. You can try again later',
197200 'mwe-upload-transcoded-status' => 'Transcoded',
198201 'mwe-upload-transcode-in-progress' => 'Transcode and upload in progress (do not close this window)',
199 - 'fogg-transcoding' => 'Encoding video to Ogg',
 202+ 'fogg-transcoding' => 'Encoding video',
200203 'fogg-select_file' => 'Select file',
201204 'fogg-select_new_file' => 'Select new file',
202205 'fogg-select_url' => 'Select URL',

Status & tagging log