4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "videoconfig.h"
24 #include "videodevice.inc"
27 #define CLAMP(x, y, z) (x) = ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))
29 VideoConfig::VideoConfig()
33 VideoConfig::~VideoConfig()
37 VideoConfig& VideoConfig::operator=(VideoConfig &that)
40 video_in_driver = that.video_in_driver;
41 strcpy(v4l_in_device, that.v4l_in_device);
42 strcpy(lml_in_device, that.lml_in_device);
43 strcpy(screencapture_display, that.screencapture_display);
44 vfirewire_in_port = that.vfirewire_in_port;
45 vfirewire_in_channel = that.vfirewire_in_channel;
46 capture_length = that.capture_length;
49 video_out_driver = that.video_out_driver;
50 strcpy(lml_out_device, that.lml_out_device);
51 CLAMP(capture_length, 1, 1000);
55 int VideoConfig::load_defaults(BC_Hash *defaults)
57 video_in_driver = defaults->get("VIDEO_IN_DRIVER", VIDEO4LINUX);
58 sprintf(v4l_in_device, "/dev/video");
59 defaults->get("V4L_IN_DEVICE", v4l_in_device);
60 sprintf(lml_in_device, "/dev/mvideo/stream");
61 defaults->get("LML_IN_DEVICE", lml_in_device);
62 sprintf(screencapture_display, "");
63 defaults->get("SCREENCAPTURE_DISPLAY", screencapture_display);
64 vfirewire_in_port = defaults->get("VFIREWIRE_IN_PORT", 0);
65 vfirewire_in_channel = defaults->get("VFIREWIRE_IN_CHANNEL", 63);
66 capture_length = defaults->get("VIDEO_CAPTURE_LENGTH", 30);
68 video_out_driver = defaults->get("VIDEO_OUT_DRIVER", PLAYBACK_X11);
69 sprintf(lml_out_device, "/dev/mvideo/stream");
70 defaults->get("LML_OUT_DEVICE", lml_out_device);
74 int VideoConfig::save_defaults(BC_Hash *defaults)
76 defaults->update("VIDEO_IN_DRIVER", video_in_driver);
77 defaults->update("V4L_IN_DEVICE", v4l_in_device);
78 defaults->update("LML_IN_DEVICE", lml_in_device);
79 defaults->update("SCREENCAPTURE_DISPLAY", screencapture_display);
80 defaults->update("VFIREWIRE_IN_PORT", vfirewire_in_port);
81 defaults->update("VFIREWIRE_IN_CHANNEL", vfirewire_in_channel);
82 defaults->update("VIDEO_CAPTURE_LENGTH", capture_length);
84 defaults->update("VIDEO_OUT_DRIVER", video_out_driver);
85 defaults->update("LML_OUT_DEVICE", lml_out_device);