]> git.sesse.net Git - casparcg/blobdiff - modules/ffmpeg/producer/util/util.h
[ffmpeg] Copied flush logic when seeking from 2.0, as well as current frame in clip...
[casparcg] / modules / ffmpeg / producer / util / util.h
index 40ace0da2a12a6481900099bd2cf132ea8d7c93b..abd167a0180f3708a2105ec736db7a33b49c001c 100644 (file)
@@ -56,9 +56,8 @@ namespace caspar { namespace ffmpeg {
 // Utils
 
 core::field_mode                                       get_mode(const AVFrame& frame);
-core::mutable_frame                                    make_frame(const void* tag, const spl::shared_ptr<AVFrame>& decoded_frame, double fps, core::frame_factory& frame_factory);
+core::mutable_frame                                    make_frame(const void* tag, const spl::shared_ptr<AVFrame>& decoded_frame, core::frame_factory& frame_factory, const core::audio_channel_layout& channel_layout);
 spl::shared_ptr<AVFrame>                       make_av_frame(core::mutable_frame& frame);
-spl::shared_ptr<AVFrame>                       make_av_frame(core::const_frame& frame);
 spl::shared_ptr<AVFrame>                       make_av_frame(std::array<uint8_t*, 4> data, const core::pixel_format_desc& pix_desc);
 
 core::pixel_format_desc                                pixel_format_desc(PixelFormat pix_fmt, int width, int height);
@@ -66,18 +65,26 @@ core::pixel_format_desc                             pixel_format_desc(PixelFormat pix_fmt, int width, int
 spl::shared_ptr<AVPacket> create_packet();
 spl::shared_ptr<AVFrame>  create_frame();
 
-spl::shared_ptr<AVCodecContext> open_codec(AVFormatContext& context, AVMediaType type, int& index);
+spl::shared_ptr<AVCodecContext> open_codec(AVFormatContext& context, AVMediaType type, int& index, bool single_threaded);
 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();
+
 double read_fps(AVFormatContext& context, double fail_value);
+boost::rational<int> read_framerate(AVFormatContext& context, const boost::rational<int>& fail_value);
 
 std::wstring print_mode(int width, int height, double fps, bool interlaced);
 
-std::wstring probe_stem(const std::wstring& stem);
-bool is_valid_file(const std::wstring& filename);
+std::wstring probe_stem(const std::wstring& stem, bool only_video);
+bool is_valid_file(const std::wstring& filename, bool only_video);
 bool try_get_duration(const std::wstring filename, std::int64_t& duration, boost::rational<std::int64_t>& time_base);
 
+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);
+
 }}