r1009: Move the dependencies to newer package names
[cinelerra_cv/mob.git] / cinelerra / iec61883output.h
blob23431f3f84de9a70295dd97db1d5cd29b41ab45c
1 #ifndef IEC61883OUTPUT_H
2 #define IEC61883OUTPUT_H
6 #ifdef HAVE_FIREWIRE
8 #include "audiodevice.inc"
9 #include "condition.inc"
10 #include <libiec61883/iec61883.h>
11 #include "libdv.h"
12 #include "mutex.inc"
13 #include "thread.h"
14 #include "vframe.inc"
15 #include "videodevice.inc"
17 // Common 1394 output for audio and video
19 // This runs continuously to keep the VTR warm.
20 // Takes encoded DV frames and PCM audio.
21 class IEC61883Output : public Thread
23 public:
24 IEC61883Output(VideoDevice *vdevice);
25 IEC61883Output(AudioDevice *adevice);
26 ~IEC61883Output();
28 void reset();
29 int open(int port,
30 int channel,
31 int length,
32 int channels,
33 int bits,
34 int samplerate,
35 int syt);
36 void start();
37 void run();
40 // Write frame with timed blocking.
42 void write_frame(VFrame *input);
45 // Write audio with timed blocking.
47 void write_samples(char *data, int samples);
48 long get_audio_position();
49 void interrupt();
50 void flush();
54 void increment_counter(int *counter);
55 void decrement_counter(int *counter);
56 int read_frame(unsigned char *data, int n, unsigned int dropped);
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 fd;
86 raw1394handle_t handle;
87 iec61883_dv_t frame;
88 // Must break up each frame into 480 byte chunks again.
89 char *out_buffer;
90 int out_size;
91 int out_position;
97 VFrame *temp_frame, *temp_frame2;
98 // Encoder for making DV frames
99 dv_t *audio_encoder;
100 dv_t *video_encoder;
101 unsigned char *output_buffer;
102 int output_number;
103 unsigned int packet_sizes[321];
104 unsigned char continuity_counter;
105 int unused_buffers;
106 int avc_id;
107 int channels;
108 int samplerate;
109 int bits;
110 int syt;
111 long audio_position;
112 int interrupted;
113 int have_video;
114 int is_pal;
115 VideoDevice *vdevice;
116 AudioDevice *adevice;
125 #endif
131 #endif