summaryrefslogtreecommitdiff
path: root/chromium/media/base/android/media_drm_bridge_delegate.h
blob: f3e1064ac42ec4540a60cad444c0701531893800 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_DELEGATE_H_
#define MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_DELEGATE_H_

#include <stdint.h>

#include <string>
#include <vector>

#include "base/macros.h"
#include "media/base/android/media_drm_bridge_client.h"
#include "media/base/eme_constants.h"
#include "media/base/media_export.h"

namespace media {

// Allows embedders to modify the Android MediaDrm flow. Delegates are
// registered to a specific key system.
class MEDIA_EXPORT MediaDrmBridgeDelegate {
 public:
  MediaDrmBridgeDelegate();

  MediaDrmBridgeDelegate(const MediaDrmBridgeDelegate&) = delete;
  MediaDrmBridgeDelegate& operator=(const MediaDrmBridgeDelegate&) = delete;

  virtual ~MediaDrmBridgeDelegate();

  // Returns the UUID of the DRM scheme that this delegate applies to.
  virtual const UUID GetUUID() const = 0;

  // Invoked from CreateSession.
  // If |init_data_out| is filled, it replaces |init_data| to send to the
  // MediaDrm instance.
  // If |optional_parameters_out| is filled, it is expected to be an
  // even-length list of (key, value) pairs to send to the MediaDrm instance.
  // Returns false if the request should be rejected.
  virtual bool OnCreateSession(
      const EmeInitDataType init_data_type,
      const std::vector<uint8_t>& init_data,
      std::vector<uint8_t>* init_data_out,
      std::vector<std::string>* optional_parameters_out);
};

}  // namespace media

#endif  // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_DELEGATE_H_