1 #ifndef DEVICE1394OUTPUT_H
2 #define DEVICE1394OUTPUT_H
8 #include "audiodevice.inc"
9 #include "condition.inc"
12 #include "ieee1394-ioctl.h"
16 #include "video1394.h"
17 #include "videodevice.inc"
19 // Common 1394 output for audio and video
21 // This runs continuously to keep the VTR warm.
22 // Takes encoded DV frames and PCM audio. Does the 1394 encryption on the fly.
23 class Device1394Output
: public Thread
26 Device1394Output(VideoDevice
*vdevice
);
27 Device1394Output(AudioDevice
*adevice
);
43 // Write frame with timed blocking.
45 void write_frame(VFrame
*input
);
48 // Write audio with timed blocking.
50 void write_samples(char *data
, int samples
);
51 long get_audio_position();
55 // This object is shared between audio and video. Return what the driver is
56 // based on whether vdevice or adevice exists.
59 // Set IOCTL numbers based on kernel version
62 void encrypt(unsigned char *output
,
67 void increment_counter(int *counter
);
68 void decrement_counter(int *counter
);
77 int current_outbuffer
;
81 // Encoder for audio frames
85 // Block while waiting for the first buffer to be allocated
86 Condition
*start_lock
;
89 // Provide timed blocking for writing routines.
91 Condition
*video_lock
;
92 Condition
*audio_lock
;
94 struct dv1394_status status
;
99 struct video1394_mmap output_mmap
;
100 struct video1394_queue_variable output_queue
;
101 // raw1394handle_t avc_handle;
102 VFrame
*temp_frame
, *temp_frame2
;
103 // Encoder for making DV frames
106 unsigned int cip_n
, cip_d
;
107 unsigned int cip_counter
;
108 unsigned char f50_60
;
109 unsigned char *output_buffer
;
111 unsigned int packet_sizes
[321];
112 unsigned char continuity_counter
;
123 VideoDevice
*vdevice
;
124 AudioDevice
*adevice
;
128 int video1394_listen_channel
;
129 int video1394_unlisten_channel
;
130 int video1394_listen_queue_buffer
;
131 int video1394_listen_wait_buffer
;
132 int video1394_talk_channel
;
133 int video1394_untalk_channel
;
134 int video1394_talk_queue_buffer
;
135 int video1394_talk_wait_buffer
;
136 int video1394_listen_poll_buffer
;
138 // To keep track of the delay between putting the audio in the buffer
139 // and when it is actually presented on the DV device
140 long *position_presented
;