8 #include "playbackconfig.h"
9 #include "device1394input.h"
10 #include "device1394output.h"
11 #include "preferences.h"
12 #include "recordconfig.h"
13 #include "videoconfig.h"
14 #include "videodevice.h"
16 #define SAMPLES_PER_FRAME 2048
18 Audio1394::Audio1394(AudioDevice *device)
19 : AudioLowLevel(device)
25 Audio1394::~Audio1394()
30 int Audio1394::initialize()
36 int Audio1394::open_input()
41 // Lock the channels for the DV format
42 device->in_channels = 2;
44 bytes_per_sample = device->in_channels * device->in_bits / 8;
47 input_thread = new Device1394Input;
48 result = input_thread->open(device->in_config->firewire_port,
49 device->in_config->firewire_channel,
52 device->in_samplerate,
64 int Audio1394::open_output()
68 // Lock the channels for the DV format
69 device->out_channels = 2;
70 device->out_bits = 16;
71 bytes_per_sample = device->out_channels * device->out_bits / 8;
73 output_thread = new Device1394Output(device);
75 if(device->driver == AUDIO_DV1394)
77 output_thread->open(device->out_config->dv1394_path,
78 device->out_config->dv1394_port,
79 device->out_config->dv1394_channel,
83 device->out_samplerate,
84 device->out_config->dv1394_syt);
88 output_thread->open(device->out_config->firewire_path,
89 device->out_config->firewire_port,
90 device->out_config->firewire_channel,
94 device->out_samplerate,
95 device->out_config->firewire_syt);
100 int Audio1394::close_all()
109 delete output_thread;
117 int Audio1394::read_buffer(char *buffer, int bytes)
121 input_thread->read_audio(buffer, bytes / bytes_per_sample);
127 int Audio1394::write_buffer(char *buffer, int bytes)
130 output_thread->write_samples(buffer, bytes / bytes_per_sample);
134 int64_t Audio1394::device_position()
137 return output_thread->get_audio_position();
143 int Audio1394::flush_device()
146 output_thread->flush();
150 int Audio1394::interrupt_playback()
153 output_thread->interrupt();