/** * undocumented function * * @access public * @author Oliver Lillie * @return void */ public function updateFormatOptions(&$save_path) { parent::updateFormatOptions($save_path); // if we have a rotation and it's set to true then we must autodetect the rotation according to the // meta data available. // !IMPORTANT that auto orientation is done before any automatic flipping. if (empty($this->_format['video_rotation']) === false && $this->_format['video_rotation'] === true) { $video_data = $this->_media_object->readVideoComponent(); if (empty($video_data['rotation']) === false) { $current_rotation = (int) $video_data['rotation']; $this->setVideoRotation(-$current_rotation); $this->addCommand('-metadata:s:v', 'rotate=""'); } else { $this->_format['video_rotation'] = null; } } // if video padding has been set we might need to update the width/height dimensions of the pad filter if (empty($this->_format['video_padding']) === false) { $padding = $this->_format['video_padding']; if (empty($padding['width']) === true || empty($padding['height']) === true) { $this->setVideoPadding($padding['_padding']['top'], $padding['_padding']['right'], $padding['_padding']['bottom'], $padding['_padding']['left'], $padding['width'], $padding['height'], $padding['colour']); } } // TODO expand the video_filters format data if (empty($this->_format['video_filters']) === false) { } return $this; }
/** * undocumented function * * @access public * @author Oliver Lillie * @return void */ public function updateFormatOptions(&$save_path, $overwrite) { parent::updateFormatOptions($save_path, $overwrite); // adjust the sample frequency if the audio codec is acc and frequency is not already set. if (in_array($this->_format['audio_codec'], array('libfdk_aac', 'aac')) === true && $this->_format['audio_sample_frequency'] === null) { $this->setAudioSampleFrequency(22050); } $video_data = $this->_media_object->readVideoComponent(); // check to see if the aspect ratio has fixed the width and heights, if so we must apply the size to any output. if ($video_data['dimensions']['aspect_ratio_fix_warning'] === true) { $this->setVideoDimensions($video_data['dimensions']['width'], $video_data['dimensions']['height']); } // if we have a rotation and it's set to true then we must autodetect the rotation according to the // meta data available. // !IMPORTANT that auto orientation is done before any automatic flipping. if (empty($this->_format['video_rotation']) === false && $this->_format['video_rotation'] === true) { if (empty($video_data['rotation']) === false) { $current_rotation = (int) $video_data['rotation']; $this->setVideoRotation(-$current_rotation); $this->addCommand('-metadata:s:v', 'rotate=""'); } else { $this->_format['video_rotation'] = null; } } // if the aspect ratio of the rotated video is not the same as the final video we must update the final outputs // aspect ratio. However, we will only automatically do this if the aspect ratio is not already set. if (in_array($this->_format['video_rotation'], array(1, 2)) === true && $this->_format['video_aspect_ratio'] === null) { $aspect_ratio = $video_data['display_aspect_ratio']; if (preg_match('/^[0-9]+\\.[0-9]+$/', $aspect_ratio, $_m) > 0) { $this->setVideoAspectRatio(1 / $aspect_ratio); } else { if (preg_match('/^([0-9]+):([0-9]+)$/', $aspect_ratio, $matches) > 0) { $this->setVideoAspectRatio($matches[2] . ':' . $matches[1]); } } } // if video padding has been set we might need to update the width/height dimensions of the pad filter if (empty($this->_format['video_padding']) === false) { $padding = $this->_format['video_padding']; if (empty($padding['width']) === true || empty($padding['height']) === true) { $this->setVideoPadding($padding['_padding']['top'], $padding['_padding']['right'], $padding['_padding']['bottom'], $padding['_padding']['left'], $padding['width'], $padding['height'], $padding['colour']); } } // TODO expand the video_filters format data if (empty($this->_format['video_filters']) === false) { } return $this; }