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

« back to all changes in this revision

Viewing changes to src/plugins/cdrkit/burn-readom.c

  • Committer: Bazaar Package Importer
  • Author(s): Josselin Mouette, Pedro Fragoso, Luca Bruno, Josselin Mouette, Emilio Pozuelo Monfort
  • Date: 2009-06-24 18:59:46 UTC
  • mfrom: (1.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20090624185946-iyxkgf3gjptir5y3
Tags: 2.26.2-1
[ Pedro Fragoso ]
* Add myself to Maintainer field
  - Thanks Ondřej Surý
* New upstream version (Closes: #528945)
  - Split package into brasero, libbrasero-media0 and libbrasero-dev
  - Add Replaces to libbrasero-media0
  - Bump libgtk to 2.14.0
  - Remove libnotify Build-dep
  - Add Build-dep libnautilus-extension-dev (>= 2.22.2)
    and install it.
  - Add Build-dep to libsm-dev
  - Add Build-dep on intltool
* Install omf files to prevent crash on Help
* Move gstreamer0.10-plugins-bad to Suggests, and add
  dvdauthor and vcdimager
* Recommends gvfs (Closes: #491827)
* Pass --disable-scrollkeeper in DEB_CONFIGURE_EXTRA_FLAGS
* debian/patches/007-fix-gnome-doc-utils-path.patch:
  - Removed, not needed anymore
* debian/patches/008-fix-volume-identifier-crash.patch:
  - Removed, merged upstream
* debian/patches/011_nautilus_menu_move.patch:
 - Move CD/DVD Creator Menu to Acessories, taken from Ubuntu

[ Luca Bruno ]
* debian/control.in:
  - Add Build-Depend gtk-doc-tools 1.9.
* debian/patches/006-fix-libdvdcss.patch:
  - Removed as applied upstream.

[ Josselin Mouette ]
* New upstream release.
* Update build-dependencies.
* Move the translations and data to a new brasero-common package.
* Rewrite the descriptions.
* Add -dev depends to the development package.
* Remove inappropriate recommends in the library package.
* Let’s not forget dvd+rw-tools so that we can write DVDs too.
* Rework dependencies accordingly.
* Put the nautilus extension in brasero.
* Conflict against nautilus-cd-burner to avoid having two burning 
  extensions.
* Include clean-la.mk and gnome-version.mk; build-depend on 
  gnome-pkg-tools 0.7.
* Don’t run dh_makeshlibs on brasero and libbrasero-plugins.
* 011_nautilus_menu_move.patch: add NoDisplay=true, this icon is 
  duplicating existing functionality (brasero icon in sound&video 
  menu, and nautilus autorun).
* Update list of copyright holders.

[ Emilio Pozuelo Monfort ]
* debian/copyright: updated.

[ Josselin Mouette ]
* copyright: improve indentation, and point to versioned LGPL.
* 090_relibtoolize.patch: add a relibtoolization patch to avoid the 
  rpath crap.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 ***************************************************************************/
8
8
 
9
9
/*
10
 
 *  This program is free software; you can redistribute it and/or modify
 
10
 *  Brasero is free software; you can redistribute it and/or modify
11
11
 *  it under the terms of the GNU General Public License as published by
12
12
 *  the Free Software Foundation; either version 2 of the License, or
13
13
 *  (at your option) any later version.
14
14
 *
15
 
 *  This program is distributed in the hope that it will be useful,
 
15
 *  Brasero is distributed in the hope that it will be useful,
16
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
18
 *  GNU Library General Public License for more details.
19
19
 *
20
20
 *  You should have received a copy of the GNU General Public License
21
 
 *  along with this program; if not, write to the Free Software
22
 
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
21
 *  along with this program; if not, write to:
 
22
 *      The Free Software Foundation, Inc.,
 
23
 *      51 Franklin Street, Fifth Floor
 
24
 *      Boston, MA  02110-1301, USA.
23
25
 */
24
26
 
25
27
#ifdef HAVE_CONFIG_H
41
43
#include "burn-job.h"
42
44
#include "burn-plugin.h"
43
45
#include "burn-volume.h"
44
 
#include "burn-drive.h"
 
46
#include "brasero-drive.h"
45
47
 
46
48
BRASERO_PLUGIN_BOILERPLATE (BraseroReadom, brasero_readom, BRASERO_TYPE_PROCESS, BraseroProcess);
47
49
static GObjectClass *parent_class = NULL;
50
52
brasero_readom_read_stderr (BraseroProcess *process, const gchar *line)
51
53
{
52
54
        BraseroReadom *readom;
 
55
        gint dummy1;
 
56
        gint dummy2;
53
57
        gchar *pos;
54
58
 
55
59
        readom = BRASERO_READOM (process);
64
68
 
65
69
                brasero_job_get_output_type (BRASERO_JOB (readom), &output);
66
70
                if (output.subtype.img_format == BRASERO_IMAGE_FORMAT_BIN)
67
 
                        written = sector * 2048;
 
71
                        written = (gint64) ((gint64) sector * 2048ULL);
68
72
                else if (output.subtype.img_format == BRASERO_IMAGE_FORMAT_CLONE)
69
 
                        written = sector * 2448;
 
73
                        written = (gint64) ((gint64) sector * 2448ULL);
70
74
                else
71
 
                        written = sector * 2048;
 
75
                        written = (gint64) ((gint64) sector * 2048ULL);
72
76
 
73
77
                brasero_job_set_written_track (BRASERO_JOB (readom), written);
74
78
 
84
88
        else if (strstr (line, "Device not ready.")) {
85
89
                brasero_job_error (BRASERO_JOB (readom),
86
90
                                   g_error_new (BRASERO_BURN_ERROR,
87
 
                                                BRASERO_BURN_ERROR_BUSY_DRIVE,
88
 
                                                _("the drive is not ready")));
89
 
        }
90
 
        else if (strstr (line, "Device or resource busy")) {
91
 
                if (!strstr (line, "retrying in")) {
92
 
                        brasero_job_error (BRASERO_JOB (readom),
93
 
                                           g_error_new (BRASERO_BURN_ERROR,
94
 
                                                        BRASERO_BURN_ERROR_BUSY_DRIVE,
95
 
                                                        _("you don't seem to have the required permissions to access the drive")));
96
 
                }
 
91
                                                BRASERO_BURN_ERROR_DRIVE_BUSY,
 
92
                                                _("The drive is busy")));
97
93
        }
98
94
        else if (strstr (line, "Cannot open SCSI driver.")) {
99
95
                brasero_job_error (BRASERO_JOB (readom),
100
96
                                   g_error_new (BRASERO_BURN_ERROR,
101
 
                                                BRASERO_BURN_ERROR_BUSY_DRIVE,
102
 
                                                _("you don't seem to have the required permissions to access the drive")));             
 
97
                                                BRASERO_BURN_ERROR_PERMISSION,
 
98
                                                _("You do not have the required permissions to use this drive")));              
103
99
        }
