~ubuntu-branches/debian/wheezy/brasero/wheezy

« back to all changes in this revision

Viewing changes to libbrasero-media/scsi-read-disc-info.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:
 
1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
 
2
/*
 
3
 * Libbrasero-media
 
4
 * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app@wanadoo.fr>
 
5
 *
 
6
 * Libbrasero-media is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * The Libbrasero-media authors hereby grant permission for non-GPL compatible
 
12
 * GStreamer plugins to be used and distributed together with GStreamer
 
13
 * and Libbrasero-media. This permission is above and beyond the permissions granted
 
14
 * by the GPL license by which Libbrasero-media is covered. If you modify this code
 
15
 * you may extend this exception to your version of the code, but you are not
 
16
 * obligated to do so. If you do not wish to do so, delete this exception
 
17
 * statement from your version.
 
18
 * 
 
19
 * Libbrasero-media is distributed in the hope that it will be useful,
 
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
22
 * GNU Library General Public License for more details.
 
23
 * 
 
24
 * You should have received a copy of the GNU General Public License
 
25
 * along with this program; if not, write to:
 
26
 *      The Free Software Foundation, Inc.,
 
27
 *      51 Franklin Street, Fifth Floor
 
28
 *      Boston, MA  02110-1301, USA.
 
29
 */
 
30
 
 
31
#ifdef HAVE_CONFIG_H
 
32
#  include <config.h>
 
33
#endif
 
34
 
 
35
#include <glib.h>
 
36
 
 
37
#include "brasero-media-private.h"
 
38
 
 
39
#include "scsi-error.h"
 
40
#include "scsi-utils.h"
 
41
#include "scsi-base.h"
 
42
#include "scsi-command.h"
 
43
#include "scsi-opcodes.h"
 
44
#include "scsi-read-disc-info.h"
 
45
 
 
46
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
 
47
 
 
48
struct _BraseroRdDiscInfoCDB {
 
49
        uchar opcode;
 
50
 
 
51
        uchar data_type         :3;
 
52
        uchar reserved0         :5;
 
53
 
 
54
        uchar reserved1         [5];
 
55
        uchar alloc_len         [2];
 
56
 
 
57
        uchar ctl;
 
58
};
 
59
 
 
60
#else
 
61
 
 
62
struct _BraseroRdDiscInfoCDB {
 
63
        uchar opcode;
 
64
 
 
65
        uchar reserved0         :5;
 
66
        uchar data_type         :3;
 
67
 
 
68
        uchar reserved1         [5];
 
69
        uchar alloc_len         [2];
 
70
 
 
71
        uchar ctl;
 
72
};
 
73
 
 
74
#endif
 
75
 
 
76
typedef struct _BraseroRdDiscInfoCDB BraseroRdDiscInfoCDB;
 
77
 
 
78
BRASERO_SCSI_COMMAND_DEFINE (BraseroRdDiscInfoCDB,
 
79
                             READ_DISC_INFORMATION,
 
80
                             BRASERO_SCSI_READ);
 
81
 
 
82
typedef enum {
 
83
BRASERO_DISC_INFO_STD           = 0x00,
 
84
BRASERO_DISC_INFO_TRACK_RES     = 0x01,
 
85
BRASERO_DISC_INFO_POW_RES       = 0x02,
 
86
        /* reserved */
 
87
} BraseroDiscInfoType;
 
88
 
 
89
 
 
90
BraseroScsiResult
 
91
brasero_mmc1_read_disc_information_std (BraseroDeviceHandle *handle,
 
92
                                        BraseroScsiDiscInfoStd **info_return,
 
93
                                        int *size,
 
94
                                        BraseroScsiErrCode *error)
 
