$path_media = $moviemasher_client->getOption('PathMedia'); $path_media .= authenticated_userid() . '/'; $path_cgi = $moviemasher_client->getOption('PathCGI'); $path_swf = $moviemasher_client->getOption('PathSWF'); $path_xml = $moviemasher_client->getOption('PathXML'); $mash_xml_path = $path_media . $id . '.xml'; $mash_string = @file_get_contents($dir_host . $mash_xml_path); if (!$mash_string) { $err = 'Could not read mash xml file: ' . $dir_host . $mash_xml_path; } else { $mash_xml = @simplexml_load_string($mash_string); if (!$mash_xml) { $err = 'Could not parse mash xml file: ' . $dir_host . $mash_xml_path; } else { $type = 'video'; $mash_info = MovieMasher_Coder_Decoder::mashInfo($mash_xml); if (!$mash_info['has_video']) { // just audio clips in mash, so change output extension $decoder_extension = $moviemasher_client->getOption('EncoderAudioExtension'); $type = 'audio'; } $label = (string) $mash_xml->mash[0]['label']; if (!$label) { $label = 'Untitled Mash'; } $meta = array(); $meta['label'] = $label; $meta['extension'] = $decoder_extension; $meta['type'] = $type; if ($moviemasher_client->progressesLocally()) { $xml_string = '';
function _codeFile() { $this->__cleanUpJob(); $file_time = microtime(true); $audio_path = ''; $video_path = ''; // load configuration URL and make sure it's not empty and can be parsed as XML $xml_string = http_get_url($this->_options['DecoderConfigURL']); if (!$xml_string) { throw new RuntimeException('No response from DecoderConfigURL: ' . $this->_options['DecoderConfigURL']); } $this->__mashXML = @simplexml_load_string($xml_string); if (!$this->__mashXML) { throw new RuntimeException('Unable to parse DecoderConfigURL: ' . $this->_options['DecoderConfigURL']); } // TODO: we should be respecting 'config' attributes in the tags! $this->__mashData = MovieMasher_Coder_Decoder::mashInfo($this->__mashXML, $this->_options['CoderBaseURL'], $this->_options['DecoderFPS'], $this->_options['DecoderExactRender']); if (empty($this->__mashData['duration'])) { throw new UnexpectedValueException('Unable to determine mash duration: ' . $this->_options['DecoderConfigURL']); } $no_audio = $this->_options['CoderNoAudio'] || !$this->__mashData['has_audio']; $no_video = $this->_options['CoderNoVideo'] || !$this->__mashData['has_video']; if ($no_video && $no_audio) { throw new UnexpectedValueException('You cannot set both CoderNoVideo and CoderNoAudio'); } if (!empty($this->_options['Verbose'])) { $this->log('MASH: ' . $this->__mashXML->asXML()); } $this->__cacheMedia(); if (!safe_path($this->_buildDir . 'build')) { throw new RuntimeException('Could not create path: ' . $this->_buildDir . 'build'); } // do flash first, since it's most likely to produce an error if (!$no_video) { $this->__buildFlash(); } if (!$no_audio) { $audio_path = $this->__buildAudio(); } if (!$no_video) { $video_path = $this->__buildVideo(); } $file_name = $this->_buildDir . $this->_options['CoderFilename'] . '.' . $this->_options['DecoderExtension']; $this->__buildMovie($file_name, $audio_path, $video_path); return $file_name; }