]> git.sesse.net Git - casparcg/blobdiff - modules/ffmpeg/producer/util/util.h
[ffmpeg] Reimplemented support for playing all audio streams in a clip and treating...
[casparcg] / modules / ffmpeg / producer / util / util.h
index abd167a0180f3708a2105ec736db7a33b49c001c..4c1f45c06c51d294562a89ed3ef4409b55eab79d 100644 (file)
 
 #include <core/video_format.h>
 #include <core/frame/pixel_format.h>
-#include <core/mixer/audio/audio_mixer.h>
+#include <core/frame/audio_channel_layout.h>
+#include <core/frame/frame.h>
 #include <core/fwd.h>
 
 #include <boost/rational.hpp>
 
 #include <array>
+#include <vector>
+#include <utility>
 
 #if defined(_MSC_VER)
 #pragma warning (push)
@@ -52,7 +55,9 @@ struct AVRational;
 struct AVCodecContext;
 
 namespace caspar { namespace ffmpeg {
-               
+
+typedef std::vector<std::pair<std::string, std::string>> ffmpeg_options;
+
 // Utils
 
 core::field_mode                                       get_mode(const AVFrame& frame);
@@ -71,7 +76,10 @@ spl::shared_ptr<AVFormatContext> open_input(const std::wstring& filename);
 bool is_sane_fps(AVRational time_base);
 AVRational fix_time_base(AVRational time_base);
 
-std::shared_ptr<AVFrame> flush();
+std::shared_ptr<core::mutable_audio_buffer>    flush_audio();
+std::shared_ptr<core::mutable_audio_buffer>    empty_audio();
+std::shared_ptr<AVFrame>                                       flush_video();
+std::shared_ptr<AVFrame>                                       empty_video();
 
 double read_fps(AVFormatContext& context, double fail_value);
 boost::rational<int> read_framerate(AVFormatContext& context, const boost::rational<int>& fail_value);
@@ -85,6 +93,8 @@ bool try_get_duration(const std::wstring filename, std::int64_t& duration, boost
 core::audio_channel_layout get_audio_channel_layout(int num_channels, std::uint64_t layout, const std::wstring& channel_layout_spec);
 
 // av_get_default_channel_layout does not work for layouts not predefined in ffmpeg. This is needed to support > 8 channels.
-std::int64_t create_channel_layout_bitmask(int num_channels);
+std::uint64_t create_channel_layout_bitmask(int num_channels);
+
+std::vector<int> find_audio_cadence(const boost::rational<int>& framerate);
 
 }}