#include "third_party/blink/renderer/modules/webcodecs/decoder_selector.h"
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/notreached.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "media/base/channel_layout.h"
#include "media/base/demuxer_stream.h"
#include "media/base/sample_format.h"
#include "media/filters/decrypting_demuxer_stream.h"
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
template <media::DemuxerStream::Type StreamType>
class NullDemuxerStream : public media::DemuxerStream { … };
template <>
void NullDemuxerStream<media::DemuxerStream::AUDIO>::Configure(
DecoderConfigType config) { … }
template <>
void NullDemuxerStream<media::DemuxerStream::VIDEO>::Configure(
DecoderConfigType config) { … }
template <media::DemuxerStream::Type StreamType>
DecoderSelector<StreamType>::DecoderSelector(
scoped_refptr<base::SequencedTaskRunner> task_runner,
CreateDecodersCB create_decoders_cb,
typename Decoder::OutputCB output_cb)
: … { … }
template <media::DemuxerStream::Type StreamType>
DecoderSelector<StreamType>::~DecoderSelector() = default;
template <media::DemuxerStream::Type StreamType>
void DecoderSelector<StreamType>::SelectDecoder(
const DecoderConfig& config,
bool low_delay,
SelectDecoderCB select_decoder_cb) { … }
template <>
std::unique_ptr<WebCodecsAudioDecoderSelector::StreamTraits>
DecoderSelector<media::DemuxerStream::AUDIO>::CreateStreamTraits() { … }
template <>
std::unique_ptr<WebCodecsVideoDecoderSelector::StreamTraits>
DecoderSelector<media::DemuxerStream::VIDEO>::CreateStreamTraits() { … }
template <media::DemuxerStream::Type StreamType>
void DecoderSelector<StreamType>::OnDecoderSelected(
SelectDecoderCB select_decoder_cb,
DecoderOrError decoder_or_error,
std::unique_ptr<media::DecryptingDemuxerStream> decrypting_demuxer_stream) { … }
template class MODULES_EXPORT DecoderSelector<media::DemuxerStream::VIDEO>;
template class MODULES_EXPORT DecoderSelector<media::DemuxerStream::AUDIO>;
}