aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeshan <heshan@heidisoft.com>2011-05-04 17:16:42 +0530
committerHeshan <heshan@heidisoft.com>2011-05-04 17:16:42 +0530
commitaa5c9b48cfa5674f534acab2cdaab685e9e116ee (patch)
treee4e708d3e796f875ce7ebe3b5af7bcfc72f6bd4b
parentd0d4b273d990ec3869a09e2312a465d357d42d13 (diff)
downloadvideo-aa5c9b48cfa5674f534acab2cdaab685e9e116ee.tar.gz
video-aa5c9b48cfa5674f534acab2cdaab685e9e116ee.tar.bz2
Run through the coder module and review the code and documentation of the module code.
-rw-r--r--includes/conversion.inc9
-rw-r--r--includes/metadata.inc3
-rw-r--r--includes/preset.inc8
-rw-r--r--includes/transcoder.inc6
-rw-r--r--includes/video_helper.inc6
-rw-r--r--metadata/flvtool2.inc3
-rw-r--r--modules/video_ui/video.admin.inc3
-rw-r--r--modules/video_ui/video.preset.inc55
-rw-r--r--modules/video_zencoder/includes/zencoder.inc17
-rw-r--r--modules/video_zencoder/transcoders/video_zencoder.inc8
-rw-r--r--modules/video_zencoder/video_zencoder.module3
-rw-r--r--transcoders/video_ffmpeg.inc20
-rw-r--r--transcoders/video_phpvideotoolkit.inc38
-rw-r--r--video.drush.inc5
-rw-r--r--video.field.inc9
-rw-r--r--video.module27
-rw-r--r--video.theme.inc9
17 files changed, 134 insertions, 95 deletions
diff --git a/includes/conversion.inc b/includes/conversion.inc
index a5a930f..76e4f34 100644
--- a/includes/conversion.inc
+++ b/includes/conversion.inc
@@ -50,7 +50,8 @@ class video_conversion {
public function process($video) {
if (is_object($video) && isset($video->fid)) {
$return = $this->render($video);
- } else {
+ }
+ else {
$video_object = $this->load_job($video);
$return = $this->render($video_object);
}
@@ -65,14 +66,14 @@ class video_conversion {
// Make sure this video is pending or do nothing.
if ($video->video_status == VIDEO_RENDERING_PENDING) {
return $this->transcoder->convert_video($video);
- } else {
+ }
+ else {
$status = array(
VIDEO_RENDERING_INQUEUE => 'in queue',
VIDEO_RENDERING_COMPLETE => 'completed',
VIDEO_RENDERING_FAILED => 'failed'
);
- watchdog('transcoder', 'Video conversion has been !status. You should add video to the queue. Please check the re-queue to enable the video conversion.',
- array('!status' => $status[$video->video_status]), WATCHDOG_WARNING);
+ watchdog('transcoder', 'Video conversion has been !status. You should add video to the queue. Please check the re-queue to enable the video conversion.', array('!status' => $status[$video->video_status]), WATCHDOG_WARNING);
return FALSE;
}
}
diff --git a/includes/metadata.inc b/includes/metadata.inc
index b921526..ca15ac2 100644
--- a/includes/metadata.inc
+++ b/includes/metadata.inc
@@ -31,7 +31,8 @@ class video_metadata {
}
if (class_exists($metadata)) {
$this->metadata = new $metadata;
- } else {
+ }
+ else {
drupal_set_message(t('The metadata is not configured properly.'), 'error');
}
}
diff --git a/includes/preset.inc b/includes/preset.inc
index 7709392..40dd286 100644
--- a/includes/preset.inc
+++ b/includes/preset.inc
@@ -27,8 +27,7 @@ class video_preset {
if (count($presets) == 0) {
$form['video_preset'] = array(
'#markup' => t('No Preset were found. Please use the !create_link link to create
- a new Video Preset, or upload an existing Feature to your modules directory.',
- array('!create_link' => l(t('Create Video Preset'), 'admin/config/media/video/presets/add'))),
+ a new Video Preset, or upload an existing Feature to your modules directory.', array('!create_link' => l(t('Create Video Preset'), 'admin/config/media/video/presets/add'))),
'#prefix' => '<div id="preset-checkboxes">',
'#suffix' => '</div>',
);
@@ -52,9 +51,8 @@ class video_preset {
'#default_value' => variable_get('video_preset', array()),
'#description' => t('Please use the !manage_link link to manage
Video Presets. Use the !create_link link to create
- a new Video Preset, or upload an existing Feature to your modules directory.',
- array('!manage_link' => l(t('Manage Video Preset'), 'admin/config/media/video/presets'),
- '!create_link' => l(t('Create Video Preset'), 'admin/config/media/video/presets/add'))),
+ a new Video Preset, or upload an existing Feature to your modules directory.', array('!manage_link' => l(t('Manage Video Preset'), 'admin/config/media/video/presets'),
+ '!create_link' => l(t('Create Video Preset'), 'admin/config/media/video/presets/add'))),
'#prefix' => '<div id="preset-checkboxes">',
'#suffix' => '</div>',
);
diff --git a/includes/transcoder.inc b/includes/transcoder.inc
index 7c53f10..89c4d36 100644
--- a/includes/transcoder.inc
+++ b/includes/transcoder.inc
@@ -48,7 +48,8 @@ class video_transcoder {
$transcoder_instance = new $transcoder;
$this->transcoder = $transcoder_instance;
return $transcoder_instance;
- } else {
+ }
+ else {
drupal_set_message(t('The transcoder is not configured properly.'), 'error');
}
}
@@ -84,7 +85,8 @@ class video_transcoder {
'thumbnails' => serialize($thumbnails),
))
->execute();
- } else {
+ }
+ else {
$updatequery = db_update('video_thumbnails')
->fields(array(
'thumbnails' => serialize($thumbnails),
diff --git a/includes/video_helper.inc b/includes/video_helper.inc
index 41a8293..e6627ca 100644
--- a/includes/video_helper.inc
+++ b/includes/video_helper.inc
@@ -87,11 +87,13 @@ class video_helper {
$default_thumbnail = file_load($field_settings['default_video_thumbnail']['fid']);
// Check the checkbox to use default thumbnail on node
$thumbnail->filepath = $default_thumbnail->uri;
- } elseif (isset($variables['item']['thumbanail']) ? TRUE : FALSE) {
+ }
+ elseif (isset($variables['item']['thumbanail']) ? TRUE : FALSE) {
// actual video thumbnails is present
$thumbnail_load = file_load($variables['item']['thumbanail']);
$thumbnail->filepath = $thumbnail_load->uri;
- } else {
+ }
+ else {
//need some type of default if nothing is present
// drupal_set_message(t('No thumbnail has been configured for the video !title.', array('!title' => $variables['entity']->title)), 'error');
return;
diff --git a/metadata/flvtool2.inc b/metadata/flvtool2.inc
index eafa9cf..5a4dfbb 100644
--- a/metadata/flvtool2.inc
+++ b/metadata/flvtool2.inc
@@ -5,6 +5,7 @@
* Class file used to store metadata on the video.
*
*/
+
class flvtool2 extends video_metadata {
protected $params = array();
@@ -76,7 +77,7 @@ class flvtool2 extends video_metadata {
return $form;
}
- public function admin_settings_validate($form, $form_state) {
+ public function admin_settings_validate($form, $form_state) {
return;
}
diff --git a/modules/video_ui/video.admin.inc b/modules/video_ui/video.admin.inc
index 2f1c94b..12778e4 100644
--- a/modules/video_ui/video.admin.inc
+++ b/modules/video_ui/video.admin.inc
@@ -122,7 +122,8 @@ function video_players_admin_settings() {
'#prefix' => '<div class="admin_flv_player_wrapper" id="flv_player_' . $ext . '">',
'#suffix' => '</div>',
);
- } else {
+ }
+ else {
$form['extensions']['video_extension_' . $ext . '_flash_player'] = array(
'#type' => 'markup',
'#markup' => t('No flash players detected.<br />You need to install !swf_tools or !flowplayer.', array('!swf_tools' => l(t('SWF Tools'), 'http://www.drupal.org/project/swftools'), '!flowplayer' => l(t('Flowplayer'), 'http://www.drupal.org/project/flowplayer'))),
diff --git a/modules/video_ui/video.preset.inc b/modules/video_ui/video.preset.inc
index e9ff011..f4ecd78 100644
--- a/modules/video_ui/video.preset.inc
+++ b/modules/video_ui/video.preset.inc
@@ -45,7 +45,7 @@ function video_preset_default_form($form, &$form_state, $preset) {
'#collapsed' => FALSE
);
$video_extension = array();
- foreach (video_video_extensions () as $extension => $theme) {
+ foreach (video_video_extensions() as $extension => $theme) {
$video_extension[$extension] = $extension;
}
$form['settings']['video']['video_extension'] = array(
@@ -202,7 +202,7 @@ function video_preset_default_form($form, &$form_state, $preset) {
$form['settings']['adv_video']['one_pass'] = array(
'#type' => 'checkbox',
'#title' => t('One pass'),
- '#description' => t('Force one-pass encoding when targeting a specific video_bitrate. True or False.'),
+ '#description' => t('Force one-pass encoding when targeting a specific video_bitrate. TRUE or FALSE.'),
'#default_value' => !empty($preset['settings']['one_pass']) ? $preset['settings']['one_pass'] : ''
);
$form['settings']['adv_video']['skip_video'] = array(
@@ -366,10 +366,10 @@ function video_presets_overview() {
$rows[] = $row;
}
return theme('table', array('header' => $header, 'rows' => $rows));
- } else {
+ }
+ else {
return t('No Preset were found. Please use the !create_link link to create
- a new video preset, or upload an existing Feature to your modules directory.',
- array('!create_link' => l(t('Create Video Preset'), 'admin/config/media/video/presets/add')));
+ a new video preset, or upload an existing Feature to your modules directory.', array('!create_link' => l(t('Create Video Preset'), 'admin/config/media/video/presets/add')));
}
}
@@ -380,7 +380,7 @@ function video_presets_overview() {
* @param <type> $preset
* @return string
*/
-function video_preset_form($form, &$form_state, $preset = false) {
+function video_preset_form($form, &$form_state, $preset = FALSE) {
$form = array();
// basic preset details
$form['preset'] = array(
@@ -393,7 +393,8 @@ function video_preset_form($form, &$form_state, $preset = false) {
'#type' => 'value',
'#value' => $preset['pid'],
);
- } elseif (video_is_default_preset($preset['name'])) {
+ }
+ elseif (video_is_default_preset($preset['name'])) {
$form['preset']['default'] = array(
'#type' => 'value',
'#value' => TRUE,
@@ -445,7 +446,7 @@ function video_preset_form($form, &$form_state, $preset = false) {
* Validation for the preset form.
*/
function video_preset_validate($form, &$form_state) {
-
+
}
/**
@@ -459,7 +460,8 @@ function video_preset_array_flatten($array, $return=array()) {
foreach ($array as $key => $value) {
if (is_array($value)) {
$return = video_preset_array_flatten($value, $return);
- } else {
+ }
+ else {
$return[$key] = $value;
}
}
@@ -477,11 +479,7 @@ function video_preset_submit($form, &$form_state) {
$preset['name'] = $form_state['values']['name'];
$preset['description'] = $form_state['values']['description'];
// unset unwanted values saved to database
- unset($form_state['values']['pid'], $form_state['values']['name'],
- $form_state['values']['description'], $form_state['values']['submit'],
- $form_state['values']['delete'], $form_state['values']['form_build_id'],
- $form_state['values']['form_token'], $form_state['values']['form_id'],
- $form_state['values']['op']);
+ unset($form_state['values']['pid'], $form_state['values']['name'], $form_state['values']['description'], $form_state['values']['submit'], $form_state['values']['delete'], $form_state['values']['form_build_id'], $form_state['values']['form_token'], $form_state['values']['form_id'], $form_state['values']['op']);
$preset['settings'] = video_preset_array_flatten($form_state['values']);
// Save this preset.
@@ -568,7 +566,8 @@ function video_preset_import_validate($form, &$form_state) {
if ($error = video_validate_preset_name($name)) {
form_set_error('name', $error);
}
- } else {
+ }
+ else {
form_set_error('name', 'Invalid preset import.');
}
@@ -593,7 +592,7 @@ function video_preset_export_form($form, &$form_state, $preset) {
unset($preset['default']);
// Get the code string representation.
- $code = var_export($preset, true);
+ $code = var_export($preset, TRUE);
// Make sure to format the arrays like drupal.
$code = str_replace("=> \n ", '=> ', $code);
@@ -663,9 +662,9 @@ function video_preset_get_presets() {
// Get all the presets from the database.
$result = db_select('video_preset', 'p')
- ->fields('p')
- ->orderBy('p.name', 'ASC')
- ->execute();
+ ->fields('p')
+ ->orderBy('p.name', 'ASC')
+ ->execute();
// Iterate through all the presets and structure them in an array.
foreach ($result as $preset) {
@@ -676,7 +675,7 @@ function video_preset_get_presets() {
}
// Now allow other modules to add their default presets.
- foreach (video_preset_get_default_presets () as $preset) {
+ foreach (video_preset_get_default_presets() as $preset) {
// adding default TRUE
$preset['default'] = TRUE;
if (!empty($preset['name']) && !isset($normal_presets[$preset['name']])) {
@@ -693,13 +692,14 @@ function video_preset_get_presets() {
function video_get_preset($preset_name) {
// Get the preset from the database.
$preset = db_select('video_preset', 'p')
- ->fields('p')
- ->condition('p.name', $preset_name)
- ->execute()
- ->fetchAssoc();
+ ->fields('p')
+ ->condition('p.name', $preset_name)
+ ->execute()
+ ->fetchAssoc();
if ($preset) {
$preset['settings'] = $preset['settings'] ? unserialize($preset['settings']) : array();
- } else {
+ }
+ else {
// Get all of the default presets.
$default_presets = video_preset_get_default_presets();
@@ -737,8 +737,9 @@ function video_preset_name_exists($preset_name) {
// See if there is a default preset name.
if ($default_presets && isset($default_presets[$preset_name])) {
- return true;
- } else {
+ return TRUE;
+ }
+ else {
return (bool) db_select('video_preset', 'p')
->fields('p')
->condition('p.name', $preset_name)
diff --git a/modules/video_zencoder/includes/zencoder.inc b/modules/video_zencoder/includes/zencoder.inc
index 09109a2..f898479 100644
--- a/modules/video_zencoder/includes/zencoder.inc
+++ b/modules/video_zencoder/includes/zencoder.inc
@@ -180,16 +180,17 @@ class video_zencoder_api {
// Check if it worked
if ($encoding_job->created) {
return $encoding_job;
- } else {
+ }
+ else {
foreach ($encoding_job->errors as $error) {
watchdog('zencoder', 'Zencoder reports some errors. !error', array('!error' => $error), WATCHDOG_ERROR);
}
- return false;
+ return FALSE;
}
}
/*
- * Verifies the existence of a file id, returns the row or false if none found.
+ * Verifies the existence of a file id, returns the row or FALSE if none found.
*/
public function load_job($jobid) {
@@ -209,7 +210,7 @@ class video_zencoder_api {
$request = new ZencoderRequest(
'https://app.zencoder.com/api/account',
- false, // API key isn't needed for new account creation
+ FALSE, // API key isn't needed for new account creation
array(
"terms_of_service" => "1",
"email" => $user->email,
@@ -223,14 +224,16 @@ class video_zencoder_api {
$message = drupal_mail('video_zencoder', 'video_zencoder', $user->email, language_default(), $results);
if (!$message['result']) {
drupal_set_message(t('Unable to send e-mail!. Your Zencoder Details are as below.<br/> <b>API Key</b> : !api_key<br/> <b>Password</b> : !password<br/>', array('!api_key' => $results['api_key'], '!password' => $results['password'])), 'status');
- } else {
+ }
+ else {
// drupal_mail('video_zencoder', 'video_zencoder', 'heshanmw@gmail.com', language_default(), $results);
drupal_set_message(t('Your account has been created and is ready to start processing on Zencoder'));
}
// return $request->results;
- return true;
+ return TRUE;
// variable_set('video_zencoder_api_key', '');
- } else {
+ }
+ else {
$errors = '';
foreach ($request->errors as $error) {
if ($error == 'Email has already been taken') {
diff --git a/modules/video_zencoder/transcoders/video_zencoder.inc b/modules/video_zencoder/transcoders/video_zencoder.inc
index e629155..eb93fba 100644
--- a/modules/video_zencoder/transcoders/video_zencoder.inc
+++ b/modules/video_zencoder/transcoders/video_zencoder.inc
@@ -100,7 +100,8 @@ class video_zencoder implements transcoder_interface {
if ($this->update($video)) {
watchdog('zencoder', t('Successfully created trancoding job on !jobid.', array('!jobid' => $video->jobid)), array(), WATCHDOG_INFO);
}
- } else {
+ }
+ else {
watchdog('zencoder', 'Failed to queus our file to Zencoder.', array(), WATCHDOG_ERROR);
$this->change_status($video->vid, VIDEO_RENDERING_FAILED);
return FALSE;
@@ -168,7 +169,8 @@ class video_zencoder implements transcoder_interface {
'#title' => t('Agree Zencoder !link.', array('!link' => l(t('Terms and Conditions'), 'http://zencoder.com/terms', array('attributes' => array('target' => '_blank'))))),
'#default_value' => variable_get('agree_terms_zencoder', TRUE),
);
- } else {
+ }
+ else {
// Zencoder API is exists
$form['zencoder_info'] = array(
'#type' => 'fieldset',
@@ -237,7 +239,7 @@ class video_zencoder implements transcoder_interface {
$user = new stdClass;
$user->email = $email;
$result = $zc->create_user($user);
- if ($result !== true)
+ if ($result !== TRUE)
form_set_error('zencoder_username', $result);
}
}
diff --git a/modules/video_zencoder/video_zencoder.module b/modules/video_zencoder/video_zencoder.module
index 93735c0..2343bc8 100644
--- a/modules/video_zencoder/video_zencoder.module
+++ b/modules/video_zencoder/video_zencoder.module
@@ -100,7 +100,8 @@ function _video_zencoder_postback_jobs() {
// echo 'working failed';
$zc->change_status($vid, VIDEO_RENDERING_FAILED);
watchdog('zencoder', t('Zencoder job failed converting videos, please login to zencoder web and check the erros.', array()), NULL, WATCHDOG_ERROR);
- } else {
+ }
+ else {
echo 'zencoder postback is working';
}
}
diff --git a/transcoders/video_ffmpeg.inc b/transcoders/video_ffmpeg.inc
index b519e77..1c2dcc6 100644
--- a/transcoders/video_ffmpeg.inc
+++ b/transcoders/video_ffmpeg.inc
@@ -24,7 +24,7 @@ class video_ffmpeg implements transcoder_interface {
$this->params['other'] = variable_get('video_other_path', '');
$this->params['thumb_command'] = variable_get('video_ffmpeg_thumbnailer_options', $this->thumb_command);
- $this->nice = variable_get('video_ffmpeg_nice_enable', false) ? 'nice -n 19 ' : '';
+ $this->nice = variable_get('video_ffmpeg_nice_enable', FALSE) ? 'nice -n 19 ' : '';
$this->params['enable_faststart'] = variable_get('video_ffmpeg_enable_faststart', 0);
$this->params['faststart_cmd'] = variable_get('video_ffmpeg_faststart_cmd', '/usr/bin/qt-faststart');
}
@@ -155,7 +155,8 @@ class video_ffmpeg implements transcoder_interface {
$dimention = explode('x', $dimensions);
if ($this->params['enable_faststart'] && in_array($settings['video_extension'], array('mov', 'mp4'))) {
$ffmpeg_output = file_directory_temp() . '/' . basename($converted_video_path);
- } else {
+ }
+ else {
$ffmpeg_output = $converted_video_path;
}
// Setup our default command to be run.
@@ -553,7 +554,8 @@ class video_ffmpeg implements transcoder_interface {
if ($ratio < $output_width / $output_height) {
$end_width = $output_height * $ratio;
$end_height = $output_height;
- } else {
+ }
+ else {
$end_height = $output_width / $ratio;
$end_width = $output_width;
}
@@ -571,11 +573,13 @@ class video_ffmpeg implements transcoder_interface {
}
if (variable_get('video_ffmpeg_pad_method', 0)) {
$options[] = '-vf "pad=' . round($output_width) . ':' . round($output_height) . ':0:' . $pad1 . '"';
- } else {
+ }
+ else {
$options[] = '-padtop ' . $pad1;
$options[] = '-padbottom ' . $pad2;
}
- } else {
+ }
+ else {
// We are padding the left/right of the video.
$padding = round($output_width - $end_width);
$pad1 = $pad2 = floor($padding / 2); //@todo does padding need to be an even number?
@@ -585,7 +589,8 @@ class video_ffmpeg implements transcoder_interface {
}
if (variable_get('video_ffmpeg_pad_method', 0)) {
$options[] = '-vf "pad=' . round($output_width) . ':' . round($output_height) . ':' . $pad1 . ':0"';
- } else {
+ }
+ else {
$options[] = '-padleft ' . $pad1;
$options[] = '-padright ' . $pad2;
}
@@ -596,7 +601,8 @@ class video_ffmpeg implements transcoder_interface {
//add our size to the beginning to make sure it hits our -s
array_unshift($options, $end_width . 'x' . $end_height);
return implode(' ', $options);
- } else {
+ }
+ else {
return $video->dimensions;
}
}
diff --git a/transcoders/video_phpvideotoolkit.inc b/transcoders/video_phpvideotoolkit.inc
index c9a27a4..641e61d 100644
--- a/transcoders/video_phpvideotoolkit.inc
+++ b/transcoders/video_phpvideotoolkit.inc
@@ -27,7 +27,7 @@ class video_phpvideotoolkit implements transcoder_interface {
//@todo: move this to the actual widget and save in video_files table.
$this->params['size'] = variable_get('video_ffmpeg_width', $this->video_width) . 'x' . variable_get('video_ffmpeg_height', $this->video_height);
$this->params['ffmpeg'] = variable_get('video_ffmpeg_path', $this->ffmpeg);
- $this->nice = variable_get('video_ffmpeg_nice_enable', false) ? 'nice -n 19 ' : '';
+ $this->nice = variable_get('video_ffmpeg_nice_enable', FALSE) ? 'nice -n 19 ' : '';
$this->params['videoext'] = variable_get('video_ffmpeg_ext', $this->video_ext);
$this->params['enable_faststart'] = variable_get('video_ffmpeg_enable_faststart', 0);
$this->params['faststart_cmd'] = variable_get('video_ffmpeg_faststart_cmd', '/usr/bin/qt-faststart');
@@ -45,7 +45,7 @@ class video_phpvideotoolkit implements transcoder_interface {
// Returns an array of available encoding & decoding codecs
public function get_codecs() {
- $info = $this->toolkit->getFFmpegInfo(false);
+ $info = $this->toolkit->getFFmpegInfo(FALSE);
$available_codecs = $info['codecs'];
@@ -110,7 +110,7 @@ class video_phpvideotoolkit implements transcoder_interface {
continue;
}
- $result = $this->toolkit->execute(false, true);
+ $result = $this->toolkit->execute(FALSE, TRUE);
if ($result !== PHPVideoToolkit::RESULT_OK) {
// if there was an error then get it
$error_msg = t($this->toolkit->getLastError());
@@ -177,7 +177,8 @@ class video_phpvideotoolkit implements transcoder_interface {
if ($this->params['enable_faststart'] && in_array($settings['video_extension'], array('mov', 'mp4'))) {
$ffmpeg_output = file_directory_temp() . '/' . basename($converted_video_path);
- } else {
+ }
+ else {
$ffmpeg_output = $converted_video_path;
}
@@ -201,7 +202,7 @@ class video_phpvideotoolkit implements transcoder_interface {
}
}
- $result = $this->toolkit->setVideoCodec($settings['video_codec'], false);
+ $result = $this->toolkit->setVideoCodec($settings['video_codec'], FALSE);
if (!$result) {
// if there was an error then get it
$error_msg = t($this->toolkit->getLastError());
@@ -227,7 +228,7 @@ class video_phpvideotoolkit implements transcoder_interface {
continue;
}
- $result = $this->toolkit->setAudioCodec($settings['audio_codec'], false);
+ $result = $this->toolkit->setAudioCodec($settings['audio_codec'], FALSE);
if (!$result) {
// if there was an error then get it
$error_msg = t($this->toolkit->getLastError());
@@ -297,7 +298,7 @@ class video_phpvideotoolkit implements transcoder_interface {
continue;
}
- $result = $this->toolkit->execute(false, true);
+ $result = $this->toolkit->execute(FALSE, TRUE);
if ($result !== PHPVideoToolkit::RESULT_OK) {
// if there was an error then get it
$error_msg = t($this->toolkit->getLastError());
@@ -497,9 +498,8 @@ class video_phpvideotoolkit implements transcoder_interface {
public function load_job($fid) {
$job = null;
$job = db_query("SELECT f.*, vf.vid, vf.nid, vf.dimensions, vf.data, vf.status as video_status
- FROM {video_files} vf LEFT JOIN {file_managed} f ON vf.fid = f.fid WHERE f.fid=vf.fid AND f.fid = :fid",
- array(':fid' => $fid))
- ->fetch();
+ FROM {video_files} vf LEFT JOIN {file_managed} f ON vf.fid = f.fid WHERE f.fid=vf.fid AND f.fid = :fid", array(':fid' => $fid))
+ ->fetch();
if (!empty($job))
return $job;
else
@@ -515,8 +515,7 @@ class video_phpvideotoolkit implements transcoder_interface {
$videos = array();
$result = db_query_range('SELECT f.*, vf.vid, vf.nid, vf.dimensions, vf.status as video_status
FROM {video_files} vf LEFT JOIN {file_managed} f ON vf.fid = f.fid
- WHERE vf.status = :vstatus AND f.status = :fstatus ORDER BY f.timestamp',
- 0, $total_videos, array(':vstatus' => VIDEO_RENDERING_PENDING, ':fstatus' => FILE_STATUS_PERMANENT));
+ WHERE vf.status = :vstatus AND f.status = :fstatus ORDER BY f.timestamp', 0, $total_videos, array(':vstatus' => VIDEO_RENDERING_PENDING, ':fstatus' => FILE_STATUS_PERMANENT));
foreach ($result as $row) {
$videos[] = $row;
}
@@ -586,7 +585,8 @@ class video_phpvideotoolkit implements transcoder_interface {
if ($ratio < $output_width / $output_height) {
$end_width = $output_height * $ratio;
$end_height = $output_height;
- } else {
+ }
+ else {
$end_height = $output_width / $ratio;
$end_width = $output_width;
}
@@ -604,11 +604,13 @@ class video_phpvideotoolkit implements transcoder_interface {
}
if (variable_get('video_ffmpeg_pad_method', 0)) {
$options[] = '-vf "pad=' . round($output_width) . ':' . round($output_height) . ':0:' . $pad1 . '"';
- } else {
+ }
+ else {
$options[] = '-padtop ' . $pad1;
$options[] = '-padbottom ' . $pad2;
}
- } else {
+ }
+ else {
// We are padding the left/right of the video.
$padding = round($output_width - $end_width);
$pad1 = $pad2 = floor($padding / 2); //@todo does padding need to be an even number?
@@ -618,7 +620,8 @@ class video_phpvideotoolkit implements transcoder_interface {
}
if (variable_get('video_ffmpeg_pad_method', 0)) {
$options[] = '-vf "pad=' . round($output_width) . ':' . round($output_height) . ':' . $pad1 . ':0"';
- } else {
+ }
+ else {
$options[] = '-padleft ' . $pad1;
$options[] = '-padright ' . $pad2;
}
@@ -629,7 +632,8 @@ class video_phpvideotoolkit implements transcoder_interface {
//add our size to the beginning to make sure it hits our -s
array_unshift($options, $end_width . 'x' . $end_height);
return implode(' ', $options);
- } else {
+ }
+ else {
return $video->dimensions;
}
}
diff --git a/video.drush.inc b/video.drush.inc
index 8c01f6d..c0968be 100644
--- a/video.drush.inc
+++ b/video.drush.inc
@@ -1,5 +1,8 @@
<?php
-
+/**
+ * @file
+ * Implement an drush commands to trasncode videos.
+ */
/**
* Implementation of hook_drush_command().
*/
diff --git a/video.field.inc b/video.field.inc
index 9f213a5..72b15e5 100644
--- a/video.field.inc
+++ b/video.field.inc
@@ -307,7 +307,8 @@ function video_field_widget_form(&$form, &$form_state, $field, $instance, $langc
if (empty($elements[0]['#default_value']['fid'])) {
$elements[0]['#description'] = theme('file_upload_help', array('description' => $instance['description'], 'upload_validators' => $elements[0]['#upload_validators']));
}
- } else {
+ }
+ else {
$elements['#file_upload_description'] = theme('file_upload_help', array('upload_validators' => $elements[0]['#upload_validators']));
}
return $elements;
@@ -416,7 +417,8 @@ function video_field_formatter_settings_summary($field, $instance, $view_mode) {
// their styles in code.
if (isset($image_styles[$settings['video_style']])) {
$summary[] = t('Video thumbnail style: @style', array('@style' => $image_styles[$settings['video_style']]));
- } else {
+ }
+ else {
$summary[] = t('Original video thumbnail');
}
@@ -441,7 +443,8 @@ function video_field_formatter_view($entity_type, $entity, $field, $instance, $l
// Check if the formatter involves a link.
if ($display['settings']['video_link'] == 'content') {
$uri = entity_uri($entity_type, $entity);
- } elseif ($display['settings']['video_link'] == 'file') {
+ }
+ elseif ($display['settings']['video_link'] == 'file') {
$link_file = TRUE;
}
diff --git a/video.module b/video.module
index 4cdca77..8d31806 100644
--- a/video.module
+++ b/video.module
@@ -185,7 +185,8 @@ function video_thumb_process(&$element, &$form_state) {
'#weight' => 10,
'#attributes' => array('class' => array('video-thumbnails'), 'onchange' => 'videoftp_thumbnail_change()', 'rel' => 'video_large_thumbnail-' . $delta),
);
- } else {
+ }
+ else {
$gen_fail = TRUE;
}
}
@@ -212,9 +213,11 @@ function video_thumb_process(&$element, &$form_state) {
// @todo Add smaller video preview instead of thumbnail?
if (isset($file['thumbanail']) && !empty($file['thumbanail'])) {
$large_thumb = file_load($file['thumbanail']);
- } elseif (!empty($field['settings']['default_video_thumbnail']['fid'])) {
+ }
+ elseif (!empty($field['settings']['default_video_thumbnail']['fid'])) {
$large_thumb = file_load($field['settings']['default_video_thumbnail']['fid']);
- } else {
+ }
+ else {
// $large_thumb = file_load($default_thumb);
}
// print_r($field['settings']);
@@ -363,7 +366,8 @@ function video_widget_element_settings(&$element, &$form_state) {
'#description' => t('This will bypass your auto conversion of videos.'),
'#attributes' => array('class' => array('video-bypass-auto-conversion')),
);
- } else if (variable_get('video_bypass_conversion', FALSE)) {
+ }
+ elseif (variable_get('video_bypass_conversion', FALSE)) {
$element['bypass_autoconversion'] = array(
'#type' => 'value',
'#value' => variable_get('video_bypass_conversion', FALSE),
@@ -379,7 +383,8 @@ function video_widget_element_settings(&$element, &$form_state) {
'#description' => t('This will convert your video to flv format when you save, instead of scheduling it for cron.'),
'#attributes' => array('class' => array('video-convert-video-on-save')),
);
- } else if (variable_get('video_convert_on_save', FALSE)) {
+ }
+ elseif (variable_get('video_convert_on_save', FALSE)) {
$element['convert_video_on_save'] = array(
'#type' => 'value',
'#value' => variable_get('video_convert_on_save', FALSE),
@@ -400,7 +405,8 @@ function video_widget_element_settings(&$element, &$form_state) {
if ($default_thumb) {
$element['use_default_video_thumb']['#attributes']['checked'] = 'checked';
}
- } else {
+ }
+ else {
$element['use_default_video_thumb'] = array(
'#type' => 'value',
'#value' => $default_thumb,
@@ -422,7 +428,8 @@ function _video_dimensions_options(&$options, $video) {
//lets check our width and height first
if ($aspect_ratio['width'] == $wxh[0] && $aspect_ratio['height'] == $wxh[1]) {
$options[$key] = $value . ' ' . t('(Matches Resolution)');
- } else {
+ }
+ else {
//now lets check our ratio's
$ratio = number_format($wxh[0] / $wxh[1], 4);
if ($ratio == $aspect_ratio['ratio']) {
@@ -636,10 +643,10 @@ function video_explode($delimeter, $dimensions) {
function video_format_right($value) {
$format = explode("x", $value);
if (!isset($format[0]) || !is_numeric(trim($format[0])))
- return false;
+ return FALSE;
if (!isset($format[1]) || !is_numeric(trim($format[1])))
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
/*
diff --git a/video.theme.inc b/video.theme.inc
index 83ddbc2..065845a 100644
--- a/video.theme.inc
+++ b/video.theme.inc
@@ -49,7 +49,8 @@ function theme_video($variables) {
if ($video = $conversion->load_job($variables['item']['fid'])) {
if ($video->video_status == VIDEO_RENDERING_ACTIVE || $video->video_status == VIDEO_RENDERING_PENDING) {
return theme('video_inprogress');
- } else if ($video->video_status == VIDEO_RENDERING_FAILED) {
+ }
+ else if ($video->video_status == VIDEO_RENDERING_FAILED) {
return theme('video_conversion_failed');
}
}
@@ -107,7 +108,8 @@ function theme_video_thumbnail($variables) {
if ($variables['video_style']) {
$image['style_name'] = $variables['video_style'];
$output = theme('image_style', $image);
- } else {
+ }
+ else {
$output = theme('image', $image);
}
@@ -201,7 +203,8 @@ function theme_video_flv($variables) {
'autoPlay' => $video->autoplay,
'autoBuffering' => $video->autobuffering,
),),);
- } else {
+ }
+ else {
$options = array(
'clip' => array('url' => urlencode($video->files->{$video->player}->url),
'autoPlay' => $video->autoplay,