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

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: Add 'allow_software_fallback' param to Initialize. 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] allow_software_fallback A <code>bool</code> specifying whether
51 /// the decoder can fall back to software decoding if a suitable hardware
52 /// decoder isn't available.
53 /// @param[in] callback A <code>CompletionCallback</code> to be called upon
54 /// completion.
55 ///
56 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
57 /// Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the
58 /// requested profile is not supported.
59 int32_t Initialize(const Graphics3D& graphics3d_context,
60 PP_MediaCodec_VideoProfile profile,
61 bool allow_software_fallback,
62 const CompletionCallback& cc);
63
64 /// Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's
65 /// |buffer|. The plugin should maintain the buffer and not call Decode()
66 /// again until the decoder signals completion by returning PP_OK or by
67 /// running |callback|.
68 /// If the call to Decode() eventually results in a picture, the |decode_id|
69 /// parameter is copied into the returned picture. The plugin can use this to
70 /// associate decoded pictures with Decode() calls (e.g. to assign timestamps
71 /// or frame numbers to pictures.) It's OK to pass 0 if this isn't needed.
72 ///
73 /// @param[in] decode_id An optional value, chosen by the plugin, that can be
74 /// used to associate calls to Decode() with decoded pictures returned by
75 /// GetPicture().
76 /// @param[in] size Buffer size in bytes.
77 /// @param[in] buffer Starting address of buffer.
78 /// @param[in] callback A <code>CompletionCallback</code> to be called upon
79 /// completion.
80 ///
81 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
82 int32_t Decode(uint32_t decode_id,
83 uint32_t size,
84 const void* buffer,
85 const CompletionCallback& cc);
86
87 /// Gets the next picture from the decoder. The picture is valid after the
88 /// decoder signals completion by returning PP_OK or running the callback. The
89 /// plugin can call GetPicture() again after the decoder signals completion.
90 /// When the plugin is finished using the picture, it should return it to the
91 /// system by calling RecyclePicture().
92 ///
93 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be
94 /// called upon completion. On success, the output will contain the picture.
95 ///
96 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
97 int32_t GetPicture(
98 const CompletionCallbackWithOutput<PP_MediaCodec_Picture>& cc);
99
100 /// Recycles a picture that the plugin has received from the decoder.
101 /// The plugin should call this as soon as it has finished using the texture
102 /// so the decoder can decode more pictures.
103 ///
104 /// @param[in] picture A <code>PP_MediaCodec_Picture</code> to return to
105 /// the decoder.
106 void RecyclePicture(const PP_MediaCodec_Picture& picture);
107
108 /// Flushes the decoder. The plugin should call this when it reaches the end
109 /// of its video stream in order to stop cleanly. The decoder will run all
110 /// pending calls to completion. The plugin should make no calls to the
111 /// decoder other than RecyclePicture() until the decoder signals completion
112 /// by running the callback.
113 ///
114 /// @param[in] callback A <code>CompletionCallback</code> to be called when
115 /// flushing is complete.
116 ///
117 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
118 int32_t Flush(const CompletionCallback& cc);
119
120 /// Resets the decoder as quickly as possible. The plugin can call Reset to
121 /// skip to another position in the video stream. Pending calls to Decode()
122 /// and GetPicture()) are aborted, causing their callbacks to run with
123 /// PP_ERROR_ABORTED. The plugin should not make any further calls to the
124 /// decoder until the decoder signals completion by running the callback.
125 ///
126 /// @param[in] callback A <code>CompletionCallback</code> to be called upon
127 /// completion.
128 ///
129 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
130 int32_t Reset(const CompletionCallback& cc);
131 };
132
133 } // namespace pp
134
135 #endif // PPAPI_CPP_MEDIA_CODEC_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698