~mfisch/brasero/update-to-3.8.0

« back to all changes in this revision

Viewing changes to src/burn-caps.c

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2008-11-18 11:30:50 UTC
  • mto: (1.4.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: james.westby@ubuntu.com-20081118113050-yhrskmatlel0gzfm
Tags: upstream-0.8.3
ImportĀ upstreamĀ versionĀ 0.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
179
179
        return default_caps;
180
180
}
181
181
 
182
 
gint
183
 
brasero_burn_caps_register_plugin_group (BraseroBurnCaps *self,
184
 
                                         const gchar *name)
185
 
{
186
 
        guint retval;
187
 
 
188
 
        if (!name)
189
 
                return 0;
190
 
 
191
 
        if (!self->priv->groups)
192
 
                self->priv->groups = g_hash_table_new_full (g_str_hash,
193
 
                                                            g_str_equal,
194
 
                                                            g_free,
195
 
                                                            NULL);
196
 
 
197
 
        retval = GPOINTER_TO_INT (g_hash_table_lookup (self->priv->groups, name));
198
 
        if (retval)
199
 
                return retval;
200
 
 
201
 
        g_hash_table_insert (self->priv->groups,
202
 
                             g_strdup (name),
203
 
                             GINT_TO_POINTER (g_hash_table_size (self->priv->groups) + 1));
204
 
 
205
 
        /* see if we have a group id now */
206
 
        if (!self->priv->group_id
207
 
        &&   self->priv->group_str
208
 
        &&  !strcmp (name, self->priv->group_str))
209
 
                self->priv->group_id = g_hash_table_size (self->priv->groups) + 1;
210
 
 
211
 
        return g_hash_table_size (self->priv->groups) + 1;
212
 
}
213
 
 
214
182
/* that function receives all errors returned by the object and 'learns' from 
215
183
 * these errors what are the safest defaults for a particular system. It should 
216
184
 * also offer fallbacks if an error occurs through a signal */
244
212
        return BRASERO_BURN_ERR;
245
213
}
246
214
 
247
 
/**
248
 
 * returns the flags that must be used (compulsory),
249
 
 * and the flags that can be used (supported).
250
 
 */
251
 
 
252
 
void
253
 
brasero_caps_list_dump (void)
254
 
{
255
 
        GSList *iter;
256
 
        BraseroBurnCaps *self;
257
 
 
258
 
        self = brasero_burn_caps_get_default ();
259
 
        for (iter = self->priv->caps_list; iter; iter = iter->next) {
260
 
                BraseroCaps *caps;
261
 
 
262
 
                caps = iter->data;
263
 
                BRASERO_BURN_LOG_WITH_TYPE (&caps->type,
264
 
                                            caps->flags,
265
 
                                            "Created %i links pointing to",
266
 
                                            g_slist_length (caps->links));
267
 
        }
268
 
}
269
 
 
270
215
static gboolean
271
216
brasero_caps_is_compatible_type (const BraseroCaps *caps,
272
217
                                 const BraseroTrackType *type)
317
262
        return TRUE;
318
263
}
319
264
 
320
 
/**
321
 
 * Used to test what the library can do based on the medium type.
322
 
 * Returns BRASERO_MEDIUM_WRITABLE if the disc can be written
323
 
 * and / or BRASERO_MEDIUM_REWRITABLE if the disc can be erased.
324
 
 */
325
 
 
326
 
BraseroMedia
327
 
brasero_burn_caps_media_capabilities (BraseroBurnCaps *self,
328
 
                                      BraseroMedia media)
329
 
{
330
 
        GSList *iter;
331
 
        GSList *links;
332
 
        BraseroMedia retval;
333
 
        BraseroCaps *caps = NULL;
334
 
 
335
 
        retval = BRASERO_MEDIUM_NONE;
336
 
        BRASERO_BURN_LOG_DISC_TYPE (media, "checking media caps for");
337
 
 
338
 
        /* we're only interested in DISC caps. There should be only one caps fitting */
339
 
        for (iter = self->priv->caps_list; iter; iter = iter->next) {
340
 
                caps = iter->data;
341
 
                if (caps->type.type != BRASERO_TRACK_TYPE_DISC)
342
 
                        continue;
343
 
 
344
 
                if ((media & caps->type.subtype.media) == media)
345
 
                        break;
346
 
 
347
 
                caps = NULL;
348
 
        }
349
 
 
350
 
        if (!caps)
351
 
                return BRASERO_MEDIUM_NONE;
352
 
 
353
 
        /* check the links */
354
 
        for (links = caps->links; links; links = links->next) {
355
 
                GSList *plugins;
356
 
                gboolean active;
357
 
                BraseroCapsLink *link;
358
 
 
359
 
                link = links->data;
360
 
 
361
 
                /* this link must have at least one active plugin to be valid
362
 
                 * plugins are not sorted but in this case we don't need them
363
 
                 * to be. we just need one active if another is with a better
364
 
                 * priority all the better. */
365
 
                active = FALSE;
366
 
                for (plugins = link->plugins; plugins; plugins = plugins->next) {
367
 
                        BraseroPlugin *plugin;
368
 
 
369
 
                        plugin = plugins->data;
370
 
                        if (brasero_plugin_get_active (plugin)) {
371
 
                                /* this link is valid */
372
 
                                active = TRUE;
373
 
                                break;
374
 
                        }
375
 
                }
376
 
 
377
 
                if (!active)
378
 
                        continue;
379
 
 
380
 
                if (!link->caps) {
381
 
                        /* means that it can be blanked */
382
 
                        retval |= BRASERO_MEDIUM_REWRITABLE;
383
 
                        continue;
384
 
                }
385
 
 
386
 
                /* means it can be written. NOTE: if this disc has already some
387
 
                 * data on it, it even means it can be appended */
388
 
                retval |= BRASERO_MEDIUM_WRITABLE;
389
 
        }
390
 
 
391
 
        return retval;
392
 
}
393
 
 
394
265
static BraseroCaps *
395
266
brasero_caps_find_start_caps (BraseroTrackType *output)
396
267
{
1183
1054
        return results;
1184
1055
}
1185
1056
 
 
1057
static gboolean
 
1058
brasero_burn_caps_sort_modifiers (gconstpointer a,
 
1059
                                  gconstpointer b)
 
