AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Namespaces | Classes | Typedefs | Functions | Variables
alexaClientSDK::playlistParser Namespace Reference

Namespaces

 test
 

Classes

class  ContentDecrypter
 
class  FFMpegInputBuffer
 
class  Id3TagsRemover
 
class  IterativePlaylistParser
 
struct  M3UContent
 A struct used to encapsulate information retrieved from an M3U playlist. More...
 
struct  PlayItem
 
class  PlaylistParser
 
class  UrlContentToAttachmentConverter
 Class that handles the streaming of urls containing media into Attachments. More...
 

Typedefs

typedef std::vector< unsigned char > ByteVector
 Alias for bytes. More...
 

Functions

bool isPlaylistExtendedM3U (const std::string &playlistContent)
 
M3UContent parseM3UContent (const std::string &playlistURL, const std::string &content)
 
avsCommon::utils::playlistParser::EncryptionInfo parseHLSEncryptionLine (const std::string &line, const std::string &baseURL)
 
long parsePlaylistMediaSequence (const std::string &line)
 
avsCommon::utils::playlistParser::ByteRange parseHLSByteRangeLine (const std::string &line)
 
avsCommon::utils::playlistParser::PlaylistEntry parseHLSMapLine (const std::string &line, const std::string &baseURL)
 
std::vector< std::string > parsePLSContent (const std::string &playlistURL, const std::string &content)
 
void removeCarriageReturnFromLine (std::string *line)
 
bool readFromContentFetcher (std::unique_ptr< avsCommon::sdkInterfaces::HTTPContentFetcherInterface > contentFetcher, std::string *content, std::atomic< bool > *shouldShutDown, std::string *playlistURL)
 
bool isURLAbsolute (const std::string &url)
 
bool getAbsoluteURLFromRelativePathToURL (std::string baseURL, std::string relativePath, std::string *absoluteURL)
 

Variables

static constexpr long INVALID_MEDIA_SEQUENCE = -1
 An invalid media sequence number. More...
 

Typedef Documentation

◆ ByteVector

typedef std::vector<unsigned char> alexaClientSDK::playlistParser::ByteVector

Alias for bytes.

Function Documentation

◆ getAbsoluteURLFromRelativePathToURL()

bool alexaClientSDK::playlistParser::getAbsoluteURLFromRelativePathToURL ( std::string  baseURL,
std::string  relativePath,
std::string *  absoluteURL 
)

Creates an absolute url, given a base url and a relative path from that url. For example, if "www.awesomewebsite.com/music/test.m3u" was the base url and the relative path was "music.mp3", "www.awesomewebsite.com/music/music.mp3" would be returned.

Parameters
baseURLThe base url to add the relative path to.
relativePathThe relative path to add to the base url.
[out]absoluteURLThe absolute url generated
Returns
true If everything was successful and false otherwise.

◆ isPlaylistExtendedM3U()

bool alexaClientSDK::playlistParser::isPlaylistExtendedM3U ( const std::string &  playlistContent)

Determines the playlist type of an M3U playlist.

Parameters
playlistContentThe M3U playlist in std::string format.
Returns
true if the playlist is extended M3U or false otherwise

◆ isURLAbsolute()

bool alexaClientSDK::playlistParser::isURLAbsolute ( const std::string &  url)

Determines whether the provided url is an absolute url as opposed to a relative url. This is done by simply checking to see if the string contains the substring "://".

Parameters
urlThe url to check.
Returns
true if the url is an absolute url and false otherwise.

◆ parseHLSByteRangeLine()

avsCommon::utils::playlistParser::ByteRange alexaClientSDK::playlistParser::parseHLSByteRangeLine ( const std::string &  line)

Parses #EXT-X-BYTERANGE line of HLS playlist and returns ByteRange.

Parameters
lineThe line to parse.
Returns
Returns ByteRange - {start, end}.

◆ parseHLSEncryptionLine()

avsCommon::utils::playlistParser::EncryptionInfo alexaClientSDK::playlistParser::parseHLSEncryptionLine ( const std::string &  line,
const std::string &  baseURL 
)

Parses #EXT-X-KEY line of HLS playlist and returns EncryptionInfo.

Parameters
lineThe line to parse.
baseURLThe URL of the playlist.
Returns
Returns EncryptionInfo.

◆ parseHLSMapLine()

avsCommon::utils::playlistParser::PlaylistEntry alexaClientSDK::playlistParser::parseHLSMapLine ( const std::string &  line,
const std::string &  baseURL 
)

Parses #EXT-X-MAP line of HLS playlist and returns PlaylistEntry.

Parameters
lineThe line to parse.
baseURLThe url of the playlist.
Returns
Returns PlaylistEntry.

◆ parseM3UContent()

M3UContent alexaClientSDK::playlistParser::parseM3UContent ( const std::string &  playlistURL,
const std::string &  content 
)

Parses an M3U playlist and returns the "children" URLs in the order they appeared in the playlist.

Parameters
playlistURLThe URL of the M3U playlist that needs to be parsed.
contentText content of the downloaded M3U playlist to parse.
Returns
M3UContent which contains parsed list of variant URLs (for master playlist) OR list of @ Playlist (for media playlist).

◆ parsePlaylistMediaSequence()

long alexaClientSDK::playlistParser::parsePlaylistMediaSequence ( const std::string &  line)

Helper method that parses the media sequence field. This method assumes that the line passed begins with the media sequence tag.

Parameters
lineThe line to be parsed.
Returns
The media sequence value or INVALID_MEDIA_SEQUENCE if any issue happened during parsing.

◆ parsePLSContent()

std::vector<std::string> alexaClientSDK::playlistParser::parsePLSContent ( const std::string &  playlistURL,
const std::string &  content 
)

Parses an PLS playlist and returns the "children" URLs in the order they appeared in the playlist.

Parameters
contentThe content to parse.
Returns
A vector of URLs in the order they appeared in the playlist.

◆ readFromContentFetcher()

bool alexaClientSDK::playlistParser::readFromContentFetcher ( std::unique_ptr< avsCommon::sdkInterfaces::HTTPContentFetcherInterface contentFetcher,
std::string *  content,
std::atomic< bool > *  shouldShutDown,
std::string *  playlistURL 
)

Retrieves playlist content and stores it into a string.

Parameters
contentFetcherObject used to retrieve url content.
[out]contentThe playlist content.
shouldShutDownA pointer to allow for the caller to cancel the content retrieval asynchronously
[out]playlistURLA pointer to the playlist url. This will be updated in case the last used URL to fetch the content is different.
Returns
true if no error occured or false otherwise.
Note
This function should be used to retrieve content specifically from playlist URLs. Attempting to use this on a media URL could be blocking forever as the URL might point to a live stream.

◆ removeCarriageReturnFromLine()

void alexaClientSDK::playlistParser::removeCarriageReturnFromLine ( std::string *  line)

Removes a carriage return from the end of a line. This is required to handle Windows style line breaks ('
'). std::getline reads by default up to '
' so at times, the '' may be included when readinglines.

Parameters
lineThe line to parse

Variable Documentation

◆ INVALID_MEDIA_SEQUENCE

constexpr long alexaClientSDK::playlistParser::INVALID_MEDIA_SEQUENCE = -1
static

An invalid media sequence number.

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0