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_AUDIO_ENCODER_RESOURCE_H_
6 #define PPAPI_PROXY_AUDIO_ENCODER_RESOURCE_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h"
12 #include "ppapi/proxy/connection.h"
13 #include "ppapi/proxy/plugin_resource.h"
14 #include "ppapi/shared_impl/resource.h"
15 #include "ppapi/thunk/ppb_audio_encoder_api.h"
19 class TrackedCallback
;
23 class SerializedHandle
;
24 class VideoFrameResource
;
26 class PPAPI_PROXY_EXPORT AudioEncoderResource
27 : public PluginResource
,
28 public thunk::PPB_AudioEncoder_API
{
30 AudioEncoderResource(Connection connection
, PP_Instance instance
);
31 ~AudioEncoderResource() override
;
33 thunk::PPB_AudioEncoder_API
* AsPPB_AudioEncoder_API() override
;
36 // PPB_AduioEncoder_API implementation.
37 int32_t GetSupportedProfiles(
38 const PP_ArrayOutput
& output
,
39 const scoped_refptr
<TrackedCallback
>& callback
) override
;
40 int32_t Initialize(uint32_t channels
,
41 PP_AudioBuffer_SampleRate input_sample_rate
,
42 PP_AudioBuffer_SampleSize input_sample_size
,
43 PP_AudioProfile output_profile
,
44 uint32_t initial_bitrate
,
45 PP_HardwareAcceleration acceleration
,
46 const scoped_refptr
<TrackedCallback
>& callback
) override
;
47 int32_t GetNumberOfSamples() override
;
48 int32_t GetBuffer(PP_Resource
* audio_buffer
,
49 const scoped_refptr
<TrackedCallback
>& callback
) override
;
50 int32_t Encode(PP_Resource audio_buffer
,
51 const scoped_refptr
<TrackedCallback
>& callback
) override
;
52 int32_t GetBitstreamBuffer(
53 PP_AudioBitstreamBuffer
* bitstream_buffer
,
54 const scoped_refptr
<TrackedCallback
>& callback
) override
;
55 void RecycleBitstreamBuffer(
56 const PP_AudioBitstreamBuffer
* bitstream_buffer
) override
;
57 void RequestBitrateChange(uint32_t bitrate
) override
;
58 void Close() override
;
60 DISALLOW_COPY_AND_ASSIGN(AudioEncoderResource
);
66 #endif // PPAPI_PROXY_AUDIO_ENCODER_RESOURCE_H_