95
{
 
96
        BraseroScsiDiscInfoStd std_info;
 
97
        BraseroScsiDiscInfoStd *buffer;
 
98
        BraseroRdDiscInfoCDB *cdb;
 
99
        BraseroScsiResult res;
 
100
        int request_size;
 
101
        int buffer_size;
 
102
 
 
103
        if (!info_return || !size) {
 
104
                BRASERO_SCSI_SET_ERRCODE (error, BRASERO_SCSI_BAD_ARGUMENT);
 
105
                return BRASERO_SCSI_FAILURE;
 
106
        }
 
107
 
 
108
        cdb = brasero_scsi_command_new (&info, handle);
 
109
        cdb->data_type = BRASERO_DISC_INFO_STD;
 
110
        BRASERO_SET_16 (cdb->alloc_len, sizeof (BraseroScsiDiscInfoStd));
 
111
 
 
112
        memset (&std_info, 0, sizeof (BraseroScsiDiscInfoStd));
 
113
        res = brasero_scsi_command_issue_sync (cdb,
 
114
                                               &std_info,
 
115
                                               sizeof (BraseroScsiDiscInfoStd),
 
116
                                               error);
 
117
        if (res)
 
118
                goto end;
 
119
 
 
120
        request_size = BRASERO_GET_16 (std_info.len) + 
 
121
                       sizeof (std_info.len);
 
122
        
 
123
        buffer = (BraseroScsiDiscInfoStd *) g_new0 (uchar, request_size);
 
124
 
 
125
        BRASERO_SET_16 (cdb->alloc_len, request_size);
 
126
        res = brasero_scsi_command_issue_sync (cdb, buffer, request_size, error);
 
127
        if (res) {
 
128
                g_free (buffer);
 
129
                goto end;
 
130
        }
 
131
 
 
132
        buffer_size = BRASERO_GET_16 (buffer->len) +
 
133
                      sizeof (buffer->len);
 
134
 
 
135
        if (request_size != buffer_size)
 
136
                BRASERO_MEDIA_LOG ("Sizes mismatch asked %i / received %i",
 
137
                                  request_size,
 
138
                                  buffer_size);
 
139
 
 
140
        *info_return = buffer;
 
141
        *size = MIN (request_size, buffer_size);
 
142
 
 
143
end:
 
144
 
 
145
        brasero_scsi_command_free (cdb);
 
146
        return res;
 
147
}
 
148
 
 
149
BraseroScsiResult
 
150
brasero_mmc5_read_disc_information_tracks (BraseroDeviceHandle *handle,
 
151
                                           BraseroScsiTrackResInfo *info_return,
 
152
                                           int size,
 
153
                                           BraseroScsiErrCode *error)
 
154
{
 
155
        BraseroRdDiscInfoCDB *cdb;
 
156
        BraseroScsiResult res;
 
157
 
 
158
        cdb = brasero_scsi_command_new (&info, handle);
 
159
        cdb->data_type = BRASERO_DISC_INFO_TRACK_RES;
 
160
        BRASERO_SET_16 (cdb->alloc_len, size);
 
161
 
 
162
        memset (info_return, 0, size);
 
163
        res = brasero_scsi_command_issue_sync (cdb, info_return, size, error);
 
164
        brasero_scsi_command_free (cdb);
 
165
        return res;
 
166
}
 
167
 
 
168
BraseroScsiResult
 
169
brasero_mmc5_read_disc_information_pows (BraseroDeviceHandle *handle,
 
170
                                         BraseroScsiPOWResInfo *info_return,
 
171
                                         int size,
 
172
                                         BraseroScsiErrCode *error)
 
173
{
 
174
        BraseroRdDiscInfoCDB *cdb;
 
175
        BraseroScsiResult res;
 
176
 
 
177
        cdb = brasero_scsi_command_new (&info, handle);
 
178
        cdb->data_type = BRASERO_DISC_INFO_POW_RES;
 
179
        BRASERO_SET_16 (cdb->alloc_len, size);
 
180
 
 
181
        memset (info_return, 0, size);
 
182
        res = brasero_scsi_command_issue_sync (cdb, info_return, size, error);
 
183
        brasero_scsi_command_free (cdb);
 
184
        return res;
 
185
}