Kodi Documentation 23.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
IMediaBackendWasm Class Referenceabstract

A media player of the browser or the device that CMediaPipelineWasm feeds: it decodes, keeps audio and video in sync and shows the video in a <video> element under the GUI canvas. More...

#include <MediaBackendWasm.h>

Inheritance diagram for IMediaBackendWasm:
CMediaBackendEmss CMediaBackendMse

Classes

struct  Packet
 

Public Types

enum class  AppendResult {
  OK , FULL , STALE , NEEDS_KEY_FRAME ,
  FAILED
}
 
enum class  AudioPath { NONE , NATIVE , CONVERTED }
 

Public Member Functions

virtual ~IMediaBackendWasm ()=default
 
virtual std::string Name () const =0
 
virtual bool SupportsVideo (const CDVDStreamInfo &hint)=0
 Looks at the codec, profile, bit depth, size and frame rate only.
 
virtual AudioPath GetAudioPath (const CDVDStreamInfo &hint)=0
 Looks at the codec, profile, channels and sample rate only.
 
virtual std::string Open (const CDVDStreamInfo &video, const CDVDStreamInfo *audio, AudioPath audioPath, double duration)=0
 Creates the media source with its tracks and waits until it takes packets.
 
virtual void Close ()=0
 
virtual std::string VideoCodecName () const =0
 
virtual std::string AudioCodecName () const =0
 
virtual bool IsHardwareVideoDecoder () const
 Whether the backend confirmed hardware video decoding.
 
virtual double MaxAudioAhead () const =0
 How far ahead of the playback position audio can be appended.
 
virtual bool PrepareVideo (DemuxPacket &packet, Packet &out)=0
 
virtual AppendResult AppendVideo (const Packet &packet)=0
 
virtual AppendResult AppendAudio (const Packet &packet)=0
 
virtual bool EndVideo ()=0
 
virtual bool EndAudio ()=0
 
virtual void ConvertAudio (const DVDAudioFrame &frame)=0
 For AudioPath::CONVERTED: takes decoded frames and returns them as packets to append.
 
virtual void FinishConvertedAudio ()=0
 Turns the frames held back for a bigger packet into one.
 
virtual bool PeekConvertedAudio (Packet &out)=0
 
virtual void PopConvertedAudio ()=0
 
virtual void Flush ()=0
 Drops what the backend holds for the position before a flush.
 
virtual void Play ()=0
 
virtual void Pause ()=0
 
virtual void SetRate (double rate)=0
 
virtual bool HasVolume () const =0
 Whether SetVolume() applies Kodi's volume; otherwise the device's own volume does.
 
virtual void SetVolume (float volume)=0
 
virtual void Seek (double seconds)=0
 Moves playback to seconds and returns once the tracks take packets for it.
 
virtual void SetStartPosition (double seconds)=0
 Where a fresh source reports to be until it plays.
 
virtual int Error () const =0
 0 while playback has no error.
 
virtual bool CanPlay () const =0
 
virtual bool Ended () const =0
 
virtual double Position () const =0
 
virtual int Resumes () const
 

Static Public Member Functions

static std::vector< std::unique_ptr< IMediaBackendWasm > > Create ()
 The backends for this device and settings, the preferred one first.
 

Detailed Description

A media player of the browser or the device that CMediaPipelineWasm feeds: it decodes, keeps audio and video in sync and shows the video in a <video> element under the GUI canvas.

Timestamps are in seconds. Every call comes from one of the pipeline's threads.

Member Enumeration Documentation

◆ AppendResult

Enumerator
OK 
FULL 

offer the packet again later

STALE 

dropped, it belonged to the position before a seek

NEEDS_KEY_FRAME 
FAILED 

◆ AudioPath

enum class IMediaBackendWasm::AudioPath
strong
Enumerator
NONE 
NATIVE 

the backend plays the stream as it is

CONVERTED 

FFmpeg decodes it and the backend takes the decoded frames.

Constructor & Destructor Documentation

◆ ~IMediaBackendWasm()

virtual IMediaBackendWasm::~IMediaBackendWasm ( )
virtualdefault

Member Function Documentation

◆ AppendAudio()

virtual AppendResult IMediaBackendWasm::AppendAudio ( const Packet & packet)
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ AppendVideo()

virtual AppendResult IMediaBackendWasm::AppendVideo ( const Packet & packet)
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ AudioCodecName()

virtual std::string IMediaBackendWasm::AudioCodecName ( ) const
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ CanPlay()

