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 "ffmpeg_pipeline.h"
25 #include "ffmpeg_pipeline_backend.h"
26 #include "ffmpeg_pipeline_backend_internal.h"
28 #include <core/frame/draw_frame.h>
29 #include <core/video_format.h>
31 namespace caspar { namespace ffmpeg {
33 ffmpeg_pipeline::ffmpeg_pipeline()
34 : impl_(create_internal_pipeline())
38 ffmpeg_pipeline ffmpeg_pipeline::graph(spl::shared_ptr<caspar::diagnostics::graph> g) { impl_->graph(std::move(g)); return *this; }
39 ffmpeg_pipeline ffmpeg_pipeline::from_file(std::string filename) { impl_->from_file(std::move(filename)); return *this; }
40 ffmpeg_pipeline ffmpeg_pipeline::from_memory_only_audio(int num_channels, int samplerate) { impl_->from_memory_only_audio(num_channels, samplerate); return *this; }
41 ffmpeg_pipeline ffmpeg_pipeline::from_memory_only_video(int width, int height, boost::rational<int> framerate) { impl_->from_memory_only_video(width, height, std::move(framerate)); return *this; }
42 ffmpeg_pipeline ffmpeg_pipeline::from_memory(int num_channels, int samplerate, int width, int height, boost::rational<int> framerate) { impl_->from_memory(num_channels, samplerate, width, height, std::move(framerate)); return *this; }
43 ffmpeg_pipeline ffmpeg_pipeline::start_frame(std::uint32_t frame) { impl_->start_frame(frame); return *this; }
44 std::uint32_t ffmpeg_pipeline::start_frame() const { return impl_->start_frame(); }
45 ffmpeg_pipeline ffmpeg_pipeline::length(std::uint32_t frames) { impl_->length(frames); return *this; }
46 std::uint32_t ffmpeg_pipeline::length() const { return impl_->length(); }
47 ffmpeg_pipeline ffmpeg_pipeline::seek(std::uint32_t frame) { impl_->seek(frame); return *this; }
48 ffmpeg_pipeline ffmpeg_pipeline::loop(bool value) { impl_->loop(value); return *this; }
49 bool ffmpeg_pipeline::loop() const { return impl_->loop(); }
50 std::string ffmpeg_pipeline::source_filename() const { return impl_->source_filename(); }
51 ffmpeg_pipeline ffmpeg_pipeline::vfilter(std::string filter) { impl_->vfilter(std::move(filter)); return *this; }
52 ffmpeg_pipeline ffmpeg_pipeline::afilter(std::string filter) { impl_->afilter(std::move(filter)); return *this; }
53 int ffmpeg_pipeline::width() const { return impl_->width(); }
54 int ffmpeg_pipeline::height() const { return impl_->height(); }
55 boost::rational<int> ffmpeg_pipeline::framerate() const { return impl_->framerate(); }
56 bool ffmpeg_pipeline::progressive() const { return impl_->progressive(); }
57 ffmpeg_pipeline ffmpeg_pipeline::to_memory(spl::shared_ptr<core::frame_factory> factory, core::video_format_desc format) { impl_->to_memory(std::move(factory), std::move(format)); return *this; }
58 ffmpeg_pipeline ffmpeg_pipeline::to_file(std::string filename) { impl_->to_file(std::move(filename)); return *this; }
59 ffmpeg_pipeline ffmpeg_pipeline::vcodec(std::string codec) { impl_->vcodec(std::move(codec)); return *this; }
60 ffmpeg_pipeline ffmpeg_pipeline::acodec(std::string codec) { impl_->acodec(std::move(codec)); return *this; }
61 ffmpeg_pipeline ffmpeg_pipeline::format(std::string fmt) { impl_->format(std::move(fmt)); return *this; }
62 ffmpeg_pipeline ffmpeg_pipeline::start() { impl_->start(); return *this; }
63 bool ffmpeg_pipeline::try_push_audio(caspar::array<const std::int32_t> data) { return impl_->try_push_audio(std::move(data)); }
64 bool ffmpeg_pipeline::try_push_video(caspar::array<const std::uint8_t> data) { return impl_->try_push_video(std::move(data)); }
65 core::draw_frame ffmpeg_pipeline::try_pop_frame() { return impl_->try_pop_frame(); }
66 std::uint32_t ffmpeg_pipeline::last_frame() const { return impl_->last_frame(); }
67 bool ffmpeg_pipeline::started() const { return impl_->started(); }
68 void ffmpeg_pipeline::stop() { impl_->stop(); }