You are here

public function video_localcommand::preset_settings in Video 6.5

Overrides video_transcoder::preset_settings

File

transcoders/video_localcommand.inc, line 572

Class

video_localcommand

Code

public function preset_settings(&$form_state, video_preset $preset) {
  $form = array();
  $settings = $preset
    ->getSettings();
  if (!isset($settings['commands'])) {
    $settings['commands'] = array(
      '',
    );
  }

  // Add an empty entry box
  $settings['commands'][] = '';
  $form['commands'] = array(
    '#tree' => TRUE,
  );
  foreach ($settings['commands'] as $k => $command) {
    $form['commands'][$k] = array(
      '#type' => 'textarea',
      '#title' => t('Command @num', array(
        '@num' => $k + 1,
      )),
      '#default_value' => $command,
      '#rows' => 2,
      '#required' => $k === 0,
      '#wysiwyg' => FALSE,
    );
  }
  if (!empty($this->flvtoolcmd)) {
    $form['useflvtool2'] = array(
      '#type' => 'checkbox',
      '#title' => t('Post-process the output with flvtool2'),
      '#default_value' => !empty($settings['useflvtool2']),
    );
  }
  if (!empty($this->faststartcmd)) {
    $form['useqtfaststart'] = array(
      '#type' => 'checkbox',
      '#title' => t('Post-process the output with qt-faststart'),
      '#default_value' => !empty($settings['useqtfaststart']),
    );
  }
  $form['help'] = array(
    '#type' => 'item',
    '#title' => t('Notes'),
    '#value' => '<p>' . t('The commands are executed in a temporary directory that is removed after the conversion has completed.') . '<br/>' . t('If you are using FFmpeg to transcode large videos, consider adding <code>-nostats</code> to your command line(s) to reduce memory usage while transcoding.') . '<br/>' . t('Submit this form and revisit this page to add more commands.') . '</p>' . '<p>' . t('You can use the following replacement variables in your commands:') . '</p>' . theme('item_list', array(
      '<strong>!cmd_path</strong>: ' . t('the path to your executable (currently: %executable).', array(
        '%executable' => $this->cmdpath,
      )),
      '<strong>!videofile</strong>: ' . t('the escaped absolute path to the input video file.'),
      '<strong>!convertfile</strong>: ' . t('the escaped absolute path to the output video file.'),
      '<strong>!width</strong>: ' . t('the width of the output video file, excluding padding, for use with -s.'),
      '<strong>!height</strong>: ' . t('the height of the output video file, excluding padding, for use with -s.'),
      '<strong>!paddingwidth</strong>: ' . t('the width of the output video file, including padding, for use as first parameter of -vf pad.'),
      '<strong>!paddingheight</strong>: ' . t('the height of the output video file, including padding, for use as second parameter of -vf pad.'),
      '<strong>!paddingtop</strong>: ' . t('the padding added to the top of the output video file, for use with -padtop or as third parameter of -vf pad.'),
      '<strong>!paddingbottom</strong>: ' . t('the padding added to the bottom of the output video file, for use with -padbottom.'),
      '<strong>!paddingleft</strong>: ' . t('the padding added to the left of the output video file, for use with -padleft or as fourth parameter of -vf pad.'),
      '<strong>!paddingright</strong>: ' . t('the padding added to the right of the output video file, for use with -padright.'),
    )),
  );
  return $form;
}