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
web_video_server::LibavStreamer::sendImage
virtual void sendImage(const cv::Mat &, const ros::Time &time)
Definition: libav_streamer.cpp:243
web_video_server::LibavStreamerType::codec_name_
const std::string codec_name_
Definition: libav_streamer.h:75
web_video_server::LibavStreamer::qmax_
int qmax_
Definition: libav_streamer.h:56
web_video_server::LibavStreamer::output_format_
AVOutputFormat * output_format_
Definition: libav_streamer.h:37
web_video_server::LibavStreamer::io_buffer_
uint8_t * io_buffer_
Definition: libav_streamer.h:59
boost::shared_ptr< HttpConnection >
web_video_server::LibavStreamer::bitrate_
int bitrate_
Definition: libav_streamer.h:54
web_video_server::ImageTransportImageStreamer
Definition: image_streamer.h:49
web_video_server::LibavStreamer::gop_
int gop_
Definition: libav_streamer.h:57
web_video_server::LibavStreamer::codec_context_
AVCodecContext * codec_context_
Definition: libav_streamer.h:40
image_streamer.h
web_video_server::ImageStreamerType
Definition: image_streamer.h:79
web_video_server::LibavStreamer::initializeEncoder
virtual void initializeEncoder()
Definition: libav_streamer.cpp:239
web_video_server::LibavStreamer::content_type_
std::string content_type_
Definition: libav_streamer.h:53
web_video_server::LibavStreamer::~LibavStreamer
~LibavStreamer()
Definition: libav_streamer.cpp:69
web_video_server::LibavStreamerType
Definition: libav_streamer.h:62
web_video_server::LibavStreamer::first_image_timestamp_
ros::Time first_image_timestamp_
Definition: libav_streamer.h:48
web_video_server::LibavStreamer::codec_name_
std::string codec_name_
Definition: libav_streamer.h:52
web_video_server::LibavStreamer::LibavStreamer
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)
Definition: libav_streamer.cpp:51
web_video_server::LibavStreamer::format_name_
std::string format_name_
Definition: libav_streamer.h:51
web_video_server::LibavStreamer::frame_
AVFrame * frame_
Definition: libav_streamer.h:46
web_video_server::LibavStreamerType::LibavStreamerType
LibavStreamerType(const std::string &format_name, const std::string &codec_name, const std::string &content_type)
Definition: libav_streamer.cpp:360
web_video_server::LibavStreamer
Definition: libav_streamer.h:24
web_video_server::LibavStreamer::video_stream_
AVStream * video_stream_
Definition: libav_streamer.h:41
web_video_server::LibavStreamerType::content_type_
const std::string content_type_
Definition: libav_streamer.h:76
async_web_server_cpp::HttpRequest
web_video_server::LibavStreamerType::create_viewer
std::string create_viewer(const async_web_server_cpp::HttpRequest &request)
Definition: libav_streamer.cpp:374
web_video_server::LibavStreamer::qmin_
int qmin_
Definition: libav_streamer.h:55
web_video_server::LibavStreamer::initialize
virtual void initialize(const cv::Mat &)
Definition: libav_streamer.cpp:103
http_connection.hpp
web_video_server
Definition: h264_streamer.h:9
image_transport.h
web_video_server::LibavStreamer::encode_mutex_
boost::mutex encode_mutex_
Definition: libav_streamer.h:49
web_video_server::LibavStreamerType::format_name_
const std::string format_name_
Definition: libav_streamer.h:74
web_video_server::LibavStreamer::codec_
AVCodec * codec_
Definition: libav_streamer.h:39
ros::Time
web_video_server::LibavStreamer::opt_
AVDictionary * opt_
Definition: libav_streamer.h:43
web_video_server::LibavStreamer::sws_context_
struct SwsContext * sws_context_
Definition: libav_streamer.h:47
web_video_server::LibavStreamerType::create_streamer
boost::shared_ptr< ImageStreamer > create_streamer(const async_web_server_cpp::HttpRequest &request, async_web_server_cpp::HttpConnectionPtr connection, ros::NodeHandle &nh)
Definition: libav_streamer.cpp:366
http_request.hpp
web_video_server::LibavStreamer::format_context_
AVFormatContext * format_context_
Definition: libav_streamer.h:38
ros::NodeHandle


web_video_server
Author(s): Mitchell Wills
autogenerated on Wed Mar 2 2022 01:13:35