r84453 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84452‎ | r84453 | r84454 >
Date:15:32, 21 March 2011
Author:catrope
Status:ok
Tags:
Comment:
TimedMediaHandler: Some indentation fixes (tabs->spaces, mostly)
Modified paths:
  • /trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php (modified) (history)
  • /trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscode.php (modified) (history)
  • /trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscodeJob.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php
@@ -83,27 +83,28 @@
8484
8585 function getImagePopUp(){
8686 return Xml::tags( 'div' , array(
87 - 'id' => "ogg_thumbplayer_" . TimedMediaTransformOutput::$serial++,
88 - 'class' => 'PopUpMediaTransform',
89 - 'style' => "width:" . intval( $this->width ) . "px;height:" .
90 - intval( $this->getPlayerHeight() ) . "px",
91 - 'data-videopayload' => $this->getXmlMediaTagOutput( $this->getPopupPlayerSize() ),
 87+ 'id' => "ogg_thumbplayer_" . TimedMediaTransformOutput::$serial++,
 88+ 'class' => 'PopUpMediaTransform',
 89+ 'style' => "width:" . intval( $this->width ) . "px;height:" .
 90+ intval( $this->getPlayerHeight() ) . "px",
 91+ 'data-videopayload' => $this->getXmlMediaTagOutput( $this->getPopupPlayerSize() ),
9292 ),
93 - Xml::tags( 'img', array(
94 - 'style' => 'width:100%;height:100%;',
95 - 'src' => $this->getUrl(),
96 - ),'')
97 - .
98 - // For javascript disabled browsers provide a link to the asset:
99 - Xml::tags( 'a', array(
 93+ Xml::tags( 'img', array(
 94+ 'style' => 'width:100%;height:100%;',
 95+ 'src' => $this->getUrl(),
 96+ ),'')
 97+ .
 98+ // For javascript disabled browsers provide a link to the asset:
 99+ Xml::tags( 'a', array(
100100 'href'=> $this->file->getUrl(),
101101 'title' => wfMsg( 'timedmedia-play-media' )
102102 ), '<b></b>'. // why is the a child tag escaped unless there is an html string prefix?
103 - Xml::tags( 'div', array(
 103+ Xml::tags( 'div', array(
104104 'target' => '_new',
105105 'class' => 'play-btn-large'
106 - ), '')
 106+ ), ''
107107 )
 108+ )
108109 );
109110 }
110111
Index: trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscodeJob.php
@@ -152,24 +152,24 @@
153153 $cmd.= $this->ffmpegAddVideoOptions( $file, $target, $options, $pass );
154154 }
155155
156 - // Check for start time
 156+ // Check for start time
157157 if( isset( $options['starttime'] ) ){
158158 $cmd.= ' -ss ' . wfEscapeShellArg( $options['starttime'] );
159159 } else {
160160 $options['starttime'] = 0;
161161 }
162 - // Check for end time:
163 - if( isset( $options['endtime'] ) ){
164 - $cmd.= ' -t ' . intval( $options['endtime'] ) - intval($options['starttime'] ) ;
165 - }
166 -
167 - if ( $pass == 1 || isset( $options['noaudio'] ) ) {
168 - $cmd.= ' -an';
169 - } else {
170 - $cmd.= $this->ffmpegAddAudioOptions( $file, $target, $options, $pass );
171 - }
 162+ // Check for end time:
 163+ if( isset( $options['endtime'] ) ){
 164+ $cmd.= ' -t ' . intval( $options['endtime'] ) - intval($options['starttime'] ) ;
 165+ }
172166
173 - // Output WebM
 167+ if ( $pass == 1 || isset( $options['noaudio'] ) ) {
 168+ $cmd.= ' -an';
 169+ } else {
 170+ $cmd.= $this->ffmpegAddAudioOptions( $file, $target, $options, $pass );
 171+ }
 172+
 173+ // Output WebM
174174 $cmd.=" -f webm";
175175
176176 if ( $pass != 0 ) {
@@ -230,56 +230,56 @@
231231 // Get size transform ( if maxSize is > file, file size is used:
232232 list( $width, $height ) = WebVideoTranscode::getMaxSizeTransform( $file, $options['maxSize'] );
233233 $cmd.= ' -s ' . intval( $width ) . 'x' . intval( $height );
234 - } else if (
235 - (isset( $options['width'] ) && $options['width'] > 0 )
 234+ } else if (
 235+ (isset( $options['width'] ) && $options['width'] > 0 )
236236 &&
237237 (isset( $options['height'] ) && $options['height'] > 0 )
238 - ){
 238+ ){
239239 $cmd.= ' -s ' . intval( $options['width'] ) . 'x' . intval( $options['height'] );
240 - }
241 -
 240+ }
 241+
