2 #include "colormodels.h"
8 // Only allow one instance of the decoder to run simultaneously.
9 static Mutex cr2_mutex;
12 FileCR2::FileCR2(Asset *asset, File *file)
13 : FileBase(asset, file)
28 int FileCR2::check_sig(Asset *asset)
30 cr2_mutex.lock("FileCR2::check_sig");
31 char string[BCTEXTLEN];
34 strcpy(string, asset->path);
42 int result = dcraw_main(argc, argv);
49 int FileCR2::open_file(int rd, int wr)
51 cr2_mutex.lock("FileCR2::check_sig");
61 int result = dcraw_main(argc, argv);
62 if(!result) format_to_asset();
69 int FileCR2::close_file()
74 void FileCR2::format_to_asset()
76 asset->video_data = 1;
78 sscanf(dcraw_info, "%d %d", &asset->width, &asset->height);
79 if(!asset->frame_rate) asset->frame_rate = 1;
80 asset->video_length = -1;
84 int FileCR2::read_frame(VFrame *frame)
86 cr2_mutex.lock("FileCR2::check_sig");
87 if(frame->get_color_model() == BC_RGBA_FLOAT)
101 dcraw_data = (float**)frame->get_rows();
103 int result = dcraw_main(argc, argv);
109 int FileCR2::colormodel_supported(int colormodel)
111 if(colormodel == BC_RGB_FLOAT ||
112 colormodel == BC_RGBA_FLOAT)