LibavEncoder.hpp
1 #pragma once
2 
3 #include <Media/Libav.hpp>
4 #if SCORE_HAS_LIBAV
5 #include <Gfx/Libav/LibavOutputSettings.hpp>
6 
7 #include <ossia/detail/pod_vector.hpp>
8 
9 #include <tcb/span.hpp>
10 extern "C" {
11 #include <libavcodec/avcodec.h>
12 #include <libavdevice/avdevice.h>
13 #include <libavformat/avformat.h>
14 #include <libavutil/pixdesc.h>
15 #include <libswscale/swscale.h>
16 }
17 namespace Gfx
18 {
19 
20 struct OutputStream;
22 {
23  explicit LibavEncoder(const LibavOutputSettings& set);
24  ~LibavEncoder();
25  void enumerate();
26 
27  int start();
28  int add_frame(tcb::span<ossia::float_vector>);
29  int add_frame(const unsigned char* data, AVPixelFormat fmt, int width, int height);
30  int stop();
31 
32  bool available() const noexcept { return m_formatContext; }
33 
34  LibavOutputSettings m_set;
35  AVDictionary* opt = NULL;
36  AVFormatContext* m_formatContext{};
37 
38  std::vector<OutputStream> streams;
39 
40  int audio_stream_index = 0;
41  int video_stream_index = 0;
42 };
43 
44 }
45 #endif
Binds the rendering pipeline to ossia processes.
Definition: CameraDevice.cpp:28
Definition: LibavEncoder.hpp:22
Definition: LibavOutputSettings.hpp:16