Example #1
0
 def close(self):
     """
     Finalizes the encoder and deallocates all structures
     """
     try:
         self.stop()
         if self.connection:
             mmal.mmal_connection_destroy(self.connection)
             self.connection = None
         if self.pool:
             mmal.mmal_port_pool_destroy(self.output_port, self.pool)
             self.pool = None
         if self.encoder:
             if self.encoder[0].is_enabled:
                 mmal.mmal_component_disable(self.encoder)
             mmal.mmal_component_destroy(self.encoder)
             self.encoder = None
             self.output_port = None
             self.input_port = None
     finally:
         if self.port == 1:
             self.parent._video_encoder = None
         elif self.port == 2:
             self.parent._still_encoder = None
         else:
             raise PiCameraValueError("Invalid camera port %d" % self.port)
Example #2
0
 def close(self):
     """
     Finalizes the encoder and deallocates all structures
     """
     self.stop()
     if self.connection:
         mmal.mmal_connection_destroy(self.connection)
         self.connection = None
     if self.pool:
         mmal.mmal_port_pool_destroy(self.output_port, self.pool)
         self.pool = None
     if self.encoder:
         if self.encoder[0].is_enabled:
             mmal.mmal_component_disable(self.encoder)
         mmal.mmal_component_destroy(self.encoder)
         self.encoder = None
         self.output_port = None
         self.input_port = None
Example #3
0
 def close(self):
     """
     Finalizes the encoder and deallocates all structures
     """
     self.stop()
     if self.connection:
         mmal.mmal_connection_destroy(self.connection)
         self.connection = None
     if self.pool:
         mmal.mmal_port_pool_destroy(self.output_port, self.pool)
         self.pool = None
     if self.encoder:
         if self.encoder[0].is_enabled:
             mmal.mmal_component_disable(self.encoder)
         mmal.mmal_component_destroy(self.encoder)
         self.encoder = None
         self.output_port = None
         self.input_port = None