Ring Daemon 16.0.0
Loading...
Searching...
No Matches
libav_utils.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2025 Savoir-faire Linux Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <libavutil/samplefmt.h>
20
21#include <vector>
22#include <map>
23#include <string>
24#include <memory>
25
26extern "C" {
27struct AVDictionary;
28struct AVFrame;
29struct AVPixFmtDescriptor;
30struct AVBufferRef;
31struct AVCodec;
32void av_buffer_unref(AVBufferRef **buf);
33}
34
35namespace jami {
36namespace libav_utils {
37
38void av_init();
39
40const char* const DEFAULT_H264_PROFILE_LEVEL_ID = "profile-level-id=428029";
41const char* const MAX_H264_PROFILE_LEVEL_ID = "profile-level-id=640034";
42
45
47
48std::string getError(int err);
49
50const char* getDictValue(const AVDictionary* d, const std::string& key, int flags = 0);
51
52void setDictValue(AVDictionary** d, const std::string& key, const std::string& value, int flags = 0);
53
55
57
61
62typedef std::unique_ptr<AVBufferRef, AVBufferRef_deleter> AVBufferPtr;
63
64} // namespace libav_utils
65} // namespace jami
void av_buffer_unref(AVBufferRef **buf)
AVSampleFormat choose_sample_fmt(const AVCodec *codec, const AVSampleFormat *preferred_formats, int preferred_formats_count)
void fillWithBlack(AVFrame *frame)
const char * getDictValue(const AVDictionary *d, const std::string &key, int flags)
const char *const MAX_H264_PROFILE_LEVEL_ID
Definition libav_utils.h:41
void setDictValue(AVDictionary **d, const std::string &key, const std::string &value, int flags)
AVSampleFormat choose_sample_fmt_default(const AVCodec *codec, AVSampleFormat defaultFormat)
void fillWithSilence(AVFrame *frame)
bool is_yuv_planar(const AVPixFmtDescriptor &desc)
std::unique_ptr< AVBufferRef, AVBufferRef_deleter > AVBufferPtr
Definition libav_utils.h:62
std::string getError(int err)
const char *const DEFAULT_H264_PROFILE_LEVEL_ID
Definition libav_utils.h:40
void emitSignal(Args... args)
Definition ring_signal.h:64
void operator()(AVBufferRef *buf) const
Definition libav_utils.h:59