r57588 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57587‎ | r57588 | r57589 >
Date:20:48, 9 October 2009
Author:dale
Status:deferred
Tags:
Comment:
* fixed to use FormatJson::decode FormatJson::encode functions
Modified paths:
  • /trunk/extensions/WikiAtHome/ApiWikiAtHome.php (modified) (history)
  • /trunk/extensions/WikiAtHome/WahJobManager.php (modified) (history)
  • /trunk/extensions/WikiAtHome/WikiAtHome.php (modified) (history)
  • /trunk/extensions/WikiAtHome/internalCmdLineEncoder.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiAtHome/ApiWikiAtHome.php
@@ -60,7 +60,7 @@
6161 }else{
6262 $job4Client = array();
6363 //unpack the $job_json
64 - $job4Client['job_json'] = json_decode( $job->job_json ) ;
 64+ $job4Client['job_json'] = FormatJson::decode( $job->job_json ) ;
6565 //we set the job key to job_id _ sha1
6666 $job4Client['job_key'] = $job->job_id . '_'. sha1( $job->job_json );
6767 $job4Client['job_title'] = $job->title;
Index: trunk/extensions/WikiAtHome/WikiAtHome.php
@@ -58,8 +58,87 @@
5959 'description' => 'Enables distributing transcoding & flattening video jobs to clients using firefogg.',
6060 'descriptionmsg' => 'wah-desc',
6161 );
 62+/******************* CONFIGURATION STARTS HERE **********************/
6263
 64+//ffmpeg2theora path: enables us to get basic source file information
 65+$wgffmpeg2theora = '/usr/bin/ffmpeg2theora';
6366
 67+//the oggCat path enables server side concatenation of encoded "chunks"
 68+$wgOggCat = '/usr/local/bin/oggCat';
 69+
 70+//with oggCat installed then we can do jobs in "chunks"
 71+//and assemble on the server: (this way large encode jobs happen ~fast~)
 72+// $wgChunkDuration is set in seconds: (setting this too low will result in bad encodes)
 73+// $wgChunkDuration is only used if we have a valid $wgOggCat install
 74+$wgJobTypeConfig = array(
 75+ 'transcode' => array(
 76+ //set chunk duration to zero to not split the file
 77+ 'chunkDuration'=> 0,
 78+ // if the api should assign the job on the Special:WikiAtHome page
 79+ // (or via other external api scripts)
 80+ 'assignAtHome' => true,
 81+ 'assignInternal'=> true
 82+ ),
 83+ 'flatten'=> array(
 84+ 'chunkDuration'=> 10,
 85+ 'assignAtHome' => true,
 86+ 'assignInternal' => false
 87+ )
 88+);
 89+
 90+//time interval in seconds between clients asking the server for jobs.
 91+$wgClientSearchInterval = 60;
 92+
 93+//how long before considering a job ready to be assigned to others
 94+//note first "in" wins & if once time is up we decrement set_c
 95+$wgJobTimeOut = 60*10; //10 min
 96+
 97+//this sets how many copies of any given stream we should send out as part of a job
 98+$wgNumberOfClientsPerJobSet = 25;
 99+
 100+//what to encode to:
 101+$wgEnabledDerivatives = array(
 102+ WikiAtHome::ENC_SAVE_BANDWITH,
 103+ WikiAtHome::ENC_WEB_STREAM,
 104+ WikiAtHome::ENC_HQ_STREAM
 105+);
 106+
 107+//these params are set via firefogg encode options see:
 108+//http://firefogg.org/dev/index.html
 109+//if you want to re-derive things you should change its key above in the WikiAtHome class
 110+$wgDerivativeSettings[ WikiAtHome::ENC_SAVE_BANDWITH ] =
 111+ array(
 112+ 'videoBitrate' => '128',
 113+ 'audioBitrate' => '32',
 114+ 'samplerate' => '22050',
 115+ 'framerate' => '15',
 116+ 'channels' => '1',
 117+ 'maxSize' => '200',
 118+ 'noUpscaling' => 'true',
 119+ 'twopass' => 'true',
 120+ 'keyframeInterval' => '64',
 121+ 'bufDelay' => '128'
 122+ );
 123+$wgDerivativeSettings[ WikiAtHome::ENC_WEB_STREAM ] =
 124+ array(
 125+ 'maxSize' => '400',
 126+ 'videoBitrate' => '512',
 127+ 'audioBitrate' => '96',
 128+ 'noUpscaling' => 'true',
 129+ 'twopass' => 'true',
 130+ 'keyframeInterval' => '128',
 131+ 'bufDelay' => '256'
 132+ );
 133+
 134+$wgDerivativeSettings[ WikiAtHome::ENC_HQ_STREAM ] =
 135+ array(
 136+ 'maxSize' => '1080',
 137+ 'videoQuality' => 6,
 138+ 'audioQuality' => 3,
 139+ 'noUpscaling' => 'true'
 140+ );
 141+
 142+
