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");
19 oss_in_channels[i] = 2;
23 firewire_channel = 63;
24 strcpy(firewire_path, "/dev/raw1394");
25 sprintf(esound_in_server, "");
28 sprintf(alsa_in_device, "default");
31 in_samplerate = 48000;
34 AudioInConfig::~AudioInConfig()
38 int AudioInConfig::is_duplex(AudioInConfig *in, AudioOutConfig *out)
40 if(in->driver == out->driver)
45 case AUDIO_OSS_ENVY24:
46 return (!strcmp(in->oss_in_device[0], out->oss_out_device[0]) &&
47 in->oss_in_bits == out->oss_out_bits &&
48 in->oss_in_channels[0] == out->oss_out_channels[0]);
51 // ALSA always opens 2 devices
62 void AudioInConfig::copy_from(AudioInConfig *src)
66 firewire_port = src->firewire_port;
67 firewire_channel = src->firewire_channel;
68 strcpy(firewire_path, src->firewire_path);
70 strcpy(esound_in_server, src->esound_in_server);
71 esound_in_port = src->esound_in_port;
73 for(int i = 0; i < MAXDEVICES; i++)
75 oss_enable[i] = src->oss_enable[i];
76 strcpy(oss_in_device[i], src->oss_in_device[i]);
77 oss_in_channels[i] = src->oss_in_channels[i];
78 oss_in_bits = src->oss_in_bits;
81 strcpy(alsa_in_device, src->alsa_in_device);
82 alsa_in_bits = src->alsa_in_bits;
83 alsa_in_channels = src->alsa_in_channels;
84 in_samplerate = src->in_samplerate;
87 AudioInConfig& AudioInConfig::operator=(AudioInConfig &that)
93 int AudioInConfig::load_defaults(Defaults *defaults)
95 char string[BCTEXTLEN];
96 driver = defaults->get("AUDIOINDRIVER", driver);
97 firewire_port = defaults->get("AFIREWIRE_IN_PORT", firewire_port);
98 firewire_channel = defaults->get("AFIREWIRE_IN_CHANNEL", firewire_channel);
99 defaults->get("AFIREWIRE_IN_PATH", firewire_path);
100 for(int i = 0; i < MAXDEVICES; i++)
102 sprintf(string, "OSS_ENABLE_%d", i);
103 oss_enable[i] = defaults->get(string, oss_enable[i]);
104 sprintf(string, "OSS_IN_DEVICE_%d", i);
105 defaults->get(string, oss_in_device[i]);
106 sprintf(string, "OSS_IN_CHANNELS_%d", i);
107 oss_in_channels[i] = defaults->get(string, oss_in_channels[i]);
109 sprintf(string, "OSS_IN_BITS");
110 oss_in_bits = defaults->get(string, oss_in_bits);
111 defaults->get("ESOUND_IN_SERVER", esound_in_server);
112 esound_in_port = defaults->get("ESOUND_IN_PORT", esound_in_port);
114 defaults->get("ALSA_IN_DEVICE", alsa_in_device);
115 alsa_in_bits = defaults->get("ALSA_IN_BITS", alsa_in_bits);
116 alsa_in_channels = defaults->get("ALSA_IN_CHANNELS", alsa_in_channels);
117 in_samplerate = defaults->get("IN_SAMPLERATE", in_samplerate);
121 int AudioInConfig::save_defaults(Defaults *defaults)
123 char string[BCTEXTLEN];
124 defaults->update("AUDIOINDRIVER", driver);
125 defaults->update("AFIREWIRE_IN_PORT", firewire_port);
126 defaults->update("AFIREWIRE_IN_CHANNEL", firewire_channel);
127 defaults->update("AFIREWIRE_IN_PATH", firewire_path);
129 for(int i = 0; i < MAXDEVICES; i++)
131 sprintf(string, "OSS_ENABLE_%d", i);
132 defaults->update(string, oss_enable[i]);
133 sprintf(string, "OSS_IN_DEVICE_%d", i);
134 defaults->update(string, oss_in_device[i]);
135 sprintf(string, "OSS_IN_CHANNELS_%d", i);
136 defaults->update(string, oss_in_channels[i]);
139 sprintf(string, "OSS_IN_BITS");
140 defaults->update(string, oss_in_bits);
141 defaults->update("ESOUND_IN_SERVER", esound_in_server);
142 defaults->update("ESOUND_IN_PORT", esound_in_port);
144 defaults->update("ALSA_IN_DEVICE", alsa_in_device);
145 defaults->update("ALSA_IN_BITS", alsa_in_bits);
146 defaults->update("ALSA_IN_CHANNELS", alsa_in_channels);
147 defaults->update("IN_SAMPLERATE", in_samplerate);
157 VideoInConfig::VideoInConfig()
159 driver = VIDEO4LINUX;
160 sprintf(v4l_in_device, "/dev/video0");
161 sprintf(v4l2_in_device, "/dev/video0");
162 sprintf(v4l2jpeg_in_device, "/dev/video0");
163 sprintf(lml_in_device, "/dev/mvideo/stream");
164 sprintf(buz_in_device, "/dev/video0");
165 sprintf(screencapture_display, "");
167 firewire_channel = 63;
168 sprintf(firewire_path, "/dev/raw1394");
169 // number of frames to read from device during video recording.
170 // capture_length = 15;
174 in_framerate = 29.97;
177 VideoInConfig::~VideoInConfig()
181 char* VideoInConfig::get_path()
186 return v4l_in_device;
189 return v4l2_in_device;
191 case VIDEO4LINUX2JPEG:
192 return v4l2jpeg_in_device;
195 return buz_in_device;
198 return v4l_in_device;
201 void VideoInConfig::copy_from(VideoInConfig *src)
203 driver = src->driver;
204 strcpy(v4l_in_device, src->v4l_in_device);
205 strcpy(v4l2_in_device, src->v4l2_in_device);
206 strcpy(v4l2jpeg_in_device, src->v4l2jpeg_in_device);
207 strcpy(lml_in_device, src->lml_in_device);
208 strcpy(buz_in_device, src->buz_in_device);
209 strcpy(screencapture_display, src->screencapture_display);
210 firewire_port = src->firewire_port;
211 firewire_channel = src->firewire_channel;
212 strcpy(firewire_path, src->firewire_path);
213 capture_length = src->capture_length;
216 in_framerate = src->in_framerate;
219 VideoInConfig& VideoInConfig::operator=(VideoInConfig &that)
225 int VideoInConfig::load_defaults(Defaults *defaults)
227 driver = defaults->get("VIDEO_IN_DRIVER", driver);
228 defaults->get("V4L_IN_DEVICE", v4l_in_device);
229 defaults->get("V4L2_IN_DEVICE", v4l2_in_device);
230 defaults->get("V4L2JPEG_IN_DEVICE", v4l2jpeg_in_device);
231 defaults->get("LML_IN_DEVICE", lml_in_device);
232 defaults->get("BUZ_IN_DEVICE", buz_in_device);
233 defaults->get("SCREENCAPTURE_DISPLAY", screencapture_display);
234 firewire_port = defaults->get("VFIREWIRE_IN_PORT", firewire_port);
235 firewire_channel = defaults->get("VFIREWIRE_IN_CHANNEL", firewire_channel);
236 defaults->get("VFIREWIRE_IN_PATH", firewire_path);
237 capture_length = defaults->get("VIDEO_CAPTURE_LENGTH", capture_length);
238 w = defaults->get("RECORD_W", w);
239 h = defaults->get("RECORD_H", h);
240 in_framerate = defaults->get("IN_FRAMERATE", in_framerate);
244 int VideoInConfig::save_defaults(Defaults *defaults)
246 defaults->update("VIDEO_IN_DRIVER", driver);
247 defaults->update("V4L_IN_DEVICE", v4l_in_device);
248 defaults->update("V4L2_IN_DEVICE", v4l2_in_device);
249 defaults->update("V4L2JPEG_IN_DEVICE", v4l2jpeg_in_device);
250 defaults->update("LML_IN_DEVICE", lml_in_device);
251 defaults->update("BUZ_IN_DEVICE", buz_in_device);
252 defaults->update("SCREENCAPTURE_DISPLAY", screencapture_display);
253 defaults->update("VFIREWIRE_IN_PORT", firewire_port);
254 defaults->update("VFIREWIRE_IN_CHANNEL", firewire_channel);
255 defaults->update("VFIREWIRE_IN_PATH", firewire_path);
256 defaults->update("VIDEO_CAPTURE_LENGTH", capture_length);
257 defaults->update("RECORD_W", w);
258 defaults->update("RECORD_H", h);
259 defaults->update("IN_FRAMERATE", in_framerate);