r121: This commit was manufactured by cvs2svn to create tag
[cinelerra_cv/mob.git] / hvirtual / cinelerra / device1394output.h
blob9a6b7fe3543019d6f6ed686743aa74ee9adb1b74
1 #ifndef DEVICE1394OUTPUT_H
2 #define DEVICE1394OUTPUT_H
6 #ifdef HAVE_FIREWIRE
8 #include "condition.inc"
9 #include "libdv.h"
10 #include "mutex.inc"
11 #include "thread.h"
12 #include "vframe.inc"
13 #include "video1394.h"
15 // Common 1394 output for audio and video
17 // This runs continuously to keep the VTR warm.
18 // Takes encoded DV frames and PCM audio. Does the 1394 encryption on the fly.
19 class Device1394Output : public Thread
21 public:
22 Device1394Output();
23 ~Device1394Output();
25 int open(char *path,
26 int port,
27 int channel,
28 int length,
29 int channels,
30 int bits,
31 int samplerate,
32 int syt);
33 void start();
34 void run();
37 // Write frame with timed blocking.
39 void write_frame(VFrame *input);
42 // Write audio with timed blocking.
44 void write_samples(char *data, int samples);
45 long get_audio_position();
46 void interrupt();
47 void flush();
50 void encrypt(unsigned char *output,
51 unsigned char *data,
52 int data_size);
55 void increment_counter(int *counter);
56 void decrement_counter(int *counter);
59 char **buffer;
60 int *buffer_size;
61 int *buffer_valid;
63 int total_buffers;
64 int current_inbuffer;
65 int current_outbuffer;
67 char *audio_buffer;
68 int audio_samples;
69 // Encoder for audio frames
70 dv_t *encoder;
72 Mutex *buffer_lock;
73 // Block while waiting for the first buffer to be allocated
74 Condition *start_lock;
75 Mutex *position_lock;
77 // Provide timed blocking for writing routines.
79 Condition *video_lock;
80 Condition *audio_lock;
81 int done;
84 // Output
85 int output_fd;
86 struct video1394_mmap output_mmap;
87 struct video1394_queue_variable output_queue;
88 // raw1394handle_t avc_handle;
89 VFrame *temp_frame, *temp_frame2;
90 // Encoder for making DV frames
91 dv_t *audio_encoder;
92 dv_t *video_encoder;
93 unsigned int cip_n, cip_d;
94 unsigned int cip_counter;
95 unsigned char f50_60;
96 Device1394Output *output_thread;
97 unsigned char *output_buffer;
98 int output_number;
99 unsigned int packet_sizes[321];
100 unsigned char continuity_counter;
101 int unused_buffers;
102 int avc_id;
103 int channels;
104 int samplerate;
105 int bits;
106 int syt;
107 long audio_position;
108 int interrupted;
109 int have_video;
115 #endif
121 #endif