license header for review
[cinelerra_cv/ct.git] / cinelerra / vdevicelml.h
blob74b68da01fda17bf07e591463b8fa24c2bf80a01
1 #ifndef VDEVICELML_H
2 #define VDEVICELML_H
4 #include "guicast.h"
5 #include "vdevicebase.h"
7 // ./quicktime
8 #include "jpeg.h"
9 #include "quicktime.h"
11 #define INPUT_BUFFER_SIZE 65536
13 class VDeviceLML : public VDeviceBase
15 public:
16 VDeviceLML(VideoDevice *device);
17 ~VDeviceLML();
19 int open_input();
20 int open_output();
21 int close_all();
22 int read_buffer(VFrame *frame);
23 int write_buffer(VFrame *frame, EDL *edl);
24 int reset_parameters();
25 ArrayList<int>* get_render_strategies();
27 private:
28 int reopen_input();
30 inline unsigned char get_byte()
32 if(!input_buffer) input_buffer = new unsigned char[INPUT_BUFFER_SIZE];
33 if(input_position >= INPUT_BUFFER_SIZE) refill_input();
34 return input_buffer[input_position++];
37 inline unsigned long next_bytes(int total)
39 unsigned long result = 0;
40 int i;
42 if(!input_buffer) input_buffer = new unsigned char[INPUT_BUFFER_SIZE];
43 if(input_position + total > INPUT_BUFFER_SIZE) refill_input();
45 for(i = 0; i < total; i++)
47 result <<= 8;
48 result |= input_buffer[input_position + i];
50 return result;
53 int refill_input();
54 inline int write_byte(unsigned char byte)
56 if(!frame_buffer)
58 frame_buffer = new unsigned char[256000];
59 frame_allocated = 256000;
62 if(frame_size >= frame_allocated)
64 unsigned char *new_frame = new unsigned char[frame_allocated * 2];
65 memcpy(new_frame, frame_buffer, frame_size);
66 delete frame_buffer;
67 frame_buffer = new_frame;
68 frame_allocated *= 2;
71 frame_buffer[frame_size++] = byte;
72 return 0;
75 int write_fake_marker();
77 FILE *jvideo_fd;
78 unsigned char *input_buffer, *frame_buffer;
79 long input_position;
80 long frame_size, frame_allocated;
81 int input_error;
82 // quicktime_mjpeg_hdr jpeg_header;
83 long last_frame_no;
84 ArrayList<int> render_strategies;
87 #endif
89 // Local Variables:
90 // mode: C++
91 // c-file-style: "linux"
92 // End: