~mfisch/brasero/update-to-3.8.0

« back to all changes in this revision

Viewing changes to libbrasero-burn/brasero-dest-selection.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2009-09-08 09:33:41 UTC
  • mfrom: (1.1.29 upstream)
  • Revision ID: james.westby@ubuntu.com-20090908093341-jh02q5ba0q8jyu9l
Tags: 2.27.92-0ubuntu1
* New upstream release (LP: #425998)
  - Some improvements when handling DVD-RW sequential
  - #593829 - Brasero gets stuck in a loop at "Getting size" while burning another session on a multi-session disk
  - #578466 - Unable to overburn
  - #593314 - Brasero is failing to burn from sftp
  - #593492 - Compilation must be ordered by file name
  - #587122 - Copying DVD - "Error while reading video DVD (no error)"
  - #592026 - brasero crashes when eject a medium
  - #592025 - brasero crashes on detecting src images on a NFS path when preparing burning an image
  - #591880 - Image checksumming causes internal error (LP: #354995)
  - #591397 - Brasero Main window pops up after exiting from Image Burning window.
  - Translation updates
  - lots of small fixes and improvements

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#include <gconf/gconf-client.h>
44
44
 
45
45
#include "burn-basics.h"
46
 
#include "brasero-track.h"
 
46
#include "burn-plugin-manager.h"
 
47
#include "brasero-medium-selection-priv.h"
 
48
#include "brasero-session-helper.h"
 
49
 
 
50
#include "brasero-dest-selection.h"
 
51
 
 
52
#include "brasero-drive.h"
47
53
#include "brasero-medium.h"
48
 
#include "brasero-session.h"
49
 
#include "brasero-drive.h"
50
54
#include "brasero-volume.h"
 
55
 
51
56
#include "brasero-burn-lib.h"
52
 
#include "burn-plugin-manager.h"
53
 
#include "brasero-medium-selection-priv.h"
54
 
 
55
 
#include "brasero-dest-selection.h"
 
57
#include "brasero-tags.h"
 
58
#include "brasero-track.h"
 
59
#include "brasero-session.h"
56
60
#include "brasero-session-cfg.h"
57
 
#include "brasero-session-helper.h"
58
61
 
59
62
typedef struct _BraseroDestSelectionPrivate BraseroDestSelectionPrivate;
60
63
struct _BraseroDestSelectionPrivate
223
226
        if (priv->locked_drive) {
224
227
                brasero_drive_unlock (priv->locked_drive);
225
228
                g_object_unref (priv->locked_drive);
 
229
                priv->locked_drive = NULL;
226
230
        }
227
231
}
228
232
 
234
238
}
235
239
 
236
240
static goffset
237
 
_get_medium_free_space (BraseroMedium *medium)
 
241
_get_medium_free_space (BraseroMedium *medium,
 
242
                        goffset session_blocks)
238
243
{
239
244
        BraseroMedia media;
240
245
        goffset blocks = 0;
243
248
        media = brasero_burn_library_get_media_capabilities (media);
244
249
 
245
250
        /* NOTE: we always try to blank a medium when we can */
246
 
        if (media & BRASERO_MEDIUM_REWRITABLE)
247
 
                brasero_medium_get_free_space (medium,
248
 
                                               NULL,
249
 
                                               &blocks);
250
 
        else {
251
 
                brasero_medium_get_free_space (medium,
252
 
                                               NULL,
253
 
                                               &blocks);
254
 
        }
 
251
        brasero_medium_get_free_space (medium,
 
252
                                       NULL,
 
253
                                       &blocks);
 
254
 
 
255
        if ((media & BRASERO_MEDIUM_REWRITABLE)
 
256
        && blocks < session_blocks)
 
257
                brasero_medium_get_capacity (medium,
 
258
                                             NULL,
 
259
                                             &blocks);
255
260
 
256
261
        return blocks;
257
262
}
316
321
choose_closest_size:
317
322
 
318
323
        brasero_burn_session_get_size (session, &session_blocks, NULL);
319
 
        medium_blocks = _get_medium_free_space (medium);
 
