6 #include "condition.inc"
11 #include "vdevicebase.h"
12 #include "vdevicebuz.inc"
16 #define INPUT_BUFFER_SIZE 0x40000
18 // Let's get real. The Buz driver doesn't work. If the buffers overflow
19 // for enough time it locks up and can't be recovered except by a
20 // SIGINT and restart. We need to cascade the buffer reading in another
21 // ring buffer thread, have it read continuously, and cancel it if it
22 // dies. How about if we do this in SCHED_RR and wait for it to die before
23 // implementing cancellation?
26 class VDeviceBUZInput
: public Thread
29 VDeviceBUZInput(VDeviceBUZ
*device
);
33 void get_buffer(char **ptr
, int *size
);
35 void increment_counter(int *counter
);
36 void decrement_counter(int *counter
);
43 int current_outbuffer
;
44 Condition
*output_lock
;
50 class VDeviceBUZ
: public VDeviceBase
53 VDeviceBUZ(VideoDevice
*device
);
56 friend class VDeviceBUZInput
;
61 int read_buffer(VFrame
*frame
);
62 int write_buffer(VFrame
*frames
, EDL
*edl
);
63 int reset_parameters();
64 ArrayList
<int>* get_render_strategies();
65 int set_channel(Channel
*channel
);
66 int get_norm(int norm
);
67 static void get_inputs(ArrayList
<Channel
*> *input_sources
);
68 int set_picture(PictureConfig
*picture
);
69 int get_best_colormodel(int colormodel
);
70 void create_channeldb(ArrayList
<Channel
*> *channeldb
);
71 void new_output_buffer(VFrame
*output
, int colormodel
);
75 int open_input_core(Channel
*channel
);
76 int close_input_core();
77 int open_output_core(Channel
*channel
);
78 int close_output_core();
81 char *input_buffer
, *frame_buffer
, *output_buffer
;
82 long frame_size
, frame_allocated
;
84 // quicktime_mjpeg_hdr jpeg_header;
86 ArrayList
<int> render_strategies
;
87 // Temporary frame for compressing output data
89 // Frame given to user to acquire data
93 VDeviceBUZInput
*input_thread
;
95 struct buz_params bparm
;
96 struct buz_requestbuffers breq
;
97 // Can't CSYNC the first loop
99 // Number of output frame to load