pianod2
multisource multiuser scriptable networked music player
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
Media Namespace Reference

Media source, source parameters and player interfaces. More...

Namespaces

 Key
 

Classes

class  Manager
 The Media::Manager contains a collection of all sources. More...
 
class  SourceParameters
 Source parameter manager. More...
 
class  Initializer
 Initialize the media engines; uninitialize on destruction. More...
 
class  Player
 Base class for playing audio from some source. More...
 
class  ThreadedPlayer
 Base class for audio players that are spawned to a new thread. More...
 
struct  Statistics
 Statistics on media played from the sources. More...
 
class  Source
 Base class that wraps any audio source, such as Pandora, Spotify, or local music. More...
 
class  SplitId
 Mechanism to split MusicThingie IDs into source identifier, type and inner ID. More...
 
class  LavMetadataReader
 Read media stream metadata via ffmpeg. More...
 
class  GstreamerMetadataReader
 Read media stream metadata via gstreamer. More...
 
class  MediaException
 An exception thrown by metadata readers when metadata cannot be extracted. More...
 
class  Metadata
 
class  OSXMetadataReader
 A class to extract metadata from media files using AVFoundation. More...
 
class  TaglibReader
 A class to extract metadata from media files using Taglib. More...
 
class  PlayerWrapper
 The Player class is abstract, and is implemented several different ways (ffmpeg, gstreamer, AVFoundation...). More...
 

Typedefs

using SourcePtr = std::unique_ptr< Source >
 

Enumerations

enum class  ProxyMode { None , Donor , Recipient }
 How a source participates in track-source substitutions;. More...
 
enum class  PersistenceMode { Temporary , Loaded , Remember , Restore }
 
enum class  SelectionMethod {
  Song , Album , Artist , Playlist ,
  Random
}
 The manner in which shuffling is performed. More...
 
enum class  Key {
  Unknown , Artist , Album , Title ,
  Genre , Comment , Year , Track ,
  Disc
}
 

Functions

void reportLibrariesAndVersions (int verbose)
 Report media libraries in use and their versions. More...
 
static const GValue * retrieveTag (const GstTagList *tag_list, const gchar *tag, GType type)
 Retrieve a value out of the tag list. More...
 
static void retrieveTag (const GstTagList *list, const gchar *tag, float *value)
 Extract a floating point value from the tag list. More...
 
static void retrieveUintTag (const GstTagList *list, const gchar *tag, int *value)
 Extract an unsigned integer value from the tag list. More...
 
static void retrieveYearTag (const GstTagList *list, const gchar *tag, int *value)
 Extract the year from the tag list. More...
 
static void retrieveDurationTag (const GstTagList *list, const gchar *tag, float *value)
 Extract a string value from the tag list. More...
 
static void retrieveTag (const GstTagList *list, const gchar *tag, std::string *value)
 Extract a string value from the tag list. More...
 
constexpr int32_t KeyCode (int32_t a, int32_t b, int32_t c, int32_t d)
 
static Key saneKey (const NSString *keySpace, const NSObject *key, const NSObject *commonKey)
 
static std::string getTagByName (const TagLib::FileRef &file, const char *tagname)
 Acquire a metadata field by name. More...
 
static float getFileGain (const TagLib::FileRef &file)
 

Variables

LookupTable< Media::ProxyModeProxyWords
 
LookupTable< Media::PersistenceModePersistenceWords
 
static const char * media_formats []
 

Detailed Description

Media source, source parameters and player interfaces.

Typedef Documentation

◆ SourcePtr

using Media::SourcePtr = typedef std::unique_ptr<Source>

Enumeration Type Documentation

◆ Key

enum Media::Key
strong
Enumerator
Unknown 
Artist 
Album 
Title 
Genre 
Comment 
Year 
Track 
Disc 

◆ PersistenceMode

Enumerator
Temporary 

Provided from command line, store neither settings nor indexes.

Loaded 

Values loaded from stored data, do not update settings but do update indexes.

Remember 

Store it, store indexes, but manually restore only.

Restore 

Store it, store indexes, and automatically restore on startup.

◆ ProxyMode

enum Media::ProxyMode
strong

How a source participates in track-source substitutions;.

Enumerator
None 

Source does not participate.

Donor 

Source provides substitute tracks.

Recipient 

Source wants its tracks replaced when possible.

