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/memory.h>
25 #include <common/array.h>
29 #include <boost/rational.hpp>
35 FORWARD2(caspar, diagnostics, class graph);
37 namespace caspar { namespace ffmpeg {
39 struct ffmpeg_pipeline_backend;
46 ffmpeg_pipeline graph(spl::shared_ptr<caspar::diagnostics::graph> g);
48 ffmpeg_pipeline from_file(std::string filename);
49 ffmpeg_pipeline from_memory_only_audio(int num_channels, int samplerate);
50 ffmpeg_pipeline from_memory_only_video(int width, int height, boost::rational<int> framerate);
51 ffmpeg_pipeline from_memory(int num_channels, int samplerate, int width, int height, boost::rational<int> framerate);
53 ffmpeg_pipeline start_frame(std::uint32_t frame);
54 std::uint32_t start_frame() const;
55 ffmpeg_pipeline length(std::uint32_t frames);
56 std::uint32_t length() const;
57 ffmpeg_pipeline seek(std::uint32_t frame);
58 ffmpeg_pipeline loop(bool value);
60 std::string source_filename() const;
62 ffmpeg_pipeline vfilter(std::string filter);
63 ffmpeg_pipeline afilter(std::string filter);
66 boost::rational<int> framerate() const;
67 bool progressive() const;
69 ffmpeg_pipeline to_memory(spl::shared_ptr<core::frame_factory> factory, core::video_format_desc format);
70 ffmpeg_pipeline to_file(std::string filename);
71 ffmpeg_pipeline vcodec(std::string codec);
72 ffmpeg_pipeline acodec(std::string codec);
73 ffmpeg_pipeline format(std::string fmt);
75 ffmpeg_pipeline start();
76 bool try_push_audio(caspar::array<const std::int32_t> data);
77 bool try_push_video(caspar::array<const std::uint8_t> data);
78 core::draw_frame try_pop_frame();
79 std::uint32_t last_frame() const;
84 std::shared_ptr<ffmpeg_pipeline_backend> impl_;