video.cpp
Go to the documentation of this file.
00001 
00025 #include <ardrone_autonomy/video.h>
00026 
00027 #define NB_STAGES 10
00028 #define CAMIF_H_CAMERA_USED CAMIF_CAMERA_OVTRULY
00029 
00030 unsigned char buffer[MAX_STREAM_WIDTH * MAX_STREAM_HEIGHT * 3];
00031 int32_t current_frame_id = 0;
00032 ros::Time shared_video_receive_time;
00033 
00034 extern "C" C_RESULT export_stage_open(void *cfg, vp_api_io_data_t *in, vp_api_io_data_t *out)
00035 {
00036   return (SUCCESS);
00037 }
00038 
00039 extern "C" C_RESULT export_stage_transform(void *cfg, vp_api_io_data_t *in, vp_api_io_data_t *out)
00040 {
00041 //    PRINT("In Transform before copy\n");
00042 //        printf("The size of buffer is %d\n", in->size);
00043   vp_os_mutex_lock(&video_lock);
00044   shared_video_receive_time = ros::Time::now();
00045   memcpy(buffer, in->buffers[0], in->size);
00046   current_frame_id++;
00047   if (realtime_video)
00048   {
00049     ros_driver->PublishVideo();
00050   }
00051   vp_os_mutex_unlock(&video_lock);
00052 //    vp_os_mutex_unlock(&video_update_lock);
00053   return (SUCCESS);
00054 }
00055 
00056 extern "C" C_RESULT export_stage_close(void *cfg, vp_api_io_data_t *in, vp_api_io_data_t *out)
00057 {
00058   return (SUCCESS);
00059 }
00060 
00061 const vp_api_stage_funcs_t vp_stages_export_funcs =
00062 {
00063   NULL,
00064   (vp_api_stage_open_t)export_stage_open,
00065   (vp_api_stage_transform_t)export_stage_transform,
00066   (vp_api_stage_close_t)export_stage_close
00067 };


ardrone_autonomy
Author(s): Mani Monajjemi, Mani Monajjemi
autogenerated on Fri Aug 28 2015 10:07:51