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;
75 //printf("Audio1394::open_output 1 %s\n", device->out_config->firewire_path);
76 output_thread->open(device->out_config->firewire_path,
77 device->out_config->firewire_port,
78 device->out_config->firewire_channel,
82 device->out_samplerate,
83 device->out_config->firewire_syt,
84 device->out_config->firewire_use_dv1394);
88 int Audio1394::close_all()
105 int Audio1394::read_buffer(char *buffer, int bytes)
109 input_thread->read_audio(buffer, bytes / bytes_per_sample);
115 int Audio1394::write_buffer(char *buffer, int bytes)
118 output_thread->write_samples(buffer, bytes / bytes_per_sample);
122 int64_t Audio1394::device_position()
125 return output_thread->get_audio_position();
131 int Audio1394::flush_device()
134 output_thread->flush();
138 int Audio1394::interrupt_playback()
141 output_thread->interrupt();