324
        medium_blocks = _get_medium_free_space (medium, session_blocks);
320
325
 
321
326
        if (medium_blocks - session_blocks <= 0)
322
327
                return TRUE;
323
328
 
324
 
        burner_blocks = _get_medium_free_space (brasero_drive_get_medium (burner));
 
329
        burner_blocks = _get_medium_free_space (brasero_drive_get_medium (burner), session_blocks);
325
330
        if (burner_blocks - session_blocks <= 0)
326
331
                brasero_burn_session_set_burner (session, brasero_medium_get_drive (medium));
327
332
        else if (burner_blocks - session_blocks > medium_blocks - session_blocks)
499
504
        if (brasero_medium_get_status (medium) & BRASERO_MEDIUM_FILE) {
500
505
                gchar *path;
501
506
 
 
507
                input = brasero_track_type_new ();
 
508
                brasero_burn_session_get_input_type (priv->session, input);
 
509
 
 
510
                /* There should be a special name for image in video context */
 
511
                if (brasero_track_type_get_has_stream (input)
 
512
                &&  BRASERO_STREAM_FORMAT_HAS_VIDEO (brasero_track_type_get_stream_format (input))) {
 
513
                        BraseroImageFormat format;
 
514
 
 
515
                        format = brasero_burn_session_get_output_format (priv->session);
 
516
                        if (format == BRASERO_IMAGE_FORMAT_CUE) {
 
517
                                g_free (medium_name);
 
518
                                if (brasero_burn_session_tag_lookup_int (priv->session, BRASERO_VCD_TYPE) == BRASERO_SVCD)
 
519
                                        medium_name = g_strdup (_("SVCD image"));
 
520
                                else
 
521
                                        medium_name = g_strdup (_("VCD image"));
 
522
                        }
 
523
                        else if (format == BRASERO_IMAGE_FORMAT_BIN) {
 
524
                                g_free (medium_name);
 
525
                                medium_name = g_strdup (_("Video DVD image"));
 
526
                        }
 
527
                }
 
528
                brasero_track_type_free (input);
 
529
 
502
530
                /* get the set path for the image file */
503
531
                path = brasero_dest_selection_get_output_path (BRASERO_DEST_SELECTION (selection));
504
532
                if (!path)
554
582
                                       &data_blocks,
555
583
                                       &session_bytes);
556
584
 
 
585
        /* Determine the size available for burning */
557
586
        if (flags & (BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND)) {
558
587
                brasero_medium_get_free_space (medium,
559
588
                                               &size_bytes,
567
596
                 * its free space would be 0. This is the best way to do it
568
597
                 * instead of checking for a CLOSED medium as it allows the 
569
598
                 * overwrite media to be appended or merged if need be. */
570
 
                if ((!blocks || blocks > data_blocks)
 
599
                if ((flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)
571
600
                && (brasero_burn_library_get_media_capabilities (media) & BRASERO_MEDIUM_REWRITABLE))
572
601
                        brasero_medium_get_capacity (medium,
573
602
                                                     &size_bytes,
599
628
 
600
629
        /* format the size */
601
630
        if (brasero_track_type_get_has_stream (input)
 
631
        && BRASERO_STREAM_FORMAT_HAS_VIDEO (brasero_track_type_get_stream_format (input))) {
 
632
                guint64 free_time;
 
633
 
 
634
                /* This is an embarassing problem: this is an approximation
 
635
                 * based on the fact that 2 hours = 4.3GiB */
 
636
                free_time = size_bytes - session_bytes;
 
637
                free_time = free_time * 72000LL / 47LL;
 
638
                size_string = brasero_units_get_time_string (free_time,
 
639
                                                             TRUE,
 
640
                                                             TRUE);
 
641
        }
 
642
        else if (brasero_track_type_get_has_stream (input)
602
643
        || (brasero_track_type_get_has_medium (input)
603
644
        && (brasero_track_type_get_medium_type (input) & BRASERO_MEDIUM_HAS_AUDIO)))
604
645
                size_string = brasero_units_get_time_string (BRASERO_BYTES_TO_DURATION (size_bytes - session_bytes),