summaryrefslogtreecommitdiff
path: root/src/camera
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2021-08-22 09:58:25 +0200
committerJörg Frings-Fürst <debian@jff.email>2021-08-22 09:58:25 +0200
commit55d274a13c2524d55e07f2395316aa9d2cae912b (patch)
treeed56dbd62e0ce978ab83e8ffe2d6034e612d028f /src/camera
parentfa96deefd4bc785c2937e40df3eb0742e2353c13 (diff)
parent63876b56fcba61ef061c5f0edd924551bc079354 (diff)
Merge branch 'release/debian/0.30.14-1'debian/0.30.14-1
Diffstat (limited to 'src/camera')
-rw-r--r--src/camera/GPhoto.vala13
-rw-r--r--src/camera/ImportPage.vala29
2 files changed, 20 insertions, 22 deletions
diff --git a/src/camera/GPhoto.vala b/src/camera/GPhoto.vala
index 39b2109..9bcb151 100644
--- a/src/camera/GPhoto.vala
+++ b/src/camera/GPhoto.vala
@@ -119,15 +119,11 @@ namespace GPhoto {
// if buffer can be loaded into memory, return a Bytes class with
// CameraFile being the owner of the data. This way, the CameraFile is freed
// when the Bytes are freed
- unowned uint8 *data;
- ulong data_len;
- var res = file.get_data_and_size(out data, out data_len);
+ unowned uint8[] buffer = null;
+ var res = file.get_data(out buffer);
if (res != Result.OK)
return null;
- unowned uint8[] buffer = (uint8[]) data;
- buffer.length = (int) data_len;
-
return Bytes.new_with_owner<GPhoto.CameraFile>(buffer, file);
}
@@ -135,9 +131,10 @@ namespace GPhoto {
// filesystem. In these cases shotwell can access the file directly. See:
// http://redmine.yorba.org/issues/2959
public PhotoMetadata? get_fallback_metadata(Camera camera, Context context, string folder, string filename) {
- GPhoto.CameraStorageInformation *sifs = null;
+ // Fixme: Why do we need to query get_storageinfo here first?
+ GPhoto.CameraStorageInformation[] sifs = null;
int count = 0;
- camera.get_storageinfo(&sifs, out count, context);
+ camera.get_storageinfo(out sifs, context);
GPhoto.PortInfo port_info;
camera.get_port_info(out port_info);
diff --git a/src/camera/ImportPage.vala b/src/camera/ImportPage.vala
index 3f70f08..1e50777 100644
--- a/src/camera/ImportPage.vala
+++ b/src/camera/ImportPage.vala
@@ -1208,11 +1208,10 @@ public class ImportPage : CheckerboardPage {
Gee.ArrayList<ImportSource> import_list = new Gee.ArrayList<ImportSource>();
- GPhoto.CameraStorageInformation *sifs = null;
- int count = 0;
- refresh_result = camera.get_storageinfo(&sifs, out count, spin_idle_context.context);
+ GPhoto.CameraStorageInformation[] sifs = null;
+ refresh_result = camera.get_storageinfo(out sifs, spin_idle_context.context);
if (refresh_result == GPhoto.Result.OK) {
- for (int fsid = 0; fsid < count; fsid++) {
+ for (int fsid = 0; fsid < sifs.length; fsid++) {
// Check well-known video and image paths first to prevent accidental
// scanning of undesired directories (which can cause user annoyance with
// some smartphones or camera-equipped media players)
@@ -1353,18 +1352,19 @@ public class ImportPage : CheckerboardPage {
// Need to do this because some phones (iPhone, in particular) changes the name of their filesystem
// between each mount
public static string? get_fs_basedir(GPhoto.Camera camera, int fsid) {
- GPhoto.CameraStorageInformation *sifs = null;
- int count = 0;
- GPhoto.Result res = camera.get_storageinfo(&sifs, out count, null_context.context);
+ GPhoto.CameraStorageInformation[] sifs = null;
+ GPhoto.Result res = camera.get_storageinfo(out sifs, null_context.context);
if (res != GPhoto.Result.OK)
return null;
- if (fsid >= count)
+ if (fsid >= sifs.length)
return null;
-
- GPhoto.CameraStorageInformation *ifs = sifs + fsid;
-
- return (ifs->fields & GPhoto.CameraStorageInfoFields.BASE) != 0 ? ifs->basedir : "/";
+
+ if (GPhoto.CameraStorageInfoFields.BASE in sifs[fsid].fields) {
+ return (string) sifs[fsid].basedir;
+ } else {
+ return "/";
+ }
}
public static string? get_fulldir(GPhoto.Camera camera, string camera_name, int fsid, string folder) {
@@ -1439,12 +1439,13 @@ public class ImportPage : CheckerboardPage {
import_list.add(video_source);
} else {
// determine file format from type, and then from file extension
- PhotoFileFormat file_format = PhotoFileFormat.from_gphoto_type(info.file.type);
+ string file_type = (string)info.file.type;
+ PhotoFileFormat file_format = PhotoFileFormat.from_gphoto_type(file_type);
if (file_format == PhotoFileFormat.UNKNOWN) {
file_format = PhotoFileFormat.get_by_basename_extension(filename);
if (file_format == PhotoFileFormat.UNKNOWN) {
message("Skipping %s/%s: Not a supported file extension (%s)", fulldir,
- filename, info.file.type);
+ filename, file_type);
continue;
}