function _scald_transcoders in Scald: Media Management made easy 6
Get the available Scald Transcoders
NOTE: Having $scald_config->types properly populated is a prerequisite for this function.
This function returns a structured array which specifies all the currently provided Scald Transcoders. The actions are in an array with one or more elements in the format: array( 'transcoder-slug' => array( 'provider' => 'provider-name', 'formats' => array( 'type-slug' => 'file_format', ... ), ... );
Return value
The Scald Transcoders array
1 call to _scald_transcoders()
- scald_config_rebuild in ./
scald.module - Rebuild the Scald Configuration Object & other key configuration variables.
File
- ./
scald.module, line 732
Code
function _scald_transcoders() {
// Build the formats array for 'passthrough', *always* includes every Type
// currently registered with Scald Core.
$scald_config = variable_get('scald_config', 0);
$type_formats = array();
foreach (array_keys($scald_config->types) as $type) {
$type_formats[$type] = 'passthrough';
}
$scald_transcoders = array();
$scald_transcoders['passthrough'] = array(
'provider' => 'scald',
'formats' => $type_formats,
);
$transcoder_results = db_query('
SELECT
transcoder,
provider
FROM
{scald_transcoders}
');
while ($transcoder_raw = db_fetch_array($transcoder_results)) {
$scald_transcoders[$transcoder_raw['transcoder']] = array(
'provider' => $transcoder_raw['provider'],
'formats' => array(),
);
}
$format_results = db_query('
SELECT
transcoder,
type,
file_format
FROM
{scald_transcoder_formats}
');
while ($format_raw = db_fetch_array($format_results)) {
$scald_transcoders[$format_raw['transcoder']]['formats'][] = array(
$format_raw['type'] => $format_raw['file_format'],
);
}
return $scald_transcoders;
}