QtlMovie 1.12 (A specialized FFmpeg front-end)
QtlMediaStreamInfo Class Reference

Description of a stream (video, audio, subtitle) in a multimedia file. More...

Public Types

enum  StreamType {
  Video,
  Audio,
  Subtitle,
  Other
}
 Type of stream in a multimedia file. More...
 
enum  SubtitleType {
  SubRip,
  SubSsa,
  SubAss,
  SubDvd,
  SubDvb,
  SubTeletext,
  SubCc,
  SubOther,
  SubNone
}
 Type of encoding for subtitles. More...
 

Public Member Functions

 QtlMediaStreamInfo ()
 Default constructor. More...
 
int audioChannels () const
 Get the number of audio channels. More...
 
int bitRate () const
 Get the bitrate of the stream. More...
 
int ccNumber () const
 Get the Close Captions number (CC subtitles only). More...
 
QString codecName () const
 Get the codec name of the stream. More...
 
QString description (bool compact) const
 Get a human readable description of the stream. More...
 
float displayAspectRatio (bool original=false) const
 Get the video frame display aspect ratio. More...
 
QString displayAspectRatioString (bool original=false, bool validFloat=false) const
 Get the video frame display aspect ratio as a string. More...
 
int ffIndex () const
 Get the stream index as allocated by FFmpeg/FFprobe. More...
 
QString ffSpecifier (int fileIndex=0) const
 Get the stream specifier for FFmpeg/FFprobe command line. More...
 
bool forced () const
 Check if the stream is "forced" (mostly subtitles). More...
 
float frameRate () const
 Get the frame rate of the stream (video). More...
 
int height () const
 Get the video frame height in pixels (video and DVD subtitles). More...
 
bool impaired () const
 Check if the stream is targeted to hearing or visual impaired audience (audio or subtitle). More...
 
bool isCommentary () const
 Check if the stream is a commentary soundtrack. More...
 
bool isDubbedAudio () const
 Check if the stream is a dubbed soundtrack. More...
 
bool isOriginalAudio () const
 Check if the stream is an original soundtrack. More...
 
QString language () const
 Get the stream language (audio, subtitle). More...
 
int rotation () const
 Get the video frame rotation in degrees. More...
 
int samplingRate () const
 Get the sampling rate. More...
 
void setAudioChannels (int audioChannels)
 Set the number of audio channels. More...
 
void setBitRate (int bitRate)
 Set the bitrate of the stream. More...
 
void setCcNumber (int ccNumber)
 Set the Close Captions number (CC subtitles only). More...
 
void setCodecName (const QString &codecName)
 Set the codec name of the stream. More...
 
void setCommentary (bool commentary)
 Set if the stream is a commentary soundtrack. More...
 
void setDisplayAspectRatio (float dar)
 Set the original video frame display aspect ratio. More...
 
void setDubbedAudio (bool dubbedAudio)
 Set if the stream is a dubbed soundtrack. More...
 
void setFFIndex (int ffIndex)
 Set the stream index as allocated by FFmpeg/FFprobe. More...
 
void setForced (bool forced)
 Set if the stream is "forced" (mostly subtitles). More...
 
void setForcedDisplayAspectRatio (float dar)
 Force the video frame display aspect ratio to a value not identical to the original one. More...
 
void setFrameRate (float frameRate)
 Set the frame rate of the stream (video). More...
 
void setHeight (int height)
 Set the video frame height in pixels (video and DVD subtitles). More...
 
void setImpaired (bool impaired)
 Set if the stream is targeted to hearing or visual impaired audience (audio or subtitle). More...
 
void setLanguage (const QString &language)
 Set the stream language (audio, subtitle). More...
 
void setOriginalAudio (bool originalAudio)
 Set if the stream is an original soundtrack. More...
 
void setRotation (int rotation)
 Set the video frame rotation in degrees. More...
 
void setSamplingRate (int samplingRate)
 Set the sampling rate. More...
 
void setStreamId (int id)
 Set the physical stream id in the input file. More...
 
void setStreamType (const StreamType &streamType)
 Set the stream type. More...
 
