]> git.sesse.net Git - casparcg/blobdiff - modules/ffmpeg/producer/util/util.h
### Mayor refactoring. Simplified frame handling and image_mixer. Separated video...
[casparcg] / modules / ffmpeg / producer / util / util.h
index 11393946cea8eb2e022882714e3cdb8ed9d9e1fc..87310f9d430d7533297ada7547de5e70c73c1ba7 100644 (file)
 \r
 #pragma once\r
 \r
-#include <common/memory/safe_ptr.h>\r
+#include <common/forward.h>\r
+#include <common/spl/memory.h>\r
 \r
 #include <core/video_format.h>\r
-#include <core/producer/frame/pixel_format.h>\r
+#include <core/frame/pixel_format.h>\r
 #include <core/mixer/audio/audio_mixer.h>\r
 \r
+#include <array>\r
+\r
 enum PixelFormat;\r
 struct AVFrame;\r
 struct AVFormatContext;\r
@@ -34,17 +37,11 @@ struct AVPacket;
 struct AVRational;\r
 struct AVCodecContext;\r
 \r
-namespace caspar {\r
-\r
-namespace core {\r
-\r
-struct pixel_format_desc;\r
-class write_frame;\r
-struct frame_factory;\r
+FORWARD2(caspar, core, struct pixel_format_desc);\r
+FORWARD2(caspar, core, class mutable_frame);\r
+FORWARD2(caspar, core, class frame_factory);\r
 \r
-}\r
-\r
-namespace ffmpeg {\r
+namespace caspar { namespace ffmpeg {\r
                \r
 std::shared_ptr<core::audio_buffer> flush_audio();\r
 std::shared_ptr<core::audio_buffer> empty_audio();\r
@@ -55,14 +52,18 @@ std::shared_ptr<AVFrame>                    empty_video();
 \r
 static const int CASPAR_PIX_FMT_LUMA = 10; // Just hijack some unual pixel format.\r
 \r
-core::field_mode               get_mode(const AVFrame& frame);\r
-int                                                    make_alpha_format(int format); // NOTE: Be careful about CASPAR_PIX_FMT_LUMA, change it to PIX_FMT_GRAY8 if you want to use the frame inside some ffmpeg function.\r
-safe_ptr<core::write_frame> make_write_frame(const void* tag, const safe_ptr<AVFrame>& decoded_frame, const safe_ptr<core::frame_factory>& frame_factory, int flags);\r
+core::field_mode                                       get_mode(const AVFrame& frame);\r
+int                                                                    make_alpha_format(int format); // NOTE: Be careful about CASPAR_PIX_FMT_LUMA, change it to PIX_FMT_GRAY8 if you want to use the frame inside some ffmpeg function.\r
+core::mutable_frame                    make_frame(const void* tag, const spl::shared_ptr<AVFrame>& decoded_frame, double fps, const spl::shared_ptr<core::frame_factory>& frame_factory, int flags);\r
+spl::shared_ptr<AVFrame>                       make_av_frame(core::mutable_frame& frame);\r
+spl::shared_ptr<AVFrame>                       make_av_frame(std::array<uint8_t*, 4> data, const core::pixel_format_desc& pix_desc);\r
+\r
+core::pixel_format_desc                                pixel_format_desc(PixelFormat pix_fmt, int width, int height);\r
 \r
-safe_ptr<AVPacket> create_packet();\r
+spl::shared_ptr<AVPacket> create_packet();\r
 \r
-safe_ptr<AVCodecContext> open_codec(AVFormatContext& context,  enum AVMediaType type, int& index);\r
-safe_ptr<AVFormatContext> open_input(const std::wstring& filename);\r
+spl::shared_ptr<AVCodecContext> open_codec(AVFormatContext& context,  enum AVMediaType type, int& index);\r
+spl::shared_ptr<AVFormatContext> open_input(const std::wstring& filename);\r
 \r
 bool is_sane_fps(AVRational time_base);\r
 AVRational fix_time_base(AVRational time_base);\r