r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / device1394input.h
blob31b2aec7dc4e6efaef737aabf2dab4bdec8077ca
1 #ifndef DEVICE1394INPUT_H
2 #define DEVICE1394INPUT_H
6 #ifdef HAVE_FIREWIRE
8 #include "condition.inc"
9 #include "libdv.h"
10 #include "mutex.inc"
11 #include "raw1394.h"
12 #include "thread.h"
13 #include "vframe.inc"
15 // Common 1394 output for audio and video
17 // Extracts video and audio from the single DV stream
18 class Device1394Input : public Thread
20 public:
21 Device1394Input();
22 ~Device1394Input();
24 int Device1394Input::open(int port,
25 int channel,
26 int length,
27 int channels,
28 int samplerate,
29 int bits);
30 void run();
31 void increment_counter(int *counter);
32 void decrement_counter(int *counter);
34 static int dv_iso_handler(raw1394handle_t handle,
35 int channel,
36 size_t length,
37 quadlet_t *data);
38 static bus_reset_handler_t dv_reset_handler(raw1394handle_t handle,
39 unsigned int generation);
41 // Read a video frame with timed blocking
43 int read_video(VFrame *data);
46 // Read audio with timed blocking
48 int read_audio(char *data, int samples);
50 // Storage of currently downloading frame
51 char *temp;
52 int bytes_read;
54 // Storage of all frames
55 char **buffer;
56 int *buffer_valid;
57 int buffer_size;
58 int total_buffers;
59 int current_inbuffer;
61 // For extracting audio
62 dv_t *decoder;
64 // Storage of audio data
65 char *audio_buffer;
66 int audio_samples;
68 // number of next video buffer to read
69 int current_outbuffer;
71 Mutex *buffer_lock;
72 Condition *video_lock;
73 Condition *audio_lock;
74 int done;
76 raw1394handle_t handle;
77 int channel;
78 int length;
79 int channels;
80 int samplerate;
81 int bits;
88 #endif
92 #endif