void setSubtitleType (const SubtitleType &subtitleType)
 Set the subtitle type of the stream. More...
 
void setTeletextPage (int teletextPage)
 Set the Teletext page number (Teletext subtitles only). More...
 
void setTitle (const QString &title)
 Set the free format description of the stream. More...
 
void setWidth (int width)
 Set the video frame width in pixels (video and DVD subtitles). More...
 
int streamId () const
 Get the physical stream id in the input file. More...
 
StreamType streamType () const
 Get the stream type. More...
 
QString streamTypeName () const
 Get the stream type as a string. More...
 
SubtitleType subtitleType () const
 Get the subtitle type of the stream. More...
 
int teletextPage () const
 Get the Teletext page number (Teletext subtitles only). More...
 
QString title () const
 Get the free format description of the stream. More...
 
int width () const
 Get the video frame width in pixels (video and DVD subtitles). More...
 

Static Public Member Functions

static QString fileExtension (SubtitleType type)
 Get the usual file extension for subtitle. More...
 
static bool isTextFile (SubtitleType type)
 Check if subtitles files are text files. More...
 
static bool isTextFile (const QString &fileName)
 Check if subtitles files are text files. More...
 
static void merge (QtlMediaStreamInfoList &destination, const QtlMediaStreamInfoList &source)
 Merge two lists of stream informations. More...
 
static QString streamTypeName (StreamType type)
 Convert a StreamType into a string. More...
 
static SubtitleType subtitleType (const QString &fileName, bool checkExistence=false)
 Get the type of a subtitle file, based on its extension. More...
 

Static Private Member Functions

static void add (QString &str, const QString &item, const QString &separator=", ")
 Append a separator to a string if it is non empty and a new item. More...
 

Private Attributes

int _audioChannels
 Audio channel count. More...
 
int _bitRate
 Bitrate (bits/second). More...
 
int _ccNumber
 Closed Captions channel and field. More...
 
QString _codecName
 Codec name (free format). More...
 
bool _commentary
 Commentary soundtrack. More...
 
float _dar
 Video frame display aspect ratio. More...
 
bool _dubbedAudio
 Dubbed soundtrack. More...
 
int _ffIndex
 Stream index as allocated by FFmpeg/FFprobe. More...
 
bool _forced
 Forced stream. More...
 
float _forcedDar
 Manually forced video frame display aspect ratio. More...
 
float _frameRate
 Frame rate (frames/second). More...
 
int _height
 Video frame height in pixels. More...
 
bool _impaired
 For hearing/visual impaired. More...
 
QString _language
 Stream language (audio, subtitle). More...
 
bool _originalAudio
 Original soundtrack. More...
 
int _rotation
 Video frame rotation in degrees. More...
 
int _samplingRate
 Sampling rate (samples/second). More...
 
int _streamId
 Physical stream id in input file. More...
 
StreamType _streamType
 Stream type (audio, video, etc.) More...
 
SubtitleType _subtitleType
 Subtitle type. More...
 
int _teletextPage
 Teletext page number (Teletext subtitles only). More...
 
QString _title
 Free format readable description. More...
 
int _width
 Video frame width in pixels. More...
 

Detailed Description

Description of a stream (video, audio, subtitle) in a multimedia file.

Member Enumeration Documentation

◆ StreamType

Type of stream in a multimedia file.

Enumerator
Video 

Video stream.

Audio 

Audio stream.

Subtitle 

Subtitle stream.

Other 

Other type of stream (not to be transcoded)

◆ SubtitleType

Type of encoding for subtitles.

Enumerator
SubRip 

SubRip format, .srt file.

SubSsa 

SubStation Alpha, .ssa files.

SubAss 

Advanced SubStation Alpha, SSA v4+, .ass files.

SubDvd 

DVD subtitles or VobSub, .sub + .idx files.

SubDvb 

DVB subtitles (in transport streams only).

SubTeletext 

Teletext subtitles (in transport streams only).

SubCc 

CEA-608/708 Closed Captions.

SubOther 

Other type of subtitles.

SubNone 

Not a subtitle stream or file.

