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

Side by Side Diff: ppapi/cpp/media_codec_video_decoder.h

Issue 210373003: Pepper VideoDecoder API definition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweak comment.x Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014 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_MEDIA_CODEC_VIDEO_DECODER_H_
6 #define PPAPI_CPP_MEDIA_CODEC_VIDEO_DECODER_H_
7
8 #include "ppapi/c/pp_media_codec.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
15 /// @file
16 /// This file defines the API to create and use a MediaCodecVideoDecoder
17 /// resource.
18
19 struct PP_FileInfo;
20
21 namespace pp {
22
23 class InstanceHandle;
24
25 /// The <code>MediaCodecVideoDecoder</code> class represents a video decoder
26 /// resource.
27 class MediaCodecVideoDecoder : public Resource {
28 public:
29 /// Default constructor for creating an is_null()
30 /// <code>MediaCodecVideoDecoder</code> object.
31 MediaCodecVideoDecoder();
32
33 /// A constructor used to create a <code>MediaCodecVideoDecoder</code> and
34 /// associate it with the provided <code>Instance</code>.
35 /// @param[in] instance The instance with which this resource will be
36 /// associated.
37 explicit MediaCodecVideoDecoder(const InstanceHandle& instance);
38
39 /// The copy constructor for <code>MediaCodecVideoDecoder</code>.
40 /// @param[in] other A reference to a <code>MediaCodecVideoDecoder</code>.
41 MediaCodecVideoDecoder(const MediaCodecVideoDecoder& other);
42
43 /// Initializes a video decoder resource. This should only be called once,
44 /// after construction and before any other methods.
45 ///
46 /// @param[in] graphics3d_context A <code>Graphics3D</code> resource to use
47 /// during decoding.
48 /// @param[in] profile A <code>PP_MediaCodec_VideoProfile</code> specifying
49 /// the video's codec profile.
50 /// @param[in] callback A <code>CompletionCallback</code> to be called upon
51 /// completion.
52 ///
53 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
54 /// Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the
55 /// requested profile is not supported.
56 int32_t Initialize(const Graphics3D& graphics3d_context,
57 PP_MediaCodec_VideoProfile profile,
58 const CompletionCallback& cc);
59
60 /// Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's
61 /// |buffer|. The plugin should maintain the buffer and not call Decode()
62 /// again until the decoder signals completion by returning PP_OK or by
63 /// running |callback|.
64 /// If the call to Decode() eventually results in a picture, the |decode_id|
65 /// parameter is copied into the returned picture. The plugin can use this to
66 /// associate decoded pictures with Decode() calls (e.g. to assign timestamps
67 /// or frame numbers to pictures.) It's OK to pass 0 if this isn't needed.
68 ///
69 /// @param[in] decode_id An optional value, chosen by the plugin, that can be
70 /// used to associate calls to Decode() with decoded pictures returned by
71 /// GetPicture().
72 /// @param[in] size Buffer size in bytes.
73 /// @param[in] buffer Starting address of buffer.
74 /// @param[in] callback A <code>CompletionCallback</code> to be called upon
75 /// completion.
76 ///
77 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
78 int32_t Decode(uint32_t decode_id,
79 uint32_t size,
80 const void* buffer,
81 const CompletionCallback& cc);
82
83 /// Gets the next picture from the decoder. The picture is valid after the
84 /// decoder signals completion by returning PP_OK or running the callback. The
85 /// plugin can call GetPicture() again after the decoder signals completion.
86 /// When the plugin is finished using the picture, it should return it to the
87 /// system by calling RecyclePicture().
88 ///
89 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be
90 /// called upon completion. On success, the output will contain the picture.
91 ///
92 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
93 int32_t GetPicture(
94 const CompletionCallbackWithOutput<PP_MediaCodec_Picture>& cc);
95
96 /// Recycles a picture that the plugin has received from the decoder.
97 /// The plugin should call this as soon as it has finished using the texture
98 /// so the decoder can decode more pictures.
99 ///
100 /// @param[in] picture A <code>PP_MediaCodec_Picture</code> to return to
101 /// the decoder.
102 void RecyclePicture(const PP_MediaCodec_Picture& picture);
103
104 /// Flushes the decoder. The plugin should call this when it reaches the end
105 /// of its video stream in order to stop cleanly. The decoder will run all
106 /// pending calls to completion. The plugin should make no calls to the
107 /// decoder other than RecyclePicture() until the decoder signals completion
108 /// by running the callback.
109 ///
110 /// @param[in] callback A <code>CompletionCallback</code> to be called when
111 /// flushing is complete.
112 ///
113 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
114 int32_t Flush(const CompletionCallback& cc);
115
116 /// Resets the decoder as quickly as possible. The plugin can call Reset to
117 /// skip to another position in the video stream. Pending calls to Decode()
118 /// and GetPicture()) are aborted, causing their callbacks to run with
119 /// PP_ERROR_ABORTED. The plugin should not make any further calls to the
120 /// decoder until the decoder signals completion by running the callback.
121 ///
122 /// @param[in] callback A <code>CompletionCallback</code> to be called upon
123 /// completion.
124 ///
125 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
126 int32_t Reset(const CompletionCallback& cc);
127 };
128
129 } // namespace pp
130
131 #endif // PPAPI_CPP_MEDIA_CODEC_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698