Fixed initialisation of tf in file_open(). Without setting the memory to 0,
[cinelerra_cv/mob.git] / cinelerra / videoconfig.C
blobfef18351f1ce765a8d470f3a18f0a8fbd9304a8c
1 #include "bchash.h"
2 #include "videoconfig.h"
3 #include "videodevice.inc"
4 #include <string.h>
6 #define CLAMP(x, y, z) (x) = ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))
8 VideoConfig::VideoConfig()
12 VideoConfig::~VideoConfig()
16 VideoConfig& VideoConfig::operator=(VideoConfig &that)
18 // Input
19         video_in_driver = that.video_in_driver;
20         strcpy(v4l_in_device, that.v4l_in_device);
21         strcpy(lml_in_device, that.lml_in_device);
22         strcpy(screencapture_display, that.screencapture_display);
23         vfirewire_in_port = that.vfirewire_in_port;
24         vfirewire_in_channel = that.vfirewire_in_channel;
25         capture_length = that.capture_length;
27 // Output
28         video_out_driver = that.video_out_driver;
29         strcpy(lml_out_device, that.lml_out_device);
30         CLAMP(capture_length, 1, 1000);
31         return *this;
34 int VideoConfig::load_defaults(BC_Hash *defaults)
36         video_in_driver = defaults->get("VIDEO_IN_DRIVER", VIDEO4LINUX);
37         sprintf(v4l_in_device, "/dev/video");
38         defaults->get("V4L_IN_DEVICE", v4l_in_device);
39         sprintf(lml_in_device, "/dev/mvideo/stream");
40         defaults->get("LML_IN_DEVICE", lml_in_device);
41         sprintf(screencapture_display, "");
42         defaults->get("SCREENCAPTURE_DISPLAY", screencapture_display);
43         vfirewire_in_port = defaults->get("VFIREWIRE_IN_PORT", 0);
44         vfirewire_in_channel = defaults->get("VFIREWIRE_IN_CHANNEL", 63);
45         capture_length = defaults->get("VIDEO_CAPTURE_LENGTH", 30);
47         video_out_driver = defaults->get("VIDEO_OUT_DRIVER", PLAYBACK_X11);
48         sprintf(lml_out_device, "/dev/mvideo/stream");
49         defaults->get("LML_OUT_DEVICE", lml_out_device);
50         return 0;
53 int VideoConfig::save_defaults(BC_Hash *defaults)
55         defaults->update("VIDEO_IN_DRIVER", video_in_driver);
56         defaults->update("V4L_IN_DEVICE", v4l_in_device);
57         defaults->update("LML_IN_DEVICE", lml_in_device);
58         defaults->update("SCREENCAPTURE_DISPLAY", screencapture_display);
59         defaults->update("VFIREWIRE_IN_PORT", vfirewire_in_port);
60         defaults->update("VFIREWIRE_IN_CHANNEL", vfirewire_in_channel);
61         defaults->update("VIDEO_CAPTURE_LENGTH", capture_length);
63         defaults->update("VIDEO_OUT_DRIVER", video_out_driver);
64         defaults->update("LML_OUT_DEVICE", lml_out_device);