# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: contributions/modules/ffmpeg_converter/README.txt
--- contributions/modules/ffmpeg_converter/README.txt Base (1.8)
+++ contributions/modules/ffmpeg_converter/README.txt Locally Modified (Based On 1.8)
@@ -32,7 +32,7 @@
    them):
    
    - FileField: http://drupal.org/project/filefield
-   - Job queue: http://drupal.org/project/job_queue
+   - Drupal Queue: http://drupal.org/project/drupal_queue
    - Rules: http://drupal.org/project/rules
    
 4. Optionally download and install MimeDetect, which will set proper MIME types 
@@ -72,9 +72,8 @@
    Add another rule for "After updating existing content" if you like.
 
    All media files uploaded to the source field should now be automatically
-   converted if you have Job queue installed and cron set up (see
-   http://drupal.org/cron). On Administer > Reports > Queued jobs you can find a
-   list of all conversions that have not yet run.
+   converted if you have Drupal Queue installed and cron set up (see
+   http://drupal.org/cron and Drupal Queue's README.txt file).
    
 5. Test you configuration. You will probably want to allow PHP to execute for a
    longer time than the usual default. This can be configured in your php.ini 
Index: contributions/modules/ffmpeg_converter/ffmpeg_converter.admin.inc
--- contributions/modules/ffmpeg_converter/ffmpeg_converter.admin.inc Base (1.8)
+++ contributions/modules/ffmpeg_converter/ffmpeg_converter.admin.inc Locally Modified (Based On 1.8)
@@ -8,11 +8,19 @@
  */
 
 /**
- * Page callback: debug settings form.
+ * Page callback: configuration form.
  */
-function ffmpeg_converter_admin_debug() {
+function ffmpeg_converter_admin_configuration() {
   $form = array();
 
+  $form['ffmpeg_converter_timeout'] = array(
+    '#type' => 'textfield',
+    '#size' => 5,
+    '#title' => t('Conversion time limit'),
+    '#field_suffix' => ' ' . t('sec'),
+    '#description' => t('Specify the number of seconds FFmpeg Converter will be allowed to spend converting files each time the convertion queue runs. Note that this is not a hard timeout, but rather a time limit for initiating new conversions.'),
+    '#default_value' => variable_get('ffmpeg_converter_timeout', 30),
+  );
   $form['ffmpeg_converter_debug'] = array(
     '#type' => 'checkbox',
     '#title' => t('Save debug messages to the log'),
Index: contributions/modules/ffmpeg_converter/ffmpeg_converter.install
--- contributions/modules/ffmpeg_converter/ffmpeg_converter.install Base (1.4)
+++ contributions/modules/ffmpeg_converter/ffmpeg_converter.install Locally Modified (Based On 1.4)
@@ -89,7 +89,7 @@
     );
     $rec_missing = array();
     $recommended = array(
-      'job_queue' => $t('Job Queue'),
+      'drupal_queue' => $t('Drupal Queue'),
       'rules' => $t('Rules'),
       'filefield' => $t('FileField'),
     );
@@ -198,3 +198,17 @@
 
   return $ret;
 }
+
+/**
+ * Notify users of the switch from Job Queue to Drupal Queue.
+ */
+function ffmpeg_converter_update_6201() {
+
+  // Check the new dependency on Ctools.
+  if (!module_exists('drupal_queue') && module_exists('job_queue')) {
+    drupal_set_message('FFmpeg Converter has switched from Job Queue to <a href="http://drupal.org/project/drupal_queue">Drupal Queue</a> for handling its conversion jobs. Please install and enable Drupal Queue. If you no longer need it, it is now safe to disable and remove Job Queue.');
+  }
+
+  drupal_set_message();
+  return array();
+}
Index: contributions/modules/ffmpeg_converter/ffmpeg_converter.module
--- contributions/modules/ffmpeg_converter/ffmpeg_converter.module Base (1.44)
+++ contributions/modules/ffmpeg_converter/ffmpeg_converter.module Locally Modified (Based On 1.44)
@@ -19,11 +19,11 @@
  */
 function ffmpeg_converter_menu() {
   $items = array();
-  $items['admin/build/ffmpeg_converter/debug'] = array(
-    'title' => 'Debugging',
+  $items['admin/settings/ffmpeg_converter/configuration'] = array(
+    'title' => 'Configuration',
     'type' => MENU_LOCAL_TASK,
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('ffmpeg_converter_admin_debug'),
+    'page arguments' => array('ffmpeg_converter_admin_configuration'),
     'access arguments' => array('administer ffmpeg wrapper'),
     'file' => 'ffmpeg_converter.admin.inc',
     'weight' => 9,
@@ -200,6 +200,37 @@
 
 
 /**
+ * Implementation of hook_cron_queue_info().
+ */
+function ffmpeg_converter_cron_queue_info() {
+  return array(
+    'ffmpeg_converter' => array(
+      'worker callback' => 'ffmpeg_converter_worker',
+      'time' => variable_get('ffmpeg_converter_timeout', 30),
+    ),
+  );
+}
+
+
+/**
+ * Drupal Queue worker implementation.
+ */
+function ffmpeg_converter_worker($data) {
+  // Clear the cached list of queued files.
+  cache_clear_all('ffmpeg_converter_queued_files', 'cache');
+
+  // Run the conversion.
+  if (function_exists($data['function'])) {
+    call_user_func_array($data['function'], $data['arguments']);
+    watchdog('ffmpeg_converter', 'Ran queued job "!description"', array('!description' => t($data['description'], $data['arguments'])));
+  }
+  else {
+    watchdog('ffmpeg_converter', 'Failed to run queued job "!description" because the function %function is not defined.', array('!description' => $data['description'], '%function' => $data['function']), WATCHDOG_ERROR);
+  }
+}
+
+
+/**
  * Add a file field to the process queue.
  *
  * @param $nid
@@ -214,12 +245,20 @@
  * @param $preset_key
  *   The key of the FFmpeg Converter preset to use.
  * @return
- *   FALSE if Job queue is unavailable, NULL otherwise.
+ *   FALSE if Drupal Queue is unavailable, NULL otherwise.
  */
 function ffmpeg_converter_queue_filefield($nid, $source_field, $dest_field, $field_instance, $preset_key) {
-  if (function_exists('job_queue_add')) {
+  if (function_exists('drupal_queue_include')) {
     cache_clear_all('ffmpeg_converter_queued_files', 'cache');
-    return job_queue_add('ffmpeg_converter_convert_filefield', t('Convert a file field with FFmpeg.'), array($nid, $source_field, $dest_field, $field_instance, $preset_key));
+
+    $job = array(
+      'function' => 'ffmpeg_converter_convert_filefield',
+      'description' => t('Convert a file field with FFmpeg'),
+      'arguments' => array($nid, $source_field, $dest_field, $field_instance, $preset_key),
+    );
+    drupal_queue_include();
+    $queue = DrupalQueue::get('ffmpeg_converter');
+    $queue->createItem($job);
   }
   else {
     return false;
@@ -249,9 +288,10 @@
     $files = $cache->data;
   }
   else {
-    $jobs = db_query("SELECT * FROM {job_queue} WHERE function = 'ffmpeg_converter_convert_filefield'");
+    $res = db_query("SELECT data FROM {queue} WHERE name = 'ffmpeg_converter'");
     $files = array();
-    while ($job = db_fetch_array($jobs)) {
+    while ($data = db_result($res)) {
+      $job = unserialize($data);
       $args = unserialize($job['arguments']);
       $files[] = $args[0] . '-' . $args[1] . '-' . $args[2] . '-' . $args[3];
     }
@@ -299,9 +339,6 @@
 
   $node = node_load($nid, null, true);
 
-  // Clear the cached list of queued files.
-  cache_clear_all('ffmpeg_converter_queued_files', 'cache');
-  
   // Check the necessary prerequisites.
   if (empty($node) || empty($node->{$source_field}[$field_instance]['fid']) || !function_exists('content_fields')) {
     return false;
Index: contributions/modules/ffmpeg_converter/plugins/export_ui/ffmpeg_converter_presets_ui.class.php
--- contributions/modules/ffmpeg_converter/plugins/export_ui/ffmpeg_converter_presets_ui.class.php Base (1.2)
+++ contributions/modules/ffmpeg_converter/plugins/export_ui/ffmpeg_converter_presets_ui.class.php Locally Modified (Based On 1.2)
@@ -18,11 +18,11 @@
     parent::list_form($form, $form_state);
 
     $help = t('Use this page to create and modify FFmpeg configuration presets which you can use to process media files automatically.');
-    if (module_exists('filefield') && module_exists('job_queue') && module_exists('rules')) {
+    if (module_exists('filefield') && module_exists('drupal_queue') && module_exists('rules')) {
       $help .= ' ' . t('Your presets will appear in <a href="@rules">Rules</a> using the "Queue file field for conversion" action, which lets you create rules that convert all media files that are uploaded to a certain file field automatically.', array('@rules' => url('admin/rules/trigger')));
     }
     else {
-      $help .= ' ' . t('If you install and enable the Rules, Job Queue and FileField modules, your presets will appear on rule configuration pages, which allows you to have all media files that are uploaded to a certain file field processed automatically.');
+      $help .= ' ' . t('If you install and enable the Rules, Drupal Queue and FileField modules, your presets will appear on rule configuration pages, which allows you to have all media files that are uploaded to a certain file field processed automatically.');
     }
     $help .= ' ' . t('Other modules may also make this conversion functionality available in their own specific contexts.');
     $help = '<p class="ffmpeg-converter-help">' . $help . '</p>';
