# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: C:\Sites\Asocome.com\wwwroot\sites\all\modules\video\libraries\phpvideotoolkit
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: phpvideotoolkit.php5.php
--- phpvideotoolkit.php5.php Base (BASE)
+++ phpvideotoolkit.php5.php Locally Modified (Based On LOCAL)
@@ -478,9 +478,15 @@
    * @access protected
    * @param string $tmp_directory A full absolute path to you temporary directory
    */
-  function __construct($ffmpeg_binary = '/usr/bin/ffmpeg', $tmp_dir='/tmp/') {
+  function __construct($ffmpeg_binary = null, $tmp_dir=null) {
 // 			print_r(array(debug_backtrace(), $tmp_dir));
+    if($ffmpeg_binary == null){
+         $ffmpeg_binary = variable_get('video_ffmpeg_path', '/usr/bin/ffmpeg');
+    }
     $this->_ffmpeg_binary = $ffmpeg_binary;
+    if($tmp_dir == null){
+        $tmp_dir = file_directory_temp() . '/';
+    }
     $this->_tmp_directory = $tmp_dir;
   }
 
@@ -571,41 +577,29 @@
     $format = '';
     $data = array('reading_from_cache' => false);
 // 			execute the ffmpeg lookup
-    $buffer = self::_captureExecBuffer($this->_ffmpeg_binary . ' -formats', $tmp_dir);
+    $formats = self::_captureExecBuffer($this->_ffmpeg_binary . ' -formats', $tmp_dir);
     $codecs = self::_captureExecBuffer($this->_ffmpeg_binary . ' -codecs', $tmp_dir);
     $filters = self::_captureExecBuffer($this->_ffmpeg_binary . ' -bsfs', $tmp_dir);
     $protocols = self::_captureExecBuffer($this->_ffmpeg_binary . ' -protocols', $tmp_dir);
-    self::$ffmpeg_found = $data['ffmpeg-found'] = !(strpos($buffer[0], 'command not found') !== false || strpos($buffer[0], 'No such file or directory') !== false);
+    self::$ffmpeg_found = $data['ffmpeg-found'] = !(strpos($formats[0], 'command not found') !== false || strpos($formats[0], 'No such file or directory') !== false);
 
     $data['compiler'] = array();
     $data['binary'] = array();
     $data['ffmpeg-php-support'] = self::hasFFmpegPHPSupport();
 
-    $data['raw'] = implode("\r\n", $buffer) . "\r\n" . implode("\r\n", $codecs) . "\r\n" . implode("\r\n", $filters) . implode("\r\n", $protocols);
-
-    if (!self::$ffmpeg_found) {
-      self::$ffmpeg_info = $data;
-      return $data;
-    }
-
-    $buffer = $data['raw'];
-
-// 			start building the info array
-    $look_ups = array('formats' => 'File formats:', 'configuration' => 'configuration: ', 'codecs' => 'Codecs:', 'filters' => 'Bitstream filters:', 'protocols' => 'Supported file protocols:', 'abbreviations' => 'Frame size, frame rate abbreviations:', 'Note:');
-    $total_lookups = count($look_ups);
-    $pregs = array();
     $indexs = array();
+    $matches = array();
+    $indexs['configuration'] = 0;
+    $matches[] = implode("\r\n", $formats);
+    $indexs['formats'] = 1;
+    $matches[] = implode("\r\n", $formats);
+    $indexs['codecs'] = 2;
+    $matches[] = implode("\r\n", $codecs);
+    $indexs['filters'] = 3;
+    $matches[] = implode("\r\n", $filters);
+    $indexs['protocols'] = 4;
+    $matches[] = implode("\r\n", $protocols);
 
-// 			search for the content
-    foreach ($look_ups as $key => $reg) {
-      if (strpos($buffer, $reg) !== false) {
-        $index = array_push($pregs, $reg);
-        $indexs[$key] = $index;
-      }
-    }
-
-    preg_match('/' . implode('(.*)', $pregs) . '(.*)/s', $buffer, $matches);
-
     $configuration = '';
     if (isset($indexs['configuration']))
       $configuration = trim($matches[$indexs['configuration']]);
@@ -614,7 +608,7 @@
     $data['binary']['configuration'] = $config_flags[0];
     $data['binary']['vhook-support'] = in_array('--enable-vhook', $config_flags[0]) || !in_array('--disable-vhook', $config_flags[0]);
     // 			grab the versions
-    $data['binary']['versions'] = self::getVersion($buffer);
+    $data['binary']['versions'] = self::getVersion($matches[0]);
     // 			grab the ffmpeg compile info 
     preg_match('/built on (.*), gcc: (.*)/', $configuration, $conf);
     if (count($conf) > 0) {
@@ -887,7 +881,7 @@
     if (count($matches) > 0) {
       $data['video'] = array();
 // 				get the dimension parts
-      preg_match('/([0-9]{1,5})x([0-9]{1,5})/', $matches[2], $dimensions_matches);
+      preg_match('/([0-9]{1,5})x([0-9]{1,5}),/', $matches[2], $dimensions_matches);
 // 				print_r($dimensions_matches);
       $dimensions_value = $dimensions_matches[0];
       $data['video']['dimensions'] = array(
@@ -2900,6 +2894,12 @@
       $this->addCommand('-passlogfile', $multi_pass_file);
     }
 
+    // TODO make this a configuration variable by codec
+    $isExperimental= true;
+    if($isExperimental){
+     $this->addCommand('-strict experimental');   
+    }
+
 //			combine all the output commands
     $command_string = $this->_combineCommands();
 //			prepare the command suitable for exec
@@ -2914,6 +2914,7 @@
 
 //			execute the command
 // 			$exec_string = $exec_string.' 2>&1';// &> '.$this->_log_file;
+    //drupal_set_message('$exec_string: ' . $exec_string);
     $buffer = self::_captureExecBuffer($exec_string, $this->_tmp_directory);
 // 			exec($exec_string, $buffer);
     if ($log) {
