3 #include "audioconfig.h"
4 #include "audiodevice.h"
5 #include "device1394input.h"
6 #include "device1394output.h"
7 #include "iec61883input.h"
8 #include "iec61883output.h"
10 #include "preferences.h"
11 #include "recordconfig.h"
12 #include "vdevice1394.h"
14 #include "playbackconfig.h"
15 #include "videodevice.h"
27 VDevice1394::VDevice1394(VideoDevice *device)
33 VDevice1394::~VDevice1394()
38 int VDevice1394::initialize()
47 int VDevice1394::open_input()
49 // Share audio driver. The audio driver does the capturing in this case
50 // and fills video frames for us.
53 (device->adevice->in_config->driver == AUDIO_1394 ||
54 device->adevice->in_config->driver == AUDIO_DV1394 ||
55 device->adevice->in_config->driver == AUDIO_IEC61883))
57 Audio1394 *low_level = (Audio1394*)device->adevice->get_lowlevel_in();
58 input_thread = low_level->input_thread;
59 input_iec = low_level->input_iec;
63 if(!input_thread && !input_iec)
65 if(device->in_config->driver == CAPTURE_FIREWIRE)
67 input_thread = new Device1394Input;
68 result = input_thread->open(device->in_config->firewire_port,
69 device->in_config->firewire_channel,
70 device->in_config->capture_length,
75 device->in_config->h);
84 input_iec = new IEC61883Input;
85 result = input_iec->open(device->in_config->firewire_port,
86 device->in_config->firewire_channel,
87 device->in_config->capture_length,
92 device->in_config->h);
103 int VDevice1394::open_output()
105 // Share audio driver. The audio driver takes DV frames from us and
107 if(device->adevice &&
108 (device->adevice->out_config->driver == AUDIO_1394 ||
109 device->adevice->out_config->driver == AUDIO_DV1394 ||
110 device->adevice->out_config->driver == AUDIO_IEC61883))
112 Audio1394 *low_level = (Audio1394*)device->adevice->get_lowlevel_out();
113 output_thread = low_level->output_thread;
114 output_iec = low_level->output_iec;
118 if(!output_thread && !output_iec)
120 if(device->out_config->driver == PLAYBACK_DV1394)
122 output_thread = new Device1394Output(device);
123 output_thread->open(device->out_config->dv1394_path,
124 device->out_config->dv1394_port,
125 device->out_config->dv1394_channel,
130 device->out_config->dv1394_syt);
133 if(device->out_config->driver == PLAYBACK_FIREWIRE)
135 output_thread = new Device1394Output(device);
136 output_thread->open(device->out_config->firewire_path,
137 device->out_config->firewire_port,
138 device->out_config->firewire_channel,
143 device->out_config->firewire_syt);
147 output_iec = new IEC61883Output(device);
148 output_iec->open(device->out_config->firewire_port,
149 device->out_config->firewire_channel,
154 device->out_config->firewire_syt);
161 int VDevice1394::close_all()
180 delete output_thread;
194 if(user_frame) delete user_frame;
200 int VDevice1394::read_buffer(VFrame *frame)
205 if(!input_thread && !input_iec) return 1;
207 if(input_thread) input_thread->read_video(frame);
209 if(input_iec) input_iec->read_video(frame);
215 void VDevice1394::new_output_buffer(VFrame **outputs,
220 if(colormodel != user_frame->get_color_model())
232 user_frame = new VFrame;
235 user_frame = new VFrame(0,
243 user_frame->set_shm_offset(0);
244 outputs[0] = user_frame;
247 int VDevice1394::write_buffer(VFrame **frame, EDL *edl)
249 if(output_thread) output_thread->write_frame(frame[0]);
251 if(output_iec) output_iec->write_frame(frame[0]);
258 int VDevice1394::can_copy_from(Asset *asset, int output_w, int output_h)
273 #endif // HAVE_FIREWIRE