r68585 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68584‎ | r68585 | r68586 >
Date:20:19, 25 June 2010
Author:dale
Status:deferred
Tags:
Comment:
* added webm to firefogg gui.
** updated some language messages
Modified paths:
  • /branches/MwEmbedStandAlone/modules/AddMedia/AddMedia.i18n.php (modified) (history)
  • /branches/MwEmbedStandAlone/modules/AddMedia/mw.Firefogg.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/AddMedia/mw.FirefoggGUI.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/AddMedia/tests/Firefogg_GUI.html (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/tests/PanZoom.html (replaced) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoTransition.html (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/tests/panzoom/Fruits-4s.smil.xml (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/SmilPlayer/tests/panzoom/Fruits-4s.smil.xml
@@ -32,9 +32,11 @@
3333 dur="1.5s" fill="freeze" values="418,-3,34%,13%;9,1115,41%,20%"/>
3434
3535 <animate attributeName="panZoom" begin="13.0"
36 - dur="1.5s" fill="freeze" values="9,1115,41%,20%;573,2073,64%,17%"/>
 36+ dur="1.5s" fill="freeze" values="9,1115,41%,20%;573,2073,64%,17%"/>
 37+
3738 <animate attributeName="panZoom" begin="16.0"
38 - dur="1.5s" fill="freeze" values="573,2073,64%,17%;1118,1365,14%,8%"/>
 39+ dur="1.5s" fill="freeze" values="573,2073,64%,17%;1118,1365,14%,8%"/>
 40+
3941 <animate attributeName="panZoom" begin="18.0"
4042 dur="1.5s" fill="freeze" values="1118,1365,14%,8%;0,0,100%,100%"/>
4143 </img>
@@ -52,9 +54,7 @@
5355 <tev begin="16s"/>
5456 as well as squeeze-ready organges.
5557 <clear begin="19s"/>
56 -<!-- The screen does not clear if there is no additional character text.... -->
57 - .
58 -
 58+ Cabbage!!!
5959 </smilText>
6060
6161 </par>
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoTransition.html
@@ -1,7 +1,7 @@
22 <!doctype html>
33 <html>
44 <head>
5 - <title>Pan Zoom Example</title>
 5+ <title>Video Transistion Example</title>
66 <script type="text/javascript" src="../../../mwEmbed.js?debug=true"></script>
77 <!-- <script type="text/javascript" src="../../ResourceLoader.php?class=window.jQuery,mwEmbed&debug=true"></script> -->
88 <script type="text/javascript">
Index: branches/MwEmbedStandAlone/modules/AddMedia/tests/Firefogg_GUI.html
@@ -1,9 +1,9 @@
22 <!DOCTYPE HTML>
33 <html><head>
44 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
5 - <title>Firefogg - Make Ogg Video in your Browser</title>
6 - <script type="text/javascript" src="../../../ResourceLoader.php?class=window.jQuery,mwEmbed"></script>
7 - <!--<script type="text/javascript" src="../mwEmbed.js?debug=true"></script> -->
 5+ <title>Firefogg - Make Ogg/Webm Video in your Browser</title>
 6+ <!--<script type="text/javascript" src="../../../ResourceLoader.php?class=window.jQuery,mwEmbed"></script> -->
 7+ <script type="text/javascript" src="../../../mwEmbed.js?debug=true"></script>
88 <style type="text/css" media="all">
99 body {
1010 margin: 0;
@@ -24,7 +24,7 @@
2525 text-align: center;
2626 }
2727 h1 {
28 - font-size: 48px;
 28+ font-size: 38px;
2929 letter-spacing: 0.25em;
3030 margin-bottom: 0;
3131 line-height: 0.8em;
@@ -82,7 +82,7 @@
8383 <a href="http://firefogg.org/index.html">
8484 <img alt="Firefogg" src="http://firefogg.org/png/firefogg.png"/>
8585 </a><br>
86 -Make Ogg Video</h1>
 86+Make Ogg/Webm Video</h1>
8787 <br>
8888 <div style="margin-right:auto;margin-left:auto;width:500px;">
8989 Note: Your video file will be locally encoded and not upload to any server
Index: branches/MwEmbedStandAlone/modules/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: branches/MwEmbedStandAlone/modules/AddMedia/mw.FirefoggGUI.js
@@ -3,7 +3,7 @@
44 */
55
66 mw.addMessages({
7 - "fogg-save_local_file" : "Save Ogg",
 7+ "fogg-save_local_file" : "Encode to File",
88 "fogg-help-sticky" : "Help (click to stick)",
99 "fogg-cg-preset" : "Preset: <strong>$1<\/strong>",
1010 "fogg-cg-quality" : "Basic quality and resolution control",
@@ -12,9 +12,11 @@
1313 "fogg-cg-advVideo" : "Advanced video encoding controls",
1414 "fogg-cg-advAudio" : "Advanced audio encoding controls",
1515 "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",
 16+ "fogg-webvideo-desc" : "Ogg Web video Theora, Vorbis 600 kbit\/s and 400px maximum width",
 17+ "fogg-savebandwidth-desc" : "Ogg Low bandwidth Theora, Vorbis 164 kbit\/s and 200px maximum width",
 18+ "fogg-highquality-desc" : "Ogg High quality Theora, Vorbis 1080px maximum width",
 19+ "fogg-webvideo-webm-desc" : "Webm Web video VP8 600 kbit\/s and 480px maximum width",
 20+ "fogg-highquality-webm-desc" : "Webm High quality VP8 1080px maximum width",
1921 "fogg-videoQuality-title" : "Video quality",
2022 "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).",
2123 "fogg-starttime-title" : "Start second",
@@ -24,7 +26,7 @@
2527 "fogg-audioQuality-title" : "Audio quality",
2628 "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).",
2729 "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>.",
 30+ "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>",
2931 "fogg-audioCodec-title" : "Audio codec",
3032 "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>",
3133 "fogg-width-title" : "Video width",
@@ -121,7 +123,7 @@
122124 'custom': {
123125 'descKey': 'fogg-preset-custom',
124126 'conf': {}
125 - },
 127+ },
126128 'webvideo': {
127129 'desc': gM( 'fogg-webvideo-desc' ),
128130 'conf': {
@@ -151,11 +153,31 @@
152154 'audioQuality' : 3,
153155 'noUpscaling' : true
154156 }
 157+ },
 158+ 'webvideo_webm': {
 159+ 'desc': gM( 'fogg-webvideo-webm-desc' ),
 160+ 'conf': {
 161+ 'videoCodec' : 'vp8',
 162+ 'maxSize' : 480,
 163+ 'videoBitrate' : 544,
 164+ 'audioBitrate' : 96,
 165+ 'noUpscaling' : true
 166+ }
 167+ },
 168+ 'webvideo_webmhq': {
 169+ 'desc' : gM('fogg-highquality-webm-desc'),
 170+ 'conf' : {
 171+ 'videoCodec' : 'vp8',
 172+ 'maxSize' : 1080,
 173+ 'videoQuality' : 6,
 174+ 'audioQuality' : 3,
 175+ 'noUpscaling' : true
 176+ }
155177 }
156178 }
157179 },
158180
159 - // Customised configuration hashtable
 181+ // Customized configuration hashtable
160182 local_settings: {},
161183
162184 // Core Firefogg default encoder configuration
@@ -184,7 +206,7 @@
185207 },
186208 'videoCodec': {
187209 'default' : "theora",
188 - 'selectVal' : [ 'theora' ],
 210+ 'selectVal' : [ 'theora', 'vp8' ],
189211 'type' : "select",
190212 'group' : "quality"
191213 },
@@ -452,7 +474,6 @@
453475 '</span>' +
454476 '</label></td><td valign="top">';
455477 // Get the default value (or an empty string if there is no default)
456 -
457478 var defaultValue = this.default_encoder_config[configKey]['default'];
458479 if ( !defaultValue ) {
459480 defaultValue = '';
@@ -497,7 +518,7 @@
498519 for ( var i in configEntry.selectVal ) {
499520 var val = configEntry.selectVal[i];
500521 if ( typeof val == 'string' ) {
501 - var sel = ( configEntry.selectVal[i] == val ) ? ' selected' : '';
 522+ var sel = ( defaultValue == val ) ? ' selected' : '';
502523 out += '<option value="' + val + '"'+sel+'>' + val + '</option>';
503524 } else if ( typeof val == 'object' ) {
504525 for ( var key in val ) {
@@ -738,16 +759,17 @@
739760 /**
740761 * Update the UI due to a change in preset
741762 */
742 - updatePresetSelection: function( presetKey ) {
 763+ updatePresetSelection: function( presetKey ) {
743764 // Update the local configuration
744 - this.local_settings['default'] = presetKey;
 765+ this.local_settings['default'] = presetKey;
745766 mw.log( 'update preset desc: ' + presetKey );
746767 var presetDesc = '';
747768 if ( this.local_settings.presets[presetKey].desc ) {
748769 presetDesc = this.local_settings.presets[presetKey].desc;
749770 } else {
750771 presetDesc = gM( 'fogg-preset-' + presetKey );
751 - }
 772+ }
 773+
752774 // Update the preset title
753775 $j( this.selector + ' .gd_preset' )
754776 .html( gM( 'fogg-cg-preset', presetDesc ) );
@@ -755,7 +777,7 @@
756778 $j( this.selector + ' ._preset_select' ).val( presetKey );
757779 },
758780
759 - /*
 781+ /**
760782 * Update the interface due to a change in a particular config key
761783 */
762784 updateInterfaceValue: function( confKey, val ) {
@@ -852,9 +874,10 @@
853875 * into which a video has already been selected. Overrides the base method.
854876 */
855877 getEncoderSettings: function() {
856 - if ( this.current_encoder_settings != null ) {
857 - return this.current_encoder_settings;
858 - }
 878+ // update the encoder settings (from local settings)
 879+ var pKey = this.local_settings['default'];
 880+ // Update the current encoder settings:
 881+ this.current_encoder_settings = this.local_settings.presets[ pKey ].conf;
859882
860883 // Call the base function
861884 // Note that settings will be a reference and can be modified
@@ -981,10 +1004,7 @@
9821005 this.updateValuesInHtml();
9831006 },
9841007
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;
 1008+ doEncode: function( progressCallback, doneCallback ) {
9891009 this.basefogg_doEncode( progressCallback, doneCallback );
9901010 },
9911011
Index: branches/MwEmbedStandAlone/modules/AddMedia/AddMedia.i18n.php
@@ -31,7 +31,7 @@
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-save_local_file' => 'Encode to File',
3636 'fogg-help-sticky' => 'Help (click to stick)',
3737 'fogg-cg-preset' => 'Preset: <strong>$1</strong>',
3838 'fogg-cg-quality' => 'Basic quality and resolution control',
@@ -40,9 +40,11 @@
4141 'fogg-cg-advVideo' => 'Advanced video encoding controls',
4242 'fogg-cg-advAudio' => 'Advanced audio encoding controls',
4343 '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',
 44+ 'fogg-webvideo-desc' => 'Ogg Web video Theora, Vorbis 600 kbit\/s and 400px maximum width',
 45+ 'fogg-savebandwidth-desc' => 'Ogg Low bandwidth Theora, Vorbis 164 kbit\/s and 200px maximum width',
 46+ 'fogg-highquality-desc' => 'Ogg High quality Theora, Vorbis 1080px maximum width',
 47+ 'fogg-webvideo-webm-desc' => 'Webm Web video VP8 600 kbit\/s and 480px maximum width',
 48+ 'fogg-highquality-webm-desc' => 'Webm High quality VP8 1080px maximum width',
4749 'fogg-videoQuality-title' => 'Video quality',
4850 '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).',
4951 'fogg-starttime-title' => 'Start second',
@@ -52,7 +54,7 @@
5355 'fogg-audioQuality-title' => 'Audio quality',
5456 '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).',
5557 '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>.',
 58+ '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>',
5759 'fogg-audioCodec-title' => 'Audio codec',
5860 '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>',
5961 'fogg-width-title' => 'Video width',
@@ -195,7 +197,7 @@
196198 'rsd-search-timeout' => 'The search request did not complete. The server may be down experiencing heavy load. You can try again later',
197199 'mwe-upload-transcoded-status' => 'Transcoded',
198200 'mwe-upload-transcode-in-progress' => 'Transcode and upload in progress (do not close this window)',
199 - 'fogg-transcoding' => 'Encoding video to Ogg',
 201+ 'fogg-transcoding' => 'Encoding video',
200202 'fogg-select_file' => 'Select file',
201203 'fogg-select_new_file' => 'Select new file',
202204 'fogg-select_url' => 'Select URL',

Status & tagging log