Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / blink / webmediaplayer_util.h
blob9182f8a9733be1abeb0bb4768a473abe0c6771b1
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_UTIL_H_
6 #define MEDIA_BLINK_WEBMEDIAPLAYER_UTIL_H_
8 #include "base/time/time.h"
9 #include "media/base/audio_renderer_sink.h"
10 #include "media/base/eme_constants.h"
11 #include "media/base/media_export.h"
12 #include "media/base/pipeline_status.h"
13 #include "media/base/ranges.h"
14 #include "third_party/WebKit/public/platform/WebCallbacks.h"
15 #include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h"
16 #include "third_party/WebKit/public/platform/WebMediaPlayer.h"
17 #include "third_party/WebKit/public/platform/WebSetSinkIdError.h"
18 #include "third_party/WebKit/public/platform/WebTimeRange.h"
19 #include "url/gurl.h"
21 namespace media {
23 blink::WebTimeRanges MEDIA_EXPORT ConvertToWebTimeRanges(
24 const Ranges<base::TimeDelta>& ranges);
26 blink::WebMediaPlayer::NetworkState MEDIA_EXPORT PipelineErrorToNetworkState(
27 PipelineStatus error);
29 // Report various metrics to UMA and RAPPOR.
30 void MEDIA_EXPORT ReportMetrics(blink::WebMediaPlayer::LoadType load_type,
31 const GURL& url,
32 const GURL& origin_url);
34 // Record a RAPPOR metric for the origin of an HLS playback.
35 void MEDIA_EXPORT RecordOriginOfHLSPlayback(const GURL& origin_url);
37 // Convert Initialization Data Types.
38 EmeInitDataType MEDIA_EXPORT
39 ConvertToEmeInitDataType(blink::WebEncryptedMediaInitDataType init_data_type);
40 blink::WebEncryptedMediaInitDataType MEDIA_EXPORT
41 ConvertToWebInitDataType(EmeInitDataType init_data_type);
43 typedef blink::WebCallbacks<void, blink::WebSetSinkIdError*> WebSetSinkIdCB;
45 // Wraps a WebSetSinkIdCB into a media::SwitchOutputDeviceCB
46 // and binds it to the current thread
47 SwitchOutputDeviceCB MEDIA_EXPORT
48 ConvertToSwitchOutputDeviceCB(WebSetSinkIdCB* web_callbacks);
50 } // namespace media
52 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_UTIL_H_