summaryrefslogtreecommitdiffstats
path: root/media/base/decryptor_client.h
blob: 9db50cec662b06dd3675f5ac300cc17bb9896c45 (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
50
// Copyright (c) 2012 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_DECRYPTOR_CLIENT_H_
#define MEDIA_BASE_DECRYPTOR_CLIENT_H_

#include <string>

#include "base/memory/scoped_ptr.h"
#include "media/base/decryptor.h"

namespace media {

// Interface used by a decryptor to fire key events.
// See: http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#event-summary
class DecryptorClient {
 public:
  // Signals that a key has been added.
  virtual void KeyAdded(const std::string& key_system,
                        const std::string& session_id) = 0;

  // Signals that a key error occurred. The |system_code| is key
  // system-dependent. For clear key system, the |system_code| is always zero.
  virtual void KeyError(const std::string& key_system,
                        const std::string& session_id,
                        Decryptor::KeyError error_code,
                        int system_code) = 0;

  // Signals that a key message has been generated.
  virtual void KeyMessage(const std::string& key_system,
                          const std::string& session_id,
                          scoped_array<uint8> message,
                          int message_length,
                          const std::string& default_url) = 0;

  // Signals that a key is needed for decryption. |key_system| and |session_id|
  // can be empty if the key system has not been selected.
  virtual void NeedKey(const std::string& key_system,
                       const std::string& session_id,
                       scoped_array<uint8> init_data,
                       int init_data_length) = 0;

 protected:
  virtual ~DecryptorClient() {}
};

}  // namespace media

#endif  // MEDIA_BASE_DECRYPTOR_CLIENT_H_