104
100
        else if (strstr (line, "Cannot send SCSI cmd via ioctl")) {
105
101
                brasero_job_error (BRASERO_JOB (readom),
106
102
                                   g_error_new (BRASERO_BURN_ERROR,
107
 
                                                BRASERO_BURN_ERROR_SCSI_IOCTL,
108
 
                                                _("you don't seem to have the required permissions to access the drive")));
 
103
                                                BRASERO_BURN_ERROR_PERMISSION,
 
104
                                                _("You do not have the required permissions to use this drive")));
 
105
        }
 
106
        /* we scan for this error as in this case readcd returns success */
 
107
        else if (sscanf (line, "Input/output error. Error on sector %d not corrected. Total of %d error", &dummy1, &dummy2) == 2) {
 
108
                brasero_job_error (BRASERO_JOB (process),
 
109
                                   g_error_new (BRASERO_BURN_ERROR,
 
110
                                                BRASERO_BURN_ERROR_GENERAL,
 
111
                                                _("An internal error occured")));
 
112
        }
 
113
        else if (strstr (line, "No space left on device")) {
 
114
                brasero_job_error (BRASERO_JOB (readom),
 
115
                                   g_error_new (BRASERO_BURN_ERROR,
 
116
                                                BRASERO_BURN_ERROR_DISK_SPACE,
 
117
                                                _("There is no space left on the device")));
109
118
        }
110
119
 
111
120
        return BRASERO_BURN_OK;
