LCOV - code coverage report
Current view: top level - src/media - libav_utils.h (source / functions) Hit Total Coverage
Test: jami-coverage-filtered.info Lines: 1 1 100.0 %
Date: 2024-04-29 07:59:39 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  *  Copyright (C) 2004-2024 Savoir-faire Linux Inc.
       3             :  *
       4             :  *  Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
       5             :  *  Author: Philippe Gorley <philippe.gorley@savoirfairelinux.com>
       6             :  *
       7             :  *  This program is free software; you can redistribute it and/or modify
       8             :  *  it under the terms of the GNU General Public License as published by
       9             :  *  the Free Software Foundation; either version 3 of the License, or
      10             :  *  (at your option) any later version.
      11             :  *
      12             :  *  This program is distributed in the hope that it will be useful,
      13             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :  *  GNU General Public License for more details.
      16             :  *
      17             :  *  You should have received a copy of the GNU General Public License
      18             :  *  along with this program; if not, write to the Free Software
      19             :  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
      20             :  */
      21             : 
      22             : #pragma once
      23             : 
      24             : #include <libavutil/samplefmt.h>
      25             : 
      26             : #include <vector>
      27             : #include <map>
      28             : #include <string>
      29             : #include <memory>
      30             : 
      31             : extern "C" {
      32             : struct AVDictionary;
      33             : struct AVFrame;
      34             : struct AVPixFmtDescriptor;
      35             : struct AVBufferRef;
      36             : struct AVCodec;
      37             : void av_buffer_unref(AVBufferRef **buf);
      38             : }
      39             : 
      40             : namespace jami {
      41             : namespace libav_utils {
      42             : 
      43             : void av_init();
      44             : 
      45             : const char* const DEFAULT_H264_PROFILE_LEVEL_ID = "profile-level-id=428029";
      46             : const char* const MAX_H264_PROFILE_LEVEL_ID = "profile-level-id=640034";
      47             : 
      48             : enum AVSampleFormat choose_sample_fmt(const AVCodec* codec, const enum AVSampleFormat* preferred_formats, int preferred_formats_count);
      49             : enum AVSampleFormat choose_sample_fmt_default(const AVCodec* codec, enum AVSampleFormat defaultFormat);
      50             : 
      51             : bool is_yuv_planar(const AVPixFmtDescriptor& desc);
      52             : 
      53             : std::string getError(int err);
      54             : 
      55             : const char* getDictValue(const AVDictionary* d, const std::string& key, int flags = 0);
      56             : 
      57             : void setDictValue(AVDictionary** d, const std::string& key, const std::string& value, int flags = 0);
      58             : 
      59             : void fillWithBlack(AVFrame* frame);
      60             : 
      61             : void fillWithSilence(AVFrame* frame);
      62             : 
      63             : struct AVBufferRef_deleter {
      64         192 :     void operator()(AVBufferRef* buf) const { av_buffer_unref(&buf); }
      65             : };
      66             : 
      67             : typedef std::unique_ptr<AVBufferRef, AVBufferRef_deleter> AVBufferPtr;
      68             : 
      69             : } // namespace libav_utils
      70             : } // namespace jami

Generated by: LCOV version 1.14