1010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)/* Copyright (c) 2014 The Chromium Authors. All rights reserved.
2010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * Use of this source code is governed by a BSD-style license that can be
3010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * found in the LICENSE file.
4010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) */
5010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
61320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci/* From ppb_video_decoder.idl modified Mon Sep  8 16:40:15 2014. */
7010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
8010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#ifndef PPAPI_C_PPB_VIDEO_DECODER_H_
9010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#define PPAPI_C_PPB_VIDEO_DECODER_H_
10010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
11010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#include "ppapi/c/pp_bool.h"
12010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#include "ppapi/c/pp_codecs.h"
13010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#include "ppapi/c/pp_completion_callback.h"
14010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#include "ppapi/c/pp_instance.h"
15010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#include "ppapi/c/pp_macros.h"
16010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#include "ppapi/c/pp_resource.h"
17010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#include "ppapi/c/pp_size.h"
18010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#include "ppapi/c/pp_stdint.h"
19010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define PPB_VIDEODECODER_INTERFACE_0_1 "PPB_VideoDecoder;0.1"
211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define PPB_VIDEODECODER_INTERFACE_0_2 "PPB_VideoDecoder;0.2"
221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define PPB_VIDEODECODER_INTERFACE PPB_VIDEODECODER_INTERFACE_0_2
231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
24010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)/**
25010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * @file
26010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * This file defines the <code>PPB_VideoDecoder</code> interface.
27010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) */
28010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
29010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
30010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)/**
31010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * @addtogroup Interfaces
32010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * @{
33010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) */
34010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)/**
35010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * Video decoder interface.
36010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) *
37010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * Typical usage:
38010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * - Call Create() to create a new video decoder resource.
39010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * - Call Initialize() to initialize it with a 3d graphics context and the
40010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) *   desired codec profile.
41010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * - Call Decode() continuously (waiting for each previous call to complete) to
42010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) *   push bitstream buffers to the decoder.
43010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * - Call GetPicture() continuously (waiting for each previous call to complete)
44010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) *   to pull decoded pictures from the decoder.
45010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * - Call Flush() to signal end of stream to the decoder and perform shutdown
46010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) *   when it completes.
47010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * - Call Reset() to quickly stop the decoder (e.g. to implement Seek) and wait
48010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) *   for the callback before restarting decoding at another point.
49010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * - To destroy the decoder, the plugin should release all of its references to
50010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) *   it. Any pending callbacks will abort before the decoder is destroyed.
51010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) *
52010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * Available video codecs vary by platform.
53010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * All: theora, vorbis, vp8.
54010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * Chrome and ChromeOS: aac, h264.
55010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * ChromeOS: mpeg4.
56010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) */
571320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccistruct PPB_VideoDecoder_0_2 {
58010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  /**
59010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * Creates a new video decoder resource.
60010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
61010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] instance A <code>PP_Instance</code> identifying the instance
62010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * with the video decoder.
63010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
64010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @return A <code>PP_Resource</code> corresponding to a video decoder if
65010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * successful or 0 otherwise.
66010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   */
67010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  PP_Resource (*Create)(PP_Instance instance);
68010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  /**
69010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * Determines if the given resource is a video decoder.
70010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
71010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] resource A <code>PP_Resource</code> identifying a resource.
72010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
73010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @return <code>PP_TRUE</code> if the resource is a
74010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * <code>PPB_VideoDecoder</code>, <code>PP_FALSE</code> if the resource is
75010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * invalid or some other type.
76010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   */
77010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  PP_Bool (*IsVideoDecoder)(PP_Resource resource);
78010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  /**
79010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * Initializes a video decoder resource. This should be called after Create()
80010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * and before any other functions.
81010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
82010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
83010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * decoder.
84010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] graphics3d_context A <code>PPB_Graphics3D</code> resource to use
85010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * during decoding.
86010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] profile A <code>PP_VideoProfile</code> specifying the video
87010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * codec profile.
881320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci   * @param[in] acceleration A <code>PP_HardwareAcceleration</code> specifying
891320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci   * whether to use a hardware accelerated or a software implementation.
90010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
91010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * completion.
92010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
93010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @return An int32_t containing an error code from <code>pp_errors.h</code>.
94010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the
95010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * requested profile is not supported. In this case, the client may call
96010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * Initialize() again with different parameters to find a good configuration.
97010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   */
98010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  int32_t (*Initialize)(PP_Resource video_decoder,
99010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                        PP_Resource graphics3d_context,
100010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                        PP_VideoProfile profile,
1011320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                        PP_HardwareAcceleration acceleration,
102010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                        struct PP_CompletionCallback callback);
103010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  /**
104010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's
105cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * |buffer|. The plugin should wait until the decoder signals completion by
106cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * returning PP_OK or by running |callback| before calling Decode() again.
107010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
108010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * In general, each bitstream buffer should contain a demuxed bitstream frame
109010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * for the selected video codec. For example, H264 decoders expect to receive
110010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * one AnnexB NAL unit, including the 4 byte start code prefix, while VP8
111010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * decoders expect to receive a bitstream frame without the IVF frame header.
112010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
113010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * If the call to Decode() eventually results in a picture, the |decode_id|
114010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * parameter is copied into the returned picture. The plugin can use this to
115010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * associate decoded pictures with Decode() calls (e.g. to assign timestamps
116010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * or frame numbers to pictures.) This value is opaque to the API so the
117010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * plugin is free to pass any value.
118010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
119010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
120010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * decoder.
121010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] decode_id An optional value, chosen by the plugin, that can be
122010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * used to associate calls to Decode() with decoded pictures returned by
123010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * GetPicture().
124010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] size Buffer size in bytes.
125010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] buffer Starting address of buffer.
126010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] callback A <code>PP_CompletionCallback</code> to be called on
127010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * completion.
128010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
129010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @return An int32_t containing an error code from <code>pp_errors.h</code>.
130cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Flush()
131cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * or Reset() call is pending.
132cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * Returns PP_ERROR_INPROGRESS if there is another Decode() call pending.
133cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * Returns PP_ERROR_NOMEMORY if a bitstream buffer can't be created.
134cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * Returns PP_ERROR_ABORTED when Reset() is called while Decode() is pending.
135010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   */
136010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  int32_t (*Decode)(PP_Resource video_decoder,
137010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                    uint32_t decode_id,
138010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                    uint32_t size,
139010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                    const void* buffer,
140010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                    struct PP_CompletionCallback callback);
141010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  /**
142010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * Gets the next picture from the decoder. The picture is valid after the
143010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * decoder signals completion by returning PP_OK or running |callback|. The
144010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * plugin can call GetPicture() again after the decoder signals completion.
145010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * When the plugin is finished using the picture, it should return it to the
146010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * system by calling RecyclePicture().
147010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
148010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
149010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * decoder.
150010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[out] picture A <code>PP_VideoPicture</code> to hold the decoded
151010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * picture.
152010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] callback A <code>PP_CompletionCallback</code> to be called on
153010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * completion.
154010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
155010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @return An int32_t containing an error code from <code>pp_errors.h</code>.
156cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Reset()
157cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * call is pending.
158cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * Returns PP_ERROR_INPROGRESS if there is another GetPicture() call pending.
159010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush()
160010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * completes while GetPicture() is pending.
161010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   */
162010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  int32_t (*GetPicture)(PP_Resource video_decoder,
163010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                        struct PP_VideoPicture* picture,
164010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                        struct PP_CompletionCallback callback);
165010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  /**
166010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * Recycles a picture that the plugin has received from the decoder.
167010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * The plugin should call this as soon as it has finished using the texture so
168010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * the decoder can decode more pictures.
169010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
170010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
171010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * decoder.
172010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] picture A <code>PP_VideoPicture</code> to return to
173010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * the decoder.
174010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   */
175010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  void (*RecyclePicture)(PP_Resource video_decoder,
176010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                         const struct PP_VideoPicture* picture);
177010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  /**
178cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * Flushes the decoder. The plugin should call Flush() when it reaches the
179cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * end of its video stream in order to stop cleanly. The decoder will run any
180cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * pending Decode() call to completion. The plugin should make no further
181cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * calls to the decoder other than GetPicture() and RecyclePicture() until
182cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * the decoder signals completion by running |callback|. Just before
183cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * completion, any pending GetPicture() call will complete by running its
184cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * callback with result PP_ERROR_ABORTED to signal that no more pictures are
185116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * available. Any pictures held by the plugin remain valid during and after
186116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * the flush and should be recycled back to the decoder.
187010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
188010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
189010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * decoder.
190010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] callback A <code>PP_CompletionCallback</code> to be called on
191010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * completion.
192010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
193010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @return An int32_t containing an error code from <code>pp_errors.h</code>.
194cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * Returns PP_ERROR_FAILED if the decoder isn't initialized.
195010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   */
196010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  int32_t (*Flush)(PP_Resource video_decoder,
197010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                   struct PP_CompletionCallback callback);
198010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  /**
199010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * Resets the decoder as quickly as possible. The plugin can call Reset() to
200cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * skip to another position in the video stream. After Reset() returns, any
201cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * pending calls to Decode() and GetPicture()) abort, causing their callbacks
202cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * to run with PP_ERROR_ABORTED. The plugin should not make further calls to
203116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * the decoder other than RecyclePicture() until the decoder signals
204116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * completion by running |callback|. Any pictures held by the plugin remain
205116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * valid during and after the reset and should be recycled back to the
206116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * decoder.
207010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
208010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
209010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * decoder.
210010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @param[in] callback A <code>PP_CompletionCallback</code> to be called on
211010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * completion.
212010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   *
213010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   * @return An int32_t containing an error code from <code>pp_errors.h</code>.
214cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * Returns PP_ERROR_FAILED if the decoder isn't initialized.
215010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)   */
216010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  int32_t (*Reset)(PP_Resource video_decoder,
217010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                   struct PP_CompletionCallback callback);
218010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)};
2191320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
2201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccitypedef struct PPB_VideoDecoder_0_2 PPB_VideoDecoder;
2211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
2221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccistruct PPB_VideoDecoder_0_1 {
2231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  PP_Resource (*Create)(PP_Instance instance);
2241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  PP_Bool (*IsVideoDecoder)(PP_Resource resource);
2251320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  int32_t (*Initialize)(PP_Resource video_decoder,
2261320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                        PP_Resource graphics3d_context,
2271320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                        PP_VideoProfile profile,
2281320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                        PP_Bool allow_software_fallback,
2291320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                        struct PP_CompletionCallback callback);
2301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  int32_t (*Decode)(PP_Resource video_decoder,
2311320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                    uint32_t decode_id,
2321320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                    uint32_t size,
2331320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                    const void* buffer,
2341320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                    struct PP_CompletionCallback callback);
2351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  int32_t (*GetPicture)(PP_Resource video_decoder,
2361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                        struct PP_VideoPicture* picture,
2371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                        struct PP_CompletionCallback callback);
2381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  void (*RecyclePicture)(PP_Resource video_decoder,
2391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                         const struct PP_VideoPicture* picture);
2401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  int32_t (*Flush)(PP_Resource video_decoder,
2411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                   struct PP_CompletionCallback callback);
2421320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  int32_t (*Reset)(PP_Resource video_decoder,
2431320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                   struct PP_CompletionCallback callback);
2441320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci};
245010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)/**
246010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) * @}
247010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) */
248010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
249010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#endif  /* PPAPI_C_PPB_VIDEO_DECODER_H_ */
250010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
251