00001 #ifndef MULTIPART_STREAM_H_ 00002 #define MULTIPART_STREAM_H_ 00003 00004 #include <ros/ros.h> 00005 #include <async_web_server_cpp/http_connection.hpp> 00006 00007 namespace web_video_server 00008 { 00009 00010 class MultipartStream { 00011 public: 00012 MultipartStream(async_web_server_cpp::HttpConnectionPtr& connection, const std::string& boundry="boundarydonotcross"); 00013 00014 void sendInitialHeader(); 00015 void sendPartHeader(const ros::Time &time, const std::string& type, size_t payload_size); 00016 void sendPartFooter(); 00017 void sendPartAndClear(const ros::Time &time, const std::string& type, std::vector<unsigned char> &data); 00018 void sendPart(const ros::Time &time, const std::string& type, const boost::asio::const_buffer &buffer, 00019 async_web_server_cpp::HttpConnection::ResourcePtr resource); 00020 00021 private: 00022 async_web_server_cpp::HttpConnectionPtr connection_; 00023 std::string boundry_; 00024 }; 00025 00026 } 00027 00028 #endif