Pepper_47_C++_interfaces
drm_listener_samsung.h
Go to the documentation of this file.
1 // Copyright (c) 2016 Samsung Electronics. 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.
4 
5 #ifndef PPAPI_CPP_SAMSUNG_DRM_LISTENER_SAMSUNG_H_
6 #define PPAPI_CPP_SAMSUNG_DRM_LISTENER_SAMSUNG_H_
7 
8 #include "ppapi/c/pp_resource.h"
9 #include "ppapi/c/samsung/ppp_media_player_samsung.h"
10 
11 /// @file
12 /// This file defines a <code>DRMListener_Samsung</code> type which allows
13 /// plugin to receive DRM events.
14 namespace pp {
15 
16 class MediaPlayer_Samsung;
17 
18 /// Listener for receiving DRM related events.
19 ///
20 /// All event methods will be called on the same thread. If this class was
21 /// created on a thread with a running message loop, the event methods will run
22 /// on this thread. Otherwise, they will run on the main thread.
24  public:
25  virtual ~DRMListener_Samsung();
26 
27  /// During parsing media container encrypted track was found.
28  ///
29  /// @param[in] drm_type A type of DRM system
30  /// @param[in] init_data_size Size in bytes of |init_data| buffer.
31  /// @param[in] init_data A pointer to the buffer containing DRM specific
32  /// initialization data.
33  virtual void OnInitdataLoaded(
34  PP_MediaPlayerDRMType drm_type,
35  uint32_t init_data_size,
36  const void* init_data);
37 
38  /// Decryption license needs to be requested from the server and
39  /// provided to the player.
40  ///
41  /// @param[in] request_size Size in bytes of |request| buffer.
42  /// @param[in] request A pointer to the buffer containing DRM specific
43  /// request.
44  virtual void OnLicenseRequest(uint32_t request_size, const void* request);
45 
46  protected:
47  /// The default constructor which creates listener not attached
48  /// to the player
50 
51  /// Constructor which creates listener attached to the |player|.
52  explicit DRMListener_Samsung(MediaPlayer_Samsung* player);
53 
54  /// Attaches listener to the |player|.
55  void AttachTo(MediaPlayer_Samsung* player);
56 
57  private:
58  void Detach();
59  PP_Resource player_;
60 
61  // Disallow copy and assign
63  DRMListener_Samsung& operator=(const DRMListener_Samsung&);
64 };
65 
66 } // namespace pp
67 
68 #endif // PPAPI_CPP_SAMSUNG_DRM_LISTENER_SAMSUNG_H_
void AttachTo(MediaPlayer_Samsung *player)
Attaches listener to the |player|.
virtual void OnInitdataLoaded(PP_MediaPlayerDRMType drm_type, uint32_t init_data_size, const void *init_data)
virtual void OnLicenseRequest(uint32_t request_size, const void *request)