~ubuntu-branches/debian/experimental/brasero/experimental

« back to all changes in this revision

Viewing changes to libbrasero-burn/brasero-caps-burn.c

  • Committer: Bazaar Package Importer
  • Author(s): Josselin Mouette
  • Date: 2011-03-29 16:33:51 UTC
  • mfrom: (1.3.18 upstream) (5.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20110329163351-ac3wgbh4mplmhnht
Tags: 2.91.93-1
* Only depend on growisofs instead of dvd+rw-tools.
* New upstream pre-release.
* Update build-dependencies, package names, and paths.
* Require totem-plparser 2.32 since its soname changed.
* Do not include GIR package for now, since the versioning is broken 
  (see Bugzilla #646069).
* 01_pkglibdir.patch: dropped, upstream now has a variable we can use 
  for that effect.
* 11_nautilus_menu_no_display.patch, 31_link_libice.patch, 
  50_checksum.patch: dropped, merged upstream.
* 90_relibtoolize.patch: dropped, unnecessary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include "brasero-caps-burn.h"
41
41
#include "burn-caps.h"
42
42
#include "burn-debug.h"
 
43
#include "brasero-plugin.h"
 
44
#include "brasero-plugin-private.h"
43
45
#include "brasero-plugin-information.h"
44
46
#include "burn-task.h"
45
47
#include "brasero-session-helper.h"
61
63
                g_set_error (error,                                             \
62
64
                             BRASERO_BURN_ERROR,                                \
63
65
                             BRASERO_BURN_ERROR_GENERAL,                        \
64
 
                             _("An internal error occured"));                   \
 
66
                             _("An internal error occurred"));                  \
65
67
        BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG (session);                          \
66
68
}
67
69
 
73
75
                                BraseroBurnError error,
74
76
                                BraseroBurnCaps *caps)
75
77
{
76
 
#if 0
77
 
        GError *error = NULL;
78
 
        GConfClient *client;
79
 
 
80
 
        /* This was originally to fix a bug in fedora 5 that prevents from
81
 
         * sending SCSI commands as a normal user through cdrdao. There is a
82
 
         * fallback fortunately with cdrecord and raw images but no on_the_fly
83
 
         * burning.
84
 
         * That could be used as a hook to know how a job runs and give a
85
 
         * "penalty" to job types being too often faulty. There could also be
86
 
         * a dialog to ask the user if he wants to use another backend.
87
 
         */
88
 
 
89
 
        /* set it in GConf to remember that next time */
90
 
        client = gconf_client_get_default ();
91
 
        gconf_client_set_bool (client, GCONF_KEY_CDRDAO_DISABLED, TRUE, &error);
92
 
        if (error) {
93
 
                g_warning ("Can't write with GConf: %s", error->message);
94
 
                g_error_free (error);
95
 
        }
96
 
        g_object_unref (client);
97
 
#endif
98
78
        return BRASERO_BURN_ERR;
99
79
}
100
80
 
119
99
 
120
100
                plugin = iter->data;
121
101
 
122
 
                if (!brasero_plugin_get_active (plugin))
 
102
                if (!brasero_plugin_get_active (plugin, 0))
123
103
                        continue;
124
104
 
