root/trunk/core/raw.c

547551
11
#define RAW_TARGET_DIRECTORY    "A/DCIM/%03dCANON"
11
#define RAW_TARGET_DIRECTORY    "A/DCIM/%03dCANON"
12
//#define RAW_TMP_FILENAME        "HDK_RAW.TMP"
12
//#define RAW_TMP_FILENAME        "HDK_RAW.TMP"
13
#define RAW_TARGET_FILENAME     "%s%04d%s"
13
#define RAW_TARGET_FILENAME     "%s%04d%s"
14
#define RAW_BRACKETING_FILENAME "%s%04d_%02d%s" 
14
15
15
//-------------------------------------------------------------------
16
//-------------------------------------------------------------------
16
static char fn[64];
17
static char fn[64];
...
...
28
int raw_savefile() {
29
int raw_savefile() {
29
		int fd, m=(mode_get()&MODE_SHOOTING_MASK);
30
		int fd, m=(mode_get()&MODE_SHOOTING_MASK);
30
    static struct utimbuf t;
31
    static struct utimbuf t;
31
32
    static int br_counter; 
33
    
32
    if (state_kbd_script_run && shot_histogram_enabled) build_shot_histogram();
34
    if (state_kbd_script_run && shot_histogram_enabled) build_shot_histogram();
33
35
34
    if (develop_raw) {
36
    if (develop_raw) {
...
...
50
52
51
    shooting_bracketing();
53
    shooting_bracketing();
52
54
55
    if(conf.tv_bracket_value || conf.av_bracket_value || conf.iso_bracket_value || conf.subj_dist_bracket_value) {
56
        if(state_shooting_progress != SHOOTING_PROGRESS_PROCESSING)
57
            br_counter = 1;
58
        else
59
            br_counter++;
60
    }
61
    else
62
        br_counter=0;
63
64
53
    // got here second time in a row. Skip second RAW saving.
65
    // got here second time in a row. Skip second RAW saving.
54
    if (conf.raw_save_first_only && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) {
66
    if (conf.raw_save_first_only && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) {
55
        return 0;
67
        return 0;
...
...
69
        mkdir(dir);
81
        mkdir(dir);
70
82
71
        sprintf(fn, "%s/", dir);
83
        sprintf(fn, "%s/", dir);
72
        sprintf(fn+strlen(fn), RAW_TARGET_FILENAME, img_prefixes[conf.raw_prefix], get_target_file_num(), img_exts[conf.raw_ext]);
84
        if(br_counter && conf.bracketing_add_raw_suffix)
73
85
            sprintf(fn+strlen(fn), RAW_BRACKETING_FILENAME, img_prefixes[conf.raw_prefix], get_target_file_num(), br_counter, img_exts[conf.raw_ext]);
86
        else
87
            sprintf(fn+strlen(fn), RAW_TARGET_FILENAME, img_prefixes[conf.raw_prefix], get_target_file_num(), img_exts[conf.raw_ext]); 
74
        fd = open(fn, O_WRONLY|O_CREAT, 0777);
88
        fd = open(fn, O_WRONLY|O_CREAT, 0777);
75
        if (fd>=0) {
89
        if (fd>=0) {
76
            write(fd, hook_raw_image_addr(), hook_raw_size());
90
            write(fd, hook_raw_image_addr(), hook_raw_size());