118
127
{
119
128
        gint64 nb_blocks;
120
129
        BraseroTrack *track;
 
130
        GValue *value = NULL;
121
131
        BraseroTrackType output;
122
132
 
123
133
        brasero_job_get_current_track (BRASERO_JOB (readom), &track);
124
134
        brasero_job_get_output_type (BRASERO_JOB (readom), &output);
125
135
 
 
136
        brasero_track_tag_lookup (track,
 
137
                                  BRASERO_TRACK_MEDIUM_ADDRESS_START_TAG,
 
138
                                  &value);
 
139
        if (value) {
 
140
                guint64 start, end;
 
141
 
 
142
                /* we were given an address to start */
 
143
                start = g_value_get_uint64 (value);
 
144
 
 
145
                /* get the length now */
 
146
                value = NULL;
 
147
                brasero_track_tag_lookup (track,
 
148
                                          BRASERO_TRACK_MEDIUM_ADDRESS_END_TAG,
 
149
                                          &value);
 
150
 
 
151
                end = g_value_get_uint64 (value);
 
152
 
 
153
                BRASERO_JOB_LOG (readom,
 
154
                                 "reading from sector %lli to %lli",
 
155
                                 start,
 
156
                                 end);
 
157
                g_ptr_array_add (argv, g_strdup_printf ("-sectors=%lli-%lli",
 
158
                                                        start,
 
159
                                                        end));
 
160
        }
126
161
        /* 0 means all disc, -1 problem */
127
 
        if (brasero_track_get_drive_track (track) > 0) {
 
162
        else if (brasero_track_get_drive_track (track) > 0) {
128
163
                gint64 start;
129
164
                BraseroMedium *medium;
130
165
 
180
215
                         GError **error)
181
216
{
182
217
        gint64 blocks;
 
218
        GValue *value = NULL;
183
219
        BraseroTrackType output;
184
220
        BraseroTrack *track = NULL;
185
221
 
186
222
        brasero_job_get_current_track (BRASERO_JOB (self), &track);
187
223
        brasero_job_get_output_type (BRASERO_JOB (self), &output);
188
224
 
189
 
        if (brasero_track_get_drive_track (track) > 0) {
 
225
        brasero_track_tag_lookup (track,
 
226
                                  BRASERO_TRACK_MEDIUM_ADDRESS_START_TAG,
 
227
                                  &value);
 
228
        if (value) {
 
229
                guint64 start, end;
 
230
 
 
231
                /* we were given an address to start */
 
232
                start = g_value_get_uint64 (value);
 
233
 
 
234
                /* get the length now */
 
235
                value = NULL;
 
236
                brasero_track_tag_lookup (track,
 
237
                                          BRASERO_TRACK_MEDIUM_ADDRESS_END_TAG,
 
238
                                          &value);
 
239
 
 
240
                end = g_value_get_uint64 (value);
 
241
                blocks = end - start;
 
242
        }
 
243
        else if (brasero_track_get_drive_track (track) > 0) {
190
244
                BraseroMedium *medium;
191
245
 
192
246
                medium = brasero_track_get_medium_source (track);
212
266
        if (output.subtype.img_format == BRASERO_IMAGE_FORMAT_BIN) {
213
267
                brasero_job_set_output_size_for_current_track (BRASERO_JOB (self),
214
268
                                                               blocks,
215
 
                                                               blocks * 2048);
 
269
                                                               blocks * 2048ULL);
216
270
        }
217
271
        else if (output.subtype.img_format == BRASERO_IMAGE_FORMAT_CLONE) {
218
272
                brasero_job_set_output_size_for_current_track (BRASERO_JOB (self),
219
273
                                                               blocks,
220
 
                                                               blocks * 2448);
 
274
                                                               blocks * 2448ULL);
221
275
        }
222
276
        else
223
277
                return BRASERO_BURN_NOT_SUPPORTED;
270
324
                g_set_error (error,
271
325
                             BRASERO_BURN_ERROR,
272
326
                             BRASERO_BURN_ERROR_GENERAL,
273
 
                             _("raw images cannot be created with DVDs"));
 
327
                             _("An internal error occured"));
274
328
                return BRASERO_BURN_ERR;
275
329
        }
276
330
 
314
368
        else    /* unfortunately raw images can't be piped out */
315
369
                BRASERO_JOB_NOT_SUPPORTED (readom);
316
370
 
 
371
        brasero_job_set_use_average_rate (BRASERO_JOB (process), TRUE);
317
372
        return BRASERO_BURN_OK;
318
373
}
319
374
 
343
398
static BraseroBurnResult
344
399
brasero_readom_export_caps (BraseroPlugin *plugin, gchar **error)
345
400
{
346
 
        gchar *prog_name;
 
401
        BraseroBurnResult result;
347
402
        GSList *output;
348
403
        GSList *input;
349
404
 
350
405
        brasero_plugin_define (plugin,
351
406
                               "readom",
352
 
                               _("use readom to image CDs"),
 
407
                               _("Use readom to create disc images"),
353
408
                               "Philippe Rouquier",
354
409
                               1);
355
410
 
356
 
        /* First see if this plugin can be used, i.e. if readom is in
357
 
         * the path */
358
 
        prog_name = g_find_program_in_path ("readom");
359
 
        if (!prog_name) {
360
 
                *error = g_strdup (_("readom could not be found in the path"));
361
 
                return BRASERO_BURN_ERR;
362
 
        }
363
 
        g_free (prog_name);
 
411
        /* First see if this plugin can be used */
 
412
        result = brasero_process_check_path ("readom", error);
 
413
        if (result != BRASERO_BURN_OK)
 
414
                return result;
364
415
 
365
416
        /* that's for clone mode only The only one to copy audio */
366
417
        output = brasero_caps_image_new (BRASERO_PLUGIN_IO_ACCEPT_FILE,
387
438
 
388
439
        input = brasero_caps_disc_new (BRASERO_MEDIUM_CD|
389
440
                                       BRASERO_MEDIUM_DVD|
390
 
                                       BRASERO_MEDIUM_DVD_DL|
 
441
                                       BRASERO_MEDIUM_DUAL_L|
391
442
                                       BRASERO_MEDIUM_PLUS|
392
443
                                       BRASERO_MEDIUM_SEQUENTIAL|
393
444
                                       BRASERO_MEDIUM_RESTRICTED|