layout: doc title: “Starboard Module Reference: media.h”

Provides media definitions that are common between the Decoder and Player interfaces.

Enums

SbMediaAudioCodec

Types of audio elementary streams that can be supported.

Values

  • kSbMediaAudioCodecNone
  • kSbMediaAudioCodecAac
  • kSbMediaAudioCodecOpus
  • kSbMediaAudioCodecVorbis

SbMediaAudioCodingType

Possible audio coding types.

Values

  • kSbMediaAudioCodingTypeNone
  • kSbMediaAudioCodingTypeAac
  • kSbMediaAudioCodingTypeAc3
  • kSbMediaAudioCodingTypeAtrac
  • kSbMediaAudioCodingTypeBitstream
  • kSbMediaAudioCodingTypeDolbyDigitalPlus
  • kSbMediaAudioCodingTypeDts
  • kSbMediaAudioCodingTypeMpeg1
  • kSbMediaAudioCodingTypeMpeg2
  • kSbMediaAudioCodingTypeMpeg3
  • kSbMediaAudioCodingTypePcm

SbMediaAudioConnector

Possible audio connector types.

Values

  • kSbMediaAudioConnectorNone
  • kSbMediaAudioConnectorAnalog
  • kSbMediaAudioConnectorBluetooth
  • kSbMediaAudioConnectorHdmi
  • kSbMediaAudioConnectorNetwork
  • kSbMediaAudioConnectorSpdif
  • kSbMediaAudioConnectorUsb

SbMediaAudioFrameStorageType

Possible audio frame storage types.

Values

  • kSbMediaAudioFrameStorageTypeInterleaved - The samples of a multi-channel audio stream are stored in one continuousbuffer. Samples at the same timestamp are stored one after another. Forexample, for a stereo stream with channels L and R that contains sampleswith timestamps 0, 1, 2, etc., the samples are stored in one buffer as“L0 R0 L1 R1 L2 R2 ...”.
  • kSbMediaAudioFrameStorageTypePlanar - The samples of each channel are stored in their own continuous buffer.For example, for a stereo stream with channels L and R that containssamples with timestamps 0, 1, 2, etc., the samples are stored in twobuffers “L0 L1 L2 ...” and “R0 R1 R2 ...”.

SbMediaAudioSampleType

Possible audio sample types.

Values

  • kSbMediaAudioSampleTypeInt16
  • kSbMediaAudioSampleTypeFloat32

SbMediaMatrixId

