Ring Daemon
Loading...
Searching...
No Matches
libav_utils.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2026 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
19
20#include <libavutil/samplefmt.h>
21
22#include <string>
23#include <memory>
24
25extern "C" {
26struct AVDictionary;
27struct AVFrame;
28struct AVPixFmtDescriptor;
29struct AVBufferRef;
30struct AVCodec;
31void av_buffer_unref(AVBufferRef** buf);
32}
33
34namespace jami {
35namespace libav_utils {
36
37void av_init();
38
39const char* const DEFAULT_H264_PROFILE_LEVEL_ID = "profile-level-id=428029";
40const char* const MAX_H264_PROFILE_LEVEL_ID = "profile-level-id=640034";
41
46
48
49std::string getError(int err);
50
51const char* getDictValue(const AVDictionary* d, const std::string& key, int flags = 0);
52
53void setDictValue(AVDictionary** d, const std::string& key, const std::string& value, int flags = 0);
54
56
58
60
65
66typedef std::unique_ptr<AVBufferRef, AVBufferRef_deleter> AVBufferPtr;
67
68} // namespace libav_utils
69} // 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:40
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)
AudioFormat getFormat(const AVFrame *frame)
bool is_yuv_planar(const AVPixFmtDescriptor &desc)
std::unique_ptr< AVBufferRef, AVBufferRef_deleter > AVBufferPtr
Definition libav_utils.h:66
std::string getError(int err)
const char *const DEFAULT_H264_PROFILE_LEVEL_ID
Definition libav_utils.h:39
void emitSignal(Args... args)
Definition jami_signal.h:64
Structure to hold sample rate and channel number associated with audio data.
void operator()(AVBufferRef *buf) const
Definition libav_utils.h:63