]> git.sesse.net Git - casparcg/blobdiff - modules/ffmpeg/producer/muxer/frame_muxer.h
[ffmpeg] Removed FFMPEG_Resource to simplify code and documented streaming video...
[casparcg] / modules / ffmpeg / producer / muxer / frame_muxer.h
index 061cb10fe689acb65fe384a4dd528ba450b3d321..97984427ad099f9601e892b3195eff45679ecb16 100644 (file)
@@ -1,53 +1,69 @@
-#pragma once\r
-\r
-#include <common/memory/safe_ptr.h>\r
-#include <common/concurrency/governor.h>\r
-\r
-#include <core/mixer/audio/audio_mixer.h>\r
-\r
-#include <boost/noncopyable.hpp>\r
-\r
-#include <agents.h>\r
-\r
-#include <vector>\r
-\r
-struct AVFrame;\r
-\r
-namespace caspar { \r
-       \r
-namespace core {\r
-\r
-class write_frame;\r
-class basic_frame;\r
-struct frame_factory;\r
-\r
-}\r
-\r
-namespace ffmpeg {\r
-\r
-class frame_muxer2 : boost::noncopyable\r
-{\r
-public:\r
-       \r
-       typedef safe_ptr<AVFrame>                                                                       video_source_element_t;\r
-       typedef safe_ptr<core::audio_buffer>                                            audio_source_element_t;\r
-       typedef std::pair<safe_ptr<core::basic_frame>, ticket_t>        target_element_t;\r
-\r
-       typedef Concurrency::ISource<video_source_element_t>            video_source_t;\r
-       typedef Concurrency::ISource<audio_source_element_t>            audio_source_t;\r
-       typedef Concurrency::ITarget<target_element_t>                          target_t;\r
-                                                                \r
-       frame_muxer2(video_source_t* video_source,\r
-                                audio_source_t* audio_source, \r
-                                target_t& target,\r
-                                double in_fps, \r
-                                const safe_ptr<core::frame_factory>& frame_factory,\r
-                                const std::wstring& filter = L"");\r
-       \r
-       int64_t calc_nb_frames(int64_t nb_frames) const;\r
-private:\r
-       struct implementation;\r
-       safe_ptr<implementation> impl_;\r
-};\r
-\r
-}}
\ No newline at end of file
+/*
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
+*
+* This file is part of CasparCG (www.casparcg.com).
+*
+* CasparCG is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* CasparCG is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
+*
+* Author: Robert Nagy, ronag89@gmail.com
+*/
+
+#pragma once
+
+#include "display_mode.h"
+
+#include <common/forward.h>
+#include <common/memory.h>
+
+#include <core/frame/frame.h>
+#include <core/mixer/audio/audio_mixer.h>
+#include <core/fwd.h>
+
+#include <boost/noncopyable.hpp>
+#include <boost/rational.hpp>
+
+#include <vector>
+
+struct AVFrame;
+
+namespace caspar { namespace ffmpeg {
+
+class frame_muxer : boost::noncopyable
+{
+public:
+       frame_muxer(
+                       boost::rational<int> in_framerate,
+                       const spl::shared_ptr<core::frame_factory>& frame_factory,
+                       const core::video_format_desc& format_desc,
+                       const core::audio_channel_layout& channel_layout,
+                       const std::wstring& filter,
+                       bool multithreaded_filter);
+
+       void push(const std::shared_ptr<AVFrame>& video_frame);
+       void push(const std::shared_ptr<core::mutable_audio_buffer>& audio_samples);
+
+       bool video_ready() const;
+       bool audio_ready() const;
+
+       core::draw_frame poll();
+
+       boost::rational<int> out_framerate() const;
+
+       uint32_t calc_nb_frames(uint32_t nb_frames) const;
+private:
+       struct impl;
+       spl::shared_ptr<impl> impl_;
+};
+
+}}