2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
4 * This file is part of CasparCG (www.casparcg.com).
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
19 * Author: Helge Norberg, helge.norberg@svt.se
24 #include <common/diagnostics/graph.h>
25 #include <common/array.h>
27 #include <core/frame/draw_frame.h>
29 #include <boost/rational.hpp>
31 namespace caspar { namespace ffmpeg {
33 struct ffmpeg_pipeline_backend
35 virtual ~ffmpeg_pipeline_backend() { }
37 virtual void graph(spl::shared_ptr<caspar::diagnostics::graph> g) = 0;
39 virtual void from_file(std::string filename) = 0;
40 virtual void from_memory_only_audio(int num_channels, int samplerate) = 0;
41 virtual void from_memory_only_video(int width, int height, boost::rational<int> framerate) = 0;
42 virtual void from_memory(int num_channels, int samplerate, int width, int height, boost::rational<int> framerate) = 0;
44 virtual void start_frame(std::uint32_t frame) = 0;
45 virtual std::uint32_t start_frame() const = 0;
46 virtual void length(std::uint32_t frames) = 0;
47 virtual std::uint32_t length() const = 0;
48 virtual void seek(std::uint32_t frame) = 0;
49 virtual void loop(bool value) = 0;
50 virtual bool loop() const = 0;
51 virtual std::string source_filename() const = 0;
53 virtual void vfilter(std::string filter) = 0;
54 virtual void afilter(std::string filter) = 0;
55 virtual int width() const = 0;
56 virtual int height() const = 0;
57 virtual boost::rational<int> framerate() const = 0;
58 virtual bool progressive() const = 0;
59 virtual std::uint32_t last_frame() const = 0;
61 virtual void to_memory(spl::shared_ptr<core::frame_factory> factory, core::video_format_desc format) = 0;
62 virtual void to_file(std::string filename) = 0;
63 virtual void vcodec(std::string codec) = 0;
64 virtual void acodec(std::string codec) = 0;
65 virtual void format(std::string fmt) = 0;
67 virtual void start() = 0;
68 virtual bool try_push_audio(caspar::array<const std::int32_t> data) = 0;
69 virtual bool try_push_video(caspar::array<const std::uint8_t> data) = 0;
70 virtual core::draw_frame try_pop_frame() = 0;
71 virtual bool started() const = 0;
72 virtual void stop() = 0;