00001 #include "defaults.h"
00002 #include "videoconfig.h"
00003 #include "videodevice.inc"
00004 #include <string.h>
00005
00006 #define CLAMP(x, y, z) (x) = ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))
00007
00008 VideoConfig::VideoConfig()
00009 {
00010 }
00011
00012 VideoConfig::~VideoConfig()
00013 {
00014 }
00015
00016 VideoConfig& VideoConfig::operator=(VideoConfig &that)
00017 {
00018
00019 video_in_driver = that.video_in_driver;
00020 strcpy(v4l_in_device, that.v4l_in_device);
00021 strcpy(lml_in_device, that.lml_in_device);
00022 strcpy(screencapture_display, that.screencapture_display);
00023 vfirewire_in_port = that.vfirewire_in_port;
00024 vfirewire_in_channel = that.vfirewire_in_channel;
00025 capture_length = that.capture_length;
00026
00027
00028 video_out_driver = that.video_out_driver;
00029 strcpy(lml_out_device, that.lml_out_device);
00030 CLAMP(capture_length, 1, 1000);
00031 return *this;
00032 }
00033
00034 int VideoConfig::load_defaults(Defaults *defaults)
00035 {
00036 video_in_driver = defaults->get("VIDEO_IN_DRIVER", VIDEO4LINUX);
00037 sprintf(v4l_in_device, "/dev/video");
00038 defaults->get("V4L_IN_DEVICE", v4l_in_device);
00039 sprintf(lml_in_device, "/dev/mvideo/stream");
00040 defaults->get("LML_IN_DEVICE", lml_in_device);
00041 sprintf(screencapture_display, "");
00042 defaults->get("SCREENCAPTURE_DISPLAY", screencapture_display);
00043 vfirewire_in_port = defaults->get("VFIREWIRE_IN_PORT", 0);
00044 vfirewire_in_channel = defaults->get("VFIREWIRE_IN_CHANNEL", 63);
00045 capture_length = defaults->get("VIDEO_CAPTURE_LENGTH", 30);
00046
00047 video_out_driver = defaults->get("VIDEO_OUT_DRIVER", PLAYBACK_X11);
00048 sprintf(lml_out_device, "/dev/mvideo/stream");
00049 defaults->get("LML_OUT_DEVICE", lml_out_device);
00050 return 0;
00051 }
00052
00053 int VideoConfig::save_defaults(Defaults *defaults)
00054 {
00055 defaults->update("VIDEO_IN_DRIVER", video_in_driver);
00056 defaults->update("V4L_IN_DEVICE", v4l_in_device);
00057 defaults->update("LML_IN_DEVICE", lml_in_device);
00058 defaults->update("SCREENCAPTURE_DISPLAY", screencapture_display);
00059 defaults->update("VFIREWIRE_IN_PORT", vfirewire_in_port);
00060 defaults->update("VFIREWIRE_IN_CHANNEL", vfirewire_in_channel);
00061 defaults->update("VIDEO_CAPTURE_LENGTH", capture_length);
00062
00063 defaults->update("VIDEO_OUT_DRIVER", video_out_driver);
00064 defaults->update("LML_OUT_DEVICE", lml_out_device);
00065 }