Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
StreamUtils Class Reference

#include <StreamUtils.h>

Classes

struct  AudioCandidate
 One audio stream. More...
 
struct  AudioPreferences
 The settings that decide which audio stream playback starts with. More...
 

Static Public Member Functions

static int CompareAudioPreference (const AudioCandidate &lh, const AudioCandidate &rh, const AudioPreferences &preferences)
 Compare two audio streams the way playback picks the stream it starts on.
 
static int GetCodecPriority (const std::string &codec)
 
static int CompareAudioQuality (const std::string &codecA, int channelsA, const std::string &codecB, int channelsB)
 Compare two audio streams on the technical quality of what they carry.
 
static constexpr uint32_t MakeFourCC (char c1, char c2, char c3, char c4)
 Make a FourCC code as unsigned integer value.
 
static std::string GetCodecName (int codecId, int profile)
 Get the codec name translated from ffmpeg codec id and profile.
 
static std::string NormalizeAudioCodecName (const std::string &codec)
 Normalise an externally supplied (eg. NFO) audio codec name to the name Kodi uses.
 
static std::string GetDefaultLayout (unsigned int channels)
 Return a default channel layout in x.y.z form for a channel count.
 
static std::string GetLayout (unsigned int channels)
 Return a default channel layout for a channel count or localized count of channels when no default exists.
 
static bool IsCodecSupportForcedOverlay (int codecId)
 Determines if a codec support forced overlays (on image type subtitles).
 

Member Function Documentation

◆ CompareAudioPreference()

int StreamUtils::CompareAudioPreference ( const AudioCandidate & lh,
const AudioCandidate & rh,
const AudioPreferences & preferences )
static

Compare two audio streams the way playback picks the stream it starts on.

The tiers, in order: the wanted language (or the original flag when that is the preference), the hearing and visual impaired flags, the default flag when the user asked for it, a stereo layout, technical quality, and finally the default flag as a tiebreak.

Parameters
lhThe first stream
rhThe second stream
preferencesThe settings in force, see AudioPreferences::Current()
Returns
A positive value when the first stream is the better match, a negative value when the second is, and zero when these properties cannot separate the two
Note
This is a strict weak ordering, as CSelectionStreams::Get() hands it to std::stable_sort. Every tier is a property each stream decides for itself, never one that depends on the pair.

◆ CompareAudioQuality()

int StreamUtils::CompareAudioQuality ( const std::string & codecA,
int channelsA,
const std::string & codecB,
int channelsB )
static

Compare two audio streams on the technical quality of what they carry.

Parameters
codecAThe codec name of the first stream, as GetCodecPriority() expects it
channelsAThe channel count of the first stream, zero or negative when unknown
codecBThe codec name of the second stream
channelsBThe channel count of the second stream
Returns
A positive value when the first stream is better, a negative value when the second is, and zero when the two are equally good (which is not the same as interchangeable, as equally ranked codecs are different presentations)

◆ GetCodecName()

std::string StreamUtils::GetCodecName ( int codecId,
int profile )
static

Get the codec name translated from ffmpeg codec id and profile.

Parameters
codecIdThe ffmpeg codec id
profileThe ffmpeg codec profile
Returns
The codec name

◆ GetCodecPriority()

int StreamUtils::GetCodecPriority ( const std::string & codec)
static

◆ GetDefaultLayout()

std::string StreamUtils::GetDefaultLayout ( unsigned int channels)
static

Return a default channel layout in x.y.z form for a channel count.

Parameters
[in]channelsthe count of channels
Returns
the default layout

◆ GetLayout()

std::string StreamUtils::GetLayout ( unsigned int channels)
static

Return a default channel layout for a channel count or localized count of channels when no default exists.

Parameters
[in]channelsthe count of channels
Returns
the layout

◆ IsCodecSupportForcedOverlay()

bool StreamUtils::IsCodecSupportForcedOverlay ( int codecId)
static

Determines if a codec support forced overlays (on image type subtitles).

Parameters
codecIdThe ffmpeg codec id
Returns
True when support forced overlay, otherwise false

◆ MakeFourCC()

static constexpr uint32_t StreamUtils::MakeFourCC ( char c1,
char c2,
char c3,
char c4 )
inlinestaticconstexpr

Make a FourCC code as unsigned integer value.

Parameters
c1The first FourCC char
c2The second FourCC char
c3The third FourCC char
c4The fourth FourCC char
Returns
The FourCC as unsigned integer value

◆ NormalizeAudioCodecName()

std::string StreamUtils::NormalizeAudioCodecName ( const std::string & codec)
static

Normalise an externally supplied (eg. NFO) audio codec name to the name Kodi uses.

Parameters
codecThe audio codec name, lowercased
Returns
The equivalent Kodi codec name, or the codec name unchanged if nothing maps

The documentation for this class was generated from the following files: