/** * CONVERT VIDEOS TO FLV FORMAT * @param database A database connector object */ function inject($path_flv) { defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('CONVERTPATH') ? null : define('CONVERTPATH', dirname(__FILE__)); if(substr(PHP_OS, 0, 3) == "WIN") { defined('JPATH_SITE') ? null : define('JPATH_SITE', str_replace("\components\com_hwdvideoshare\converters", "", CONVERTPATH) ); } else { defined('JPATH_SITE') ? null : define('JPATH_SITE', str_replace("/components/com_hwdvideoshare/converters", "", CONVERTPATH) ); } // get hwdVideoShare general settings include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'config.hwdvideoshare.php'); $c = hwd_vs_Config::get_instance(); // get hwdVideoShare server settings include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'serverconfig.hwdvideoshare.php'); $s = hwd_vs_SConfig::get_instance(); $result = array(); if(substr(PHP_OS, 0, 3) != "WIN") { $cmd_input = $s->flvtool2path.' -U '.$path_flv; } else { $cmd_input = $s->flvtool2path.' -U "'.$path_flv.'"'; } @exec("$sharedlib $cmd_input 2>&1", $cmd_output); $result[0] = 0; // result of flvtool2 execution $result[1] = null; // ? $result[2] = $cmd_input; // input of flvtool2 execution $result[3] = $cmd_output; // output of flvtool2 execution $result[4] = ''; // holder for output text if(empty($cmd_output)) { $result[0] = 1; } $result = hwd_vs_InjectMetaData::generateOutput($result); return $result; }
hwd_vs_ConverterTools::writeLog($file_contents); $output.= "<div class=\"abortbox\"><h2>File ".$n." of ".$count." Aborted!</h2></div>"; $n = $n + 1; continue; } chmod($path_new_mp4, 0755); } /****************************************** * FLASH META DATA MANIPULATION (INSERT onMetaData TAG) **/ $InjectMetaData = hwd_vs_InjectMetaData::inject($path_new_flv); $output.= $InjectMetaData[4]; if ($InjectMetaData[0] == 0) { $file_contents = '['.date('Y-m-d H:i:s').'] [ Meta Injection Failed ] INPUT: '.$InjectMetaData[2].' OUTPUT: '.$InjectMetaData[3]; hwd_vs_ConverterTools::writeLog($file_contents); } /****************************************** * GET VIDEO LENGTH **/ $ExtractDuration = hwd_vs_ExtractDuration::extract($path_new_flv, hwd_vs_ConverterTools::processOutput($ConvertVideo[3])); $output.= $ExtractDuration[3];
/** * start converter */ function ajaxReinsertMetaFLV() { global $limit, $limitstart; $db =& JFactory::getDBO(); $video_id = Jrequest::getInt( 'cid', '' ); $db->SetQuery( 'SELECT video_id FROM #__hwdvidsvideos WHERE id = '.$video_id ); $video_id = $db->loadResult(); include_once(JPATH_SITE."/components/com_hwdvideoshare/converters/__ConversionTools.php"); include_once(JPATH_SITE."/components/com_hwdvideoshare/converters/__InjectMetaData.php"); $path_new_flv = JPATH_SITE."/hwdvideos/uploads/".$video_id.".flv"; $filename_ext = ''; $InjectMetaData = hwd_vs_InjectMetaData::inject($path_new_flv); print $InjectMetaData[4]; exit; }