Constructor & Destructor Documentation

◆ QtlMediaStreamInfo()

QtlMediaStreamInfo::QtlMediaStreamInfo ( )

Default constructor.

Member Function Documentation

◆ streamTypeName() [1/2]

QString QtlMediaStreamInfo::streamTypeName ( QtlMediaStreamInfo::StreamType  type)
static

Convert a StreamType into a string.

Parameters
[in]typeStream type.
Returns
Human readable string.

◆ streamType()

StreamType QtlMediaStreamInfo::streamType ( ) const
inline

Get the stream type.

Returns
The stream type.

◆ streamTypeName() [2/2]

QString QtlMediaStreamInfo::streamTypeName ( ) const
inline

Get the stream type as a string.

Returns
The stream type as a string.

◆ setStreamType()

void QtlMediaStreamInfo::setStreamType ( const StreamType streamType)
inline

Set the stream type.

Parameters
[in]streamTypeThe stream type.

◆ description()

QString QtlMediaStreamInfo::description ( bool  compact) const

Get a human readable description of the stream.

Parameters
[in]compactIf true, return a more compact string, for short-width display.
Returns
A human readable description of the stream.

◆ title()

QString QtlMediaStreamInfo::title ( ) const
inline

Get the free format description of the stream.

Returns
The free format description of the stream.

◆ setTitle()

void QtlMediaStreamInfo::setTitle ( const QString &  title)

Set the free format description of the stream.

Parameters
[in]titleThe free format description of the stream.

◆ codecName()

QString QtlMediaStreamInfo::codecName ( ) const
inline

Get the codec name of the stream.

Returns
The codec name of the stream.

◆ setCodecName()

void QtlMediaStreamInfo::setCodecName ( const QString &  codecName)

Set the codec name of the stream.

Parameters
[in]codecNameThe codec name of the stream.

◆ language()

QString QtlMediaStreamInfo::language ( ) const
inline

Get the stream language (audio, subtitle).

Returns
The stream language (audio, subtitle). No specific encoding, depends on input file metadata. The returned string is always lowercase and trimmed.

◆ setLanguage()

void QtlMediaStreamInfo::setLanguage ( const QString &  language)

Set the stream language (audio, subtitle).

Parameters
[in]languageThe stream language.

◆ ffIndex()

int QtlMediaStreamInfo::ffIndex ( ) const
inline

Get the stream index as allocated by FFmpeg/FFprobe.

Returns
The stream index as allocated by FFmpeg/FFprobe or -1 if unknown.

◆ ffSpecifier()

QString QtlMediaStreamInfo::ffSpecifier ( int  fileIndex = 0) const

Get the stream specifier for FFmpeg/FFprobe command line.

Parameters
[in]fileIndexOptional file index.
Returns
The stream specifier for FFmpeg/FFprobe command line.

◆ setFFIndex()

void QtlMediaStreamInfo::setFFIndex ( int  ffIndex)

Set the stream index as allocated by FFmpeg/FFprobe.

Parameters
[in]ffIndexThe stream index as allocated by FFmpeg/FFprobe.

◆ streamId()

int QtlMediaStreamInfo::streamId ( ) const
inline

Get the physical stream id in the input file.

Its semantic depends on the input file format. For MPEG-TS files, this is the PID. For MPEG-PS files, this is the stream id.

Returns
The stream id or -1 if unknown.

◆ setStreamId()

void QtlMediaStreamInfo::setStreamId ( int  id)
inline

Set the physical stream id in the input file.

Do no filtering on the value since the semantic is unknown.

Parameters
[in]idThe stream id.

◆ teletextPage()

int QtlMediaStreamInfo::teletextPage ( ) const
inline

Get the Teletext page number (Teletext subtitles only).

Returns
The Teletext page number or -1 if unknown.

◆ setTeletextPage()

void QtlMediaStreamInfo::setTeletextPage ( int  teletextPage)

Set the Teletext page number (Teletext subtitles only).

Parameters
[in]teletextPageThe Teletext page number.

◆ ccNumber()

int QtlMediaStreamInfo::ccNumber ( ) const
inline

