LCOV - code coverage report
Current view: top level - foo/src/media - libav_utils.h (source / functions) Hit Total Coverage
Test: jami-coverage-filtered.info Lines: 1 1 100.0 %
Date: 2026-01-22 10:39:23 Functions: 1 1 100.0 %

          Line data    Source code
       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
      18             : #include "media/audio/audio_format.h"
      19             : 
      20             : #include <libavutil/samplefmt.h>
      21             : 
      22             : #include <string>
      23             : #include <memory>
      24             : 
      25             : extern "C" {
      26             : struct AVDictionary;
      27             : struct AVFrame;
      28             : struct AVPixFmtDescriptor;
      29             : struct AVBufferRef;
      30             : struct AVCodec;
      31             : void av_buffer_unref(AVBufferRef** buf);
      32             : }
      33             : 
      34             : namespace jami {
      35             : namespace libav_utils {
      36             : 
      37             : void av_init();
      38             : 
      39             : const char* const DEFAULT_H264_PROFILE_LEVEL_ID = "profile-level-id=428029";
      40             : const char* const MAX_H264_PROFILE_LEVEL_ID = "profile-level-id=640034";
      41             : 
      42             : enum AVSampleFormat choose_sample_fmt(const AVCodec* codec,
      43             :                                       const enum AVSampleFormat* preferred_formats,
      44             :                                       int preferred_formats_count);
      45             : enum AVSampleFormat choose_sample_fmt_default(const AVCodec* codec, enum AVSampleFormat defaultFormat);
      46             : 
      47             : bool is_yuv_planar(const AVPixFmtDescriptor& desc);
      48             : 
      49             : std::string getError(int err);
      50             : 
      51             : const char* getDictValue(const AVDictionary* d, const std::string& key, int flags = 0);
      52             : 
      53             : void setDictValue(AVDictionary** d, const std::string& key, const std::string& value, int flags = 0);
      54             : 
      55             : void fillWithBlack(AVFrame* frame);
      56             : 
      57             : void fillWithSilence(AVFrame* frame);
      58             : 
      59             : AudioFormat getFormat(const AVFrame* frame);
      60             : 
      61             : struct AVBufferRef_deleter
      62             : {
      63         188 :     void operator()(AVBufferRef* buf) const { av_buffer_unref(&buf); }
      64             : };
      65             : 
      66             : typedef std::unique_ptr<AVBufferRef, AVBufferRef_deleter> AVBufferPtr;
      67             : 
      68             : } // namespace libav_utils
      69             : } // namespace jami

Generated by: LCOV version 1.14