Added sequence number to RAW file name within bracketing mode - page 2 - General Discussion and Assistance - CHDK Forum
supplierdeeply

Added sequence number to RAW file name within bracketing mode

  • 23 Replies
  • 15178 Views
Re: Added sequence number to RAW file name within bracketing mode
« Reply #10 on: 09 / October / 2008, 07:39:16 »
Advertisements
It works!

I changed it to ST[A-Z] and everything works fine.
Especially deleting images within the camera works!
If I delete a JPEG named IMG_0001.JPG the assotiated RAW STA_0001.CRW is deleted too.
Accessing raw images named ST#... via USB cabel is working as well.

I tested this with my IXUS 950 (DIGIC III). Tomorrow I'll test with my Powershot S3 (DIGIC II).

So this is my svn diff. In bracketing mode the raw files are named ST[A-Z]. If there are more then 26 shots in one sequence, they are named STZ.
Code: [Select]

Index: trunk//core/raw.c
===================================================================
--- trunk//core/raw.c (Revision 530)
+++ trunk//core/raw.c (Arbeitskopie)
@@ -9,6 +9,7 @@
 #define RAW_TARGET_DIRECTORY    "A/DCIM/%03dCANON"
 //#define RAW_TMP_FILENAME        "HDK_RAW.TMP"
 #define RAW_TARGET_FILENAME     "%s%04d%s"
+#define RAW_SEQUENCE_PREFIX     "ST#_"
 
 //-------------------------------------------------------------------
 static char fn[64];
@@ -26,6 +27,7 @@
 int raw_savefile() {
  int fd, m=(mode_get()&MODE_SHOOTING_MASK);
     static struct utimbuf t;
+    static int bracket_count;
 
     if (state_kbd_script_run && shot_histogram_enabled) build_shot_histogram();
 
@@ -46,6 +48,16 @@
 
     shooting_bracketing();
 
+    // count sequence if in bracketing mode
+    if (conf.tv_bracket_value || conf.av_bracket_value || conf.iso_bracket_value || conf.subj_dist_bracket_value) {
+        if (state_shooting_progress != SHOOTING_PROGRESS_PROCESSING)
+            bracket_count = 1;
+        else
+            bracket_count++;
+    }
+    else
+        bracket_count=0;
+
     // got here second time in a row. Skip second RAW saving.
     if (conf.raw_save_first_only && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) {
         return 0;
@@ -65,7 +77,13 @@
         mkdir(dir);
 
         sprintf(fn, "%s/", dir);
-        sprintf(fn+strlen(fn), RAW_TARGET_FILENAME, img_prefixes[conf.raw_prefix], get_target_file_num(), img_exts[conf.raw_ext]);
+        if (bracket_count) {
+     char* prefix = RAW_SEQUENCE_PREFIX;
+            *(prefix+2) = (char)('@'+(bracket_count<26?bracket_count:26)); 
+     sprintf(fn+strlen(fn), RAW_TARGET_FILENAME, prefix, get_target_file_num(), img_exts[conf.raw_ext]);
+ }
+ else
+     sprintf(fn+strlen(fn), RAW_TARGET_FILENAME, img_prefixes[conf.raw_prefix], get_target_file_num(), img_exts[conf.raw_ext]);
 
         fd = open(fn, O_WRONLY|O_CREAT, 0777);
         if (fd>=0) {

When testing I recognized, that raw stitch files are NOT named with the prefix ST[A-Z]. Is there a property or a function in CHDK to check whether the camera is in stitching mode?

Randolf




« Last Edit: 09 / October / 2008, 07:43:24 by rr807 »

Re: Added sequence number to RAW file name within bracketing mode
« Reply #11 on: 09 / October / 2008, 12:11:14 »
Here I'm again with a little improvement:

Now raw stitch files are named ST[A-Z] too.

Randolf

Code: [Select]
Index: trunk/core/raw.c
===================================================================
--- trunk/core/raw.c (Revision 530)
+++ trunk/core/raw.c (Arbeitskopie)
@@ -9,6 +9,7 @@
 #define RAW_TARGET_DIRECTORY    "A/DCIM/%03dCANON"
 //#define RAW_TMP_FILENAME        "HDK_RAW.TMP"
 #define RAW_TARGET_FILENAME     "%s%04d%s"
+#define RAW_SEQUENCE_PREFIX     "ST#_"
 
 //-------------------------------------------------------------------
 static char fn[64];
@@ -26,6 +27,7 @@
 int raw_savefile() {
  int fd, m=(mode_get()&MODE_SHOOTING_MASK);
     static struct utimbuf t;
+    static int bracket_count;
 
     if (state_kbd_script_run && shot_histogram_enabled) build_shot_histogram();
 
@@ -46,6 +48,16 @@
 
     shooting_bracketing();
 
+    // count sequence if in bracketing mode
+    if (conf.tv_bracket_value || conf.av_bracket_value || conf.iso_bracket_value || conf.subj_dist_bracket_value || (mode_get()&MODE_SHOOTING_MASK)==MODE_STITCH) {
+        if (state_shooting_progress != SHOOTING_PROGRESS_PROCESSING)
+            bracket_count = 1;
+        else
+            bracket_count++;
+    }
+    else
+        bracket_count=0;
+
     // got here second time in a row. Skip second RAW saving.
     if (conf.raw_save_first_only && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) {
         return 0;
@@ -65,7 +77,13 @@
         mkdir(dir);
 
         sprintf(fn, "%s/", dir);
-        sprintf(fn+strlen(fn), RAW_TARGET_FILENAME, img_prefixes[conf.raw_prefix], get_target_file_num(), img_exts[conf.raw_ext]);
+        if (bracket_count) {
+     char* prefix = RAW_SEQUENCE_PREFIX;
+            *(prefix+2) = (char)('@'+(bracket_count<26?bracket_count:26)); 
+     sprintf(fn+strlen(fn), RAW_TARGET_FILENAME, prefix, get_target_file_num(), img_exts[conf.raw_ext]);
+ }
+ else
+     sprintf(fn+strlen(fn), RAW_TARGET_FILENAME, img_prefixes[conf.raw_prefix], get_target_file_num(), img_exts[conf.raw_ext]);
 
         fd = open(fn, O_WRONLY|O_CREAT, 0777);
         if (fd>=0) {
[/codr]


*

Offline reyalp

  • ******
  • 14118
Re: Added sequence number to RAW file name within bracketing mode
« Reply #12 on: 09 / October / 2008, 15:59:26 »
rr807: be careful, in my experience the camera would get confused if the jpeg and crw have the same prefix. e.g. IMG_XXXX.JPG and IMG_XXXX.CRW would cause the jpeg to be listed twice on PTP.
Don't forget what the H stands for.

Re: Added sequence number to RAW file name within bracketing mode
« Reply #13 on: 13 / October / 2008, 07:00:39 »
It works!
Accessing raw images named ST#... via USB cabel is working as well.


Are you saying that you are able to upload the raw images via the USB ?

How are you doing that  ?


David


*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Added sequence number to RAW file name within bracketing mode
« Reply #14 on: 13 / October / 2008, 07:27:13 »
using ptp (gphoto on linux for example) or the canon software on windows i guess.

Re: Added sequence number to RAW file name within bracketing mode
« Reply #15 on: 13 / October / 2008, 07:48:00 »
using ptp (gphoto on linux for example) or the canon software on windows i guess.


Hmmm ... but do we know that works ?

A friend has been working on a programme for the last two weeks to upload the RAW files via USB.

We had chosen the prefix 'STL_' (stereo left)  and 'STR_' (stereo right).

So far, we can see them but not upload them.

The Canon software does not see them.

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Added sequence number to RAW file name within bracketing mode
« Reply #16 on: 13 / October / 2008, 07:51:28 »
thats because you chose a prefix that the camera normally doesnt use. see the links that reyalp provided, there is the original discussion about the filenames & ptp. in order to use raw via usb you'd have to use a given prefix, you cannot make up new ones - unless we can override the list of "allowed" stuff in the firmware (that requires that it depends on the camera - not the pc)

Re: Added sequence number to RAW file name within bracketing mode
« Reply #17 on: 13 / October / 2008, 08:08:05 »
thats because you chose a prefix that the camera normally doesnt use

I thought you recently confirmed that the prefix we happen (by chance) to have chosen is OK ?

"well if you keep the ST[A-Z] scheme, people can download the raws without having to use a cardreader."


David


*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Added sequence number to RAW file name within bracketing mode
« Reply #18 on: 13 / October / 2008, 08:33:12 »
hm ur right, didnt check your prefix.

*

Offline reyalp

  • ******
  • 14118
Re: Added sequence number to RAW file name within bracketing mode
« Reply #19 on: 13 / October / 2008, 16:08:29 »
In my previous experiments only the extension matters for PTP listing (exception: if you use say both IMG_ and CRW_ with the same number, it confuses the listing) The prefix + number is used to delete the related files when you delete the jpeg.

Note that I only tested on one camera (a540) and certainly didn't test all possible permutation.
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal