1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
<?php
// $Id$
/**
* @file
* Provides the administration settings for the Video Drupal module.
*/
/**
* Video transcoder admin settings
* @return <type>
*/
function video_transcoder_admin_settings() {
module_load_include('inc', 'video', '/includes/transcoder');
$transcoder = new video_transcoder;
$form = $transcoder->admin_settings();
return system_settings_form($form);
}
/**
* Form API callback to validate the upload settings form.
*/
function video_transcoder_admin_settings_validate($form, &$form_state) {
// check ffmpeg_wrapper module installed or not
if ($form_state['values']['video_convertor'] == 'video_ffmpeg_wrapper' && !module_exists('ffmpeg_wrapper')) {
form_set_error('video_convertor', t('You need to download and install the !ffmpeg_wrapper module to enable this option.', array('!ffmpeg_wrapper' => l(t('FFMPEG Wrapper'), 'http://drupal.org/project/ffmpeg_wrapper'))));
}
// add vallidations by trnacoder interface
$transcoder = $form_state['values']['video_convertor'];
module_load_include('inc', 'video', '/includes/transcoder');
$transcoder = new video_transcoder($transcoder);
$transcoder->admin_settings_validate($form, $form_state);
}
/**
* Video transcoder admin settings
* @return <type>
*/
function video_preset_admin_settings() {
module_load_include('inc', 'video', '/includes/preset');
$preset = new video_preset();
$form = $preset->admin_settings();
return system_settings_form($form);
}
/**
* Video general admin settings
* @return <type>
*/
function video_general_admin_settings() {
$form = array();
$form['video_autoplay'] = array(
'#type' => 'checkbox',
'#title' => t('Automatically start video on page load'),
'#default_value' => variable_get('video_autoplay', FALSE),
'#description' => t('Start the video when the page and video loads')
);
$form['video_autobuffering'] = array(
'#type' => 'checkbox',
'#title' => t('Automatically start video buffering'),
'#default_value' => variable_get('video_autobuffering', TRUE),
'#description' => t('Start buffering video when the page and video loads')
);
$form['video_bypass_conversion'] = array(
'#type' => 'checkbox',
'#title' => t('Bypass Video Conversion'),
'#default_value' => variable_get('video_bypass_conversion', FALSE),
'#description' => t('Bypass video conversion when creating videos.')
);
$form['video_convert_on_save'] = array(
'#type' => 'checkbox',
'#title' => t('Video Convert on Node Submit'),
'#default_value' => variable_get('video_convert_on_save', FALSE),
'#description' => t('Convert videos on node submit.')
);
$form['video_use_default_thumb'] = array(
'#type' => 'checkbox',
'#title' => t('Override Auto Thumbnails with Default'),
'#default_value' => variable_get('video_use_default_thumb', FALSE),
'#description' => t('Override auto thumbnails with default thumbnail.')
);
return system_settings_form($form);
}
/**
* Video player admin settings
* @return <type>
*/
function video_players_admin_settings() {
$form = array();
$form['extensions'] = array(
'#type' => 'fieldset',
'#title' => t('Video Extensions'),
'#description' => t('Here you can map specific players to each video extension type.'),
);
//lets get all our supported extensions and players.
$extensions = video_video_extensions();
$players = video_video_players();
$flv_players = video_video_flv_players();
foreach ($extensions as $ext => $player) {
$form['extensions']['video_extension_' . $ext] = array(
'#type' => 'select',
'#title' => t('Extension:') . ' ' . $ext,
'#default_value' => variable_get('video_extension_' . $ext, $player),
'#options' => $players,
'#prefix' => '<div class="video_select" rel="' . $ext . '">',
'#suffix' => '</div>',
);
$form['extensions']['video_extension_' . $ext . '_flash_player'] = array(
'#type' => !empty($flv_players) ? 'radios' : 'markup',
'#title' => t('Flash Player for') . ' ' . $ext,
'#value' => !empty($flv_players) ? '' : 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'))),
'#options' => $flv_players,
'#default_value' => variable_get('video_extension_' . $ext . '_flash_player', ''),
'#prefix' => '<div class="admin_flv_player_wrapper" id="flv_player_' . $ext . '">',
'#suffix' => '</div>',
);
}
return system_settings_form($form);
}
/**
* Video Metadata admin settings
* @return <type>
*/
function video_metadata_admin_settings() {
module_load_include('inc', 'video', '/includes/metadata');
$metadata = new video_metadata;
$form = $metadata->admin_settings();
return system_settings_form($form);
}
function video_metadata_admin_settings_validate($form, &$form_state) {
// add vallidations by metadata interface
$metadata = $form_state['values']['video_metadata'];
module_load_include('inc', 'video', '/includes/metadata');
$metadata = new video_metadata($metadata);
$metadata->admin_settings_validate($form, $form_state);
}
/**
* Video cron admin settings
* @return <type>
*/
function video_cron_admin_settings() {
$form = array();
$form['video_cron'] = array(
'#type' => 'checkbox',
'#title' => t('Use Drupals built in cron.'),
'#default_value' => variable_get('video_cron', TRUE),
'#description' => t('If you would like to use Drupals built in cron hook, check this box. Please be warned that transcoding videos is very resource intensive. If you use poor mans cron, I highly discourage this option. I also suggest you setup your cron to call this function through CLI instead of WGET.'),
);
$form['video_ffmpeg_instances'] = array(
'#type' => 'textfield',
'#title' => t('Total videos to convert during each cron process.'),
'#default_value' => variable_get('video_ffmpeg_instances', 5),
'#description' => t('How many videos do you want to process on each cron run? Either through hook_cron or the video_scheduler.php.'),
);
return system_settings_form($form);
}
/**
* File system admin settings
* @return <type>
*/
function video_filesystem_admin_settings() {
module_load_include('inc', 'video', '/includes/filesystem');
$filesystem = new video_filesystem;
$form = $filesystem->admin_settings();
return system_settings_form($form);
}
function video_filesystem_admin_settings_validate($form, &$form_state) {
// add vallidations by metadata interface
$filesystem = $form_state['values']['video_filesystem'];
module_load_include('inc', 'video', '/includes/filesystem');
$filesystem = new video_filesystem($filesystem);
$filesystem->admin_settings_validate($form, $form_state);
}
|