1060
{
 
1061
        BraseroPlugin *plug_a = BRASERO_PLUGIN (a);
 
1062
        BraseroPlugin *plug_b = BRASERO_PLUGIN (b);
 
1063
 
 
1064
        return brasero_plugin_get_priority (plug_a) -
 
1065
               brasero_plugin_get_priority (plug_b);
 
1066
}
 
1067
 
1186
1068
static GSList *
1187
1069
brasero_caps_add_processing_plugins_to_task (BraseroBurnSession *session,
1188
1070
                                             BraseroTask *task,
1191
1073
                                             BraseroPluginProcessFlag position)
1192
1074
{
1193
1075
        GSList *retval = NULL;
 
1076
        GSList *modifiers;
1194
1077
        GSList *iter;
1195
1078
 
1196
1079
        if (position == BRASERO_PLUGIN_RUN_NEVER
1205
1088
 
1206
1089
        /* Go through all plugins and add all possible modifiers. They must:
1207
1090
         * - be active
1208
 
         * - accept the position flags
1209
 
         * => no need for modifiers to be sorted in list. */
1210
 
        for (iter = caps->modifiers; iter; iter = iter->next) {
 
1091
         * - accept the position flags */
 
1092
        modifiers = g_slist_copy (caps->modifiers);
 
1093
        modifiers = g_slist_sort (modifiers, brasero_burn_caps_sort_modifiers);
 
1094
 
 
1095
        for (iter = modifiers; iter; iter = iter->next) {
1211
1096
                BraseroPluginProcessFlag flags;
1212
1097
                BraseroPlugin *plugin;
1213
1098
                BraseroJob *job;
1218
1103
                        continue;
1219
1104
 
1220
1105
                brasero_plugin_get_process_flags (plugin, &flags);
1221
 
                if (!(flags & position))
 
1106
                if ((flags & position) != position)
1222
1107
                        continue;
1223
1108
 
1224
1109
                type = brasero_plugin_get_gtype (plugin);
1241
1126
                        retval = g_slist_prepend (retval, task);
1242
1127
                }
1243
1128
 
1244
 
                BRASERO_BURN_LOG ("%s (modifier) added to task", brasero_plugin_get_name (plugin));
 
1129
                BRASERO_BURN_LOG ("%s (modifier) added to task",
 
1130
                                  brasero_plugin_get_name (plugin));
 
1131
 
1245
1132
                BRASERO_BURN_LOG_TYPE (io_type, "IO type");
1246
1133
 
1247
1134
                brasero_task_add_item (task, BRASERO_TASK_ITEM (job));
1248
1135
        }
 
1136
        g_slist_free (modifiers);
1249
1137
 
1250
1138
        return retval;
1251
1139
}
1402
1290
 
1403
1291
        /* reverse the list of links to have them in the right order */
1404
1292
        list = g_slist_reverse (list);
1405
 
        position = BRASERO_PLUGIN_RUN_FIRST;
 
1293
        position = BRASERO_PLUGIN_RUN_PREPROCESSING;
1406
1294
        group_id = self->priv->group_id;
1407
1295
 
1408
1296
        brasero_burn_session_get_input_type (session, &plugin_input);
1416
1304
 
1417
1305
                link = iter->data;
1418
1306
 
1419
 
                if (last_caps->type.type == BRASERO_TRACK_TYPE_DISC && !iter->next) {
1420
 
                        /* if we are recording then the last caps is considered
1421
 
                         * to be the one before the DISC caps since the latter
1422
 
                         * can't have processing plugin */
1423
 
                        position |= BRASERO_PLUGIN_RUN_LAST;
1424
 
                }
1425
 
 
1426
1307
                /* determine the plugin output */
1427
1308
                if (iter->next) {
1428
1309
                        BraseroCapsLink *next_link;
1508
1389
                BRASERO_BURN_LOG_TYPE (&plugin_input, "input");
1509
1390
                BRASERO_BURN_LOG_TYPE (&plugin_output, "output");
1510
1391
 
1511
 
                position = BRASERO_PLUGIN_RUN_NEVER;
 
1392
                position = BRASERO_PLUGIN_RUN_BEFORE_TARGET;
1512
1393
 
1513
1394
                /* the output of the plugin will become the input of the next */
1514
1395
                memcpy (&plugin_input, &plugin_output, sizeof (BraseroTrackType));
1515
1396
        }
1516
1397
        g_slist_free (list);
1517
1398
 
1518
 
        if (last_caps->type.type != BRASERO_TRACK_TYPE_DISC) {
1519
 
                GSList *result;
 
1399
        /* add the post processing plugins */
 
1400
        list = brasero_caps_add_processing_plugins_to_task (session,
 
1401
                                                            NULL,
 
1402
                                                            last_caps,
 
1403
                                                            &output,
 
1404
                                                            BRASERO_PLUGIN_RUN_AFTER_TARGET);
 
1405
        retval = g_slist_concat (retval, list);
1520
1406
 
1521
 
                /* imaging to a file so we never run the processing plugin on
1522
 
                 * the fly in this case so as to allow the last plugin to output
1523
 
                 * correctly to a file */
1524
 
                /* NOTE: if it's not a disc we didn't modified the output
1525
 
                 * subtype */
1526
 
                result = brasero_caps_add_processing_plugins_to_task (session,
1527
 
                                                                      NULL,
1528
 
                                                                      last_caps,
1529
 
                                                                      &output,
1530
 
                                                                      BRASERO_PLUGIN_RUN_LAST);
1531
 
                retval = g_slist_concat (retval, result);
1532
 
        }
1533
 
        else if (blanking) {
 
1407
        if (last_caps->type.type == BRASERO_TRACK_TYPE_DISC && blanking) {
1534
1408
                retval = g_slist_insert_before (retval,
1535
1409
                                                g_slist_last (retval),
1536
1410
                                                blanking);
2217
2091
        /* filter as we are only interested in these */
2218
2092
        required_media &= BRASERO_MEDIUM_WRITABLE|
2219
2093
                          BRASERO_MEDIUM_CD|
2220
 
                          BRASERO_MEDIUM_DVD|
2221
 
                          BRASERO_MEDIUM_DVD_DL;
 
2094
                          BRASERO_MEDIUM_DVD;
2222
2095
 
2223
2096
        return required_media;
2224
2097
}
2225
2098
 
 
2099
BraseroImageFormat
 
2100
brasero_burn_caps_get_default_output_format (BraseroBurnCaps *self,
 
2101
                                             BraseroBurnSession *session)
 
2102
{
 
2103
        BraseroTrackType source;
 
2104
        BraseroTrackType output;
 
2105
        BraseroBurnResult result;
 
2106
 
 
2107
        if (!brasero_burn_session_is_dest_file (session))
 
2108
                return BRASERO_IMAGE_FORMAT_NONE;
 
2109
 
 
2110
        brasero_burn_session_get_input_type (session, &source);
 
2111
        if (source.type == BRASERO_TRACK_TYPE_NONE)
 
2112
                return BRASERO_IMAGE_FORMAT_NONE;
 
2113
 
 
2114
        if (source.type == BRASERO_TRACK_TYPE_IMAGE)
 
2115
                return source.subtype.img_format;
 
2116
 
 
2117
        output.type = BRASERO_TRACK_TYPE_IMAGE;
 
2118
        output.subtype.img_format = BRASERO_IMAGE_FORMAT_NONE;
 
2119
 
 
2120
        if (source.type == BRASERO_TRACK_TYPE_AUDIO) {
 
2121
                /* If that's AUDIO only without VIDEO then return */
 
2122
                if (!(source.subtype.audio_format & (BRASERO_VIDEO_FORMAT_UNDEFINED|BRASERO_VIDEO_FORMAT_VCD|BRASERO_VIDEO_FORMAT_VIDEO_DVD)))
 
2123
                        return BRASERO_IMAGE_FORMAT_NONE;
 
2124
 
 
2125
                /* Otherwise try all possible image types */
 
2126
                output.subtype.img_format = BRASERO_IMAGE_FORMAT_CDRDAO;
 
2127
                for (; output.subtype.img_format != BRASERO_IMAGE_FORMAT_NONE;
 
2128
                       output.subtype.img_format >>= 1) {
 
2129
                
 
2130
                        result = brasero_burn_caps_is_output_supported (self,
 
2131
                                                                        session,
 
2132
                                                                        &output);
 
2133
                        if (result == BRASERO_BURN_OK)
 
2134
                                return output.subtype.img_format;
 
2135
                }
 
2136
 
 
2137
                return BRASERO_IMAGE_FORMAT_NONE;
 
2138
        }
 
2139
 
 
2140
        if (source.type == BRASERO_TRACK_TYPE_DATA
 
2141
        || (source.type == BRASERO_TRACK_TYPE_DISC
 
2142
        && (source.subtype.media & BRASERO_MEDIUM_DVD))) {
 
2143
                output.subtype.img_format = BRASERO_IMAGE_FORMAT_BIN;
 
2144
                result = brasero_burn_caps_is_output_supported (self,
 
2145
                                                                session,
 
2146
                                                                &output);
 
2147
                if (result != BRASERO_BURN_OK)
 
2148
                        return BRASERO_IMAGE_FORMAT_NONE;
 
2149
 
 
2150
                return BRASERO_IMAGE_FORMAT_BIN;
 
2151
        }
 
2152
 
 
2153
        /* for the input which are CDs there are lots of possible formats */
 
2154
        output.subtype.img_format = BRASERO_IMAGE_FORMAT_CDRDAO;
 
2155
        for (; output.subtype.img_format != BRASERO_IMAGE_FORMAT_NONE;
 
2156
               output.subtype.img_format >>= 1) {
 
2157
        
 
2158
                result = brasero_burn_caps_is_output_supported (self,
 
2159
                                                                session,
 
2160
                                                                &output);
 
2161
                if (result == BRASERO_BURN_OK)
 
2162
                        return output.subtype.img_format;
 
2163
        }
 
2164
 
 
2165
        return BRASERO_IMAGE_FORMAT_NONE;
 
2166
}
 
2167
 
 
2168
static BraseroCapsLink *
 
2169
brasero_caps_find_link_for_input (BraseroCaps *caps,
 
2170
                                  BraseroCaps *input)
 
2171
{
 
2172
        GSList *links;
 
2173
 
 
2174
        for (links = caps->links; links; links = links->next) {
 
2175
                BraseroCapsLink *link;
 
2176
 
 
2177
                link = links->data;
 
2178
                if (link->caps == input)
 
2179
                        return link;
 
2180
        }
 
2181
 
 
2182
        return NULL;
 
2183
}
 
2184
 
 
2185
static gboolean
 
2186
brasero_caps_has_active_input (BraseroCaps *caps,
 
2187
                               BraseroCaps *input)
 
2188
{
 
2189
        GSList *links;
 
2190
 
 
2191
        for (links = caps->links; links; links = links->next) {
 
2192
                BraseroCapsLink *link;
 
2193
 
 
2194
                link = links->data;
 
2195
                if (link->caps != input)
 
2196
                        continue;
 
2197
 
 
2198
                if (brasero_caps_link_active (link))
 
2199
                        return TRUE;
 
2200
        }
 
2201
 
 
2202
        return FALSE;
 
2203
}
 
2204
 
 
2205
static gboolean
 
2206
brasero_burn_caps_is_input (BraseroBurnCaps *self,
 
2207
                            BraseroCaps *input)
 
2208
{
 
2209
        GSList *iter;
 
2210
 
 
2211
        for (iter = self->priv->caps_list; iter; iter = iter->next) {
 
2212
                BraseroCaps *tmp;
 
2213
 
 
2214
                tmp = iter->data;
 
2215
                if (tmp == input)
 
2216
                        continue;
 
2217
 
 
2218
                if (brasero_caps_has_active_input (tmp, input))
 
2219
                        return TRUE;
 
2220
        }
 
2221
 
 
2222
        return FALSE;
 
2223
}
 
2224
 
2226
2225
static BraseroPluginIOFlag
2227
2226
brasero_caps_get_flags (BraseroCaps *caps,
2228
2227
                        BraseroBurnFlag session_flags,
2422
2421
{
2423
2422
        BraseroBurnResult result;
2424
2423
 
 
2424
        /* See if medium is supported out of the box */
2425
2425
        result = brasero_caps_get_flags_for_disc (session_flags,
2426
2426
                                                  media,
2427
2427
                                                  input,
2428
2428
                                                  supported_flags,
2429
2429
                                                  compulsory_flags);
2430
2430
 
2431
 
        if (result != BRASERO_BURN_OK) {
 
2431
        /* see if we can add BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE */
 
2432
        if ((media & (BRASERO_MEDIUM_HAS_AUDIO|BRASERO_MEDIUM_HAS_DATA))
 
2433
        && !(session_flags & (BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND))
 
2434
        &&  brasero_burn_caps_can_blank_real (self, media, session_flags) == BRASERO_BURN_OK)
 
2435
                (*supported_flags) |= BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE;
 
2436
        else if (session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)
 
2437
                return BRASERO_BURN_NOT_SUPPORTED;
 
2438
 
 
2439
        if (((*supported_flags) & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)) {
 
2440
                BraseroBurnFlag blank_compulsory = BRASERO_BURN_FLAG_NONE;
 
2441
                BraseroBurnFlag blank_supported = BRASERO_BURN_FLAG_NONE;
 
2442
 
 
2443
                /* If BLANK flag is supported then MERGE/APPEND can't be compulsory */
 
2444
                (*compulsory_flags) &= ~(BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND);
 
2445
 
2432
2446
                /* we reached this point in two cases:
2433
2447
                 * - if the disc cannot be handled
2434
2448
                 * - if some flags are not handled
2440
2454
                 * then write on its own. Basically that works only with
2441
2455
                 * overwrite formatted discs, DVD+RW, ...) */
2442
2456
 
2443
 
                if (!(media & (BRASERO_MEDIUM_HAS_AUDIO|
2444
 
                               BRASERO_MEDIUM_HAS_DATA|
2445
 
                               BRASERO_MEDIUM_UNFORMATTED))) {
2446
 
                        /* media must have data/audio */
2447
 
                        return BRASERO_BURN_NOT_SUPPORTED;
2448
 
                }
2449
 
 
2450
 
                if (session_flags & (BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND)) {
2451
 
                        /* There is nothing we can do here */
2452
 
                        return BRASERO_BURN_NOT_SUPPORTED;
2453
 
                }
2454
 
 
2455
 
                if (brasero_burn_caps_can_blank_real (self, media, session_flags) != BRASERO_BURN_OK)
2456
 
                        return BRASERO_BURN_NOT_SUPPORTED;
 
2457
                /* What's above is not entirely true. In fact we always need to
 
2458
                 * check even if we first succeeded. There are some cases like
 
2459
                 * CDRW where it's useful.
 
2460
                 * Ex: a CDRW with data appendable can be either appended (then
 
2461
                 * no DAO possible) or blanked and written (DAO possible). */
2457
2462
 
2458
2463
                (*supported_flags) |= BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE;
2459
 
                (*compulsory_flags) |= BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE;
 
2464
 
 
2465
                /* result here is the result of the first operation, so if it
 
2466
                 * failed, BLANK before becomes compulsory. */
 
2467
                if (result != BRASERO_BURN_OK)
 
2468
                        (*compulsory_flags) |= BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE;
2460
2469
 
2461
2470
                /* pretends it is blank and formatted to see if it would work.
2462
2471
                 * If it works then that means that the BLANK_BEFORE_WRITE flag
2472
2481
                                                          input,
2473
2482
                                                          supported_flags,
2474
2483
                                                          compulsory_flags);
2475
 
                if (result != BRASERO_BURN_OK)
 
2484
 
 
2485
                /* if both attempts failed, drop it */
 
2486
                if (result != BRASERO_BURN_OK
 
2487
                && (((*compulsory_flags) & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)))
2476
2488
                        return result;
2477
 
        }
2478
 
        else {
2479
 
                /* see if we can add BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE */
2480
 
                if ((media & (BRASERO_MEDIUM_HAS_AUDIO|BRASERO_MEDIUM_HAS_DATA))
2481
 
                && !(session_flags & (BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND))
2482
 
                &&  brasero_burn_caps_can_blank_real (self, media, session_flags) == BRASERO_BURN_OK)
2483
 
                        (*supported_flags) |= BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE;
2484
 
                else if (session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)
2485
 
                        return BRASERO_BURN_NOT_SUPPORTED;
2486
 
        }
2487
 
 
2488
 
        if (session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE) {
2489
 
                /* make sure we remove MERGE/APPEND from supported and
2490
 
                 * compulsory since that's not possible anymore */
2491
 
                (*supported_flags) &= ~(BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND);
2492
 
                (*compulsory_flags) &= ~(BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND);
2493
 
        }
2494
 
 
2495
 
        if ((*supported_flags) & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE) {
2496
 
                BraseroBurnFlag blank_compulsory = BRASERO_BURN_FLAG_NONE;
2497
 
                BraseroBurnFlag blank_supported = BRASERO_BURN_FLAG_NONE;
2498
2489
 
2499
2490
                /* need to add blanking flags */
2500
2491
                brasero_burn_caps_get_blanking_flags_real (self,
2504
2495
                                                           &blank_compulsory);
2505
2496
                (*supported_flags) |= blank_supported;
2506
2497
                (*compulsory_flags) |= blank_compulsory;
 
2498
        }
 
2499
        else if (result != BRASERO_BURN_OK)
 
2500
                return result;
2507
2501
 
2508
 
                /* If BLANK flag is supported then MERGE/APPEND can't be compulsory */
 
2502
        if (session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE) {
 
2503
                /* make sure we remove MERGE/APPEND from supported and
 
2504
                 * compulsory since that's not possible anymore */
 
2505
                (*supported_flags) &= ~(BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND);
2509
2506
                (*compulsory_flags) &= ~(BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND);
2510
2507
        }
2511
2508
 
2635
2632
        /* FIXME: what's the meaning of NOGRACE when outputting ? */
2636
2633
        BraseroBurnFlag compulsory_flags = BRASERO_BURN_FLAG_NONE;
2637
2634
        BraseroBurnFlag supported_flags = BRASERO_BURN_FLAG_DONT_OVERWRITE|
2638
 
                                          BRASERO_BURN_FLAG_DONT_CLEAN_OUTPUT|
2639
2635
                                          BRASERO_BURN_FLAG_CHECK_SIZE|
2640
2636
                                          BRASERO_BURN_FLAG_NOGRACE;
2641
2637
 
2653
2649
                if (input.type == BRASERO_TRACK_TYPE_DISC)
2654
2650
                        supported_flags |= BRASERO_BURN_FLAG_EJECT;
2655
2651
 
2656
 
                /* FIXME: do the flag have the same meaning now with session
2657
 
                 * making a clear distinction between tmp files and output */
2658
 
                compulsory_flags |= BRASERO_BURN_FLAG_DONT_CLEAN_OUTPUT;
2659
 
 
2660
2652
                *supported = supported_flags;
2661
2653
                *compulsory = compulsory_flags;
2662
2654
 
2765
2757
                        return ((gint32) BRASERO_MEDIUM_TYPE (caps_a->type.subtype.media) -
2766
2758
                                (gint32) BRASERO_MEDIUM_TYPE (caps_b->type.subtype.media));
2767
2759
 
2768
 
                if ((caps_a->type.subtype.media & (BRASERO_MEDIUM_DVD|BRASERO_MEDIUM_DVD_DL))
 
2760
                if ((caps_a->type.subtype.media & BRASERO_MEDIUM_DVD)
2769
2761
                &&  BRASERO_MEDIUM_SUBTYPE (caps_a->type.subtype.media) !=
2770
2762
                    BRASERO_MEDIUM_SUBTYPE (caps_b->type.subtype.media))                        
2771
2763
                        return ((gint32) BRASERO_MEDIUM_SUBTYPE (caps_a->type.subtype.media) -
3295
3287
 
3296
3288
        for (iter = default_caps->priv->caps_list; iter; iter = iter->next) {
3297
3289
                caps = iter->data;
 
3290
 
 
3291
                if (caps->type.type != BRASERO_TRACK_TYPE_DISC)
 
3292
                        continue;
 
3293
 
3298
3294
                if (caps->type.subtype.media == media) {
3299
3295
                        BRASERO_BURN_LOG_WITH_TYPE (&caps->type,
3300
3296
                                                    caps->flags,
3316
3312
        return g_slist_prepend (retval, caps);
3317
3313
}
3318
3314
 
3319
 
static GSList *
3320
 
brasero_caps_disc_new_status (GSList *retval,
3321
 
                              BraseroMedia media,
3322
 
                              BraseroMedia type)
3323
 
{
3324
 
        if ((type & BRASERO_MEDIUM_BLANK)
3325
 
        && !(media & BRASERO_MEDIUM_ROM)) {
3326
 
                /* If media is blank there is no other possible property.
3327
 
                 * BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_RESTRICTED)
3328
 
                 * condition is checked but in fact it's never valid since
3329
 
                 * such a medium cannot exist if it hasn't been formatted before
3330
 
                 * which is in contradiction with the fact is unformatted. */
3331
 
                if (BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_PLUS)
3332
 
                ||  BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_RESTRICTED)
3333
 
                ||  BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW)
3334
 
                ||  BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_PLUS_DL)) {
3335
 
                        /* This is only for above types */
3336
 
                        retval = brasero_caps_disc_lookup_or_create (retval,
3337
 
                                                                     media|
3338
 
                                                                     BRASERO_MEDIUM_BLANK);
3339
 
                        if (type & BRASERO_MEDIUM_UNFORMATTED)
3340
 
                                retval = brasero_caps_disc_lookup_or_create (retval,
3341
 
                                                                             media|
3342
 
                                                                             BRASERO_MEDIUM_BLANK|
3343
 
                                                                             BRASERO_MEDIUM_UNFORMATTED);
3344
 
                }
3345
 
                else
3346
 
                        retval = brasero_caps_disc_lookup_or_create (retval,
3347
 
                                                                     media|
3348
 
                                                                     BRASERO_MEDIUM_BLANK);
3349
 
        }
3350
 
 
3351
 
        if (type & BRASERO_MEDIUM_CLOSED) {
3352
 
                if (media & (BRASERO_MEDIUM_DVD|BRASERO_MEDIUM_DVD_DL))
3353
 
                        retval = brasero_caps_disc_lookup_or_create (retval,
3354
 
                                                                     media|
3355
 
                                                                     BRASERO_MEDIUM_CLOSED|
3356
 
                                                                     (type & BRASERO_MEDIUM_HAS_DATA)|
3357
 
                                                                     (type & BRASERO_MEDIUM_PROTECTED));
3358
 
                else {
3359
 
                        if (type & BRASERO_MEDIUM_HAS_AUDIO)
3360
 
                                retval = brasero_caps_disc_lookup_or_create (retval,
3361
 
                                                                             media|
3362
 
                                                                             BRASERO_MEDIUM_CLOSED|
3363
 
                                                                             BRASERO_MEDIUM_HAS_AUDIO);
3364
 
                        if (type & BRASERO_MEDIUM_HAS_DATA)
3365
 
                                retval = brasero_caps_disc_lookup_or_create (retval,
3366
 
                                                                             media|
3367
 
                                                                             BRASERO_MEDIUM_CLOSED|
3368
 
                                                                             BRASERO_MEDIUM_HAS_DATA);
3369
 
                        if (BRASERO_MEDIUM_IS (type, BRASERO_MEDIUM_HAS_AUDIO|BRASERO_MEDIUM_HAS_DATA))
3370
 
                                retval = brasero_caps_disc_lookup_or_create (retval,
3371
 
                                                                             media|
3372
 
                                                                             BRASERO_MEDIUM_CLOSED|
3373
 
                                                                             BRASERO_MEDIUM_HAS_DATA|
3374
 
                                                                             BRASERO_MEDIUM_HAS_AUDIO);
3375
 
                }
3376
 
        }
3377
 
 
3378
 
        if ((type & BRASERO_MEDIUM_APPENDABLE)
3379
 
        && !(media & BRASERO_MEDIUM_ROM)
3380
 
        && !(media & BRASERO_MEDIUM_RESTRICTED)
3381
 
        && ! BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVD|BRASERO_MEDIUM_PLUS|BRASERO_MEDIUM_REWRITABLE)
3382
 
        && ! BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVD_DL|BRASERO_MEDIUM_PLUS|BRASERO_MEDIUM_REWRITABLE)) {
3383
 
                if (media & BRASERO_MEDIUM_DVD)
3384
 
                        retval = brasero_caps_disc_lookup_or_create (retval,
3385
 
                                                                     media|
3386
 
                                                                     BRASERO_MEDIUM_APPENDABLE|
3387
 
                                                                     BRASERO_MEDIUM_HAS_DATA);
3388
 
                else {
3389
 
                        if (type & BRASERO_MEDIUM_HAS_AUDIO)
3390
 
                                retval = brasero_caps_disc_lookup_or_create (retval,
3391
 
                                                                             media|
3392
 
                                                                             BRASERO_MEDIUM_APPENDABLE|
3393
 
                                                                             BRASERO_MEDIUM_HAS_AUDIO);
3394
 
                        if (type & BRASERO_MEDIUM_HAS_DATA)
3395
 
                                retval = brasero_caps_disc_lookup_or_create (retval,
3396
 
                                                                             media|
3397
 
                                                                             BRASERO_MEDIUM_APPENDABLE|
3398
 
                                                                             BRASERO_MEDIUM_HAS_DATA);
3399
 
                        if (BRASERO_MEDIUM_IS (type, BRASERO_MEDIUM_HAS_AUDIO|BRASERO_MEDIUM_HAS_DATA))
3400
 
                                retval = brasero_caps_disc_lookup_or_create (retval,
3401
 
                                                                             media|
3402
 
                                                                             BRASERO_MEDIUM_HAS_DATA|
3403
 
                                                                             BRASERO_MEDIUM_APPENDABLE|
3404
 
                                                                             BRASERO_MEDIUM_HAS_AUDIO);
3405
 
                }
3406
 
        }
3407
 
 
3408
 
        return retval;
3409
 
}
3410
 
 
3411
 
static GSList *
3412
 
brasero_caps_disc_new_attribute (GSList *retval,
3413
 
                                 BraseroMedia media,
3414
 
                                 BraseroMedia type)
3415
 
{
3416
 
        if (type & BRASERO_MEDIUM_REWRITABLE) {
3417
 
                /* Always true for + media there are both single and dual layer */
3418
 
                if (media & BRASERO_MEDIUM_PLUS)
3419
 
                        retval = brasero_caps_disc_new_status (retval,
3420
 
                                                               media|BRASERO_MEDIUM_REWRITABLE,
3421
 
                                                               type);
3422
 
                /* There is no dual layer DVD-RW */
3423
 
                else if (!(media & BRASERO_MEDIUM_DVD_DL))
3424
 
                        retval = brasero_caps_disc_new_status (retval,
3425
 
                                                               media|BRASERO_MEDIUM_REWRITABLE,
3426
 
                                                               type);
3427
 
        }
3428
 
 
3429
 
        if ((type & BRASERO_MEDIUM_WRITABLE)
3430
 
        && !(media & BRASERO_MEDIUM_RESTRICTED))
3431
 
                retval = brasero_caps_disc_new_status (retval,
3432
 
                                                       media|BRASERO_MEDIUM_WRITABLE,
3433
 
                                                       type);
3434
 
 
3435
 
        if (type & BRASERO_MEDIUM_ROM)
3436
 
                retval = brasero_caps_disc_new_status (retval,
3437
 
                                                       media|BRASERO_MEDIUM_ROM,
3438
 
                                                       type);
3439
 
 
3440
 
        return retval;
3441
 
}
3442
 
 
3443
 
static GSList *
3444
 
brasero_caps_disc_new_subtype (GSList *retval,
3445
 
                               BraseroMedia media,
3446
 
                               BraseroMedia type)
3447
 
{
3448
 
        if (media & BRASERO_MEDIUM_BD) {
3449
 
                if (type & BRASERO_MEDIUM_RANDOM)
3450
 
                        retval = brasero_caps_disc_new_attribute (retval,
3451
 
                                                                  media|BRASERO_MEDIUM_RANDOM,
3452
 
                                                                  type);
3453
 
                if (type & BRASERO_MEDIUM_SRM)
3454
 
                        retval = brasero_caps_disc_new_attribute (retval,
3455
 
                                                                  media|BRASERO_MEDIUM_SRM,
3456
 
                                                                  type);
3457
 
                if (type & BRASERO_MEDIUM_POW)
3458
 
                        retval = brasero_caps_disc_new_attribute (retval,
3459
 
                                                                  media|BRASERO_MEDIUM_POW,
3460
 
                                                                  type);
3461
 
        }
3462
 
 
3463
 
        if (media & BRASERO_MEDIUM_DVD) {
3464
 
                if (type & BRASERO_MEDIUM_SEQUENTIAL)
3465
 
                        retval = brasero_caps_disc_new_attribute (retval,
3466
 
                                                                  media|BRASERO_MEDIUM_SEQUENTIAL,
3467
 
                                                                  type);
3468
 
 
3469
 
                if (type & BRASERO_MEDIUM_RESTRICTED)
3470
 
                        retval = brasero_caps_disc_new_attribute (retval,
3471
 
                                                                  media|BRASERO_MEDIUM_RESTRICTED,
3472
 
                                                                  type);
3473
 
 
3474
 
                if (type & BRASERO_MEDIUM_PLUS)
3475
 
                        retval = brasero_caps_disc_new_attribute (retval,
3476
 
                                                                  media|BRASERO_MEDIUM_PLUS,
3477
 
                                                                  type);
3478
 
                if (type & BRASERO_MEDIUM_ROM)
3479
 
                        retval = brasero_caps_disc_new_status (retval,
3480
 
                                                               media|BRASERO_MEDIUM_ROM,
3481
 
                                                               type);
3482
 
        }
3483
 
 
3484
 
        if (media & BRASERO_MEDIUM_DVD_DL) {
3485
 
                /* There is no such thing as DVD-RW DL */
3486
 
                if ((type & BRASERO_MEDIUM_SEQUENTIAL) && !(type & BRASERO_MEDIUM_REWRITABLE))
3487
 
                        retval = brasero_caps_disc_new_attribute (retval,
3488
 
                                                                  media|BRASERO_MEDIUM_SEQUENTIAL,
3489
 
                                                                  type);
3490
 
 
3491
 
                if ((type & BRASERO_MEDIUM_JUMP) && !(type & BRASERO_MEDIUM_REWRITABLE))
3492
 
                        retval = brasero_caps_disc_new_attribute (retval,
3493
 
                                                                  media|BRASERO_MEDIUM_JUMP,
3494
 
                                                                  type);
3495
 
 
3496
 
                if (type & BRASERO_MEDIUM_PLUS)
3497
 
                        retval = brasero_caps_disc_new_attribute (retval,
3498
 
                                                                  media|BRASERO_MEDIUM_PLUS,
3499
 
                                                                  type);
3500
 
 
3501
 
                if (type & BRASERO_MEDIUM_ROM)
3502
 
                        retval = brasero_caps_disc_new_status (retval,
3503
 
                                                               media|BRASERO_MEDIUM_ROM,
3504
 
                                                               type);
3505
 
        }
3506
 
 
3507
 
        return retval;
3508
 
}
3509
 
 
3510
3315
GSList *
3511
3316
brasero_caps_disc_new (BraseroMedia type)
3512
3317
{
3513
3318
        GSList *retval = NULL;
3514
 
 
3515
 
        if (type & BRASERO_MEDIUM_FILE)
3516
 
                retval = brasero_caps_disc_lookup_or_create (retval, BRASERO_MEDIUM_FILE);                                             
3517
 
 
3518
 
        if (type & BRASERO_MEDIUM_CD)
3519
 
                retval = brasero_caps_disc_new_attribute (retval,
3520
 
                                                          BRASERO_MEDIUM_CD,
3521
 
                                                          type);
3522
 
 
3523
 
        if (type & BRASERO_MEDIUM_DVD)
3524
 
                retval = brasero_caps_disc_new_subtype (retval,
3525
 
                                                        BRASERO_MEDIUM_DVD,
3526
 
                                                        type);
3527
 
 
3528
 
        if (type & BRASERO_MEDIUM_DVD_DL)
3529
 
                retval = brasero_caps_disc_new_subtype (retval,
3530
 
                                                        BRASERO_MEDIUM_DVD_DL,
3531
 
                                                        type);
3532
 
 
3533
 
        if (type & BRASERO_MEDIUM_RAM)
3534
 
                retval = brasero_caps_disc_new_attribute (retval,
3535
 
                                                          BRASERO_MEDIUM_RAM,
3536
 
                                                          type);
3537
 
 
3538
 
        if (type & BRASERO_MEDIUM_BD)
3539
 
                retval = brasero_caps_disc_new_subtype (retval,
3540
 
                                                        BRASERO_MEDIUM_BD,
3541
 
                                                        type);
 
3319
        GSList *list;
 
3320
        GSList *iter;
 
3321
 
 
3322
        list = brasero_media_get_all_list (type);
 
3323
        for (iter = list; iter; iter = iter->next) {
 
3324
                BraseroMedia medium;
 
3325
 
 
3326
                medium = GPOINTER_TO_INT (iter->data);
 
3327
                retval = brasero_caps_disc_lookup_or_create (retval, medium);
 
3328
        }
 
3329
        g_slist_free (list);
3542
3330
 
3543
3331
        return retval;
3544
3332
}
3547
3335
 * these functions are to create links
3548
3336
 */
3549
3337
 
3550
 
static BraseroCapsLink *
3551
 
brasero_caps_find_link_for_input (BraseroCaps *caps,
3552
 
                                  BraseroCaps *input)
3553
 
{
3554
 
        GSList *links;
3555
 
 
3556
 
        for (links = caps->links; links; links = links->next) {
3557
 
                BraseroCapsLink *link;
3558
 
 
3559
 
                link = links->data;
3560
 
                if (link->caps == input)
3561
 
                        return link;
3562
 
        }
3563
 
 
3564
 
        return NULL;
3565
 
}
3566
 
 
3567
3338
static void
3568
3339
brasero_caps_create_links (BraseroCaps *output,
3569
3340
                           GSList *inputs,
3723
3494
        }
3724
3495
}
3725
3496
 
 
3497
/**
 
3498
 * This is to register a plugin group 
 
3499
 * This function is only define here (though it's implemented in burn-plugin.c).
 
3500
 */
 
3501
 
 
3502
void
 
3503
brasero_plugin_set_group (BraseroPlugin *plugin, gint group_id);
 
3504
 
 
3505
void
 
3506
brasero_plugin_register_group (BraseroPlugin *plugin,
 
3507
                               const gchar *name)
 
3508
{
 
3509
        guint retval;
 
3510
        BraseroBurnCaps *self;
 
3511
 
 
3512
        if (!name) {
 
3513
                brasero_plugin_set_group (plugin, 0);
 
3514
                return;
 
3515
        }
 
3516
 
 
3517
        self = brasero_burn_caps_get_default ();
 
3518
 
 
3519
        if (!self->priv->groups)
 
3520
                self->priv->groups = g_hash_table_new_full (g_str_hash,
 
3521
                                                            g_str_equal,
 
3522
                                                            g_free,
 
3523
                                                            NULL);
 
3524
 
 
3525
        retval = GPOINTER_TO_INT (g_hash_table_lookup (self->priv->groups, name));
 
3526
        if (retval) {
 
3527
                brasero_plugin_set_group (plugin, retval);
 
3528
                return;
 
3529
        }
 
3530
 
 
3531
        g_hash_table_insert (self->priv->groups,
 
3532
                             g_strdup (name),
 
3533
                             GINT_TO_POINTER (g_hash_table_size (self->priv->groups) + 1));
 
3534
 
 
3535
        /* see if we have a group id now */
 
3536
        if (!self->priv->group_id
 
3537
        &&   self->priv->group_str
 
3538
        &&  !strcmp (name, self->priv->group_str))
 
3539
                self->priv->group_id = g_hash_table_size (self->priv->groups) + 1;
 
3540
 
 
3541
        brasero_plugin_set_group (plugin, g_hash_table_size (self->priv->groups) + 1);
 
3542
}
 
3543
 
3726
3544
/** 
3727
 
 * This is to find out what are the capacities of a plugin 
 
3545
 * This is to find out what are the capacities of a plugin
 
3546
 * Declared in brasero-plugin-private.h
3728
3547
 */
3729
3548
 
3730
3549
BraseroBurnResult
3731
 
brasero_burn_caps_plugin_can_burn (BraseroBurnCaps *self,
3732
 
                                   BraseroPlugin *plugin)
 
3550
brasero_plugin_can_burn (BraseroPlugin *plugin)
3733
3551
{
3734
3552
        GSList *iter;
 
3553
        BraseroBurnCaps *self;
 
3554
 
 
3555
        self = brasero_burn_caps_get_default ();
3735
3556
 
3736
3557
        for (iter = self->priv->caps_list; iter; iter = iter->next) {
3737
3558
                BraseroCaps *caps;
3762
3583
}
3763
3584
 
3764
3585
BraseroBurnResult
3765
 
brasero_burn_caps_plugin_can_image (BraseroBurnCaps *self,
3766
 
                                    BraseroPlugin *plugin)
 
3586
brasero_plugin_can_image (BraseroPlugin *plugin)
3767
3587
{
3768
3588
        GSList *iter;
 
3589
        BraseroBurnCaps *self;
3769
3590
 
 
3591
        self = brasero_burn_caps_get_default ();
3770
3592
        for (iter = self->priv->caps_list; iter; iter = iter->next) {
3771
3593
                BraseroTrackDataType destination;
3772
3594
                BraseroCaps *caps;
3803
3625
}
3804
3626
 
3805
3627
BraseroBurnResult
3806
 
brasero_burn_caps_plugin_can_convert (BraseroBurnCaps *self,
3807
 
                                      BraseroPlugin *plugin)
 
3628
brasero_plugin_can_convert (BraseroPlugin *plugin)
3808
3629
{
3809
3630
        GSList *iter;
 
3631
        BraseroBurnCaps *self;
3810
3632
 
 
3633
        self = brasero_burn_caps_get_default ();
3811
3634
        for (iter = self->priv->caps_list; iter; iter = iter->next) {
3812
3635
                BraseroTrackDataType destination;
3813
3636
                BraseroCaps *caps;
3842
3665
        return BRASERO_BURN_NOT_SUPPORTED;
3843
3666
}
3844
3667
 
 
3668
/**
 
3669
 * Used to test what the library can do based on the medium type.
 
3670
 * Returns BRASERO_MEDIUM_WRITABLE if the disc can be written
 
3671
 * and / or BRASERO_MEDIUM_REWRITABLE if the disc can be erased.
 
3672
 * Declared in burn-media.h.
 
3673
 */
 
3674
 
 
3675
BraseroMedia
 
3676
brasero_media_capabilities (BraseroMedia media)
 
3677
{
 
3678
        GSList *iter;
 
3679
        GSList *links;
 
3680
        BraseroMedia retval;
 
3681
        BraseroBurnCaps *self;
 
3682
        BraseroCaps *caps = NULL;
 
3683
 
 
3684
        self = brasero_burn_caps_get_default ();
 
3685
 
 
3686
        retval = BRASERO_MEDIUM_NONE;
 
3687
        BRASERO_BURN_LOG_DISC_TYPE (media, "checking media caps for");
 
3688
 
 
3689
        /* we're only interested in DISC caps. There should be only one caps fitting */
 
3690
        for (iter = self->priv->caps_list; iter; iter = iter->next) {
 
3691
                caps = iter->data;
 
3692
                if (caps->type.type != BRASERO_TRACK_TYPE_DISC)
 
3693
                        continue;
 
3694
 
 
3695
                if ((media & caps->type.subtype.media) == media)
 
3696
                        break;
 
3697
 
 
3698
                caps = NULL;
 
3699
        }
 
3700
 
 
3701
        if (!caps)
 
3702
                return BRASERO_MEDIUM_NONE;
 
3703
 
 
3704
        /* check the links */
 
3705
        for (links = caps->links; links; links = links->next) {
 
3706
                GSList *plugins;
 
3707
                gboolean active;
 
3708
                BraseroCapsLink *link;
 
3709
 
 
3710
                link = links->data;
 
3711
 
 
3712
                /* this link must have at least one active plugin to be valid
 
3713
                 * plugins are not sorted but in this case we don't need them
 
3714
                 * to be. we just need one active if another is with a better
 
3715
                 * priority all the better. */
 
3716
                active = FALSE;
 
3717
                for (plugins = link->plugins; plugins; plugins = plugins->next) {
 
3718
                        BraseroPlugin *plugin;
 
3719
 
 
3720
                        plugin = plugins->data;
 
3721
                        if (brasero_plugin_get_active (plugin)) {
 
3722
                                /* this link is valid */
 
3723
                                active = TRUE;
 
3724
                                break;
 
3725
                        }
 
3726
                }
 
3727
 
 
3728
                if (!active)
 
3729
                        continue;
 
3730
 
 
3731
                if (!link->caps) {
 
3732
                        /* means that it can be blanked */
 
3733
                        retval |= BRASERO_MEDIUM_REWRITABLE;
 
3734
                        continue;
 
3735
                }
 
3736
 
 
3737
                /* means it can be written. NOTE: if this disc has already some
 
3738
                 * data on it, it even means it can be appended */
 
3739
                retval |= BRASERO_MEDIUM_WRITABLE;
 
3740
        }
 
3741
 
 
3742
        return retval;
 
3743
}
 
3744
 
 
3745
/**
 
3746
 * This function is declared in burn-basics.h
 
3747
 * It can be used to determine whether or not brasero can do any checksuming.
 
3748
 */
 
3749
 
3845
3750
gboolean
3846
 
brasero_burn_caps_can_checksum (BraseroBurnCaps *self)
 
3751
brasero_burn_library_can_checksum (void)
3847
3752
{
3848
3753
        GSList *iter;
 
3754
        BraseroBurnCaps *self;
 
3755
 
 
3756
        self = brasero_burn_caps_get_default ();
3849
3757
 
3850
3758
        if (self->priv->tests == NULL)
3851
3759
                return FALSE;
3866
3774
 
3867
3775
        return FALSE;
3868
3776
}
 
3777
 
 
3778
/**
 
3779
 * This is declared in burn-basics.c. It's private stuff that needs to be
 
3780
 * defined in this file. For debugging use only.
 
3781
 */
 
3782
 
 
3783
void
 
3784
brasero_caps_list_dump (void)
 
3785
{
 
3786
        GSList *iter;
 
3787
        BraseroBurnCaps *self;
 
3788
 
 
3789
        self = brasero_burn_caps_get_default ();
 
3790
        for (iter = self->priv->caps_list; iter; iter = iter->next) {
 
3791
                BraseroCaps *caps;
 
3792
 
 
3793
                caps = iter->data;
 
3794
                BRASERO_BURN_LOG_WITH_TYPE (&caps->type,
 
3795
                                            caps->flags,
 
3796
                                            "Created %i links pointing to",
 
3797
                                            g_slist_length (caps->links));
 
3798
        }
 
3799
}
 
3800
 
 
3801
 
 
3802
/**
 
3803
 * Declared in burn-track.h
 
3804
 * This is to determine whether of not a track type is supported
 
3805
 */
 
3806
 
 
3807
BraseroBurnResult
 
3808
brasero_track_type_is_supported (BraseroTrackType *type)
 
3809
{
 
3810
        GSList *iter;
 
3811
        BraseroBurnCaps *self;
 
3812
 
 
3813
        self = brasero_burn_caps_get_default ();
 
3814
 
 
3815
        for (iter = self->priv->caps_list; iter; iter = iter->next) {
 
3816
                BraseroCaps *caps;
 
3817
 
 
3818
                caps = iter->data;
 
3819
 
 
3820
                if (brasero_caps_is_compatible_type (caps, type)
 
3821
                &&  brasero_burn_caps_is_input (self, caps))
 
3822
                        return BRASERO_BURN_OK;
 
3823
        }
 
3824
 
 
3825
        return BRASERO_BURN_ERR;
 
3826
}
 
3827