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(screencapture_display, that.screencapture_display);
42 vfirewire_in_port = that.vfirewire_in_port;
43 vfirewire_in_channel = that.vfirewire_in_channel;
44 capture_length = that.capture_length;
47 video_out_driver = that.video_out_driver;
48 CLAMP(capture_length, 1, 1000);
52 int VideoConfig::load_defaults(BC_Hash *defaults)
54 video_in_driver = defaults->get("VIDEO_IN_DRIVER", VIDEO4LINUX2);
55 sprintf(v4l2_in_device, "/dev/video");
56 sprintf(screencapture_display, "");
57 defaults->get("SCREENCAPTURE_DISPLAY", screencapture_display);
58 vfirewire_in_port = defaults->get("VFIREWIRE_IN_PORT", 0);
59 vfirewire_in_channel = defaults->get("VFIREWIRE_IN_CHANNEL", 63);
60 capture_length = defaults->get("VIDEO_CAPTURE_LENGTH", 30);
62 video_out_driver = defaults->get("VIDEO_OUT_DRIVER", PLAYBACK_X11);
66 int VideoConfig::save_defaults(BC_Hash *defaults)
68 defaults->update("VIDEO_IN_DRIVER", video_in_driver);
69 defaults->update("SCREENCAPTURE_DISPLAY", screencapture_display);
70 defaults->update("VFIREWIRE_IN_PORT", vfirewire_in_port);
71 defaults->update("VFIREWIRE_IN_CHANNEL", vfirewire_in_channel);
72 defaults->update("VIDEO_CAPTURE_LENGTH", capture_length);
74 defaults->update("VIDEO_OUT_DRIVER", video_out_driver);