125
105
                if (output->type == BRASERO_TRACK_TYPE_DISC) {
168
148
 
169
149
typedef struct _BraseroCapsLinkList BraseroCapsLinkList;
170
150
struct _BraseroCapsLinkList {
171
 
        BraseroCapsLinkList *next;
172
151
        BraseroCapsLink *link;
173
152
        BraseroPlugin *plugin;
174
153
};
175
154
 
176
 
static BraseroCapsLinkList *
177
 
brasero_caps_link_list_insert (BraseroCapsLinkList *list,
178
 
                               BraseroCapsLinkList *node,
179
 
                               gboolean fits)
180
 
{
181
 
        BraseroCapsLinkList *iter;
182
 
 
183
 
        if (!list)
184
 
                return node;
185
 
 
186
 
        if (brasero_plugin_get_priority (node->plugin) >
187
 
            brasero_plugin_get_priority (list->plugin)) {
188
 
                node->next = list;
189
 
                return node;
190
 
        }
191
 
 
192
 
        if (brasero_plugin_get_priority (node->plugin) ==
193
 
            brasero_plugin_get_priority (list->plugin)) {
194
 
                if (fits) {
195
 
                        node->next = list;
196
 
                        return node;
197
 
                }
198
 
 
199
 
                node->next = list->next;
200
 
                list->next = node;
201
 
                return list;
202
 
        }
203
 
 
204
 
        if (!list->next) {
205
 
                node->next = NULL;
206
 
                list->next = node;
207
 
                return list;
208
 
        }
209
 
 
210
 
        /* Need a node with at least the same priority. Stop if end is reached */
211
 
        iter = list;
212
 
        while (iter->next &&
213
 
               brasero_plugin_get_priority (node->plugin) <
214
 
               brasero_plugin_get_priority (iter->next->plugin))
215
 
                iter = iter->next;
216
 
 
217
 
        if (!iter->next) {
218
 
                /* reached the end of the list, put it at the end */
219
 
                iter->next = node;
220
 
                node->next = NULL;
221
 
        }
222
 
        else if (brasero_plugin_get_priority (node->plugin) <
223
 
                 brasero_plugin_get_priority (iter->next->plugin)) {
224
 
                /* Put it at the end of the list */
225
 
                node->next = NULL;
226
 
                iter->next->next = node;
227
 
        }
228
 
        else if (brasero_plugin_get_priority (node->plugin) >
229
 
                 brasero_plugin_get_priority (iter->next->plugin)) {
230
 
                /* insert it before iter->next */
231
 
                node->next = iter->next;
232
 
                iter->next = node;
233
 
        }
234
 
        else if (fits) {
235
 
                /* insert it before the link with the same priority */
236
 
                node->next = iter->next;
237
 
                iter->next = node;
238
 
        }
239
 
        else {
240
 
                /* insert it after the link with the same priority */
241
 
                node->next = iter->next->next;
242
 
                iter->next->next = node;
243
 
        }
244
 
        return list;
 
155
static gint
 
156
brasero_caps_link_list_sort (gconstpointer a,
 
157
                             gconstpointer b)
 
158
{
 
159
        const BraseroCapsLinkList *node1 = a;
 
160
        const BraseroCapsLinkList *node2 = b;
 
161
        return brasero_plugin_get_priority (node2->plugin) -
 
162
               brasero_plugin_get_priority (node1->plugin);
 
163
}
 
164
 
 
165
static GSList *
 
166
brasero_caps_get_best_path (GSList *path1,
 
167
                            GSList *path2)
 
168
{
 
169
        GSList *iter1, *iter2;
 
170
 
 
171
        iter1 = path1;
 
172
        iter2 = path2;
 
173
 
 
174
        for (; iter1 && iter2; iter1 = iter1->next, iter2 = iter2->next) {
 
175
                gint priority1, priority2;
 
176
                BraseroCapsLinkList *node1, *node2;
 
177
 
 
178
                node1 = iter1->data;
 
179
                node2 = iter2->data;
 
180
                priority1 = brasero_plugin_get_priority (node1->plugin);
 
181
                priority2 = brasero_plugin_get_priority (node2->plugin);
 
182
                if (priority1 > priority2) {
 
183
                        g_slist_foreach (path2, (GFunc) g_free, NULL);
 
184
                        g_slist_free (path2);
 
185
                        return path1;
 
186
                }
 
187
 
 
188
                if (priority1 < priority2) {
 
189
                        g_slist_foreach (path1, (GFunc) g_free, NULL);
 
190
                        g_slist_free (path1);
 
191
                        return path2;
 
192
                }
 
193
        }
 
194
 
 
195
        /* equality all along or one of them is shorter. Keep the shorter or
 
196
         * path1 in case of complete equality. */
 
197
        if (!iter2 && iter1) {
 
198
                /* This one seems shorter */
 
199
                g_slist_foreach (path1, (GFunc) g_free, NULL);
 
200
                g_slist_free (path1);
 
201
                return path2;
 
202
        }
 
203
 
 
204
        g_slist_foreach (path2, (GFunc) g_free, NULL);
 
205
        g_slist_free (path2);
 
206
        return path1;
 
207
}
 
208
 
 
209
static GSList *
 
210
brasero_caps_find_best_link (BraseroCaps *caps,
 
211
                             gint group_id,
 
212
                             GSList *used_caps,
 
213
                             BraseroBurnFlag session_flags,
 
214
                             BraseroMedia media,
 
215
                             BraseroTrackType *input,
 
216
                             BraseroPluginIOFlag io_flags);
 
217
 
 
218
static GSList *
 
219
brasero_caps_get_plugin_results (BraseroCapsLinkList *node,
 
220
                                 int group_id,
 
221
                                 GSList *used_caps,
 
222
                                 BraseroBurnFlag session_flags,
 
223
                                 BraseroMedia media,
 
224
                                 BraseroTrackType *input,
 
225
                                 BraseroPluginIOFlag io_flags)
 
226
{
 
227
        GSList *results;
 
228
        guint search_group_id;
 
229
        GSList *plugin_used_caps = g_slist_copy (used_caps);
 
230
 
 
231
        /* determine the group_id for the search */
 
232
        if (brasero_plugin_get_group (node->plugin) > 0 && group_id <= 0)
 
233
                search_group_id = brasero_plugin_get_group (node->plugin);
 
234
        else
 
235
                search_group_id = group_id;
 
236
 
 
237
        /* It's not a perfect fit. First see if a plugin with the same
 
238
         * priority don't have the right input. Then see if we can reach
 
239
         * the right input by going through all previous nodes */
 
240
        results = brasero_caps_find_best_link (node->link->caps,
 
241
                                               search_group_id,
 
242
                                               plugin_used_caps,
 
243
                                               session_flags,
 
244
                                               media,
 
245
                                               input,
 
246
                                               io_flags);
 
247
        g_slist_free (plugin_used_caps);
 
248
        return results;
 
249
}
 
250
 
 
251
static gboolean
 
252
brasero_caps_link_list_have_processing_plugin (GSList *list)
 
253
{
 
254
        GSList *iter;
 
255
        BraseroPluginProcessFlag position;
 
256
 
 
257
        position = BRASERO_PLUGIN_RUN_BEFORE_TARGET;
 
258
 
 
259
        for (iter = list; iter; iter = iter->next) {
 
260
                BraseroCapsLinkList *node;
 
261
                BraseroCaps *caps;
 
262
                GSList *modifiers;
 
263
 
 
264
                node = list->data;
 
265
                caps = node->link->caps;
 
266
 
 
267
                if (brasero_track_type_get_has_medium (&caps->type))
 
268
                        continue;
 
269
 
 
270
                if (!iter->next)
 
271
                        position = BRASERO_PLUGIN_RUN_PREPROCESSING;
 
272
 
 
273
                for (modifiers = caps->modifiers; modifiers; modifiers = modifiers->next) {
 
274
                        BraseroPluginProcessFlag flags;
 
275
                        BraseroPlugin *plugin;
 
276
 
 
277
                        plugin = modifiers->data;
 
278
                        if (!brasero_plugin_get_active (plugin, 0))
 
279
                                continue;
 
280
 
 
281
                        brasero_plugin_get_process_flags (plugin, &flags);
 
282
                        if ((flags & position) == position)
 
283
                                return TRUE;
 
284
                }
 
285
        }
 
286
 
 
287
        return FALSE;
245
288
}
246
289
 
247
290
static GSList *
254
297
                             BraseroPluginIOFlag io_flags)
255
298
{
256
299
        GSList *iter;
 
300
        GSList *list = NULL;
257
301
        GSList *results = NULL;
 
302
        gboolean perfect_fit = FALSE;
258
303
        BraseroCapsLinkList *node = NULL;
259
 
        BraseroCapsLinkList *list = NULL;
 
304
        gboolean have_processing_plugin = FALSE;
260
305
 
261
306
        BRASERO_BURN_LOG_WITH_TYPE (&caps->type, BRASERO_PLUGIN_IO_NONE, "find_best_link");
262
307
 
296
341
                        continue;
297
342
                }
298
343
 
 
344
                if (brasero_track_type_get_has_medium (&caps->type)) {
 
345
                        if (brasero_caps_link_check_recorder_flags_for_input (link, session_flags))
 
346
                                continue;               
 
347
                }
 
348
 
299
349
                /* see if that's a perfect fit;
300
350
                 * - it must have the same caps (type + subtype)
301
351
                 * - it must have the proper IO (file). */
333
383
                        continue;
334
384
                }
