chromium/third_party/blink/public/web/modules/media/web_media_player_util.h

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIA_WEB_MEDIA_PLAYER_UTIL_H_
#define THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIA_WEB_MEDIA_PLAYER_UTIL_H_

#include "base/time/time.h"
#include "media/base/audio_renderer_sink.h"
#include "media/base/eme_constants.h"
#include "media/base/pipeline_status.h"
#include "media/base/ranges.h"
#include "media/mojo/mojom/media_metrics_provider.mojom-shared.h"
#include "third_party/blink/public/platform/web_common.h"
#include "third_party/blink/public/platform/web_encrypted_media_types.h"
#include "third_party/blink/public/platform/web_media_player.h"
#include "third_party/blink/public/platform/web_security_origin.h"
#include "third_party/blink/public/platform/web_set_sink_id_callbacks.h"
#include "third_party/blink/public/platform/web_time_range.h"

namespace media {
class MediaLog;
}  // namespace media

namespace blink {

// Translates a |url| into the appropriate URL scheme.
BLINK_MODULES_EXPORT media::mojom::MediaURLScheme GetMediaURLScheme(
    const WebURL& url);

BLINK_MODULES_EXPORT WebTimeRanges
ConvertToWebTimeRanges(const media::Ranges<base::TimeDelta>& ranges);

BLINK_MODULES_EXPORT WebMediaPlayer::NetworkState PipelineErrorToNetworkState(
    media::PipelineStatus error);

// Report various metrics to UMA.
BLINK_MODULES_EXPORT void ReportMetrics(WebMediaPlayer::LoadType load_type,
                                        const WebURL& url,
                                        media::MediaLog* media_log);

// Wraps a WebSetSinkIdCompleteCallback into a
// media::OutputDeviceStatusCB and binds it to the current thread
BLINK_MODULES_EXPORT media::OutputDeviceStatusCB ConvertToOutputDeviceStatusCB(
    WebSetSinkIdCompleteCallback completion_callback);

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_PUBLIC_WEB_MODULES_MEDIA_WEB_MEDIA_PLAYER_UTIL_H_