add LastFrame plugin, add bld_scripts
[goodguy/history.git] / cinelerra-5.0 / guicast / vframe.C
index a3b09324bd6f59f5e5122874fd82094615925054..de53a068a70b95196007305093c722fefa91e905 100644 (file)
@@ -220,6 +220,7 @@ int VFrame::params_match(int w, int h, int color_model)
 
 int VFrame::reset_parameters(int do_opengl)
 {
+       status = 1;
        scene = 0;
        field2_offset = -1;
        memory_type = VFrame::PRIVATE;
@@ -1042,6 +1043,7 @@ int VFrame::transfer_from(VFrame *that, int bg_color)
                return this->copy_from(that);
 
        timestamp = that->timestamp;
+#if 0
        BC_CModels::transfer(
                this->get_rows(), that->get_rows(),          // Packed data out/in
                this->get_y(), this->get_u(), this->get_v(), // Planar data out/in
@@ -1051,6 +1053,33 @@ int VFrame::transfer_from(VFrame *that, int bg_color)
                that->get_color_model(), this->get_color_model(), // Color models in/out
                bg_color,                                    // alpha blend bg_color
                that->get_w(), this->get_w());               // rowspans (of luma for YUV)
+#else
+       unsigned char *in_ptrs[4], *out_ptrs[4];
+       unsigned char **inp, **outp;
+       if( BC_CModels::is_planar(that->get_color_model()) ) {
+               in_ptrs[0] = that->get_y();
+               in_ptrs[1] = that->get_u();
+               in_ptrs[2] = that->get_v();
+               in_ptrs[3] = that->get_a();
+               inp = in_ptrs;
+       }
+       else
+               inp = that->get_rows(); 
+       if( BC_CModels::is_planar(this->get_color_model()) ) {
+               out_ptrs[0] = this->get_y();
+               out_ptrs[1] = this->get_u();
+               out_ptrs[2] = this->get_v();
+               out_ptrs[3] = this->get_a();
+               outp = out_ptrs;
+       }
+       else
+               outp = this->get_rows();        
+       BC_CModels::transfer(outp, this->get_color_model(),
+                       0, 0, this->get_w(), this->get_h(), this->get_w(),
+               inp, that->get_color_model(),
+                       0, 0, that->get_w(), that->get_h(), that->get_w(),
+               bg_color);
+#endif
        return 0;
 }
 
@@ -1187,12 +1216,13 @@ void VFrame::clear_stacks()
 {
        next_effects.remove_all_objects();
        prev_effects.remove_all_objects();
-       delete params;
-       params = new BC_Hash;
+       params->clear();
+       status = 1;
 }
 
 void VFrame::copy_params(VFrame *src)
 {
+       status = src->status;
        params->copy_from(src->params);
 }
 
@@ -1213,7 +1243,7 @@ void VFrame::copy_stacks(VFrame *src)
                strcpy(ptr, src->prev_effects.values[i]);
        }
 
-       params->copy_from(src->params);
+       copy_params(src);
 }
 
 int VFrame::equal_stacks(VFrame *src)
@@ -1257,7 +1287,7 @@ void VFrame::dump()
 
 int VFrame::filefork_size()
 {
-       return sizeof(int) * 12 + sizeof(long);
+       return sizeof(int) * 13 + sizeof(long);
 }
 
 
@@ -1274,7 +1304,8 @@ void VFrame::to_filefork(unsigned char *buffer)
        *(int*)(buffer + 32) = compressed_allocated;
        *(int*)(buffer + 36) = compressed_size;
        *(int*)(buffer + 40) = is_keyframe;
-       *(long*)(buffer + 44) = sequence_number;
+       *(int*)(buffer + 44) = status;
+       *(long*)(buffer + 48) = sequence_number;
 
 
 //printf("VFrame::to_filefork %d %lld\n", __LINE__, sequence_number);
@@ -1323,7 +1354,8 @@ void VFrame::from_filefork(unsigned char *buffer)
        }
 
        is_keyframe = *(int*)(buffer + 40);
-       sequence_number = *(long*)(buffer + 44);
+       status = *(int*)(buffer + 44);
+       sequence_number = *(long*)(buffer + 48);
 //printf("VFrame::from_filefork %d %lld\n", __LINE__, sequence_number);
 }