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, "");
160 firewire_channel = 63;
161 sprintf(firewire_path, "/dev/dv1394");
162 // number of frames to read from device during video recording.
163 // capture_length = 15;
167 in_framerate = 29.97;
170 VideoInConfig::~VideoInConfig()
174 char* VideoInConfig::get_path()
179 return v4l_in_device;
182 return v4l2_in_device;
184 case VIDEO4LINUX2JPEG:
185 return v4l2jpeg_in_device;
188 return buz_in_device;
191 return v4l_in_device;
194 void VideoInConfig::copy_from(VideoInConfig *src)
196 driver = src->driver;
197 strcpy(v4l_in_device, src->v4l_in_device);
198 strcpy(v4l2_in_device, src->v4l2_in_device);
199 strcpy(v4l2jpeg_in_device, src->v4l2jpeg_in_device);
200 strcpy(lml_in_device, src->lml_in_device);
201 strcpy(buz_in_device, src->buz_in_device);
202 strcpy(screencapture_display, src->screencapture_display);
203 firewire_port = src->firewire_port;
204 firewire_channel = src->firewire_channel;
205 strcpy(firewire_path, src->firewire_path);
206 capture_length = src->capture_length;
209 in_framerate = src->in_framerate;
212 VideoInConfig& VideoInConfig::operator=(VideoInConfig &that)
218 int VideoInConfig::load_defaults(BC_Hash *defaults)
220 driver = defaults->get("VIDEO_IN_DRIVER", driver);
221 defaults->get("V4L_IN_DEVICE", v4l_in_device);
222 defaults->get("V4L2_IN_DEVICE", v4l2_in_device);
223 defaults->get("V4L2JPEG_IN_DEVICE", v4l2jpeg_in_device);
224 defaults->get("LML_IN_DEVICE", lml_in_device);
225 defaults->get("BUZ_IN_DEVICE", buz_in_device);
226 defaults->get("SCREENCAPTURE_DISPLAY", screencapture_display);
227 firewire_port = defaults->get("VFIREWIRE_IN_PORT", firewire_port);
228 firewire_channel = defaults->get("VFIREWIRE_IN_CHANNEL", firewire_channel);
229 defaults->get("VFIREWIRE_IN_PATH", firewire_path);
230 capture_length = defaults->get("VIDEO_CAPTURE_LENGTH", capture_length);
231 w = defaults->get("RECORD_W", w);
232 h = defaults->get("RECORD_H", h);
233 in_framerate = defaults->get("IN_FRAMERATE", in_framerate);
237 int VideoInConfig::save_defaults(BC_Hash *defaults)
239 defaults->update("VIDEO_IN_DRIVER", driver);
240 defaults->update("V4L_IN_DEVICE", v4l_in_device);
241 defaults->update("V4L2_IN_DEVICE", v4l2_in_device);
242 defaults->update("V4L2JPEG_IN_DEVICE", v4l2jpeg_in_device);
243 defaults->update("LML_IN_DEVICE", lml_in_device);
244 defaults->update("BUZ_IN_DEVICE", buz_in_device);
245 defaults->update("SCREENCAPTURE_DISPLAY", screencapture_display);
246 defaults->update("VFIREWIRE_IN_PORT", firewire_port);
247 defaults->update("VFIREWIRE_IN_CHANNEL", firewire_channel);
248 defaults->update("VFIREWIRE_IN_PATH", firewire_path);
249 defaults->update("VIDEO_CAPTURE_LENGTH", capture_length);
250 defaults->update("RECORD_W", w);
251 defaults->update("RECORD_H", h);
252 defaults->update("IN_FRAMERATE", in_framerate);