Get the Close Captions number (CC subtitles only).

The CC are numbered as follow:

  • 1: EIA-608, channel 1, field 1
  • 2: EIA-608, channel 1, field 2
  • 3: EIA-608, channel 2, field 1
  • 4: EIA-608, channel 2, field 2
  • 5: CEA-708, service 1
  • 6: CEA-708, service 2
  • etc. This may not be ideal. Feedback from US users required.
    Returns
    The Close Captions number or -1 if unknown.

◆ setCcNumber()

void QtlMediaStreamInfo::setCcNumber ( int  ccNumber)

Set the Close Captions number (CC subtitles only).

Parameters
[in]ccNumberThe Close Captions number.
See also
ccNumber()

◆ width()

int QtlMediaStreamInfo::width ( ) const
inline

Get the video frame width in pixels (video and DVD subtitles).

Returns
The video frame width in pixels or zero if unknown.

◆ setWidth()

void QtlMediaStreamInfo::setWidth ( int  width)

Set the video frame width in pixels (video and DVD subtitles).

Parameters
[in]widthThe video frame width.

◆ height()

int QtlMediaStreamInfo::height ( ) const
inline

Get the video frame height in pixels (video and DVD subtitles).

Returns
The video frame height in pixels or zero if unknown.

◆ setHeight()

void QtlMediaStreamInfo::setHeight ( int  height)

Set the video frame height in pixels (video and DVD subtitles).

Parameters
[in]heightThe video frame height in pixels.

◆ displayAspectRatio()

float QtlMediaStreamInfo::displayAspectRatio ( bool  original = false) const

Get the video frame display aspect ratio.

Parameters
[in]originalIf true, ignore the forced DAR (if specified) and always return the original DAR from the input file.
Returns
The video frame display aspect ratio or 0.0 if unknown.

◆ displayAspectRatioString()

QString QtlMediaStreamInfo::displayAspectRatioString ( bool  original = false,
bool  validFloat = false 
) const

Get the video frame display aspect ratio as a string.

Parameters
[in]originalIf true, ignore the forced DAR (if specified) and always return the original DAR from the input file.
[in]validFloatIf true, always return a string which can be interpreted as a float using qtlToFloat().
Returns
A string representing the video frame display aspect ratio, empty if unknown.

◆ setDisplayAspectRatio()

void QtlMediaStreamInfo::setDisplayAspectRatio ( float  dar)

Set the original video frame display aspect ratio.

Parameters
[in]darThe video frame display aspect ratio.

◆ setForcedDisplayAspectRatio()

void QtlMediaStreamInfo::setForcedDisplayAspectRatio ( float  dar)

Force the video frame display aspect ratio to a value not identical to the original one.

Parameters
[in]darThe forced video frame display aspect ratio. If zero, there is no more forced DAR and the original DAR from the input file is used.

◆ rotation()

int QtlMediaStreamInfo::rotation ( ) const
inline

Get the video frame rotation in degrees.

Returns
The video frame rotation in degrees.

◆ setRotation()

void QtlMediaStreamInfo::setRotation ( int  rotation)

Set the video frame rotation in degrees.

Parameters
[in]rotationThe video frame rotation in degrees.

◆ forced()

bool QtlMediaStreamInfo::forced ( ) const
inline

Check if the stream is "forced" (mostly subtitles).

Forced subtitles for a given language shall be displayed when the selected audio stream has the same language. They typically correspond to fragment of dialogs which are in a different language.

Returns
True if the stream is "forced".

◆ setForced()

void QtlMediaStreamInfo::setForced ( bool  forced)
inline

Set if the stream is "forced" (mostly subtitles).

Parameters
[in]forcedTrue if the stream is "forced".

◆ impaired()

bool QtlMediaStreamInfo::impaired ( ) const
inline

Check if the stream is targeted to hearing or visual impaired audience (audio or subtitle).

Returns
True if the stream is targeted to hearing or visual impaired audience.

◆ setImpaired()

void QtlMediaStreamInfo::setImpaired ( bool  impaired)
inline

Set if the stream is targeted to hearing or visual impaired audience (audio or subtitle).

Parameters
[in]impairedTrue if the stream is targeted to hearing or visual impaired audience.

◆ bitRate()

int QtlMediaStreamInfo::bitRate ( ) const
inline

Get the bitrate of the stream.

Returns
The bitrate of the stream in bits/second or zero if unknown.

◆ setBitRate()

void QtlMediaStreamInfo::setBitRate ( int  bitRate)

Set the bitrate of the stream.

Parameters
[in]bitRateThe bitrate of the stream in bits/second.

◆ frameRate()

float QtlMediaStreamInfo::frameRate ( ) const
inline

Get the frame rate of the stream (video).

Returns
The frame rate of the stream in frames/second or zero if unknown.

◆ setFrameRate()

void QtlMediaStreamInfo::setFrameRate ( float  frameRate)

Set the frame rate of the stream (video).

Parameters
[in]frameRateThe frame rate of the stream in frames/second or zero if unknown.

◆ isOriginalAudio()

bool QtlMediaStreamInfo::isOriginalAudio ( ) const
inline

Check if the stream is an original soundtrack.

Returns
True if the stream is an original soundtrack.

◆ setOriginalAudio()

void QtlMediaStreamInfo::setOriginalAudio ( bool  originalAudio)
inline

Set if the stream is an original soundtrack.

Parameters
[in]originalAudioTrue if the stream is an original soundtrack.

◆ isDubbedAudio()

bool QtlMediaStreamInfo::isDubbedAudio ( ) const
inline

Check if the stream is a dubbed soundtrack.

Returns
True if the stream is a dubbed soundtrack.

◆ setDubbedAudio()

void QtlMediaStreamInfo::setDubbedAudio ( bool  dubbedAudio)
inline

Set if the stream is a dubbed soundtrack.

Parameters
[in]dubbedAudioTrue if the stream is a dubbed soundtrack.

◆ audioChannels()

int QtlMediaStreamInfo::audioChannels ( ) const
inline

Get the number of audio channels.

Returns
The number of audio channels or zero if unknown.

◆ setAudioChannels()

void QtlMediaStreamInfo::setAudioChannels ( int  audioChannels)

Set the number of audio channels.

Parameters
[in]audioChannelsThe number of audio channels.

◆ samplingRate()

int QtlMediaStreamInfo::samplingRate ( ) const
inline

Get the sampling rate.

Returns
The sampling rate in samples/seconds or zero if unknown.

◆ setSamplingRate()

void QtlMediaStreamInfo::setSamplingRate ( int  samplingRate)

Set the sampling rate.

Parameters
[in]samplingRateThe sampling rate in samples/seconds.

◆ isCommentary()

bool QtlMediaStreamInfo::isCommentary ( ) const
inline

Check if the stream is a commentary soundtrack.

Returns
True if the stream is a commentary soundtrack.

◆ setCommentary()

void QtlMediaStreamInfo::setCommentary ( bool  commentary)
inline

Set if the stream is a commentary soundtrack.

Parameters
[in]commentaryTrue if the stream is a commentary soundtrack.

◆ subtitleType() [1/2]

SubtitleType QtlMediaStreamInfo::subtitleType ( ) const
inline

Get the subtitle type of the stream.

Returns
The subtitle type of the stream.

◆ setSubtitleType()

void QtlMediaStreamInfo::setSubtitleType ( const SubtitleType subtitleType)
inline

Set the subtitle type of the stream.

Parameters
[in]subtitleTypeThe subtitle type of the stream.

◆ subtitleType() [2/2]

QtlMediaStreamInfo::SubtitleType QtlMediaStreamInfo::subtitleType ( const QString &  fileName,
bool  checkExistence = false 
)
static

Get the type of a subtitle file, based on its extension.

Parameters
[in]fileNameFile name. The file name extension is used to determine the subtitle type.
[in]checkExistenceIf true, also check that the file exists. If false, only check the file name extension.
Returns
Subtitle type. If checkExistence is true and the file does not exist, return SubNone.

◆ fileExtension()

QString QtlMediaStreamInfo::fileExtension ( SubtitleType  type)
static

Get the usual file extension for subtitle.

Parameters
[in]typeSubtitle type.
Returns
File extension (including the dot) or empty if unknown.

◆ isTextFile() [1/2]

bool QtlMediaStreamInfo::isTextFile ( QtlMediaStreamInfo::SubtitleType  type)
static

Check if subtitles files are text files.

Parameters
[in]typeSubtitle type to check.
Returns
True if subtitle files for the given type are text files, false if they are binary files.

◆ isTextFile() [2/2]

static bool QtlMediaStreamInfo::isTextFile ( const QString &  fileName)
inlinestatic

Check if subtitles files are text files.

Parameters
[in]fileNameSubtitle file name. The file name extension is used to determine the subtitle type.
Returns
True if subtitle files for the given file are text files, false if they are binary files.

◆ merge()

void QtlMediaStreamInfo::merge ( QtlMediaStreamInfoList destination,
const QtlMediaStreamInfoList source 
)
static

Merge two lists of stream informations.

Parameters
[in,out]destinationAll existing streams in this list are merged with their counterpart in source. For each stream in destination, if a stream with the same streamId() exists in source, the missing information are added in the stream in destination.
[in]sourceA list of stream information.

◆ add()

void QtlMediaStreamInfo::add ( QString &  str,
const QString &  item,
const QString &  separator = ", " 
)
staticprivate

Append a separator to a string if it is non empty and a new item.

Parameters
[in,out]strString to update.
[in]itemItem to add.
[in]separatorSeparator to append if str is not empty.

Member Data Documentation

◆ _streamType

StreamType QtlMediaStreamInfo::_streamType
private

Stream type (audio, video, etc.)

◆ _title

QString QtlMediaStreamInfo::_title
private

Free format readable description.

◆ _codecName

QString QtlMediaStreamInfo::_codecName
private

Codec name (free format).

◆ _language

QString QtlMediaStreamInfo::_language
private

Stream language (audio, subtitle).

◆ _ffIndex

int QtlMediaStreamInfo::_ffIndex
private

Stream index as allocated by FFmpeg/FFprobe.

◆ _streamId

int QtlMediaStreamInfo::_streamId
private

Physical stream id in input file.

◆ _subtitleType

SubtitleType QtlMediaStreamInfo::_subtitleType
private

Subtitle type.

◆ _teletextPage

int QtlMediaStreamInfo::_teletextPage
private

Teletext page number (Teletext subtitles only).

◆ _ccNumber

int QtlMediaStreamInfo::_ccNumber
private

Closed Captions channel and field.

◆ _width

int QtlMediaStreamInfo::_width
private

Video frame width in pixels.

◆ _height

int QtlMediaStreamInfo::_height
private

Video frame height in pixels.

◆ _dar

float QtlMediaStreamInfo::_dar
private

Video frame display aspect ratio.

◆ _forcedDar

float QtlMediaStreamInfo::_forcedDar
private

Manually forced video frame display aspect ratio.

◆ _rotation

int QtlMediaStreamInfo::_rotation
private

Video frame rotation in degrees.

◆ _forced

bool QtlMediaStreamInfo::_forced
private

Forced stream.

◆ _impaired

bool QtlMediaStreamInfo::_impaired
private

For hearing/visual impaired.

◆ _bitRate

int QtlMediaStreamInfo::_bitRate
private

Bitrate (bits/second).

◆ _frameRate

float QtlMediaStreamInfo::_frameRate
private

Frame rate (frames/second).

◆ _originalAudio

bool QtlMediaStreamInfo::_originalAudio
private

Original soundtrack.

◆ _dubbedAudio

bool QtlMediaStreamInfo::_dubbedAudio
private

Dubbed soundtrack.

◆ _audioChannels

int QtlMediaStreamInfo::_audioChannels
private

Audio channel count.

◆ _samplingRate

int QtlMediaStreamInfo::_samplingRate
private

Sampling rate (samples/second).

◆ _commentary

bool QtlMediaStreamInfo::_commentary
private

Commentary soundtrack.


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