242242 // Handle crop:
243 - $optionMap = array(
244 - 'cropTop' => '-croptop',
245 - 'cropBottom' => '-cropbottom',
246 - 'cropLeft' => '-cropleft',
247 - 'cropRight' => '-cropright'
248 - );
249 - foreach( $optionMap as $name => $cmdArg ){
250 - if( isset($options[$name]) ){
251 - $cmd.= " $cmdArg " . wfEscapeShellArg( $options[$name] );
252 - }
253 - }
254 -
255 - // Check for keyframeInterval
256 - if( isset( $options['keyframeInterval'] ) ){
257 - $cmd.= ' -g ' . wfEscapeShellArg( $options['keyframeInterval'] );
258 - $cmd.= ' -keyint_min ' . wfEscapeShellArg( $options['keyframeInterval'] );
259 - }
260 - if( isset( $options['deinterlace'] ) ){
261 - $cmd.= ' -deinterlace';
262 - }
263 -
264 - return $cmd;
 243+ $optionMap = array(
 244+ 'cropTop' => '-croptop',
 245+ 'cropBottom' => '-cropbottom',
 246+ 'cropLeft' => '-cropleft',
 247+ 'cropRight' => '-cropright'
 248+ );
 249+ foreach( $optionMap as $name => $cmdArg ){
 250+ if( isset($options[$name]) ){
 251+ $cmd.= " $cmdArg " . wfEscapeShellArg( $options[$name] );
 252+ }
 253+ }
 254+
 255+ // Check for keyframeInterval
 256+ if( isset( $options['keyframeInterval'] ) ){
 257+ $cmd.= ' -g ' . wfEscapeShellArg( $options['keyframeInterval'] );
 258+ $cmd.= ' -keyint_min ' . wfEscapeShellArg( $options['keyframeInterval'] );
 259+ }
 260+ if( isset( $options['deinterlace'] ) ){
 261+ $cmd.= ' -deinterlace';
 262+ }
 263+
 264+ return $cmd;
265265 }
266 -
 266+
267267 function ffmpegAddAudioOptions( $file, $target, $options, $pass){
268268 $cmd ='';
269269 if( isset( $options['audioQuality'] ) ){
270270 $cmd.= " -aq " . wfEscapeShellArg( $options['audioQuality'] );
271271 }
272272 if( isset( $options['audioBitrate'] )){
273 - $cmd.= ' -ab ' . intval( $options['audioBitrate'] ) * 1000;
274 - }
275 - if( isset( $options['samplerate'] ) ){
276 - $cmd.= " -ar " . wfEscapeShellArg( $options['samplerate'] );
277 - }
278 - if( isset( $options['channels'] )){
279 - $cmd.= " -ac " . wfEscapeShellArg( $options['channels'] );
280 - }
281 - // Always use vorbis for audio:
282 - $cmd.= " -acodec libvorbis ";
283 - return $cmd;
 273+ $cmd.= ' -ab ' . intval( $options['audioBitrate'] ) * 1000;
 274+ }
 275+ if( isset( $options['samplerate'] ) ){
 276+ $cmd.= " -ar " . wfEscapeShellArg( $options['samplerate'] );
 277+ }
 278+ if( isset( $options['channels'] )){
 279+ $cmd.= " -ac " . wfEscapeShellArg( $options['channels'] );
 280+ }
 281+ // Always use vorbis for audio:
 282+ $cmd.= " -acodec libvorbis ";
 283+ return $cmd;
284284 }
285285
286286
Index: trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscode.php
@@ -61,7 +61,7 @@
6262 'bufDelay' => '128',
6363 'videoCodec' => 'theora',
6464 ),
65 - WebVideoTranscode::ENC_OGV_4MBS =>
 65+ WebVideoTranscode::ENC_OGV_4MBS =>
6666 array(
6767 'maxSize' => '360',
6868 'videoBitrate' => '368',

Status & tagging log