Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: ppapi/cpp/video_encoder.h

Issue 842293003: Pepper: Define PPB_VideoEncoder API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: C++ Wrapper Class Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/cpp/video_encoder.h
diff --git a/ppapi/cpp/video_encoder.h b/ppapi/cpp/video_encoder.h
new file mode 100644
index 0000000000000000000000000000000000000000..8289d8008e0e1656087dc865a318b9c4e1612058
--- /dev/null
+++ b/ppapi/cpp/video_encoder.h
@@ -0,0 +1,92 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_VIDEO_ENCODER_H_
+#define PPAPI_CPP_VIDEO_ENCODER_H_
+
+#include "ppapi/c/pp_codecs.h"
+#include "ppapi/c/pp_size.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/graphics_3d.h"
+#include "ppapi/cpp/resource.h"
+#include "ppapi/cpp/size.h"
+#include "ppapi/cpp/video_frame.h"
+
+/// @file
+/// This file defines the API to create and use a VideoEncoder resource.
+
+namespace pp {
+
+class InstanceHandle;
+
+/// Video decoder interface.
+///
+/// Typical usage:
+/// - Call Create() to create a new video decoder resource.
+/// - Call Initialize() to initialize it with a 3d graphics context and the
+/// desired codec profile.
+/// - Call Decode() continuously (waiting for each previous call to complete) to
+/// push bitstream buffers to the decoder.
+/// - Call GetPicture() continuously (waiting for each previous call to
+/// complete) to pull decoded pictures from the decoder.
+/// - Call Flush() to signal end of stream to the decoder and perform shutdown
+/// when it completes.
+/// - Call Reset() to quickly stop the decoder (e.g. to implement Seek) and wait
+/// for the callback before restarting decoding at another point.
+/// - To destroy the decoder, the plugin should release all of its references to
+/// it. Any pending callbacks will abort before the decoder is destroyed.
+///
+/// Available video codecs vary by platform.
+/// All: theora, vorbis, vp8.
+/// Chrome and ChromeOS: aac, h264.
+/// ChromeOS: mpeg4.
+class VideoEncoder : public Resource {
+ public:
+ /// Default constructor for creating an is_null() <code>VideoEncoder</code>
+ /// object.
+ VideoEncoder();
+
+ /// A constructor used to create a <code>VideoEncoder</code> and associate it
+ /// with the provided <code>Instance</code>.
+ /// @param[in] instance The instance with which this resource will be
+ /// associated.
+ explicit VideoEncoder(const InstanceHandle& instance);
+
+ /// The copy constructor for <code>VideoEncoder</code>.
+ /// @param[in] other A reference to a <code>VideoEncoder</code>.
+ VideoEncoder(const VideoEncoder& other);
+
+ int32_t GetSupportedProfiles(
+ const CompletionCallbackWithOutput<
+ std::vector<PP_SupportedVideoProfile> >& cc);
+
+ int32_t Initialize(const PP_VideoFrame_Format& input_format,
+ const PP_Size& input_visible_size,
+ const PP_VideoProfile& output_profile,
+ const uint32_t initial_bitrate,
+ PP_HardwareAcceleration acceleration,
+ const CompletionCallback& cc);
+
+ int32_t GetVideoFrame(
+ const CompletionCallbackWithOutput<VideoFrame>& cc);
+
+ int32_t Encode(
+ const VideoFrame& video_frame,
+ bool force_keyframe,
+ const CompletionCallback& cc);
+
+ int32_t GetBitstreamBuffer(
+ const CompletionCallbackWithOutput<PP_BitstreamBuffer>& cc);
+
+ void RecycleBitstreamBuffer(
+ const PP_BitstreamBuffer& bitstream_buffer);
+
+ void RequestEncodingParametersChange(
+ uint32_t bitrate,
+ uint32_t framerate);
+};
+
+} // namespace pp
+
+#endif // PPAPI_CPP_VIDEO_ENCODER_H_

Powered by Google App Engine
This is Rietveld 408576698