3 #include "colormodels.h"
6 #include "overlayframe.h"
11 FileBase::FileBase(Asset *asset, File *file)
15 internal_byte_order = get_byte_order();
18 overlayer = new OverlayFrame;
23 if(audio_buffer_in) delete [] audio_buffer_in;
24 if(audio_buffer_out) delete [] audio_buffer_out;
25 if(video_buffer_in) delete [] video_buffer_in;
26 if(video_buffer_out) delete [] video_buffer_out;
27 if(row_pointers_in) delete [] row_pointers_in;
28 if(row_pointers_out) delete [] row_pointers_out;
29 if(float_buffer) delete [] float_buffer;
34 int FileBase::close_file()
36 if(audio_buffer_in) delete [] audio_buffer_in;
37 if(audio_buffer_out) delete [] audio_buffer_out;
38 if(video_buffer_in) delete [] video_buffer_in;
39 if(video_buffer_out) delete [] video_buffer_out;
40 if(row_pointers_in) delete [] row_pointers_in;
41 if(row_pointers_out) delete [] row_pointers_out;
42 if(float_buffer) delete [] float_buffer;
48 int FileBase::set_dither()
54 int FileBase::reset_parameters()
64 prev_buffer_position = -1;
65 prev_frame_position = -1;
70 ulawtofloat_table = 0;
71 floattoulaw_table = 0;
74 reset_parameters_derived();
77 int FileBase::get_mode(char *mode, int rd, int wr)
79 if(rd && !wr) sprintf(mode, "rb");
81 if(!rd && wr) sprintf(mode, "wb");
88 if(stream = fopen(asset->path, "rb"))
94 if(exists) sprintf(mode, "rb+");
109 // ======================================= audio codecs
111 int FileBase::get_video_buffer(unsigned char **buffer, int depth)
113 // get a raw video buffer for writing or compression by a library
116 // Video compression is entirely done in the library.
117 int64_t bytes = asset->width * asset->height * depth;
118 *buffer = new unsigned char[bytes];
123 int FileBase::get_row_pointers(unsigned char *buffer, unsigned char ***pointers, int depth)
125 // This might be fooled if a new VFrame is created at the same address with a different height.
126 if(*pointers && (*pointers)[0] != &buffer[0])
134 *pointers = new unsigned char*[asset->height];
135 for(int i = 0; i < asset->height; i++)
137 (*pointers)[i] = &buffer[i * asset->width * depth / 8];
142 int FileBase::match4(char *in, char *out)
144 if(in[0] == out[0] &&
153 int FileBase::search_render_strategies(ArrayList<int>* render_strategies, int render_strategy)
156 for(i = 0; i < render_strategies->total; i++)
157 if(render_strategies->values[i] == render_strategy) return 1;