libav_streamer.h
Go to the documentation of this file.
1 #ifndef LIBAV_STREAMERS_H_
2 #define LIBAV_STREAMERS_H_
3 
8 
9 extern "C"
10 {
11 #include <libavcodec/avcodec.h>
12 #include <libavformat/avformat.h>
13 #include <libavutil/intreadwrite.h>
14 #include <libavformat/avio.h>
15 #include <libswscale/swscale.h>
16 #include <libavutil/opt.h>
17 #include <libavutil/mathematics.h>
18 #include <libavutil/imgutils.h>
19 }
20 
21 namespace web_video_server
22 {
23 
25 {
26 public:
28  ros::NodeHandle& nh, const std::string &format_name, const std::string &codec_name,
29  const std::string &content_type);
30 
32 
33 protected:
34  virtual void initializeEncoder();
35  virtual void sendImage(const cv::Mat&, const ros::Time& time);
36  virtual void initialize(const cv::Mat&);
37  AVOutputFormat* output_format_;
38  AVFormatContext* format_context_;
39  AVCodec* codec_;
40  AVCodecContext* codec_context_;
41  AVStream* video_stream_;
42 
43  AVDictionary* opt_; // container format options
44 
45 private:
46  AVFrame* frame_;
47  struct SwsContext* sws_context_;
49  boost::mutex encode_mutex_;
50 
51  std::string format_name_;
52  std::string codec_name_;
53  std::string content_type_;
54  int bitrate_;
55  int qmin_;
56  int qmax_;
57  int gop_;
58 
59  uint8_t* io_buffer_; // custom IO buffer
60 };
61 
63 {
64 public:
65  LibavStreamerType(const std::string &format_name, const std::string &codec_name, const std::string &content_type);
66 
69  ros::NodeHandle& nh);
70 
71  std::string create_viewer(const async_web_server_cpp::HttpRequest &request);
72 
73 private:
74  const std::string format_name_;
75  const std::string codec_name_;
76  const std::string content_type_;
77 };
78 
79 }
80 
81 #endif
AVFormatContext * format_context_
virtual void sendImage(const cv::Mat &, const ros::Time &time)
LibavStreamer(const async_web_server_cpp::HttpRequest &request, async_web_server_cpp::HttpConnectionPtr connection, ros::NodeHandle &nh, const std::string &format_name, const std::string &codec_name, const std::string &content_type)
virtual void initialize(const cv::Mat &)
struct SwsContext * sws_context_


web_video_server
Author(s): Mitchell Wills
autogenerated on Tue Mar 1 2022 00:04:38