335
385
 
336
 
                BRASERO_BURN_LOG ("Found candidate link");
 
386
                BRASERO_BURN_LOG_TYPE (&link->caps->type, "Found candidate link");
337
387
 
338
388
                /* A plugin could be found which means that link can be used.
339
389
                 * Insert it in the list at the right place.
344
394
                node->plugin = plugin;
345
395
                node->link = link;
346
396
 
347
 
                list = brasero_caps_link_list_insert (list, node, fits);
 
397
                list = g_slist_insert_sorted (list, node, brasero_caps_link_list_sort);
348
398
        }
349
399
 
350
400
        if (!list) {
356
406
 
357
407
        /* Then, go through this list (starting with highest priority links)
358
408
         * The rule is we prefer the links with the highest priority; if two
359
 
         * links have the same priority and one of them leads to a caps
360
 
         * with the correct type then choose this one. */
361
 
        for (node = list; node; node = node->next) {
362
 
                guint search_group_id;
 
409
         * links have the same priority and one of them leads to a caps with
 
410
         * the correct type then choose this one. */
 
411
        for (iter = list; iter; iter = iter->next) {
 
412
                BraseroCapsLinkList *iter_node;
 
413
 
 
414
                iter_node = iter->data;
 
415
 
 
416
                BRASERO_BURN_LOG ("Trying %s with a priority of %i",
 
417
                                  brasero_plugin_get_name (iter_node->plugin),
 
418
                                  brasero_plugin_get_priority (iter_node->plugin));
363
419
 
364
420
                /* see if that's a perfect fit; if so, then we're good. 
365
421
                 * - it must have the same caps (type + subtype)
366
 
                 * - it must have the proper IO (file) */
367
 
                if ((node->link->caps->flags & BRASERO_PLUGIN_IO_ACCEPT_FILE)
368
 
                &&   brasero_caps_is_compatible_type (node->link->caps, input)) {
369
 
                        results = g_slist_prepend (NULL, node->link);
 
422
                 * - it must have the proper IO (file).
 
423
                 * The only case where we don't want a perfect fit is when the
 
424
                 * other possibility allows for the inclusion and expression
 
425
                 * of active track processing plugins. It allows for example to
 
426
                 * choose:
 
427
                 * mkisofs => checksum image => growisofs
 
428
                 * instead of simply:
 
429
                 * growisofs.  */
 
430
                if ((iter_node->link->caps->flags & BRASERO_PLUGIN_IO_ACCEPT_FILE)
 
431
                &&   brasero_caps_is_compatible_type (iter_node->link->caps, input)) {
 
432
                        perfect_fit = TRUE;
370
433
                        break;
371
434
                }
372
435
 
373
 
                /* determine the group_id for the search */
374
 
                if (brasero_plugin_get_group (node->plugin) > 0 && group_id <= 0)
375
 
                        search_group_id = brasero_plugin_get_group (node->plugin);
376
 
                else
377
 
                        search_group_id = group_id;
378
 
 
379
 
                /* It's not a perfect fit. First see if a plugin with the same
380
 
                 * priority don't have the right input. Then see if we can reach
381
 
                 * the right input by going through all previous nodes */
382
 
                results = brasero_caps_find_best_link (node->link->caps,
383
 
                                                       search_group_id,
384
 
                                                       used_caps,
385
 
                                                       session_flags,
386
 
                                                       media,
387
 
                                                       input,
388
 
                                                       io_flags);
 
436
                results = brasero_caps_get_plugin_results (iter_node,
 
437
                                                           group_id,
 
438
                                                           used_caps,
 
439
                                                           session_flags,
 
440
                                                           media,
 
441
                                                           input,
 
442
                                                           io_flags);
389
443
                if (results) {
390
 
                        results = g_slist_prepend (results, node->link);
391
 
                        break;
392
 
                }
393
 
        }
 
444
                        have_processing_plugin = brasero_caps_link_list_have_processing_plugin (results);
 
445
                        break;
 
446
                }
 
447
        }
 