Values

  • kSbMediaMatrixIdRgb - The first 0-255 values should match the H264 specification (see Table E-5Matrix Coefficients in https://www.itu.int/rec/T-REC-H.264/en).
  • kSbMediaMatrixIdBt709
  • kSbMediaMatrixIdUnspecified
  • kSbMediaMatrixIdReserved
  • kSbMediaMatrixIdFcc
  • kSbMediaMatrixIdBt470Bg
  • kSbMediaMatrixIdSmpte170M
  • kSbMediaMatrixIdSmpte240M
  • kSbMediaMatrixIdYCgCo
  • kSbMediaMatrixIdBt2020NonconstantLuminance
  • kSbMediaMatrixIdBt2020ConstantLuminance
  • kSbMediaMatrixIdYDzDx
  • kSbMediaMatrixIdLastStandardValue
  • kSbMediaMatrixIdUnknown - Chrome-specific values start at 1000
  • kSbMediaMatrixIdLast

SbMediaPrimaryId

Values

  • kSbMediaPrimaryIdReserved0 - The first 0-255 values should match the H264 specification (see Table E-3Colour Primaries in https://www.itu.int/rec/T-REC-H.264/en).
  • kSbMediaPrimaryIdBt709
  • kSbMediaPrimaryIdUnspecified
  • kSbMediaPrimaryIdReserved
  • kSbMediaPrimaryIdBt470M
  • kSbMediaPrimaryIdBt470Bg
  • kSbMediaPrimaryIdSmpte170M
  • kSbMediaPrimaryIdSmpte240M
  • kSbMediaPrimaryIdFilm
  • kSbMediaPrimaryIdBt2020
  • kSbMediaPrimaryIdSmpteSt4281
  • kSbMediaPrimaryIdSmpteSt4312
  • kSbMediaPrimaryIdSmpteSt4321
  • kSbMediaPrimaryIdLastStandardValue
  • kSbMediaPrimaryIdUnknown - Chrome-specific values start at 1000.
  • kSbMediaPrimaryIdXyzD50
  • kSbMediaPrimaryIdCustom

SbMediaRangeId

This corresponds to the WebM Range enum which is part of WebM color data (see http://www.webmproject.org/docs/container/#Range). H.264 only uses a bool, which corresponds to the LIMITED/FULL values. Chrome-specific values start at 1000.

Values

  • kSbMediaRangeIdUnspecified - Range is not explicitly specified / unknown.
  • kSbMediaRangeIdLimited - Limited Rec. 709 color range with RGB values ranging from 16 to 235.
  • kSbMediaRangeIdFull - Full RGB color range with RGB valees from 0 to 255.
  • kSbMediaRangeIdDerived - Range is defined by TransferId/MatrixId.

SbMediaSupportType

Indicates how confident the device is that it can play media resources of the given type. The values are a direct map of the canPlayType() method specified at the following link: https://www.w3.org/TR/2011/WD-html5-20110113/video.html#dom-navigator-canplaytype

Values

  • kSbMediaSupportTypeNotSupported - The media type cannot be played.
  • kSbMediaSupportTypeMaybe - Cannot determinate if the media type is playable without playing it.
  • kSbMediaSupportTypeProbably - The media type seems to be playable.

SbMediaTransferId

Values

  • kSbMediaTransferIdReserved0 - The first 0-255 values should match the H264 specification (see Table E-4Transfer Characteristics in https://www.itu.int/rec/T-REC-H.264/en).
  • kSbMediaTransferIdBt709
  • kSbMediaTransferIdUnspecified
  • kSbMediaTransferIdReserved
  • kSbMediaTransferIdGamma22
  • kSbMediaTransferIdGamma28
  • kSbMediaTransferIdSmpte170M
  • kSbMediaTransferIdSmpte240M
  • kSbMediaTransferIdLinear
  • kSbMediaTransferIdLog
  • kSbMediaTransferIdLogSqrt
  • kSbMediaTransferIdIec6196624
  • kSbMediaTransferIdBt1361Ecg
  • kSbMediaTransferIdIec6196621
  • kSbMediaTransferId10BitBt2020
  • kSbMediaTransferId12BitBt2020
  • kSbMediaTransferIdSmpteSt2084
  • kSbMediaTransferIdSmpteSt4281
  • kSbMediaTransferIdAribStdB67 - AKA hybrid-log gamma, HLG.
  • kSbMediaTransferIdLastStandardValue
  • kSbMediaTransferIdUnknown - Chrome-specific values start at 1000.
  • kSbMediaTransferIdGamma24
  • kSbMediaTransferIdSmpteSt2084NonHdr - This is an ad-hoc transfer function that decodes SMPTE 2084 contentinto a 0-1 range more or less suitable for viewing on a non-hdrdisplay.
  • kSbMediaTransferIdCustom - TODO: Need to store an approximation of the gamma function(s).
  • kSbMediaTransferIdLast

SbMediaType

Types of media component streams.

Values

  • kSbMediaTypeAudio - Value used for audio streams.
  • kSbMediaTypeVideo - Value used for video streams.

SbMediaVideoCodec

Types of video elementary streams that could be supported.

Values

  • kSbMediaVideoCodecNone
  • kSbMediaVideoCodecH264
  • kSbMediaVideoCodecH265
  • kSbMediaVideoCodecMpeg2
  • kSbMediaVideoCodecTheora
  • kSbMediaVideoCodecVc1
  • kSbMediaVideoCodecVp10
  • kSbMediaVideoCodecVp8
  • kSbMediaVideoCodecVp9

Structs

SbMediaAudioConfiguration

A structure describing the audio configuration parameters of a single audio output.

Members

SbMediaAudioHeader

An audio sequence header, which is a description of a given audio stream. This, in hexadecimal string form, acts as a set of instructions to the audio decoder.
The Sequence Header consists of a little-endian hexadecimal encoded WAVEFORMATEX structure followed by an Audio-specific configuration field. The WAVEFORMATEX structure is specified at: http://msdn.microsoft.com/en-us/library/dd390970(v=vs.85).aspx

Members

SbMediaColorMetadata

HDR (High Dynamic Range) Metadata common for HDR10 and WebM/VP9-based HDR formats, together with the ColorSpace. HDR reproduces a greater dynamic range of luminosity than is possible with standard digital imaging. See the Consumer Electronics Association press release: https://www.cta.tech/News/Press-Releases/2015/August/CEA-Defines-%E2%80%98HDR-Compatible%E2%80%99-Displays.aspx

Members

SbMediaMasteringMetadata

SMPTE 2086 mastering data http://ieeexplore.ieee.org/document/7291707/ This standard specifies the metadata items to specify the color volume (the color primaries, white point, and luminance range) of the display that was used in mastering video content. The metadata is specified as a set of values independent of any specific digital representation. Also see the WebM container guidelines: https://www.webmproject.org/docs/container/

Members

SbMediaVideoSampleInfo

The set of information required by the decoder or player for each video sample.

Members

Functions

SbMediaCanPlayMimeAndKeySystem

Description

Returns information about whether the playback of the specific media described by mime and encrypted using key_system can be played.
Note that neither mime nor key_system can be NULL. This function returns kSbMediaSupportNotSupported if either is NULL.

Declaration and definitions

#include "starboard/media.h"

SbMediaSupportType SbMediaCanPlayMimeAndKeySystem(const char* mime,
                                                  const char* key_system) {
  SB_UNREFERENCED_PARAMETER(mime);
  SB_UNREFERENCED_PARAMETER(key_system);
  return kSbMediaSupportTypeNotSupported;
}

Parameters

SbMediaGetAudioConfiguration

Description

Retrieves the current physical audio configuration of audio output output_index on this device and places it in out_configuration, which must not be NULL.
This function returns false if nothing could be determined on this platform or if output_index does not exist on this device.

Declaration and definitions

#include "starboard/media.h"

bool SbMediaGetAudioConfiguration(
    int output_index,
    SbMediaAudioConfiguration* out_configuration) {
  SB_UNREFERENCED_PARAMETER(output_index);
  SB_UNREFERENCED_PARAMETER(out_configuration);
  return false;
}

Parameters

SbMediaGetAudioOutputCount

Description

Returns the number of audio outputs currently available on this device. Even if the number of outputs or their audio configurations can't be determined, it is expected that the platform will at least return a single output that supports at least stereo.

Declaration and definitions

#include "starboard/media.h"

int SbMediaGetAudioOutputCount() {
  return 0;
}

SbMediaIsOutputProtected

Description

Indicates whether output copy protection is currently enabled on all capable outputs. If true, then non-protection-capable outputs are expected to be blanked.

Declaration and definitions

#include "starboard/media.h"

#include "starboard/log.h"

bool SbMediaIsOutputProtected() {
  return false;
}

SbMediaIsSupported

Description

Indicates whether this platform supports decoding video_codec and audio_codec along with decrypting using key_system. If video_codec is kSbMediaVideoCodecNone or if audio_codec is kSbMediaAudioCodecNone, this function should return true as long as key_system is supported on the platform to decode any supported input formats.

Declaration and definitions

#include "starboard/media.h"

SB_EXPORT bool SbMediaIsSupported(SbMediaVideoCodec /*video_codec*/,
                                  SbMediaAudioCodec /*audio_codec*/,
                                  const char* /*key_system*/) {
  return false;
}

Parameters

SbMediaSetOutputProtection

Description

Enables or disables output copy protection on all capable outputs. If enabled, then non-protection-capable outputs are expected to be blanked.
The return value indicates whether the operation was successful, and the function returns a success even if the call is redundant in that it doesn't change the current value.

Declaration and definitions

#include "starboard/media.h"

#include "starboard/log.h"

bool SbMediaSetOutputProtection(bool enabled) {
  SB_UNREFERENCED_PARAMETER(enabled);
  return false;
}

Parameters