From c79262dfbc7a8c6f047cc94a011414a95593525c Mon Sep 17 00:00:00 2001 From: Fabio Varesano Date: Sun, 18 Feb 2007 13:31:29 +0000 Subject: Misspelled PENDING More general converting video size regex pattern (Now supports valid resolutions such as 160x92) Removed video_image_thumbnailer_path variable which is no more used. use ffmpeg path instead Thanks Marc McDougall for pointing this out. --- .../video_ffmpeg_helper/video_ffmpeg_helper.module | 30 +++++++++++----------- plugins/video_ffmpeg_helper/video_render.php | 10 ++++---- plugins/video_ffmpeg_helper/video_scheduler.php | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/plugins/video_ffmpeg_helper/video_ffmpeg_helper.module b/plugins/video_ffmpeg_helper/video_ffmpeg_helper.module index a6fc1e8..c1f94ec 100644 --- a/plugins/video_ffmpeg_helper/video_ffmpeg_helper.module +++ b/plugins/video_ffmpeg_helper/video_ffmpeg_helper.module @@ -11,7 +11,7 @@ /** * Define some constants */ -define('VIDEO_RENDERING_PENGING', 0); +define('VIDEO_RENDERING_PENDING', 0); define('VIDEO_RENDERING_ACTIVE', 5); define('VIDEO_RENDERING_COMPLETE', 10); @@ -153,35 +153,35 @@ function video_ffmpeg_helper_admin_settings() { '#description' => t('If set up correctly, this will auto-convert each uploaded video to the configured format.') . '
' . t("IMPORTANT: you will need the video_render.php correctly configured and run by cron. See README.txt for more informations."), '#default_value' => variable_get('video_ffmpeg_helper_auto_conversion', false), ); - $form['autoconv']['video_ffmpeg_helper_auto_converter_width'] = array( + $form['autoconv']['video_ffmpeg_helper_auto_cvr_width'] = array( '#type' => 'textfield', '#title' => t('Video rendering width'), '#description' => t('The width of the converted video. The height will be automatically calculated to maintain aspect ratio.'), '#size' => 3, '#maxlength' => 3, - '#default_value' => variable_get('video_ffmpeg_helper_auto_converter_width', 400), + '#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_width', 400), ); - $form['autoconv']['video_ffmpeg_helper_auto_converter_video_bitrate'] = array( + $form['autoconv']['video_ffmpeg_helper_auto_cvr_video_bitrate'] = array( '#type' => 'textfield', '#title' => t('Video bitrate'), '#description' => t('The video bitrate in kbit/s of the converted video.'), '#size' => 3, '#maxlength' => 4, - '#default_value' => variable_get('video_ffmpeg_helper_auto_converter_video_bitrate', 200), + '#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_video_bitrate', 200), ); - $form['autoconv']['video_ffmpeg_helper_auto_converter_audio_bitrate'] = array( + $form['autoconv']['video_ffmpeg_helper_auto_cvr_audio_bitrate'] = array( '#type' => 'textfield', '#title' => t('Audio bitrate'), '#description' => t('The audio bitrate in kbit/s of the converted video.'), '#size' => 3, '#maxlength' => 4, - '#default_value' => variable_get('video_ffmpeg_helper_auto_converter_audio_bitrate', 64), + '#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_audio_bitrate', 64), ); - $form['autoconv']['video_ffmpeg_helper_auto_converter_busy_video_path'] = array( + $form['autoconv']['video_ffmpeg_helper_auto_cvr_busy_video_path'] = array( '#type' => 'textfield', '#title' => t('Busy video path'), '#description' => t('Provide the relative path to a video displayed when the video is being rendered.'), - '#default_value' => variable_get('video_ffmpeg_helper_auto_converter_busy_video_path', 'busy.flv'), + '#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_busy_video_path', 'busy.flv'), ); $form['autoconv']['advanced'] = array( '#type' => 'fieldset', @@ -189,7 +189,7 @@ function video_ffmpeg_helper_admin_settings() { '#collapsible' => TRUE, '#collapsed' => TRUE ); - $form['autoconv']['advanced']['video_ffmpeg_helper_auto_converter_options'] = array( + $form['autoconv']['advanced']['video_ffmpeg_helper_auto_cvr_options'] = array( '#type' => 'textfield', '#title' => t('Video converter options'), '#description' => t('Provide the ffmpeg options to configure the video conversion. Available argument values are: ').''. t('For further informations refer to the !ffmpegdoc', array('!ffmpegdoc' => l(t('Official FFMpeg documentation.'), 'http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html', NULL, NULL, TRUE))), - '#default_value' => variable_get('video_ffmpeg_helper_auto_converter_options', '-y -i %videofile -f flv -ar 22050 -ab %audiobitrate -s %size -b %videobitrate %convertfile'), + '#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_options', '-y -i %videofile -f flv -ar 22050 -ab %audiobitrate -s %size -b %videobitrate %convertfile'), ); return system_settings_form($form); } @@ -284,10 +284,10 @@ function video_ffmpeg_helper_nodeapi(&$node, $op, $teaser) { function _video_ffmpeg_helper_add_rendering(&$node) { $file = $_SESSION['video_upload_file_stored']->filepath; //print_r($node); die; - db_query('INSERT INTO {video_rendering} (vid, nid, origfile, pid, status, started, completed) VALUES (%d, %d, "%s", %d, %d, %d, %d)', $node->vid, $node->nid, $file, 0, VIDEO_RENDERING_PENGING, 0, 0); + db_query('INSERT INTO {video_rendering} (vid, nid, origfile, pid, status, started, completed) VALUES (%d, %d, "%s", %d, %d, %d, %d)', $node->vid, $node->nid, $file, 0, VIDEO_RENDERING_PENDING, 0, 0); // let's add the rendering in progress video - $node->vidfile = variable_get('video_ffmpeg_helper_auto_converter_busy_video_path', 'busy.flv'); + $node->vidfile = variable_get('video_ffmpeg_helper_auto_cvr_busy_video_path', 'busy.flv'); db_query('UPDATE {video} SET vidfile = "%s" WHERE nid=%d AND vid=%d', $node->vidfile, $node->nid, $node->vid); } @@ -316,7 +316,7 @@ function _video_ffmpeg_helper_get_video_info(&$node) { if(variable_get('video_ffmpeg_helper_auto_resolution', false)) { // get resolution - $pattern = '/[0-9]{3}x[0-9]{3}/'; + $pattern = '/[0-9]{2,4}x[0-9]{2,4}/'; preg_match_all($pattern, $command_output, $matches, PREG_PATTERN_ORDER); $resolution = $matches[0][0]; $xy = explode("x", $resolution); @@ -375,7 +375,7 @@ function _video_ffmpeg_helper_auto_thumbnail(&$node) { $videofile = escapeshellarg($_SESSION['video_upload_file']->filepath); $thumbfile = tempnam(file_directory_temp(), 'tnail-thumb'); $seek = variable_get('video_image_auto_thumbnail_seek', 2); - $tnail = variable_get('video_image_thumbnailer_path', '/usr/bin/ffmpeg'); + $tnail = variable_get('video_ffmpeg_helper_ffmpeg_path', '/usr/bin/ffmpeg'); $options = preg_replace(array('/%videofile/', '/%thumbfile/', '/%seek/'), array($videofile, $thumbfile, $seek), variable_get('video_image_thumbnailer_options', '-i %videofile -an -y -f mjpeg -ss %seek -vframes 1 %thumbfile')); $command = "$tnail $options"; diff --git a/plugins/video_ffmpeg_helper/video_render.php b/plugins/video_ffmpeg_helper/video_render.php index fddaedd..a1747a3 100644 --- a/plugins/video_ffmpeg_helper/video_render.php +++ b/plugins/video_ffmpeg_helper/video_render.php @@ -36,7 +36,7 @@ define('VIDEO_RENDERING_NICE', 'nice -n 19'); /** * Define some constants */ -define('VIDEO_RENDERING_PENGING', 0); +define('VIDEO_RENDERING_PENDING', 0); define('VIDEO_RENDERING_ACTIVE', 5); define('VIDEO_RENDERING_COMPLETE', 10); @@ -137,13 +137,13 @@ function _video_render_get_command(&$job) { $videofile = escapeshellarg($job->origfile); // escape file name for safety $convfile = tempnam(VIDEO_RENDERING_TEMP_PATH, 'video-rendering'); - $audiobitrate = variable_get('video_ffmpeg_helper_auto_converter_audio_bitrate', 64); - $videobitrate = variable_get('video_ffmpeg_helper_auto_converter_video_bitrate', 200); + $audiobitrate = variable_get('video_ffmpeg_helper_auto_cvr_audio_bitrate', 64); + $videobitrate = variable_get('video_ffmpeg_helper_auto_cvr_video_bitrate', 200); $size = _video_render_get_size($job); $converter = VIDEO_RENDERING_FFMPEG_PATH; - $options = preg_replace(array('/%videofile/', '/%convertfile/', '/%audiobitrate/', '/%size/', '/%videobitrate/'), array($videofile, $convfile, $audiobitrate, $size, $videobitrate), variable_get('video_ffmpeg_helper_auto_converter_options', '-y -i %videofile -f flv -ar 22050 -ab %audiobitrate -s %size -b %videobitrate %convertfile')); + $options = preg_replace(array('/%videofile/', '/%convertfile/', '/%audiobitrate/', '/%size/', '/%videobitrate/'), array($videofile, $convfile, $audiobitrate, $size, $videobitrate), variable_get('video_ffmpeg_helper_auto_cvr_options', '-y -i %videofile -f flv -ar 22050 -ab %audiobitrate -s %size -b %videobitrate %convertfile')); // set to the converted file output $job->convfile = $convfile; @@ -158,7 +158,7 @@ function _video_render_get_command(&$job) { * Aspect ration is maintained. */ function _video_render_get_size(&$job) { - $def_width = variable_get('video_ffmpeg_helper_auto_converter_width', 400); + $def_width = variable_get('video_ffmpeg_helper_auto_cvr_width', 400); $height = $def_width * ($job->videoy / $job->videox); // do you remember proportions?? :-) diff --git a/plugins/video_ffmpeg_helper/video_scheduler.php b/plugins/video_ffmpeg_helper/video_scheduler.php index de64bc0..4803dc2 100644 --- a/plugins/video_ffmpeg_helper/video_scheduler.php +++ b/plugins/video_ffmpeg_helper/video_scheduler.php @@ -31,7 +31,7 @@ define('VIDEO_RENDERING_FFMPEG_INSTANCES', 5); /** * Define some constants */ -define('VIDEO_RENDERING_PENGING', 0); +define('VIDEO_RENDERING_PENDING', 0); define('VIDEO_RENDERING_ACTIVE', 5); define('VIDEO_RENDERING_COMPLETE', 10); -- cgit v1.2.3