X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fvdevicelml.h;fp=cinelerra-5.1%2Fcinelerra%2Fvdevicelml.h;h=7f7daf1f11c8720475959c50b8e41b179a57110d;hb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;hp=0000000000000000000000000000000000000000;hpb=52fcc46226f9df46f9ce9d0566dc568455a7db0b;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/vdevicelml.h b/cinelerra-5.1/cinelerra/vdevicelml.h new file mode 100644 index 00000000..7f7daf1f --- /dev/null +++ b/cinelerra-5.1/cinelerra/vdevicelml.h @@ -0,0 +1,106 @@ + +/* + * CINELERRA + * Copyright (C) 2008 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef VDEVICELML_H +#define VDEVICELML_H + +#include "guicast.h" +#include "vdevicebase.h" + +#include "jpeg.h" + +#define INPUT_BUFFER_SIZE 65536 + +class VDeviceLML : public VDeviceBase +{ +public: + VDeviceLML(VideoDevice *device); + ~VDeviceLML(); + + int open_input(); + int open_output(); + int close_all(); + int read_buffer(VFrame *frame); + int write_buffer(VFrame *frame, EDL *edl); + int reset_parameters(); + ArrayList* get_render_strategies(); + +private: + int reopen_input(); + + inline unsigned char get_byte() + { + if(!input_buffer) input_buffer = new unsigned char[INPUT_BUFFER_SIZE]; + if(input_position >= INPUT_BUFFER_SIZE) refill_input(); + return input_buffer[input_position++]; + }; + + inline unsigned long next_bytes(int total) + { + unsigned long result = 0; + int i; + + if(!input_buffer) input_buffer = new unsigned char[INPUT_BUFFER_SIZE]; + if(input_position + total > INPUT_BUFFER_SIZE) refill_input(); + + for(i = 0; i < total; i++) + { + result <<= 8; + result |= input_buffer[input_position + i]; + } + return result; + }; + + int refill_input(); + inline int write_byte(unsigned char byte) + { + if(!frame_buffer) + { + frame_buffer = new unsigned char[256000]; + frame_allocated = 256000; + } + + if(frame_size >= frame_allocated) + { + unsigned char *new_frame = new unsigned char[frame_allocated * 2]; + memcpy(new_frame, frame_buffer, frame_size); + delete frame_buffer; + frame_buffer = new_frame; + frame_allocated *= 2; + } + + frame_buffer[frame_size++] = byte; + return 0; + }; + + int write_fake_marker(); + + FILE *jvideo_fd; + unsigned char *input_buffer, *frame_buffer; + long input_position; + long frame_size, frame_allocated; + int input_error; +// quicktime_mjpeg_hdr jpeg_header; + long last_frame_no; + ArrayList render_strategies; +}; + +#endif