Shaka Player Embedded
Classes | Enumerations | Functions
Utilities

Classes

class  shaka::SdlFrameDrawer
 
struct  shaka::ShakaRect< T >
 
struct  shaka::Rational< T >
 

Enumerations

enum  shaka::VideoFillMode : uint8_t { shaka::VideoFillMode::MaintainRatio, shaka::VideoFillMode::Stretch, shaka::VideoFillMode::Zoom }
 

Functions

template<typename T >
std::ostream & shaka::operator<< (std::ostream &os, const ShakaRect< T > &rect)
 
template<typename T >
std::ostream & shaka::operator<< (std::ostream &os, const Rational< T > &bar)
 
template<typename T , typename U , typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
Rational< typename std::common_type< T, U >::typeshaka::operator* (T a, const Rational< U > &b)
 
template<typename T , typename U , typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
Rational< typename std::common_type< T, U >::typeshaka::operator/ (T a, const Rational< U > &b)
 
void shaka::FitVideoToRegion (ShakaRect< uint32_t > frame, ShakaRect< uint32_t > bounds, Rational< uint32_t > sample_aspect_ratio, VideoFillMode mode, ShakaRect< uint32_t > *src, ShakaRect< uint32_t > *dest)
 
std::string shaka::EscapeKeySystem (const std::string &key_system)
 
std::string shaka::LicenseServerConfig (const std::string &key_system)
 
std::string shaka::AdvancedDrmConfig (const std::string &key_system, const std::string &property)
 

Detailed Description

A number of utility methods that an app may want to use.

Enumeration Type Documentation

§ VideoFillMode

enum shaka::VideoFillMode : uint8_t
strong

Defines possible fill modes for the video. When drawing the video onto a region, this determines how the video gets resized to fit. The video frame will always be centered within the region.

Enumerator
MaintainRatio 

Maintain the aspect ratio of the original video and size the video based on the smaller of the extents. There will be black bars around the video if the region's aspect ratio isn't the same as the video's

Stretch 

Stretch the video to completely fill the region.

Zoom 

Maintain the aspect ratio of the original video and size the video based on the larger of the extents. This will cause the video to be cropped to fit in the region, but there won't be any black bars around the video.

Definition at line 41 of file utils.h.

Function Documentation

§ AdvancedDrmConfig()

std::string shaka::AdvancedDrmConfig ( const std::string &  key_system,
const std::string &  property 
)
inline

This creates a configuration key for advanced DRM configuration.

player.Configure(AdvancedDrmConfig("com.widevine.alpha", "videoRobustness"),
"SW_SECURE_DECODE");

Definition at line 284 of file utils.h.

§ EscapeKeySystem()

std::string shaka::EscapeKeySystem ( const std::string &  key_system)
inline

Escapes the given key-system name so it can appear in a config name path.

Parameters
key_systemThe key system name (e.g. com.widevine.alpha).
Returns
A name path usable as part of Player::Configure.

Definition at line 253 of file utils.h.

§ FitVideoToRegion()

void shaka::FitVideoToRegion ( ShakaRect< uint32_t >  frame,
ShakaRect< uint32_t >  bounds,
Rational< uint32_t >  sample_aspect_ratio,
VideoFillMode  mode,
ShakaRect< uint32_t > *  src,
ShakaRect< uint32_t > *  dest 
)

Creates two rectangles that can be used as rendering destination to draw a video with the given fill mode. If the video exceeds the bounds specified, this will use the src attribute to specify the region of the frame to draw; otherwise that stores the full bounds of the frame. The dest field will contain the bounds to draw on the window.

Parameters
frameThe bounds of the video.
boundsThe bounds to draw the frame within.
sample_aspect_ratioThe sample aspect ratio; this is the aspect ratio of the pixels in the image. (0, 0) is treated as (1, 1).
modeThe fill mode to fit to.
srcWhere to put the source rectangle. This represents the sub-region of the frame to draw.
destWhere to put the destination rectangle. This represents the region on the window to draw to.

Definition at line 23 of file shaka_utils.cc.

§ LicenseServerConfig()

std::string shaka::LicenseServerConfig ( const std::string &  key_system)
inline

This creates a configuration key that sets the license server URL for the given key system.

player.Configure(LicenseServerConfig("com.widevine.alpha"),
"https://example.com/server");

Definition at line 272 of file utils.h.

§ operator*()

template<typename T , typename U , typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
Rational<typename std::common_type<T, U>::type> shaka::operator* ( a,
const Rational< U > &  b 
)

Definition at line 210 of file utils.h.

§ operator/()

template<typename T , typename U , typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
Rational<typename std::common_type<T, U>::type> shaka::operator/ ( a,
const Rational< U > &  b 
)

Definition at line 218 of file utils.h.

§ operator<<() [1/2]

template<typename T >
std::ostream& shaka::operator<< ( std::ostream &  os,
const ShakaRect< T > &  rect 
)

Definition at line 83 of file utils.h.

§ operator<<() [2/2]

template<typename T >
std::ostream& shaka::operator<< ( std::ostream &  os,
const Rational< T > &  bar 
)

Definition at line 203 of file utils.h.