64143 /*
65144 * Main WikiAtHome Class hold some constants and config values
66145 *
@@ -189,7 +268,7 @@
190269 wfProfileIn( 'ffmpeg2theora' );
191270 $json_meta_str = wfShellExec( $cmd );
192271 wfProfileOut( 'ffmpeg2theora' );
193 - $objMeta = json_decode( $json_meta_str );
 272+ $objMeta = FormatJson::decode( $json_meta_str );
194273 //if we return the same string then json_decode has failed in php < 5.2.6
195274 //workaround for bug http://bugs.php.net/bug.php?id=45989
196275 if( $objMeta == $json_meta_str )
@@ -216,84 +295,3 @@
217296 }
218297 return true;
219298 }
220 -
221 -/******************* CONFIGURATION STARTS HERE **********************/
222 -
223 -//ffmpeg2theora path: enables us to get basic source file information
224 -$wgffmpeg2theora = '/usr/bin/ffmpeg2theora';
225 -
226 -//the oggCat path enables server side concatenation of encoded "chunks"
227 -$wgOggCat = '/usr/local/bin/oggCat';
228 -
229 -//with oggCat installed then we can do jobs in "chunks"
230 -//and assemble on the server: (this way no single slow client slows down
231 -//a video job)
232 -// $wgChunkDuration is set in seconds: (setting this too low will result in bad encodes)
233 -// $wgChunkDuration is only used if we have a valid $wgOggCat install
234 -$wgJobTypeConfig = array(
235 - 'transcode' => array(
236 - //set chunk duration to zero to not split the file
237 - 'chunkDuration'=> 0,
238 - // if the api should assign the job on the Special:WikiAtHome page
239 - // (or via other external api scripts)
240 - 'assignAtHome' => true,
241 - 'assignInternal'=> true
242 - ),
243 - 'flatten'=> array(
244 - 'chunkDuration'=> 10,
245 - 'assignAtHome' => true,
246 - 'assignInternal' => false
247 - )
248 -);
249 -
250 -//time interval in seconds between clients asking the server for jobs.
251 -$wgClientSearchInterval = 60;
252 -
253 -//how long before considering a job ready to be assigned to others
254 -//note first "in" wins & if once time is up we decrement set_c
255 -$wgJobTimeOut = 60*10; //10 min
256 -
257 -//this sets how many copies of any given stream we should send out as part of a job
258 -$wgNumberOfClientsPerJobSet = 25;
259 -
260 -//what to encode to:
261 -$wgEnabledDerivatives = array(
262 - WikiAtHome::ENC_SAVE_BANDWITH,
263 - WikiAtHome::ENC_WEB_STREAM,
264 - WikiAtHome::ENC_HQ_STREAM
265 -);
266 -
267 -//these params are set via firefogg encode options see:
268 -//http://firefogg.org/dev/index.html
269 -//if you want to re-derive things you should change its key above in the WikiAtHome class
270 -$wgDerivativeSettings[ WikiAtHome::ENC_SAVE_BANDWITH ] =
271 - array(
272 - 'videoBitrate' => '128',
273 - 'audioBitrate' => '32',
274 - 'samplerate' => '22050',
275 - 'framerate' => '15',
276 - 'channels' => '1',
277 - 'maxSize' => '200',
278 - 'noUpscaling' => 'true',
279 - 'twopass' => 'true',
280 - 'keyframeInterval' => '64',
281 - 'bufDelay' => '128'
282 - );
283 -$wgDerivativeSettings[ WikiAtHome::ENC_WEB_STREAM ] =
284 - array(
285 - 'maxSize' => '400',
286 - 'videoBitrate' => '512',
287 - 'audioBitrate' => '96',
288 - 'noUpscaling' => 'true',
289 - 'twopass' => 'true',
290 - 'keyframeInterval' => '128',
291 - 'bufDelay' => '256'
292 - );
293 -
294 -$wgDerivativeSettings[ WikiAtHome::ENC_HQ_STREAM ] =
295 - array(
296 - 'maxSize' => '1080',
297 - 'videoQuality' => 6,
298 - 'audioQuality' => 3,
299 - 'noUpscaling' => 'true'
300 - );
Index: trunk/extensions/WikiAtHome/WahJobManager.php
@@ -354,7 +354,7 @@
355355 array(
356356 'job_set_id' => $this->sId,
357357 'job_order_id' => 0,
358 - 'job_json' => wfJsonEncode( $jobJsonAry )
 358+ 'job_json' => FormatJson::encode( $jobJsonAry )
359359 );
360360 }else{
361361 for( $i=0 ; $i < $set_job_count; $i++ ){
@@ -366,7 +366,7 @@
367367 array(
368368 'job_set_id' => $this->sId,
369369 'job_order_id' => $i,
370 - 'job_json' => wfJsonEncode( $jobJsonAry )
 370+ 'job_json' => FormatJson::encode( $jobJsonAry )
371371 );
372372 }
373373 }
Index: trunk/extensions/WikiAtHome/internalCmdLineEncoder.php
@@ -53,7 +53,7 @@
5454 }
5555
5656 $jobSet = WahJobManager ::getJobSetById( $job->job_set_id );
57 - $jobDetails = json_decode( $job->job_json ) ;
 57+ $jobDetails = FormatJson::decode( $job->job_json ) ;
5858
5959 //get the title (so we can access the source file)
6060 $fTitle = Title::newFromText( $job->title, $job->ns );

Status & tagging log