OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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. |
| 4 |
| 5 #ifndef PPAPI_CPP_VIDEO_ENCODER_H_ |
| 6 #define PPAPI_CPP_VIDEO_ENCODER_H_ |
| 7 |
| 8 #include "ppapi/c/pp_codecs.h" |
| 9 #include "ppapi/c/pp_size.h" |
| 10 #include "ppapi/cpp/completion_callback.h" |
| 11 #include "ppapi/cpp/graphics_3d.h" |
| 12 #include "ppapi/cpp/resource.h" |
| 13 #include "ppapi/cpp/size.h" |
| 14 #include "ppapi/cpp/video_frame.h" |
| 15 |
| 16 /// @file |
| 17 /// This file defines the API to create and use a VideoEncoder resource. |
| 18 |
| 19 namespace pp { |
| 20 |
| 21 class InstanceHandle; |
| 22 |
| 23 /// Video decoder interface. |
| 24 /// |
| 25 /// Typical usage: |
| 26 /// - Call Create() to create a new video decoder resource. |
| 27 /// - Call Initialize() to initialize it with a 3d graphics context and the |
| 28 /// desired codec profile. |
| 29 /// - Call Decode() continuously (waiting for each previous call to complete) to |
| 30 /// push bitstream buffers to the decoder. |
| 31 /// - Call GetPicture() continuously (waiting for each previous call to |
| 32 /// complete) to pull decoded pictures from the decoder. |
| 33 /// - Call Flush() to signal end of stream to the decoder and perform shutdown |
| 34 /// when it completes. |
| 35 /// - Call Reset() to quickly stop the decoder (e.g. to implement Seek) and wait |
| 36 /// for the callback before restarting decoding at another point. |
| 37 /// - To destroy the decoder, the plugin should release all of its references to |
| 38 /// it. Any pending callbacks will abort before the decoder is destroyed. |
| 39 /// |
| 40 /// Available video codecs vary by platform. |
| 41 /// All: theora, vorbis, vp8. |
| 42 /// Chrome and ChromeOS: aac, h264. |
| 43 /// ChromeOS: mpeg4. |
| 44 class VideoEncoder : public Resource { |
| 45 public: |
| 46 /// Default constructor for creating an is_null() <code>VideoEncoder</code> |
| 47 /// object. |
| 48 VideoEncoder(); |
| 49 |
| 50 /// A constructor used to create a <code>VideoEncoder</code> and associate it |
| 51 /// with the provided <code>Instance</code>. |
| 52 /// @param[in] instance The instance with which this resource will be |
| 53 /// associated. |
| 54 explicit VideoEncoder(const InstanceHandle& instance); |
| 55 |
| 56 /// The copy constructor for <code>VideoEncoder</code>. |
| 57 /// @param[in] other A reference to a <code>VideoEncoder</code>. |
| 58 VideoEncoder(const VideoEncoder& other); |
| 59 |
| 60 int32_t GetSupportedProfiles( |
| 61 const CompletionCallbackWithOutput< |
| 62 std::vector<PP_SupportedVideoProfile> >& cc); |
| 63 |
| 64 int32_t Initialize(const PP_VideoFrame_Format& input_format, |
| 65 const PP_Size& input_visible_size, |
| 66 const PP_VideoProfile& output_profile, |
| 67 const uint32_t initial_bitrate, |
| 68 PP_HardwareAcceleration acceleration, |
| 69 const CompletionCallback& cc); |
| 70 |
| 71 int32_t GetVideoFrame( |
| 72 const CompletionCallbackWithOutput<VideoFrame>& cc); |
| 73 |
| 74 int32_t Encode( |
| 75 const VideoFrame& video_frame, |
| 76 bool force_keyframe, |
| 77 const CompletionCallback& cc); |
| 78 |
| 79 int32_t GetBitstreamBuffer( |
| 80 const CompletionCallbackWithOutput<PP_BitstreamBuffer>& cc); |
| 81 |
| 82 void RecycleBitstreamBuffer( |
| 83 const PP_BitstreamBuffer& bitstream_buffer); |
| 84 |
| 85 void RequestEncodingParametersChange( |
| 86 uint32_t bitrate, |
| 87 uint32_t framerate); |
| 88 }; |
| 89 |
| 90 } // namespace pp |
| 91 |
| 92 #endif // PPAPI_CPP_VIDEO_ENCODER_H_ |
OLD | NEW |