CHDK_DE Vorschauversion  Trunk Rev. 6014
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
filewrite.c-Dateireferenz
#include "stdlib.h"
#include "remotecap_core.h"
+ Include-Abhängigkeitsdiagramm für filewrite.c:
+ Dieser Graph zeigt, welche Datei direkt oder indirekt diese Datei enthält:

gehe zum Quellcode dieser Datei

Funktionen

int filewrite_get_file_chunk (char **addr, int *size, unsigned n, int *pos)
 
void filewrite_set_discard_file (int state)
 
void filewrite_main_hook (fwt_data_struct *fwt_data)
 
int filewrite_file_complete (void)
 
int fwt_after_close (int param)
 

Variablen

static int ignore_current_write =0
 
static cam_ptp_data_chunkfile_chunks
 

Dokumentation der Funktionen

int filewrite_file_complete ( void  )

Definiert in Zeile 178 der Datei filewrite.c.

178  {
180 #ifdef CAM_DRYOS
181 #ifdef CAM_FILEWRITETASK_SEEKS
182  if (fwt_bytes_written < file_full_size) {
183  return 1;
184  }
185 #elif defined(CAM_FILEWRITETASK_MULTIPASS)
186  if (!file_last_session) {
187  return 1;
188  }
189 #endif // CAM_FILEWRITETASK_SEEKS, CAM_FILEWRITETASK_MULTIPASS
190  current_write_ignored=0;
191  fwt_bytes_written = 0;
192 #endif // CAM_DRYOS
194  return 1;
195  }
196  return 0;
197 }
int filewrite_get_file_chunk ( char **  addr,
int *  size,
unsigned  n,
int *  pos 
)

Definiert in Zeile 30 der Datei filewrite.c.

30  {
31  *pos=-1;
32 #if !defined(CAM_FILEWRITETASK_MULTIPASS)
33  // TODO null should probably be an error
34  if (n >= MAX_CHUNKS_FOR_FWT || file_chunks == NULL) {
35  *addr=(char *)0xFFFFFFFF; // signals last chunk
36  *size=0;
37  return REMOTECAP_FWT_CHUNK_STATUS_LAST; // last chunk
38  }
39  *addr=(char *)file_chunks[n].address;
40  *size=file_chunks[n].length;
41  if (n < MAX_CHUNKS_FOR_FWT-1) {
42  if (file_chunks[n+1].length==0) {
43  return REMOTECAP_FWT_CHUNK_STATUS_LAST; // last chunk
44  }
45  return REMOTECAP_FWT_CHUNK_STATUS_MORE; // not last chunk
46  }
47  return REMOTECAP_FWT_CHUNK_STATUS_LAST; // last chunk
48 #else
49  if ( file_chunks == NULL ) { //do we have a valid queue?
50  int m=50;
51  while (m>0) { //wait for at most 500ms
52  _SleepTask(10);
53  m--;
54  if ( file_chunks != NULL ) break;
55  }
56  if ( file_chunks == NULL ) { //timeout, error
57  *addr=(char *)0;
58  *size=0;
60  }
61  }
62  *addr=(char *)file_chunks[file_curr_session_chunk].address;
63  *size=file_chunks[file_curr_session_chunk].length;
64 #ifdef CAM_FILEWRITETASK_SEEKS
65  if ( n == 0 ) { // first chunk for this shot
66  file_bytes_left = file_full_size;
67  }
68  file_bytes_left -= *size;
69  if (file_curr_session_chunk == 0) {
70  *pos=fwt_file_offset; //only post file offset for the first chunk in the current queue
71  }
72 #else
73  (void)n;
74  if ((file_curr_session_chunk==0) && (file_last_session)) {
75  *pos=0; //only post file offset for the first chunk in the last queue
76  }
77 #endif
78  file_curr_session_chunk++;
79 #ifdef CAM_FILEWRITETASK_SEEKS
80  if (file_bytes_left>0) {
81  if ( file_curr_session_chunk < MAX_CHUNKS_FOR_FWT ) {
82  if (file_chunks[file_curr_session_chunk].length==0) { //last chunk of the current queue
84  }
85  return REMOTECAP_FWT_CHUNK_STATUS_MORE; //not last
86  }
87  else {
89  }
90  }
91 #else
92  if ( file_curr_session_chunk < MAX_CHUNKS_FOR_FWT ) {
93  if (file_chunks[file_curr_session_chunk].length==0) { //last chunk of the current queue
94  if (file_last_session) {
96  }
97  else {
99  }
100  }
101  return REMOTECAP_FWT_CHUNK_STATUS_MORE; //not last
102  }
103  else {
104  if (file_last_session) {
106  }
107  else {
109  }
110  }
111 #endif
112  return REMOTECAP_FWT_CHUNK_STATUS_LAST; //last
113 #endif //CAM_FILEWRITETASK_MULTIPASS
114 }
void filewrite_main_hook ( fwt_data_struct fwt_data)

Definiert in Zeile 120 der Datei filewrite.c.

121 {
122 #ifdef CAM_FILEWRITETASK_MULTIPASS
123  file_curr_session_chunk = 0;
124 #ifdef CAM_FILEWRITETASK_SEEKS
125  // don't forget to #define FWT_SEEKMASK, FWT_MUSTSEEK
126  /*
127  * below information is only valid when this routine is called
128  *
129  * seek flag is at offset 0x50 for DryOS r50
130  * 2: seek is needed
131  * if not 2, seek is only performed when file_offset is not 0
132  *
133  * seek flag is at offset 0x4c for DryOS r51
134  * if (seek_flag & 0x40) == 0x40 then seek is needed
135  * otherwise, seek is only performed when file_offset is not 0
136  */
137  if ( ((fwt_data->seek_flag & FWT_SEEKMASK) == FWT_MUSTSEEK) || (fwt_data->file_offset != 0) ) {
138  fwt_file_offset = fwt_data->file_offset;
139  }
140  else {
141  fwt_file_offset = -1; // no seek needed
142  }
143  file_full_size = fwt_data->full_size;
144 #else
145  /*
146  * below information is only valid when this routine is called
147  *
148  * we need to watch the file open flags to determine whether the file data arrives in multiple passes
149  * if the flag isn't there, it's the last (or only) pass
150  */
151  if (fwt_data->oflags & OFLAG_NOFLUSH) {
152  file_last_session = 0;
153  }
154  else {
155  file_last_session = 1;
156  }
157 #endif // CAM_FILEWRITETASK_SEEKS
158 #endif // CAM_FILEWRITETASK_MULTIPASS
159 
160  file_chunks = &(fwt_data->pdc[0]);
161 #ifdef CAM_HAS_CANON_RAW
162  // for raw enabled cameras, get format from extension
163  // A/DCIM/100CANON/IMG_1234.CR2
164  if(strcmp(".CR2",&(fwt_data->name[24])) == 0) {
166  } else {
168  }
169 #else
171 #endif
173 }
void filewrite_set_discard_file ( int  state)

Definiert in Zeile 116 der Datei filewrite.c.

116  {
117  ignore_current_write = state;
118 }
int fwt_after_close ( int  param)

Definiert in Zeile 246 der Datei filewrite.c.

246  {
247 // imagesavecomplete=1;
248  return param;
249 }

Variablen-Dokumentation

cam_ptp_data_chunk* file_chunks
static

Definiert in Zeile 15 der Datei filewrite.c.

int ignore_current_write =0
static

Definiert in Zeile 4 der Datei filewrite.c.