398bd162eca399a7b742a868d7e6f69ac9d543bb
[platform/framework/web/crosswalk-tizen.git] /
1 // Copyright 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 CONTENT_BROWSER_RENDERER_HOST_PEPPER_MEDIA_PLAYER_PEPPER_ELEMENTARY_STREAM_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_MEDIA_PLAYER_PEPPER_ELEMENTARY_STREAM_HOST_H_
7
8 #include <vector>
9 #include "base/memory/weak_ptr.h"
10 #include "content/browser/renderer_host/pepper/media_player/elementary_stream_listener_private.h"
11 #include "ppapi/host/resource_host.h"
12 #include "ppapi/shared_impl/media_player/serialized_es_packet.h"
13
14 namespace content {
15
16 class PepperElementaryStreamPrivate;
17 class BrowserPpapiHost;
18
19 class PepperElementaryStreamHost
20     : public ppapi::host::ResourceHost,
21       public ElementaryStreamListenerPrivate,
22       public base::SupportsWeakPtr<PepperElementaryStreamHost> {
23  public:
24   PepperElementaryStreamHost(BrowserPpapiHost*, PP_Instance, PP_Resource);
25   virtual ~PepperElementaryStreamHost();
26
27   // ElementaryStreamListenerPrivate
28   void OnNeedData(int32_t bytes_max) override;
29   void OnEnoughData() override;
30   void OnSeekData(PP_TimeTicks new_position) override;
31
32  protected:
33   int32_t OnResourceMessageReceived(const IPC::Message&,
34                                     ppapi::host::HostMessageContext*) override;
35
36   virtual PepperElementaryStreamPrivate* ElementaryStreamPrivate() = 0;
37
38  private:
39   int32_t OnAppendPacket(ppapi::host::HostMessageContext*,
40                          const ppapi::SerializedESPacket&);
41   int32_t OnAppendEncryptedPacket(ppapi::host::HostMessageContext*,
42                                   const ppapi::SerializedEncryptedESPacket&);
43   int32_t OnAppendTrustZonePacket(ppapi::host::HostMessageContext* context,
44                                   const ppapi::SerializedESPacket& packet,
45                                   const PP_TrustZoneReference& handle);
46   int32_t OnFlush(ppapi::host::HostMessageContext*);
47   int32_t OnSetDRMInitData(ppapi::host::HostMessageContext*,
48                            const std::vector<uint8_t>& type,
49                            const std::vector<uint8_t>& init_data);
50
51   DISALLOW_COPY_AND_ASSIGN(PepperElementaryStreamHost);
52 };
53
54 }  // namespace content
55
56 #endif  // CONTENT_BROWSER_RENDERER_HOST_PEPPER_MEDIA_PLAYER_PEPPER_ELEMENTARY_STREAM_HOST_H_