2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG (www.casparcg.com).
\r
6 * CasparCG is free software: you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation, either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * CasparCG is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
\r
19 * Author: Robert Nagy, ronag89@gmail.com
\r
24 #include <common/memory/safe_ptr.h>
\r
26 #include <core/video_format.h>
\r
27 #include <core/producer/frame/pixel_format.h>
\r
28 #include <core/mixer/audio/audio_mixer.h>
\r
32 struct AVFormatContext;
\r
35 struct AVCodecContext;
\r
41 struct pixel_format_desc;
\r
43 struct frame_factory;
\r
49 std::shared_ptr<core::audio_buffer> flush_audio();
\r
50 std::shared_ptr<core::audio_buffer> empty_audio();
\r
51 std::shared_ptr<AVFrame> flush_video();
\r
52 std::shared_ptr<AVFrame> empty_video();
\r
56 static const int CASPAR_PIX_FMT_LUMA = 10; // Just hijack some unual pixel format.
\r
58 core::field_mode::type get_mode(const AVFrame& frame);
\r
59 int make_alpha_format(int format); // NOTE: Be careful about CASPAR_PIX_FMT_LUMA, change it to PIX_FMT_GRAY8 if you want to use the frame inside some ffmpeg function.
\r
60 safe_ptr<core::write_frame> make_write_frame(const void* tag, const safe_ptr<AVFrame>& decoded_frame, const safe_ptr<core::frame_factory>& frame_factory, int hints);
\r
62 safe_ptr<AVPacket> create_packet();
\r
64 safe_ptr<AVCodecContext> open_codec(AVFormatContext& context, enum AVMediaType type, int& index);
\r
65 safe_ptr<AVFormatContext> open_input(const std::string& filename);
\r
67 bool is_sane_fps(AVRational time_base);
\r
68 AVRational fix_time_base(AVRational time_base);
\r
70 double read_fps(AVFormatContext& context, double fail_value);
\r
72 std::string print_mode(size_t width, size_t height, double fps, bool interlaced);
\r
74 std::string probe_stem(const std::string stem);
\r
75 bool is_valid_file(const std::string filename);
\r