Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

vdevicelml.h

Go to the documentation of this file.
00001 #ifndef VDEVICELML_H
00002 #define VDEVICELML_H
00003 
00004 #include "guicast.h"
00005 #include "vdevicebase.h"
00006 
00007 // ./quicktime
00008 #include "jpeg.h"
00009 #include "quicktime.h"
00010 
00011 #define INPUT_BUFFER_SIZE 65536
00012 
00013 class VDeviceLML : public VDeviceBase
00014 {
00015 public:
00016         VDeviceLML(VideoDevice *device);
00017         ~VDeviceLML();
00018 
00019         int open_input();
00020         int open_output();
00021         int close_all();
00022         int read_buffer(VFrame *frame);
00023         int write_buffer(VFrame *frame, EDL *edl);
00024         int reset_parameters();
00025         ArrayList<int>* get_render_strategies();
00026 
00027 private:
00028         int reopen_input();
00029 
00030         inline unsigned char get_byte()
00031         {
00032                 if(!input_buffer) input_buffer = new unsigned char[INPUT_BUFFER_SIZE];
00033                 if(input_position >= INPUT_BUFFER_SIZE) refill_input();
00034                 return input_buffer[input_position++];
00035         };
00036 
00037         inline unsigned long next_bytes(int total)
00038         {
00039                 unsigned long result = 0;
00040                 int i;
00041 
00042                 if(!input_buffer) input_buffer = new unsigned char[INPUT_BUFFER_SIZE];
00043                 if(input_position + total > INPUT_BUFFER_SIZE) refill_input();
00044 
00045                 for(i = 0; i < total; i++)
00046                 {
00047                         result <<= 8;
00048                         result |= input_buffer[input_position + i];
00049                 }
00050                 return result;
00051         };
00052 
00053         int refill_input();
00054         inline int write_byte(unsigned char byte)
00055         {
00056                 if(!frame_buffer)
00057                 {
00058                         frame_buffer = new unsigned char[256000];
00059                         frame_allocated = 256000;
00060                 }
00061 
00062                 if(frame_size >= frame_allocated)
00063                 {
00064                         unsigned char *new_frame = new unsigned char[frame_allocated * 2];
00065                         memcpy(new_frame, frame_buffer, frame_size);
00066                         delete frame_buffer;
00067                         frame_buffer = new_frame;
00068                         frame_allocated *= 2;
00069                 }
00070 
00071                 frame_buffer[frame_size++] = byte;
00072                 return 0;
00073         };
00074 
00075         int write_fake_marker();
00076 
00077         FILE *jvideo_fd;
00078         unsigned char *input_buffer, *frame_buffer;
00079         long input_position;
00080         long frame_size, frame_allocated;
00081         int input_error;
00082 //      quicktime_mjpeg_hdr jpeg_header;
00083         long last_frame_no;
00084         ArrayList<int> render_strategies;
00085 };
00086 
00087 #endif

Generated on Sun Jan 8 13:39:01 2006 for Cinelerra-svn by  doxygen 1.4.4