MCPcopy Create free account
hub / github.com/LibRaw/LibRaw / main

Function main

samples/simple_dcraw.cpp:57–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 NULL};
56
57int main(int ac, char *av[])
58{
59 int i, ret, verbose = 0, output_thumbs = 0, output_all_thumbs = 0;
60
61 // don't use fixed size buffers in real apps!
62 char outfn[1024], thumbfn[1024];
63
64 LibRaw* RawProcessor = new LibRaw;
65 RawProcessor->imgdata.rawparams.custom_camera_strings = customCameras;
66 if (ac < 2)
67 {
68 printf("simple_dcraw - LibRaw %s sample. Emulates dcraw [-D] [-T] [-v] "
69 "[-e] [-E]\n"
70 " %d cameras supported\n"
71 "Usage: %s [-D] [-T] [-v] [-e] raw-files....\n"
72 "\t-4 - 16-bit mode\n"
73 "\t-L - list supported cameras and exit\n"
74 "\t-v - verbose output\n"
75 "\t-T - output TIFF files instead of .pgm/ppm\n"
76 "\t-e - extract thumbnails (same as dcraw -e in separate run)\n"
77 "\t-E - extract all thumbnails\n",
78 LibRaw::version(), LibRaw::cameraCount(), av[0]);
79 delete RawProcessor;
80 return 0;
81 }
82
83 putenv((char *)"TZ=UTC"); // dcraw compatibility, affects TIFF datestamp field
84
85#define P1 RawProcessor->imgdata.idata
86#define S RawProcessor->imgdata.sizes
87#define C RawProcessor->imgdata.color
88#define T RawProcessor->imgdata.thumbnail
89#define P2 RawProcessor->imgdata.other
90#define OUT RawProcessor->imgdata.params
91
92 for (i = 1; i < ac; i++)
93 {
94 if (av[i][0] == '-')
95 {
96 if (av[i][1] == 'T' && av[i][2] == 0)
97 OUT.output_tiff = 1;
98 if (av[i][1] == 'v' && av[i][2] == 0)
99 verbose++;
100 if (av[i][1] == 'e' && av[i][2] == 0)
101 output_thumbs++;
102 if (av[i][1] == 'E' && av[i][2] == 0)
103 {
104 output_thumbs++;
105 output_all_thumbs++;
106 }
107 if (av[i][1] == '4' && av[i][2] == 0)
108 OUT.output_bps = 16;
109 if (av[i][1] == 'C' && av[i][2] == 0)
110 RawProcessor->set_progress_handler(my_progress_callback, NULL);
111 if (av[i][1] == 'L' && av[i][2] == 0)
112 {
113 const char **clist = LibRaw::cameraList();
114 const char **cc = clist;

Callers

nothing calls this directly

Calls 9

libraw_strerrorFunction · 0.85
open_fileMethod · 0.80
unpackMethod · 0.80
unpack_thumb_exMethod · 0.80
dcraw_thumb_writerMethod · 0.80
unpack_thumbMethod · 0.80
dcraw_ppm_tiff_writerMethod · 0.80
recycleMethod · 0.80
dcraw_processMethod · 0.45

Tested by

no test coverage detected