aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalyn Cessac <dalyn.cessac@1214036.no-reply.drupal.org>2011-03-16 15:18:28 -0500
committerDalyn Cessac <dalyn.cessac@1214036.no-reply.drupal.org>2011-03-16 15:18:28 -0500
commit972dd76d32128c6180271e5d10aff89a45f0ae74 (patch)
tree18eb8be7f0b62d2bd33d9a28033ec24822bddcc0
parent8d5c044ae91efb64ef7d85f6371b043d981a3829 (diff)
downloadvideo-972dd76d32128c6180271e5d10aff89a45f0ae74.tar.gz
video-972dd76d32128c6180271e5d10aff89a45f0ae74.tar.bz2
Updated Preset UI and fixed get_codecs function
-rw-r--r--includes/conversion.inc4
-rw-r--r--includes/transcoder.inc6
-rw-r--r--modules/video_ui/video.preset.inc21
-rw-r--r--transcoders/video_ffmpeg.inc24
4 files changed, 41 insertions, 14 deletions
diff --git a/includes/conversion.inc b/includes/conversion.inc
index 493532e..59414cc 100644
--- a/includes/conversion.inc
+++ b/includes/conversion.inc
@@ -105,6 +105,10 @@ class video_conversion {
public function load_job($fid) {
return $this->transcoder->load_job($fid);
}
+
+ public function get_codecs() {
+ return $this->transcoder->get_codecs();
+ }
}
diff --git a/includes/transcoder.inc b/includes/transcoder.inc
index b17786b..e9dfbda 100644
--- a/includes/transcoder.inc
+++ b/includes/transcoder.inc
@@ -201,6 +201,10 @@ class video_transcoder {
return $this->transcoder->load_completed_job($video);
}
+ public function get_codecs() {
+ return $this->transcoder->get_codecs();
+ }
+
}
interface transcoder_interface {
@@ -212,6 +216,8 @@ interface transcoder_interface {
public function load_job($fid);
public function load_job_queue();
+
+ public function get_codecs();
public function load_completed_job(&$video);
diff --git a/modules/video_ui/video.preset.inc b/modules/video_ui/video.preset.inc
index 42680cd..1273fc3 100644
--- a/modules/video_ui/video.preset.inc
+++ b/modules/video_ui/video.preset.inc
@@ -11,6 +11,11 @@ define('VIDEO_PRESET_MAX_LENGTH', 64);
* @return <array> - The additional form settings that you would like to add to your preset.
*/
function video_preset_default_form($form, &$form_state, $preset) {
+ module_load_include('inc', 'video', '/includes/conversion');
+ $video_conversion = new video_conversion;
+
+ $codecs = $video_conversion->get_codecs();
+
$form = array();
$form['settings']['device_profile'] = array(
'#type' => 'fieldset',
@@ -57,14 +62,7 @@ function video_preset_default_form($form, &$form_state, $preset) {
'#type' => 'select',
'#title' => t('Video codec'),
'#description' => t('The video codec used in the video file can affect the ability to play the video on certain devices. The default codec used is H.264.'),
- '#options' => array(
- 'h264' => 'H.264 (default)',
- 'vp8' => 'VP8',
- 'theora' => 'Theora',
- 'vp6' => 'VP6',
- 'mpeg4' => 'MPEG-4',
- 'wmv' => 'WMV'
- ),
+ '#options' => $codecs['encode']['video'],
'#default_value' => (!empty($preset['settings']['video_codec'])) ? $preset['settings']['video_codec'] : 'h264'
);
$form['settings']['video']['video_quality'] = array(
@@ -134,12 +132,7 @@ function video_preset_default_form($form, &$form_state, $preset) {
'#type' => 'select',
'#title' => t('Audio codec'),
'#description' => t('The audio codec to be used.'),
- '#options' => array(
- 'aac' => 'AAC (default for most cases)',
- 'mp3' => 'MP3',
- 'vorbis' => 'Vorbis (default for VP8 and Theora)',
- 'wma' => 'WMA'
- ),
+ '#options' => $codecs['encode']['audio'],
'#default_value' => (!empty($preset['settings']['audio_codec'])) ? $preset['settings']['audio_codec'] : 'h264'
);
$form['settings']['audio']['audio_quality'] = array(
diff --git a/transcoders/video_ffmpeg.inc b/transcoders/video_ffmpeg.inc
index 33e5067..98108de 100644
--- a/transcoders/video_ffmpeg.inc
+++ b/transcoders/video_ffmpeg.inc
@@ -98,6 +98,30 @@ class video_ffmpeg implements transcoder_interface {
}
return $files;
}
+
+ // Returns available codecs
+ public function get_codecs() {
+ $codecs = array(
+ 'encoding' => array(
+ 'video' => array(
+ 'h264' => 'H.264 (default)',
+ 'vp8' => 'VP8',
+ 'theora' => 'Theora',
+ 'vp6' => 'VP6',
+ 'mpeg4' => 'MPEG-4',
+ 'wmv' => 'WMV'
+ ),
+ 'audio' => array(
+ 'aac' => 'AAC (default for most cases)',
+ 'mp3' => 'MP3',
+ 'vorbis' => 'Vorbis (default for VP8 and Theora)',
+ 'wma' => 'WMA'
+ )
+ ),
+ 'decoding' => array()
+ );
+ return $codecs;
+ }
public function convert_video($video) {
// This will update our current video status to active.