1 // Copyright 2015 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 PPAPI_PROXY_VIDEO_ENCODER_RESOURCE_H_
6 #define PPAPI_PROXY_VIDEO_ENCODER_RESOURCE_H_
8 #include "base/memory/ref_counted.h"
9 #include "ppapi/proxy/connection.h"
10 #include "ppapi/proxy/plugin_resource.h"
11 #include "ppapi/shared_impl/resource.h"
12 #include "ppapi/thunk/ppb_video_encoder_api.h"
16 class TrackedCallback
;
20 class PPAPI_PROXY_EXPORT VideoEncoderResource
21 : public PluginResource
,
22 public thunk::PPB_VideoEncoder_API
{
24 VideoEncoderResource(Connection connection
, PP_Instance instance
);
25 ~VideoEncoderResource() override
;
27 thunk::PPB_VideoEncoder_API
* AsPPB_VideoEncoder_API() override
;
30 // PPB_VideoEncoder_API implementation.
31 int32_t GetSupportedProfiles(
32 const PP_ArrayOutput
& output
,
33 const scoped_refptr
<TrackedCallback
>& callback
) override
;
34 int32_t Initialize(PP_VideoFrame_Format input_format
,
35 const PP_Size
* input_visible_size
,
36 PP_VideoProfile output_profile
,
37 uint32_t initial_bitrate
,
38 PP_HardwareAcceleration acceleration
,
39 const scoped_refptr
<TrackedCallback
>& callback
) override
;
40 int32_t GetFramesRequired() override
;
41 int32_t GetFrameCodedSize(PP_Size
* size
) override
;
42 int32_t GetVideoFrame(
43 PP_Resource
* video_frame
,
44 const scoped_refptr
<TrackedCallback
>& callback
) override
;
45 int32_t Encode(PP_Resource video_frame
,
46 PP_Bool force_keyframe
,
47 const scoped_refptr
<TrackedCallback
>& callback
) override
;
48 int32_t GetBitstreamBuffer(
49 PP_BitstreamBuffer
* picture
,
50 const scoped_refptr
<TrackedCallback
>& callback
) override
;
51 void RecycleBitstreamBuffer(const PP_BitstreamBuffer
* picture
) override
;
52 void RequestEncodingParametersChange(uint32_t bitrate
,
53 uint32_t framerate
) override
;
54 void Close() override
;
56 DISALLOW_COPY_AND_ASSIGN(VideoEncoderResource
);
62 #endif // PPAPI_PROXY_VIDEO_ENCODER_RESOURCE_H_