Files
handbrake-cluster-webui/lib/RippingCluster/Source/PluginFactory.class.php
Ben Roberts 2ef47de25c Added MKV source/worker plugins, tidied sources page
Added placeholder for source plugin to read from an existing mkv file.
Added corresponding worker placeholder to transcode an mkv file using
ffmpeg.
Updated the sources page to show which sources come from which plugins.
2010-09-24 20:05:37 +01:00

72 lines
2.1 KiB
PHP

<?php
class RippingCluster_Source_PluginFactory extends RippingCluster_PluginFactory {
const PLUGIN_DIR = 'RippingCluster/Source/Plugin/';
const PLUGIN_PREFIX = 'RippingCluster_Source_Plugin_';
const PLUGIN_INTERFACE = 'RippingCluster_Source_IPlugin';
public static function init() {
}
public static function scan() {
$candidatePlugins = parent::findPlugins(self::PLUGIN_DIR);
self::loadPlugins($candidatePlugins, self::PLUGIN_PREFIX, self::PLUGIN_INTERFACE);
}
public static function enumerate($plugin) {
self::ensureScanned();
if ( ! self::isValidPlugin($plugin)) {
return null;
}
return call_user_func(array(self::classname($plugin), 'enumerate'));
}
public static function enumerateAll() {
self::ensureScanned();
$sources = array();
foreach (self::getValidPlugins() as $plugin) {
$sources[$plugin] = self::enumerate($plugin);
}
return $sources;
}
public static function load($plugin, $source_filename, $scan = true, $use_cache = true) {
self::ensureScanned();
if ( ! self::isValidPlugin($plugin)) {
return null;
}
return call_user_func(array(self::classname($plugin), 'load'), $source_filename, $scan, $use_cache);
}
public static function loadEncoded($plugin, $encoded_filename, $scan = true, $use_cache = true) {
self::ensureScanned();
if ( ! self::isValidPlugin($plugin)) {
return null;
}
return call_user_func(array(self::classname($plugin), 'loadEncoded'), $encoded_filename, $scan, $use_cache);
}
public static function isValidSource($plugin, $source_filename) {
self::ensureScanned();
if ( ! self::isValidPlugin($plugin)) {
return null;
}
return call_user_func(array(self::classname($plugin), 'isValidSource'), source_filename);
}
}
?>