4 #include "colormodels.h"
7 #include "overlayframe.h"
12 FileBase::FileBase(Asset *asset, File *file)
16 internal_byte_order = get_byte_order();
19 overlayer = new OverlayFrame;
24 if(audio_buffer_in) delete [] audio_buffer_in;
25 if(audio_buffer_out) delete [] audio_buffer_out;
26 if(video_buffer_in) delete [] video_buffer_in;
27 if(video_buffer_out) delete [] video_buffer_out;
28 if(row_pointers_in) delete [] row_pointers_in;
29 if(row_pointers_out) delete [] row_pointers_out;
30 if(float_buffer) delete [] float_buffer;
35 int FileBase::close_file()
37 if(audio_buffer_in) delete [] audio_buffer_in;
38 if(audio_buffer_out) delete [] audio_buffer_out;
39 if(video_buffer_in) delete [] video_buffer_in;
40 if(video_buffer_out) delete [] video_buffer_out;
41 if(row_pointers_in) delete [] row_pointers_in;
42 if(row_pointers_out) delete [] row_pointers_out;
43 if(float_buffer) delete [] float_buffer;
49 int FileBase::set_dither()
55 int FileBase::reset_parameters()
65 prev_buffer_position = -1;
66 prev_frame_position = -1;
71 ulawtofloat_table = 0;
72 floattoulaw_table = 0;
76 reset_parameters_derived();
79 int FileBase::get_mode(char *mode, int rd, int wr)
81 if(rd && !wr) sprintf(mode, "rb");
83 if(!rd && wr) sprintf(mode, "wb");
90 if(stream = fopen(asset->path, "rb"))
96 if(exists) sprintf(mode, "rb+");
111 // ======================================= audio codecs
113 int FileBase::get_video_buffer(unsigned char **buffer, int depth)
115 // get a raw video buffer for writing or compression by a library
118 // Video compression is entirely done in the library.
119 int64_t bytes = asset->width * asset->height * depth;
120 *buffer = new unsigned char[bytes];
125 int FileBase::get_row_pointers(unsigned char *buffer, unsigned char ***pointers, int depth)
127 // This might be fooled if a new VFrame is created at the same address with a different height.
128 if(*pointers && (*pointers)[0] != &buffer[0])
136 *pointers = new unsigned char*[asset->height];
137 for(int i = 0; i < asset->height; i++)
139 (*pointers)[i] = &buffer[i * asset->width * depth / 8];
144 int FileBase::match4(char *in, char *out)
146 if(in[0] == out[0] &&
155 int FileBase::search_render_strategies(ArrayList<int>* render_strategies, int render_strategy)
158 for(i = 0; i < render_strategies->total; i++)
159 if(render_strategies->values[i] == render_strategy) return 1;