Delete unused downloads page asset.
[chromium-blink-merge.git] / ppapi / c / dev / ppb_video_decoder_dev.h
blob8b15fb07d1703188942055ca9d6de9b4857d62f0
1 /* Copyright (c) 2012 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 */
6 /* From dev/ppb_video_decoder_dev.idl modified Tue Oct 29 00:32:59 2013. */
8 #ifndef PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_
9 #define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_
11 #include "ppapi/c/dev/pp_video_dev.h"
12 #include "ppapi/c/pp_bool.h"
13 #include "ppapi/c/pp_completion_callback.h"
14 #include "ppapi/c/pp_instance.h"
15 #include "ppapi/c/pp_macros.h"
16 #include "ppapi/c/pp_resource.h"
17 #include "ppapi/c/pp_size.h"
18 #include "ppapi/c/pp_stdint.h"
20 #define PPB_VIDEODECODER_DEV_INTERFACE_0_16 "PPB_VideoDecoder(Dev);0.16"
21 #define PPB_VIDEODECODER_DEV_INTERFACE PPB_VIDEODECODER_DEV_INTERFACE_0_16
23 /**
24 * @file
25 * This file defines the <code>PPB_VideoDecoder_Dev</code> interface.
29 /**
30 * @addtogroup Interfaces
31 * @{
33 /**
34 * Video decoder interface.
36 * Typical usage:
37 * - Use Create() to create & configure a new PPB_VideoDecoder_Dev resource.
38 * - Call Decode() to decode some video data.
39 * - Receive ProvidePictureBuffers callback
40 * - Supply the decoder with textures using AssignPictureBuffers.
41 * - Receive PictureReady callbacks
42 * - Hand the textures back to the decoder using ReusePictureBuffer.
43 * - To signal EOS to the decoder: call Flush() and wait for NotifyFlushDone
44 * callback.
45 * - To reset the decoder (e.g. to implement Seek): call Reset() and wait for
46 * NotifyResetDone callback.
47 * - To tear down the decoder call Destroy().
49 * See PPP_VideoDecoder_Dev for the notifications the decoder may send the
50 * plugin.
52 struct PPB_VideoDecoder_Dev_0_16 {
53 /**
54 * Creates & initializes a video decoder.
56 * Parameters:
57 * |instance| pointer to the plugin instance.
58 * |context| a PPB_Graphics3D resource in which decoding will happen.
59 * |profile| the video stream's format profile.
61 * The created decoder is returned as PP_Resource. 0 means failure.
63 PP_Resource (*Create)(PP_Instance instance,
64 PP_Resource context,
65 PP_VideoDecoder_Profile profile);
66 /**
67 * Tests whether |resource| is a video decoder created through Create
68 * function of this interface.
70 * Parameters:
71 * |resource| is handle to resource to test.
73 * Returns true if is a video decoder, false otherwise.
75 PP_Bool (*IsVideoDecoder)(PP_Resource resource);
76 /**
77 * Dispatches bitstream buffer to the decoder.
79 * Parameters:
80 * |video_decoder| is the previously created handle to the decoder resource.
81 * |bitstream_buffer| is the bitstream buffer that contains at most one
82 * input frame.
83 * |callback| will be called when |bitstream_buffer| has been processed by
84 * the decoder.
86 * Returns an error code from pp_errors.h.
88 int32_t (*Decode)(PP_Resource video_decoder,
89 const struct PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
90 struct PP_CompletionCallback callback);
91 /**
92 * Provides the decoder with texture-backed picture buffers for video
93 * decoding.
95 * This function should be called when the plugin has its
96 * ProvidePictureBuffers method called. The decoder will stall until it has
97 * received all the buffers it's asked for.
99 * Parameters:
100 * |video_decoder| is the previously created handle to the decoder resource.
101 * |no_of_buffers| how many buffers are behind picture buffer pointer.
102 * |buffers| contains the reference to the picture buffer that was
103 * allocated.
105 void (*AssignPictureBuffers)(PP_Resource video_decoder,
106 uint32_t no_of_buffers,
107 const struct PP_PictureBuffer_Dev buffers[]);
109 * Tells the decoder to reuse the given picture buffer. Typical use of this
110 * function is to call from PictureReady callback to recycle picture buffer
111 * back to the decoder after blitting the image so that decoder can use the
112 * image for output again.
114 * Parameters:
115 * |video_decoder| is the previously created handle to the decoder resource.
116 * |picture_buffer_id| contains the id of the picture buffer that was
117 * processed.
119 void (*ReusePictureBuffer)(PP_Resource video_decoder,
120 int32_t picture_buffer_id);
122 * Flush input and output buffers in the decoder. Any pending inputs are
123 * decoded and pending outputs are delivered to the plugin. Once done
124 * flushing, the decoder will call |callback|.
126 * Parameters:
127 * |video_decoder| is the previously created handle to the decoder resource.
128 * |callback| is one-time callback that will be called once the flushing
129 * request has been completed.
131 * Returns an error code from pp_errors.h.
133 int32_t (*Flush)(PP_Resource video_decoder,
134 struct PP_CompletionCallback callback);
136 * Reset the decoder as quickly as possible. Pending inputs and outputs are
137 * dropped and the decoder is put back into a state ready to receive further
138 * Decode() calls. |callback| will be called when the reset is done.
140 * Parameters:
141 * |video_decoder| is the previously created handle to the decoder resource.
142 * |callback| is one-time callback that will be called once the reset
143 * request has been completed.
145 * Returns an error code from pp_errors.h.
147 int32_t (*Reset)(PP_Resource video_decoder,
148 struct PP_CompletionCallback callback);
150 * Tear down the decoder as quickly as possible. Pending inputs and outputs
151 * are dropped and the decoder frees all of its resources. Although resources
152 * may be freed asynchronously, after this method returns no more callbacks
153 * will be made on the client. Any resources held by the client at that point
154 * may be freed.
156 * Parameters:
157 * |video_decoder| is the previously created handle to the decoder resource.
159 void (*Destroy)(PP_Resource video_decoder);
162 typedef struct PPB_VideoDecoder_Dev_0_16 PPB_VideoDecoder_Dev;
164 * @}
167 #endif /* PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ */