pianod2
multisource multiuser scriptable networked music player
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Audio::LibavMediaReader Class Referenceabstract

Base class for reading media streams via ffmpeg. More...

#include <ffmpegplayer.h>

Inheritance diagram for Audio::LibavMediaReader:
Inheritance graph
[legend]

Classes

struct  CodecDeleter
 

Public Member Functions

 LibavMediaReader (const std::string &media_url, int timeout=15)
 Base abstract class for reading a media file or URL using ffmpeg. More...
 
virtual ~LibavMediaReader (void)
 

Protected Member Functions

int initializeStream (std::unique_ptr< AVCodecContext, CodecDeleter > &codec_context)
 Prepare a ffmpeg source for playing its audio stream. More...
 
void processReplayGain (AVReplayGain *gain, int size)
 Process a replaygain packet by extracting the track gain, or if not found then then the album gain. More...
 
virtual void setGain (float gain)=0
 

Protected Attributes

const std::string url
 Media URL or filename. More...
 
bool is_network = false
 True if media is network streaming. More...
 
AVFormatContext * transport = nullptr
 

Detailed Description

Base class for reading media streams via ffmpeg.

Constructor & Destructor Documentation

◆ LibavMediaReader()

Audio::LibavMediaReader::LibavMediaReader ( const std::string &  media_url,
int  timeout = 15 
)

Base abstract class for reading a media file or URL using ffmpeg.

Parameters
media_urlThe filename or URL of the media.
timeoutThe timeout for reading the media stream, in seconds.
Here is the call graph for this function:

◆ ~LibavMediaReader()

Audio::LibavMediaReader::~LibavMediaReader ( void  )
virtual

Member Function Documentation

◆ initializeStream()

int Audio::LibavMediaReader::initializeStream ( std::unique_ptr< AVCodecContext, CodecDeleter > &  codec_context)
protected

Prepare a ffmpeg source for playing its audio stream.

Chooses codec, extracts replay gain if available, and sets streams other than the audio are set to ignore.

Parameters
codec_contextOn return, is set to an initialized codec_context with appropriate codec selected for the media.
Returns
The audio stream index.
Exceptions
LavAudioExceptionif something goes wrong.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processReplayGain()

void Audio::LibavMediaReader::processReplayGain ( AVReplayGain *  gain,
int  size 
)
protected

Process a replaygain packet by extracting the track gain, or if not found then then the album gain.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGain()

virtual void Audio::LibavMediaReader::setGain ( float  gain)
protectedpure virtual

Implemented in Media::LavMetadataReader, and Audio::LavPlayer.

Here is the caller graph for this function:

Member Data Documentation

◆ is_network

bool Audio::LibavMediaReader::is_network = false
protected

True if media is network streaming.

◆ transport

AVFormatContext* Audio::LibavMediaReader::transport = nullptr
protected

◆ url

const std::string Audio::LibavMediaReader::url
protected

Media URL or filename.


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