1 #include "audiodevice.inc"
3 #include "playbackconfig.h"
4 #include "recordconfig.h"
5 #include "videodevice.inc"
12 AudioInConfig::AudioInConfig()
15 for(int i = 0; i < MAXDEVICES; i++)
17 oss_enable[i] = (i == 0);
18 sprintf(oss_in_device[i], "/dev/dsp");
22 firewire_channel = 63;
23 strcpy(firewire_path, "/dev/dv1394");
24 sprintf(esound_in_server, "");
27 sprintf(alsa_in_device, "default");
29 in_samplerate = 48000;
33 AudioInConfig::~AudioInConfig()
37 int AudioInConfig::is_duplex(AudioInConfig *in, AudioOutConfig *out)
39 if(in->driver == out->driver)
44 case AUDIO_OSS_ENVY24:
45 return (!strcmp(in->oss_in_device[0], out->oss_out_device[0]) &&
46 in->oss_in_bits == out->oss_out_bits);
49 // ALSA always opens 2 devices
60 void AudioInConfig::copy_from(AudioInConfig *src)
64 firewire_port = src->firewire_port;
65 firewire_channel = src->firewire_channel;
66 strcpy(firewire_path, src->firewire_path);
68 strcpy(esound_in_server, src->esound_in_server);
69 esound_in_port = src->esound_in_port;
71 for(int i = 0; i < MAXDEVICES; i++)
73 oss_enable[i] = src->oss_enable[i];
74 strcpy(oss_in_device[i], src->oss_in_device[i]);
75 oss_in_bits = src->oss_in_bits;
78 strcpy(alsa_in_device, src->alsa_in_device);
79 alsa_in_bits = src->alsa_in_bits;
80 in_samplerate = src->in_samplerate;
81 channels = src->channels;
84 AudioInConfig& AudioInConfig::operator=(AudioInConfig &that)
90 int AudioInConfig::load_defaults(BC_Hash *defaults)
92 char string[BCTEXTLEN];
93 driver = defaults->get("AUDIOINDRIVER", driver);
94 firewire_port = defaults->get("AFIREWIRE_IN_PORT", firewire_port);
95 firewire_channel = defaults->get("AFIREWIRE_IN_CHANNEL", firewire_channel);
96 defaults->get("AFIREWIRE_IN_PATH", firewire_path);
97 for(int i = 0; i < MAXDEVICES; i++)
99 sprintf(string, "OSS_ENABLE_%d", i);
100 oss_enable[i] = defaults->get(string, oss_enable[i]);
101 sprintf(string, "OSS_IN_DEVICE_%d", i);
102 defaults->get(string, oss_in_device[i]);
104 sprintf(string, "OSS_IN_BITS");
105 oss_in_bits = defaults->get(string, oss_in_bits);
106 defaults->get("ESOUND_IN_SERVER", esound_in_server);
107 esound_in_port = defaults->get("ESOUND_IN_PORT", esound_in_port);
109 defaults->get("ALSA_IN_DEVICE", alsa_in_device);
110 alsa_in_bits = defaults->get("ALSA_IN_BITS", alsa_in_bits);
111 in_samplerate = defaults->get("IN_SAMPLERATE", in_samplerate);
112 channels = defaults->get("IN_CHANNELS", channels);
116 int AudioInConfig::save_defaults(BC_Hash *defaults)
118 char string[BCTEXTLEN];
119 defaults->update("AUDIOINDRIVER", driver);
120 defaults->update("AFIREWIRE_IN_PORT", firewire_port);
121 defaults->update("AFIREWIRE_IN_CHANNEL", firewire_channel);
122 defaults->update("AFIREWIRE_IN_PATH", firewire_path);
124 for(int i = 0; i < MAXDEVICES; i++)
126 sprintf(string, "OSS_ENABLE_%d", i);
127 defaults->update(string, oss_enable[i]);
128 sprintf(string, "OSS_IN_DEVICE_%d", i);
129 defaults->update(string, oss_in_device[i]);
132 sprintf(string, "OSS_IN_BITS");
133 defaults->update(string, oss_in_bits);
134 defaults->update("ESOUND_IN_SERVER", esound_in_server);
135 defaults->update("ESOUND_IN_PORT", esound_in_port);
137 defaults->update("ALSA_IN_DEVICE", alsa_in_device);
138 defaults->update("ALSA_IN_BITS", alsa_in_bits);
139 defaults->update("IN_SAMPLERATE", in_samplerate);
140 defaults->update("IN_CHANNELS", channels);
150 VideoInConfig::VideoInConfig()
152 driver = VIDEO4LINUX;
153 sprintf(v4l_in_device, "/dev/video0");
154 sprintf(v4l2_in_device, "/dev/video0");
155 sprintf(v4l2jpeg_in_device, "/dev/video0");
156 sprintf(lml_in_device, "/dev/mvideo/stream");
157 sprintf(buz_in_device, "/dev/video0");
158 sprintf(screencapture_display, "");
162 sprintf(dvb_in_host, "echephyle");
171 firewire_channel = 63;
172 sprintf(firewire_path, "/dev/dv1394");
173 // number of frames to read from device during video recording.
174 // capture_length = 15;
178 in_framerate = 29.97;
181 VideoInConfig::~VideoInConfig()
185 char* VideoInConfig::get_path()
190 return v4l_in_device;
193 return v4l2_in_device;
195 case VIDEO4LINUX2JPEG:
196 return v4l2jpeg_in_device;
199 return buz_in_device;
205 return v4l_in_device;
208 void VideoInConfig::copy_from(VideoInConfig *src)
210 driver = src->driver;
211 strcpy(v4l_in_device, src->v4l_in_device);
212 strcpy(v4l2_in_device, src->v4l2_in_device);
213 strcpy(v4l2jpeg_in_device, src->v4l2jpeg_in_device);
214 strcpy(lml_in_device, src->lml_in_device);
215 strcpy(buz_in_device, src->buz_in_device);
216 strcpy(screencapture_display, src->screencapture_display);
222 strcpy(dvb_in_host, src->dvb_in_host);
223 dvb_in_port = src->dvb_in_port;
224 dvb_in_number = src->dvb_in_number;
230 firewire_port = src->firewire_port;
231 firewire_channel = src->firewire_channel;
232 strcpy(firewire_path, src->firewire_path);
233 capture_length = src->capture_length;
236 in_framerate = src->in_framerate;
239 VideoInConfig& VideoInConfig::operator=(VideoInConfig &that)
245 int VideoInConfig::load_defaults(BC_Hash *defaults)
247 driver = defaults->get("VIDEO_IN_DRIVER", driver);
248 defaults->get("V4L_IN_DEVICE", v4l_in_device);
249 defaults->get("V4L2_IN_DEVICE", v4l2_in_device);
250 defaults->get("V4L2JPEG_IN_DEVICE", v4l2jpeg_in_device);
251 defaults->get("LML_IN_DEVICE", lml_in_device);
252 defaults->get("BUZ_IN_DEVICE", buz_in_device);
253 defaults->get("SCREENCAPTURE_DISPLAY", screencapture_display);
255 defaults->get("DVB_IN_HOST", dvb_in_host);
256 dvb_in_port = defaults->get("DVB_IN_PORT", dvb_in_port);
257 dvb_in_number = defaults->get("DVB_IN_NUMBER", dvb_in_number);
259 firewire_port = defaults->get("VFIREWIRE_IN_PORT", firewire_port);
260 firewire_channel = defaults->get("VFIREWIRE_IN_CHANNEL", firewire_channel);
261 defaults->get("VFIREWIRE_IN_PATH", firewire_path);
262 capture_length = defaults->get("VIDEO_CAPTURE_LENGTH", capture_length);
263 w = defaults->get("RECORD_W", w);
264 h = defaults->get("RECORD_H", h);
265 in_framerate = defaults->get("IN_FRAMERATE", in_framerate);
269 int VideoInConfig::save_defaults(BC_Hash *defaults)
271 defaults->update("VIDEO_IN_DRIVER", driver);
272 defaults->update("V4L_IN_DEVICE", v4l_in_device);
273 defaults->update("V4L2_IN_DEVICE", v4l2_in_device);
274 defaults->update("V4L2JPEG_IN_DEVICE", v4l2jpeg_in_device);
275 defaults->update("LML_IN_DEVICE", lml_in_device);
276 defaults->update("BUZ_IN_DEVICE", buz_in_device);
277 defaults->update("SCREENCAPTURE_DISPLAY", screencapture_display);
282 defaults->update("DVB_IN_HOST", dvb_in_host);
283 defaults->update("DVB_IN_PORT", dvb_in_port);
284 defaults->update("DVB_IN_NUMBER", dvb_in_number);
290 defaults->update("VFIREWIRE_IN_PORT", firewire_port);
291 defaults->update("VFIREWIRE_IN_CHANNEL", firewire_channel);
292 defaults->update("VFIREWIRE_IN_PATH", firewire_path);
293 defaults->update("VIDEO_CAPTURE_LENGTH", capture_length);
294 defaults->update("RECORD_W", w);
295 defaults->update("RECORD_H", h);
296 defaults->update("IN_FRAMERATE", in_framerate);
303 // c-file-style: "linux"