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, "");
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 AudioInConfig& AudioInConfig::operator=(AudioInConfig &that)
66 firewire_port = that.firewire_port;
67 firewire_channel = that.firewire_channel;
68 strcpy(firewire_path, that.firewire_path);
70 strcpy(esound_in_server, that.esound_in_server);
71 esound_in_port = that.esound_in_port;
73 for(int i = 0; i < MAXDEVICES; i++)
75 oss_enable[i] = that.oss_enable[i];
76 strcpy(oss_in_device[i], that.oss_in_device[i]);
77 oss_in_channels[i] = that.oss_in_channels[i];
78 oss_in_bits = that.oss_in_bits;
81 strcpy(alsa_in_device, that.alsa_in_device);
82 alsa_in_bits = that.alsa_in_bits;
83 alsa_in_channels = that.alsa_in_channels;
84 in_samplerate = that.in_samplerate;
88 int AudioInConfig::load_defaults(Defaults *defaults)
90 char string[BCTEXTLEN];
91 driver = defaults->get("AUDIOINDRIVER", driver);
92 firewire_port = defaults->get("AFIREWIRE_IN_PORT", firewire_port);
93 firewire_channel = defaults->get("AFIREWIRE_IN_CHANNEL", firewire_channel);
94 defaults->get("AFIREWIRE_IN_PATH", firewire_path);
95 for(int i = 0; i < MAXDEVICES; i++)
97 sprintf(string, "OSS_ENABLE_%d", i);
98 oss_enable[i] = defaults->get(string, oss_enable[i]);
99 sprintf(string, "OSS_IN_DEVICE_%d", i);
100 defaults->get(string, oss_in_device[i]);
101 sprintf(string, "OSS_IN_CHANNELS_%d", i);
102 oss_in_channels[i] = defaults->get(string, oss_in_channels[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 alsa_in_channels = defaults->get("ALSA_IN_CHANNELS", alsa_in_channels);
112 in_samplerate = defaults->get("IN_SAMPLERATE", in_samplerate);
116 int AudioInConfig::save_defaults(Defaults *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]);
130 sprintf(string, "OSS_IN_CHANNELS_%d", i);
131 defaults->update(string, oss_in_channels[i]);
134 sprintf(string, "OSS_IN_BITS");
135 defaults->update(string, oss_in_bits);
136 defaults->update("ESOUND_IN_SERVER", esound_in_server);
137 defaults->update("ESOUND_IN_PORT", esound_in_port);
139 defaults->update("ALSA_IN_DEVICE", alsa_in_device);
140 defaults->update("ALSA_IN_BITS", alsa_in_bits);
141 defaults->update("ALSA_IN_CHANNELS", alsa_in_channels);
142 defaults->update("IN_SAMPLERATE", in_samplerate);
152 VideoInConfig::VideoInConfig()
154 driver = VIDEO4LINUX;
155 sprintf(v4l_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/raw1394");
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 buz_in_device;
185 return v4l_in_device;
188 VideoInConfig& VideoInConfig::operator=(VideoInConfig &that)
190 driver = that.driver;
191 strcpy(v4l_in_device, that.v4l_in_device);
192 strcpy(lml_in_device, that.lml_in_device);
193 strcpy(buz_in_device, that.buz_in_device);
194 strcpy(screencapture_display, that.screencapture_display);
195 firewire_port = that.firewire_port;
196 firewire_channel = that.firewire_channel;
197 strcpy(firewire_path, that.firewire_path);
198 capture_length = that.capture_length;
201 in_framerate = that.in_framerate;
205 int VideoInConfig::load_defaults(Defaults *defaults)
207 driver = defaults->get("VIDEO_IN_DRIVER", driver);
208 defaults->get("V4L_IN_DEVICE", v4l_in_device);
209 defaults->get("LML_IN_DEVICE", lml_in_device);
210 defaults->get("BUZ_IN_DEVICE", buz_in_device);
211 defaults->get("SCREENCAPTURE_DISPLAY", screencapture_display);
212 firewire_port = defaults->get("VFIREWIRE_IN_PORT", firewire_port);
213 firewire_channel = defaults->get("VFIREWIRE_IN_CHANNEL", firewire_channel);
214 defaults->get("VFIREWIRE_IN_PATH", firewire_path);
215 capture_length = defaults->get("VIDEO_CAPTURE_LENGTH", capture_length);
216 w = defaults->get("RECORD_W", w);
217 h = defaults->get("RECORD_H", h);
218 in_framerate = defaults->get("IN_FRAMERATE", in_framerate);
222 int VideoInConfig::save_defaults(Defaults *defaults)
224 defaults->update("VIDEO_IN_DRIVER", driver);
225 defaults->update("V4L_IN_DEVICE", v4l_in_device);
226 defaults->update("LML_IN_DEVICE", lml_in_device);
227 defaults->update("BUZ_IN_DEVICE", buz_in_device);
228 defaults->update("SCREENCAPTURE_DISPLAY", screencapture_display);
229 defaults->update("VFIREWIRE_IN_PORT", firewire_port);
230 defaults->update("VFIREWIRE_IN_CHANNEL", firewire_channel);
231 defaults->update("VFIREWIRE_IN_PATH", firewire_path);
232 defaults->update("VIDEO_CAPTURE_LENGTH", capture_length);
233 defaults->update("RECORD_W", w);
234 defaults->update("RECORD_H", h);
235 defaults->update("IN_FRAMERATE", in_framerate);