◆ SelectionMethod

The manner in which shuffling is performed.

Enumerator
Song 

Songs are picked randomly from the union of applicable playlists.

Album 

An entire album is picked randomly from a playlist.

Artist 

An artist is picked randomly, then a few of their songs are picked.

Playlist 

A playlist is picked randomly, then a few of its songs randomly.

Random 

One of the above methods is randomly chosen.

Function Documentation

◆ getFileGain()

static float Media::getFileGain ( const TagLib::FileRef &  file)
static

Extract replay gain. libavformat does this sometime, but since there are so many standards to choose from (ID3, APE, iTunes, some others) it doesn't over them all. Here we cover the iTunes case, which libavformat & gstreamer ignore.

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

◆ getTagByName()

static std::string Media::getTagByName ( const TagLib::FileRef &  file,
const char *  tagname 
)
static

Acquire a metadata field by name.

Parameters
fileA taglib file handle.
tagnameThe metadata field name.
Returns
The data found, or an empty string.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ KeyCode()

constexpr int32_t Media::KeyCode ( int32_t  a,
int32_t  b,
int32_t  c,
int32_t  d 
)
constexpr
Here is the caller graph for this function:

◆ reportLibrariesAndVersions()

void Media::reportLibrariesAndVersions ( int  verbose)

Report media libraries in use and their versions.

Parameters
verboseIf >0, include additional details.
Here is the caller graph for this function:

◆ retrieveDurationTag()

static void Media::retrieveDurationTag ( const GstTagList *  list,
const gchar *  tag,
float *  value 
)
static

Extract a string value from the tag list.

Parameters
listA dictionary of tags and values.
tagThe tag whose value to retrieve.
valueThe variable to retrieve into.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retrieveTag() [1/3]

static void Media::retrieveTag ( const GstTagList *  list,
const gchar *  tag,
float *  value 
)
static

Extract a floating point value from the tag list.

Parameters
listA dictionary of tags and values.
tagThe tag whose value to retrieve.
valueThe variable to retrieve into.
Here is the call graph for this function:

◆ retrieveTag() [2/3]

static void Media::retrieveTag ( const GstTagList *  list,
const gchar *  tag,
std::string *  value 
)
static

Extract a string value from the tag list.

Parameters
listA dictionary of tags and values.
tagThe tag whose value to retrieve.
valueThe variable to retrieve into.
Here is the call graph for this function:

◆ retrieveTag() [3/3]

static const GValue* Media::retrieveTag ( const GstTagList *  tag_list,
const gchar *  tag,
GType  type 
)
static

Retrieve a value out of the tag list.

Parameters
tag_listThe tag collection to extract a value from.
tagThe tag whose value to retrieve.
typeThe expected datatype of the tag's value.
Returns
If found an the expected type, the value, otherwise null.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retrieveUintTag()

static void Media::retrieveUintTag ( const GstTagList *  list,
const gchar *  tag,
int *  value 
)
static

Extract an unsigned integer value from the tag list.

Parameters
listA dictionary of tags and values.
tagThe tag whose value to retrieve.
valueThe variable to retrieve into.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retrieveYearTag()

static void Media::retrieveYearTag ( const GstTagList *  list,
const gchar *  tag,
int *  value 
)
static

Extract the year from the tag list.

Parameters
listA dictionary of tags and values.
tagThe tag whose value to retrieve.
valueThe variable to retrieve into.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saneKey()

static Key Media::saneKey ( const NSString *  keySpace,
const NSObject *  key,
const NSObject *  commonKey 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ media_formats

const char* Media::media_formats[]
static
Initial value:
= {
".mp3",
".m4a",
".flac",
".wav",
".mp4a",
".wma",
".snd",
".aiff",
".aac",
".ogg",
".mpa",
".alac",
nullptr
}

◆ PersistenceWords

LookupTable<Media::PersistenceMode> Media::PersistenceWords
Initial value:
{
{ "none", PersistenceMode::Temporary },
{ "remember", PersistenceMode::Remember },
{ "restore", PersistenceMode::Restore }
}

◆ ProxyWords

LookupTable<Media::ProxyMode> Media::ProxyWords
Initial value:
{
{ "none", ProxyMode::None },
{ "donor", ProxyMode::Donor },
{ "recipient", ProxyMode::Recipient }
}