| Index: ppapi/c/ppb_media_codec_video_decoder.h
|
| diff --git a/ppapi/c/ppb_media_codec_video_decoder.h b/ppapi/c/ppb_media_codec_video_decoder.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..cac34e07cf83137beffb41db6cf5e0c3417a922f
|
| --- /dev/null
|
| +++ b/ppapi/c/ppb_media_codec_video_decoder.h
|
| @@ -0,0 +1,186 @@
|
| +/* Copyright (c) 2014 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.
|
| + */
|
| +
|
| +/* From ppb_media_codec_video_decoder.idl modified Fri Apr 18 09:47:01 2014. */
|
| +
|
| +#ifndef PPAPI_C_PPB_MEDIA_CODEC_VIDEO_DECODER_H_
|
| +#define PPAPI_C_PPB_MEDIA_CODEC_VIDEO_DECODER_H_
|
| +
|
| +#include "ppapi/c/pp_bool.h"
|
| +#include "ppapi/c/pp_completion_callback.h"
|
| +#include "ppapi/c/pp_instance.h"
|
| +#include "ppapi/c/pp_macros.h"
|
| +#include "ppapi/c/pp_media_codec.h"
|
| +#include "ppapi/c/pp_resource.h"
|
| +#include "ppapi/c/pp_size.h"
|
| +#include "ppapi/c/pp_stdint.h"
|
| +
|
| +#define PPB_MEDIACODECVIDEODECODER_INTERFACE_0_1 \
|
| + "PPB_MediaCodecVideoDecoder;0.1" /* dev */
|
| +/**
|
| + * @file
|
| + * This file defines the <code>PPB_MediaCodecVideoDecoder</code> interface.
|
| + */
|
| +
|
| +
|
| +/**
|
| + * @addtogroup Interfaces
|
| + * @{
|
| + */
|
| +/**
|
| + * 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() to send a bitstream buffer to the decoder.
|
| + * - Call GetPicture() to get the next decoded picture.
|
| + * - Call Flush() to signal end of stream to the decoder and perform shutdown
|
| + * when it completes.
|
| + * - To reset the decoder (e.g. to implement Seek), call Reset() and wait for
|
| + * the callback.
|
| + * - To destroy the decoder, the plugin should release all of its references to
|
| + * it. To avoid receiving aborted callbacks, call Flush() and wait for
|
| + * completion first.
|
| + */
|
| +struct PPB_MediaCodecVideoDecoder_0_1 { /* dev */
|
| + /**
|
| + * Creates a new video decoder resource.
|
| + *
|
| + * @param[in] instance A <code>PP_Instance</code> identifying the instance
|
| + * with the video decoder.
|
| + *
|
| + * @return A <code>PP_Resource</code> corresponding to a video decoder if
|
| + * successful or 0 otherwise.
|
| + */
|
| + PP_Resource (*Create)(PP_Instance instance);
|
| + /**
|
| + * Determines if the given resource is a video decoder.
|
| + *
|
| + * @param[in] resource A <code>PP_Resource</code> identifying a resource.
|
| + *
|
| + * @return <code>PP_TRUE</code> if the resource is a
|
| + * <code>PPB_MediaCodecVideoDecoder</code>, <code>PP_FALSE</code> if the
|
| + * resource is invalid or some other type.
|
| + */
|
| + PP_Bool (*IsMediaCodecVideoDecoder)(PP_Resource resource);
|
| + /**
|
| + * Initializes a video decoder resource. This should only be called once,
|
| + * after Create() and before any other functions.
|
| + *
|
| + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
|
| + * decoder.
|
| + * @param[in] graphics3d_context A <code>PPB_Graphics3D</code> resource to use
|
| + * during decoding.
|
| + * @param[in] profile A <code>PP_MediaCodec_VideoProfile</code> specifying the
|
| + * video's codec profile.
|
| + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
|
| + * completion.
|
| + *
|
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>.
|
| + * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the
|
| + * requested profile is not supported.
|
| + */
|
| + int32_t (*Initialize)(PP_Resource video_decoder,
|
| + PP_Resource context,
|
| + PP_MediaCodec_VideoProfile profile,
|
| + struct PP_CompletionCallback callback);
|
| + /**
|
| + * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's
|
| + * |buffer|. The plugin should maintain the buffer and not call Decode() again
|
| + * until the decoder signals completion by returning PP_OK or running the
|
| + * |callback|.
|
| + * If the call to Decode() eventually causes GetPicture() to return a picture,
|
| + * the |picture_id| parameter will be copied into the returned picture.
|
| + * The plugin can use this to associate decoded pictures with Decode() calls
|
| + * (e.g. to assign timestamps or frame numbers to pictures.)
|
| + *
|
| + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
|
| + * decoder.
|
| + * @param[in] picture_id An identifier that can be used to associate calls to
|
| + * Decode() with decoded pictures returned by GetPicture().
|
| + * @param[in] size Buffer size in bytes.
|
| + * @param[in] buffer Starting address of buffer.
|
| + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
|
| + * completion.
|
| + *
|
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>.
|
| + */
|
| + int32_t (*Decode)(PP_Resource video_decoder,
|
| + uint32_t picture_id,
|
| + uint32_t size,
|
| + const void* buffer,
|
| + struct PP_CompletionCallback callback);
|
| + /**
|
| + * Gets the next picture from the decoder. The picture is valid after the
|
| + * decoder signals completion by returning PP_OK or running the callback. The
|
| + * plugin can call GetPicture() again after the decoder signals completion.
|
| + * When the plugin is finished using the picture, it should return it to the
|
| + * system by calling RecyclePicture().
|
| + *
|
| + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
|
| + * decoder.
|
| + * @param[out] picture A <code>PP_MediaCodec_Picture</code> to hold the
|
| + * decoded picture.
|
| + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
|
| + * completion.
|
| + *
|
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>.
|
| + */
|
| + int32_t (*GetPicture)(PP_Resource video_decoder,
|
| + struct PP_MediaCodec_Picture* picture,
|
| + struct PP_CompletionCallback callback);
|
| + /**
|
| + * Recycles a picture that the plugin has received from the decoder.
|
| + * The plugin should call this as soon as it has finished using the texture so
|
| + * the decoder can decode more pictures.
|
| + *
|
| + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
|
| + * decoder.
|
| + * @param[in] picture A <code>PP_MediaCodec_Picture</code> to return to
|
| + * the decoder.
|
| + */
|
| + void (*RecyclePicture)(PP_Resource video_decoder,
|
| + const struct PP_MediaCodec_Picture* picture);
|
| + /**
|
| + * Flushes the decoder. The plugin should call this when it reaches the end of
|
| + * its video stream in order to stop cleanly. The decoder will run all pending
|
| + * calls to completion. The plugin should make no calls to the decoder other
|
| + * than RecyclePicture() until the decoder signals completion by running the
|
| + * callback.
|
| + *
|
| + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
|
| + * decoder.
|
| + * @param[in] callback A <code>PP_CompletionCallback</code> to be called when
|
| + * flushing is complete.
|
| + *
|
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>.
|
| + */
|
| + int32_t (*Flush)(PP_Resource video_decoder,
|
| + struct PP_CompletionCallback callback);
|
| + /**
|
| + * Resets the decoder as quickly as possible. The plugin can call Reset to
|
| + * skip to another position in the video stream. Pending calls to Decode() and
|
| + * GetPicture()) are aborted, causing their callbacks to run with
|
| + * PP_ERROR_ABORTED. The plugin should not make any further calls to the
|
| + * decoder until the decoder signals completion by running the callback.
|
| + *
|
| + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
|
| + * decoder.
|
| + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
|
| + * completion.
|
| + *
|
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>.
|
| + */
|
| + int32_t (*Reset)(PP_Resource video_decoder,
|
| + struct PP_CompletionCallback callback);
|
| +};
|
| +/**
|
| + * @}
|
| + */
|
| +
|
| +#endif /* PPAPI_C_PPB_MEDIA_CODEC_VIDEO_DECODER_H_ */
|
| +
|
|
|