448
 
 
449
        /* Do not check for results that could be NULL in case of a perfect fit */
 
450
        if (!iter)
 
451
                goto end;
 
452
 
 
453
        node = iter->data;
 
454
 
 
455
        /* Stage 3: there may be other link with the same priority (most the
 
456
         * time because it is the same plugin) so we try them as well and keep
 
457
         * the one whose next plugin in the list has the highest priority. */
 
458
        for (iter = iter->next; iter; iter = iter->next) {
 
459
                GSList *other_results;
 
460
                BraseroCapsLinkList *iter_node;
 
461
 
 
462
                iter_node = iter->data;
 
463
                if (brasero_plugin_get_priority (iter_node->plugin) !=
 
464
                    brasero_plugin_get_priority (node->plugin))
 
465
                        break;
 
466
 
 
467
                BRASERO_BURN_LOG ("Trying %s with a priority of %i",
 
468
                                  brasero_plugin_get_name (iter_node->plugin),
 
469
                                  brasero_plugin_get_priority (iter_node->plugin));
 
470
 
 
471
                /* see if that's a perfect fit */
 
472
                if ((iter_node->link->caps->flags & BRASERO_PLUGIN_IO_ACCEPT_FILE) == 0
 
473
                ||  !brasero_caps_is_compatible_type (iter_node->link->caps, input)) {
 
474
                        other_results = brasero_caps_get_plugin_results (iter_node,
 
475
                                                                         group_id,
 
476
                                                                         used_caps,
 
477
                                                                         session_flags,
 
478
                                                                         media,
 
479
                                                                         input,
 
480
                                                                         io_flags);
 
481
                        if (!other_results)
 
482
                                continue;
 
483
 
 
484
                        if (perfect_fit) {
 
485
                                have_processing_plugin = brasero_caps_link_list_have_processing_plugin (other_results);
 
486
                                if (have_processing_plugin) {
 
487
                                        /* Note: results == NULL for perfect fit */
 
488
                                        results = other_results;
 
489
 
 
490
                                        perfect_fit = FALSE;
 
491
                                        node = iter_node;
 
492
                                }
 
493
                                else {
 
494
                                        g_slist_foreach (other_results, (GFunc) g_free, NULL);
 
495
                                        g_slist_free (other_results);
 
496
                                }
 
497
                        }
 
498
                        else {
 
499
                                results = brasero_caps_get_best_path (results, other_results);
 
500
                                if (results == other_results) {
 
501
                                        have_processing_plugin = brasero_caps_link_list_have_processing_plugin (other_results);
 
502
                                        node = iter_node;
 
503
                                }
 
504
                        }
 
505
                }
 
506
                else if (!perfect_fit && !have_processing_plugin) {
 
507
                        g_slist_foreach (results, (GFunc) g_free, NULL);
 
508
                        g_slist_free (results);
 
509
                        results = NULL;
 
510
 
 
511
                        perfect_fit = TRUE;
 
512
                        node = iter_node;
 
513
                }
 
514
        }
 
