コード例 #1
0
    /**
     * CONVERT VIDEOS TO FLV FORMAT
     * @param database A database connector object
     */
	function move($path_mp4) {

		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 server settings
		include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'serverconfig.hwdvideoshare.php');
		$s = hwd_vs_SConfig::get_instance();

		$path_mp4_temp = $path_mp4.".temp";

		if(substr(PHP_OS, 0, 3) == "WIN")
		{
			$path_cmd_mp4 = '"'.$path_mp4.'"';
			$path_cmd_mp4_temp  = '"'.$path_mp4_temp.'"';
		}
		else
		{
			$path_cmd_mp4 = $path_mp4;
			$path_cmd_mp4_temp  = $path_mp4_temp;
		}

		$cmd_input = "$s->qtfaststart $path_cmd_mp4 $path_cmd_mp4_temp";
		@exec("$sharedlib $cmd_input 2>&1", $cmd_output);

		$result = array();
		$result[0] = 0;
		$result[1] = $cmd_input;
		$result[2] = $cmd_output;

		if(file_exists($path_mp4_temp) && (filesize($path_mp4_temp) > 0)) {

			@unlink($path_mp4);
			@rename($path_mp4_temp, $path_mp4);

			if(file_exists($path_mp4) && (filesize($path_mp4) > 0)) {

				@unlink($path_mp4_temp);

			}

			$check_string = implode(",", $cmd_output);

			if (strpos($check_string, "writing moov atom") === false) {

				$result[0] = 0;

			} else {

				$result[0] = 1;

			}

		}

		$result = hwd_vs_MoovAtom::generateOutput($result);
		return $result;

	}