r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / device1394output.h
blob38f83fe20f68eae950a9fda81150f1a661a9c96a
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"
14 #include <libdv/dv1394.h>
16 // Common 1394 output for audio and video
18 // This runs continuously to keep the VTR warm.
19 // Takes encoded DV frames and PCM audio. Does the 1394 encryption on the fly.
20 class Device1394Output : public Thread
22 public:
23 Device1394Output();
24 ~Device1394Output();
26 int open(char *path,
27 int port,
28 int channel,
29 int length,
30 int channels,
31 int bits,
32 int samplerate,
33 int syt,
34 int use_dv1394);
35 void start();
36 void run();
39 // Write frame with timed blocking.
41 void write_frame(VFrame *input);
44 // Write audio with timed blocking.
46 void write_samples(char *data, int samples);
47 long get_audio_position();
48 void interrupt();
49 void flush();
52 void encrypt(unsigned char *output,
53 unsigned char *data,
54 int data_size);
57 void increment_counter(int *counter);
58 void decrement_counter(int *counter);
61 char **buffer;
62 int *buffer_size;
63 int *buffer_valid;
65 int total_buffers;
66 int current_inbuffer;
67 int current_outbuffer;
69 char *audio_buffer;
70 int audio_samples;
71 // Encoder for audio frames
72 dv_t *encoder;
74 Mutex *buffer_lock;
75 // Block while waiting for the first buffer to be allocated
76 Condition *start_lock;
77 Mutex *position_lock;
79 // Provide timed blocking for writing routines.
81 Condition *video_lock;
82 Condition *audio_lock;
83 int done;
86 // Output
87 int output_fd;
88 struct dv1394_status status;
89 struct video1394_mmap output_mmap;
90 struct video1394_queue_variable output_queue;
91 // raw1394handle_t avc_handle;
92 VFrame *temp_frame, *temp_frame2;
93 // Encoder for making DV frames
94 dv_t *audio_encoder;
95 dv_t *video_encoder;
96 unsigned int cip_n, cip_d;
97 unsigned int cip_counter;
98 unsigned char f50_60;
99 Device1394Output *output_thread;
100 unsigned char *output_buffer;
101 int output_number;
102 unsigned int packet_sizes[321];
103 unsigned char continuity_counter;
104 int unused_buffers;
105 int avc_id;
106 int channels;
107 int samplerate;
108 int bits;
109 int syt;
110 long audio_position;
111 int interrupted;
112 int have_video;
113 int use_dv1394;
119 #endif
125 #endif