515
 
 
516
        results = g_slist_prepend (results, node);
 
517
        list = g_slist_remove (list, node);
 
518
 
 
519
end:
394
520
 
395
521
        /* clear up */
396
522
        used_caps = g_slist_remove (used_caps, caps);
397
 
        for (node = list; node; node = list) {
398
 
                list = node->next;
399
 
                g_free (node);
400
 
        }
 
523
        g_slist_foreach (list, (GFunc) g_free, NULL);
 
524
        g_slist_free (list);
401
525
 
402
526
        return results;
403
527
}
424
548
        GSList *modifiers;
425
549
        GSList *iter;
426
550
 
427
 
        if (position == BRASERO_PLUGIN_RUN_NEVER
428
 
        ||  caps->type.type == BRASERO_TRACK_TYPE_DISC)
 
551
        if (brasero_track_type_get_has_medium (&caps->type))
429
552
                return NULL;
430
553
 
431
554
        BRASERO_BURN_LOG_WITH_TYPE (&caps->type,
447
570
                GType type;
448
571
 
449
572
                plugin = iter->data;
450
 
                if (!brasero_plugin_get_active (plugin))
 
573
                if (!brasero_plugin_get_active (plugin, 0))
451
574
                        continue;
452
575
 
453
576
                brasero_plugin_get_process_flags (plugin, &flags);
489
612
GSList *
490
613
brasero_burn_caps_new_task (BraseroBurnCaps *self,
491
614
                            BraseroBurnSession *session,
 
615
                            BraseroTrackType *temp_output,
492
616
                            GError **error)
493
617
{
494
618
        BraseroPluginProcessFlag position;
503
627
        GSList *retval = NULL;
504
628
        GSList *iter, *list;
505
629
        BraseroMedia media;
506
 
        gint group_id;
507
630
        gboolean res;
508
631
 
509
632
        /* determine the output and the flags for this task */
510
 
        if (brasero_burn_session_is_dest_file (session)) {
 
633
        if (temp_output) {
 
634
                output.type = temp_output->type;
 
635
                output.subtype.img_format = temp_output->subtype.img_format;
 
636
        }
 
637
        else
 
638
                brasero_burn_session_get_output_type (session, &output);
 
639
 
 
640
        if (brasero_track_type_get_has_medium (&output))
 
641
                media = brasero_track_type_get_medium_type (&output);
 
642
        else
511
643
                media = BRASERO_MEDIUM_FILE;
512
644
 
513
 
                output.type = BRASERO_TRACK_TYPE_IMAGE;
514
 
                output.subtype.img_format = brasero_burn_session_get_output_format (session);
515
 
        }
516
 
        else {
517
 
                media = brasero_burn_session_get_dest_media (session);
518
 
 
519
 
                output.type = BRASERO_TRACK_TYPE_DISC;
520
 
                output.subtype.media = media;
521
 
        }
522
 
 
523
645
        if (BRASERO_BURN_SESSION_NO_TMP_FILE (session))
524
646
                flags = BRASERO_PLUGIN_IO_ACCEPT_PIPE;
525
647
        else
562
684
                 * handle this flag (means that the plugin should erase and
563
685
                 * then write on its own. Basically that works only with
564
686
                 * overwrite formatted discs, DVD+RW, ...) */
565
 
                if (output.type != BRASERO_TRACK_TYPE_DISC)
 
687
                if (!brasero_track_type_get_has_medium (&output))
566
688
                        BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG_ERROR (session, error);
567
689
 
568
690
                /* output is a disc try with initial blanking */
583
705
                           BRASERO_MEDIUM_HAS_AUDIO);
584
706
                media |= BRASERO_MEDIUM_BLANK;
585
707
 
586
 
                output.subtype.media = media;
 
708
                brasero_track_type_set_medium_type (&output, media);
587
709
 
588
710
                last_caps = brasero_burn_caps_find_start_caps (self, &output);
589
711
                if (!last_caps)
619
741
        /* reverse the list of links to have them in the right order */
620
742
        list = g_slist_reverse (list);
621
743
        position = BRASERO_PLUGIN_RUN_PREPROCESSING;
622
 
        group_id = self->priv->group_id;
623
744
 
624
745
        brasero_burn_session_get_input_type (session, &plugin_input);
625
746
        for (iter = list; iter; iter = iter->next) {
626
747
                BraseroTrackType plugin_output;
627
 
                BraseroCapsLink *link;
628
 
                BraseroPlugin *plugin;
 
748
                BraseroCapsLinkList *node;
629
749
                BraseroJob *job;
630
750
                GSList *result;
631
751
                GType type;
632
752
 
633
 
                link = iter->data;
 
753
                node = iter->data;
634
754
 
635
 
                /* determine the plugin output */
 
755
                /* determine the plugin output:
 
756
                 * if it's not the last one it takes the input of the next
 
757
                 * plugin as its output.
 
758
                 * Otherwise it uses the final output type */
636
759
                if (iter->next) {
637
 
                        BraseroCapsLink *next_link;
 
760
                        BraseroCapsLinkList *next_node;
638
761
 
639
 
                        next_link = iter->next->data;
640
 
                        if (next_link == link) {
641
 
                                /* That's a processing plugin so the output must
642
 
                                 * be the exact same as the input, which is not
643
 
                                 * necessarily the caps type referred to by the 
644
 
                                 * link if the link is amongst the first. In
645
 
                                 * that case that's the session input. */
646
 
                                memcpy (&plugin_output,
647
 
                                        &plugin_input,
648
 
                                        sizeof (BraseroTrackType));
649
 
                        }
650
 
                        else {
651
 
                                memcpy (&plugin_output,
652
 
                                        &next_link->caps->type,
653
 
                                        sizeof (BraseroTrackType));
654
 
                        }
 
762
                        next_node = iter->next->data;
 
763
                        memcpy (&plugin_output,
 
764
                                &next_node->link->caps->type,
 
765
                                sizeof (BraseroTrackType));
655
766
                }
656
767
                else
657
768
                        memcpy (&plugin_output,
661
772
                /* first see if there are track processing plugins */
662
773
                result = brasero_caps_add_processing_plugins_to_task (session,
663
774
                                                                      task,
664
 
                                                                      link->caps,
 
775
                                                                      node->link->caps,
665
776
                                                                      &plugin_input,
666
777
                                                                      position);
667
778
                retval = g_slist_concat (retval, result);
668
779
 
669
 
                /* create job from the best plugin in link */
670
 
                plugin = brasero_caps_link_find_plugin (link,
671
 
                                                        group_id,
672
 
                                                        session_flags,
673
 
                                                        &plugin_output,
674
 
                                                        media);
675
 
                if (!plugin) {
676
 
                        g_set_error (error,
677
 
                                     BRASERO_BURN_ERROR,
678
 
                                     BRASERO_BURN_ERROR_GENERAL,
679
 
                                     _("An internal error occured"));
680
 
                        g_slist_foreach (retval, (GFunc) g_object_unref, NULL);
681
 
                        g_slist_free (retval);
682
 
                        g_slist_free (list);
683
 
                        return NULL;
684
 
                }
685
 
 
686
 
                /* This is meant to have plugins in the same group id as much as
687
 
                 * possible */
688
 
                if (brasero_plugin_get_group (plugin) > 0 && group_id <= 0)
689
 
                        group_id = brasero_plugin_get_group (plugin);
690
 
 
691
 
                type = brasero_plugin_get_gtype (plugin);
 
780
                /* Create an object from the plugin */
 
781
                type = brasero_plugin_get_gtype (node->plugin);
692
782
                job = BRASERO_JOB (g_object_new (type,
693
783
                                                 "output", &plugin_output,
694
784
                                                 NULL));
695
785
                g_signal_connect (job,
696
786
                                  "error",
697
787
                                  G_CALLBACK (brasero_burn_caps_job_error_cb),
698
 
                                  link);
 
788
                                  node->link);
699
789
 
700
790
                if (!task
701
 
                ||  !(link->caps->flags & BRASERO_PLUGIN_IO_ACCEPT_PIPE)
 
791
                ||  !(node->link->caps->flags & BRASERO_PLUGIN_IO_ACCEPT_PIPE)
702
792
                ||  !BRASERO_BURN_SESSION_NO_TMP_FILE (session)) {
703
793
                        /* only the last task will be doing the proper action
704
794
                         * all other are only steps to take to reach the final
713
803
 
714
804
                brasero_task_add_item (task, BRASERO_TASK_ITEM (job));
715
805
 
716
 
                BRASERO_BURN_LOG ("%s added to task", brasero_plugin_get_name (plugin));
 
806
                BRASERO_BURN_LOG ("%s added to task", brasero_plugin_get_name (node->plugin));
717
807
                BRASERO_BURN_LOG_TYPE (&plugin_input, "input");
718
808
                BRASERO_BURN_LOG_TYPE (&plugin_output, "output");
719
809
 
722
812
                /* the output of the plugin will become the input of the next */
723
813
                memcpy (&plugin_input, &plugin_output, sizeof (BraseroTrackType));
724
814
        }
 
815
        g_slist_foreach (list, (GFunc) g_free, NULL);
725
816
        g_slist_free (list);
726
817
 
727
818
        /* add the post processing plugins */
732
823
                                                            BRASERO_PLUGIN_RUN_AFTER_TARGET);
733
824
        retval = g_slist_concat (retval, list);
734
825
 
735
 
        if (last_caps->type.type == BRASERO_TRACK_TYPE_DISC && blanking) {
 
826
        if (brasero_track_type_get_has_medium (&last_caps->type) && blanking) {
736
827
                retval = g_slist_insert_before (retval,
737
828
                                                g_slist_last (retval),
738
829
                                                blanking);
823
914
                        BraseroPlugin *plugin;
824
915
 
825
916
                        plugin = plugins->data;
826
 
                        if (!brasero_plugin_get_active (plugin))
 
917
                        if (!brasero_plugin_get_active (plugin, 0))
827
918
                                continue;
828
919
 
829
920
                        /* note for checksuming task there is no group possible */
878
969
        list = g_slist_reverse (list);
879
970
        for (iter = list; iter; iter = iter->next) {
880
971
                GType type;
881
 
                GSList *plugins;
882
 
                BraseroCapsLink *link;
883
 
                BraseroPlugin *candidate_plugin;
 
972
                BraseroCapsLinkList *node;
884
973
                BraseroTrackType *plugin_output;
885
974
 
886
 
                link = iter->data;
 
975
                node = iter->data;
887
976
 
888
977
                /* determine the plugin output */
889
978
                if (iter->next) {
895
984
                else
896
985
                        plugin_output = &last_caps->type;
897
986
 
898
 
                /* find the best plugin */
899
 
                candidate_plugin = NULL;
900
 
                for (plugins = link->plugins; plugins; plugins = plugins->next) {
901
 
                        BraseroPlugin *plugin;
902
 
 
903
 
                        plugin = plugins->data;
904
 
 
905
 
                        if (!brasero_plugin_get_active (plugin))
906
 
                                continue;
907
 
 
908
 
                        if (!candidate_plugin)
909
 
                                candidate_plugin = plugin;
910
 
                        else if (brasero_plugin_get_priority (plugin) >
911
 
                                 brasero_plugin_get_priority (candidate_plugin))
912
 
                                candidate_plugin = plugin;
913
 
                }
914
 
 
915
987
                /* create the object */
916
 
                type = brasero_plugin_get_gtype (candidate_plugin);
 
988
                type = brasero_plugin_get_gtype (node->plugin);
917
989
                job = BRASERO_JOB (g_object_new (type,
918
990
                                                 "output", plugin_output,
919
991
                                                 NULL));
920
992
                g_signal_connect (job,
921
993
                                  "error",
922
994
                                  G_CALLBACK (brasero_burn_caps_job_error_cb),
923
 
                                  link);
 
995
                                  node->link);
924
996
 
925
997
                brasero_task_add_item (task, BRASERO_TASK_ITEM (job));
926
998
 
927
 
                BRASERO_BURN_LOG ("%s added to task", brasero_plugin_get_name (candidate_plugin));
 
999
                BRASERO_BURN_LOG ("%s added to task", brasero_plugin_get_name (node->plugin));
928
1000
        }
 
1001
        g_slist_foreach (list, (GFunc) g_free, NULL);
929
1002
        g_slist_free (list);
930
1003
 
931
1004
        /* Create the candidate */
986
1059
 
987
1060
                                plugin = plugins->data;
988
1061
 
989
 
                                if (!brasero_plugin_get_active (plugin))
 
1062
                                if (!brasero_plugin_get_active (plugin, 0))
990
1063
                                        continue;
991
1064
 
992
1065
                                if (!brasero_plugin_check_blank_flags (plugin, media, flags))