00001 #ifndef VFRAME_H
00002 #define VFRAME_H
00003
00004 #include "colormodels.h"
00005 #include "vframe.inc"
00006
00007 class PngReadFunction;
00008
00009 struct PngData
00010 {
00011 unsigned char* data;
00012 long size;
00013 };
00014
00015 class VFrame
00016 {
00017 public:
00018
00019
00020 VFrame(unsigned char *data,
00021 int w,
00022 int h,
00023 int color_model = BC_RGBA8888,
00024 long bytes_per_line = -1);
00025 VFrame(unsigned char *data,
00026 long y_offset,
00027 long u_offset,
00028 long v_offset,
00029 int w,
00030 int h,
00031 int color_model = BC_RGBA8888,
00032 long bytes_per_line = -1);
00033
00034 VFrame(unsigned char *png_data);
00035 VFrame(const PngData& png_data);
00036 VFrame(VFrame &vframe);
00037
00038 VFrame();
00039 ~VFrame();
00040
00041 friend class PngReadFunction;
00042
00043
00044
00045 int equivalent(VFrame *src);
00046
00047
00048 int reallocate(unsigned char *data,
00049 long y_offset,
00050 long u_offset,
00051 long v_offset,
00052 int w,
00053 int h,
00054 int color_model,
00055 long bytes_per_line);
00056
00057 void set_memory(unsigned char *data,
00058 long y_offset,
00059 long u_offset,
00060 long v_offset);
00061
00062 void set_compressed_memory(unsigned char *data,
00063 int data_size,
00064 int data_allocated);
00065
00066
00067 int read_png(unsigned char *data);
00068 int read_png(const PngData& png_data);
00069
00070
00071 int equals(VFrame *frame);
00072
00073 int params_match(int w, int h, int color_model);
00074
00075 long set_shm_offset(long offset);
00076 long get_shm_offset();
00077
00078
00079 int copy_from(VFrame *frame);
00080
00081 int clear_frame();
00082 int allocate_compressed_data(long bytes);
00083
00084
00085
00086
00087 long get_number();
00088 void set_number(long number);
00089
00090 long get_compressed_allocated();
00091 long get_compressed_size();
00092 long set_compressed_size(long size);
00093 int get_color_model();
00094
00095 unsigned char* get_data();
00096
00097 unsigned char** get_rows();
00098
00099 unsigned char* get_y();
00100 unsigned char* get_u();
00101 unsigned char* get_v();
00102 int get_w();
00103 int get_h();
00104 int get_w_fixed();
00105 int get_h_fixed();
00106 static int get_scale_tables(int *column_table, int *row_table,
00107 int in_x1, int in_y1, int in_x2, int in_y2,
00108 int out_x1, int out_y1, int out_x2, int out_y2);
00109 int get_bytes_per_pixel();
00110 long get_bytes_per_line();
00111 static int calculate_bytes_per_pixel(int colormodel);
00112 static long calculate_data_size(int w,
00113 int h,
00114 int bytes_per_line = -1,
00115 int color_model = BC_RGB888);
00116
00117 long get_data_size();
00118 void rotate270();
00119 void rotate90();
00120 void flip_vert();
00121
00122
00123
00124 int get_field2_offset();
00125 int set_field2_offset(int value);
00126
00127 void set_keyframe(int value);
00128 int get_keyframe();
00129
00130
00131 void overlay(VFrame *src,
00132 int out_x1,
00133 int out_y1);
00134
00135 private:
00136 int clear_objects();
00137 int reset_parameters();
00138 void create_row_pointers();
00139 int allocate_data(unsigned char *data,
00140 long y_offset,
00141 long u_offset,
00142 long v_offset,
00143 int w,
00144 int h,
00145 int color_model,
00146 long bytes_per_line);
00147
00148
00149 int field2_offset;
00150
00151 int shared;
00152 long shm_offset;
00153
00154 long bytes_per_line;
00155 int bytes_per_pixel;
00156
00157 unsigned char *data;
00158
00159 unsigned char **rows;
00160
00161 int color_model;
00162
00163 long compressed_allocated;
00164
00165 long compressed_size;
00166
00167 unsigned char *y, *u, *v;
00168 long y_offset;
00169 long u_offset;
00170 long v_offset;
00171
00172 int w, h;
00173
00174 unsigned char *image;
00175 long image_offset;
00176 long image_size;
00177
00178 long sequence_number;
00179 int is_keyframe;
00180 };
00181
00182
00183 #endif