virtual bool IMediaBackendWasm::CanPlay ( ) const
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ Close()

virtual void IMediaBackendWasm::Close ( )
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ ConvertAudio()

virtual void IMediaBackendWasm::ConvertAudio ( const DVDAudioFrame & frame)
pure virtual

For AudioPath::CONVERTED: takes decoded frames and returns them as packets to append.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ Create()

std::vector< std::unique_ptr< IMediaBackendWasm > > IMediaBackendWasm::Create ( )
static

The backends for this device and settings, the preferred one first.

◆ EndAudio()

virtual bool IMediaBackendWasm::EndAudio ( )
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ Ended()

virtual bool IMediaBackendWasm::Ended ( ) const
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ EndVideo()

virtual bool IMediaBackendWasm::EndVideo ( )
pure virtual

Ends the track after the data appended so far.

Returns
false when it has to be called again later.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ Error()

virtual int IMediaBackendWasm::Error ( ) const
pure virtual

0 while playback has no error.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ FinishConvertedAudio()

virtual void IMediaBackendWasm::FinishConvertedAudio ( )
pure virtual

Turns the frames held back for a bigger packet into one.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ Flush()

virtual void IMediaBackendWasm::Flush ( )
pure virtual

Drops what the backend holds for the position before a flush.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ GetAudioPath()

virtual AudioPath IMediaBackendWasm::GetAudioPath ( const CDVDStreamInfo & hint)
pure virtual

Looks at the codec, profile, channels and sample rate only.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ HasVolume()

virtual bool IMediaBackendWasm::HasVolume ( ) const
pure virtual

Whether SetVolume() applies Kodi's volume; otherwise the device's own volume does.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ IsHardwareVideoDecoder()

virtual bool IMediaBackendWasm::IsHardwareVideoDecoder ( ) const
inlinevirtual

Whether the backend confirmed hardware video decoding.

Reimplemented in CMediaBackendEmss.

◆ MaxAudioAhead()

virtual double IMediaBackendWasm::MaxAudioAhead ( ) const
pure virtual

How far ahead of the playback position audio can be appended.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ Name()

virtual std::string IMediaBackendWasm::Name ( ) const
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ Open()

virtual std::string IMediaBackendWasm::Open ( const CDVDStreamInfo & video,
const CDVDStreamInfo * audio,
AudioPath audioPath,
double duration )
pure virtual

Creates the media source with its tracks and waits until it takes packets.

Parameters
audionullptr for no audio.
durationinfinity when unknown.
Returns
A description of the tracks for the log, empty on failure.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ Pause()

virtual void IMediaBackendWasm::Pause ( )
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ PeekConvertedAudio()

virtual bool IMediaBackendWasm::PeekConvertedAudio ( Packet & out)
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ Play()

virtual void IMediaBackendWasm::Play ( )
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ PopConvertedAudio()

virtual void IMediaBackendWasm::PopConvertedAudio ( )
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ Position()

virtual double IMediaBackendWasm::Position ( ) const
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ PrepareVideo()

virtual bool IMediaBackendWasm::PrepareVideo ( DemuxPacket & packet,
Packet & out )
pure virtual
Returns
false when the packet is not to be appended, such as before the first parameter sets. out stays valid until the next call.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ Resumes()

virtual int IMediaBackendWasm::Resumes ( ) const
inlinevirtual

Times the platform resumed playback on its own, which drops what was appended. The backend takes packets again from Position().

Reimplemented in CMediaBackendEmss.

◆ Seek()

virtual void IMediaBackendWasm::Seek ( double seconds)
pure virtual

Moves playback to seconds and returns once the tracks take packets for it.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ SetRate()

virtual void IMediaBackendWasm::SetRate ( double rate)
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ SetStartPosition()

virtual void IMediaBackendWasm::SetStartPosition ( double seconds)
pure virtual

Where a fresh source reports to be until it plays.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ SetVolume()

virtual void IMediaBackendWasm::SetVolume ( float volume)
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ SupportsVideo()

virtual bool IMediaBackendWasm::SupportsVideo ( const CDVDStreamInfo & hint)
pure virtual

Looks at the codec, profile, bit depth, size and frame rate only.

Implemented in CMediaBackendEmss, and CMediaBackendMse.

◆ VideoCodecName()

virtual std::string IMediaBackendWasm::VideoCodecName ( ) const
pure virtual

Implemented in CMediaBackendEmss, and CMediaBackendMse.


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