OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ |
6 #define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ | 6 #define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ |
7 | 7 |
| 8 #include "ppapi/c/pp_bool.h" |
8 #include "ppapi/c/dev/pp_video_dev.h" | 9 #include "ppapi/c/dev/pp_video_dev.h" |
9 #include "ppapi/c/pp_module.h" | 10 #include "ppapi/c/pp_module.h" |
10 #include "ppapi/c/pp_resource.h" | 11 #include "ppapi/c/pp_resource.h" |
11 #include "ppapi/c/pp_stdint.h" | 12 #include "ppapi/c/pp_stdint.h" |
12 #include "ppapi/c/pp_completion_callback.h" | 13 #include "ppapi/c/pp_completion_callback.h" |
13 | 14 |
14 #define PPB_VIDEODECODER_DEV_INTERFACE "PPB_VideoDecoder(Dev);0.1" | 15 #define PPB_VIDEODECODER_DEV_INTERFACE "PPB_VideoDecoder(Dev);0.2" |
15 | 16 |
16 struct PPB_VideoDecoder_Dev { | 17 struct PPB_VideoDecoder_Dev { |
17 // Queries capability of the decoder for |codec|. | 18 // Queries capability of the decoder for |codec|. |
18 // |codec| is the requested codec id. | 19 // |codec| is the requested codec id. |
19 // |configs| is a pointer to a buffer containing |config_size| elements. | 20 // |configs| is a pointer to a buffer containing |config_size| elements. |
20 // The number of configurations is returned in |num_config|. Element 0 through | 21 // The number of configurations is returned in |num_config|. Element 0 through |
21 // |num_config| - 1 of |configs| are filled in with valid PP_VideoConfig's. | 22 // |num_config| - 1 of |configs| are filled in with valid PP_VideoConfig's. |
22 // No more than |config_size| PP_VideoConfig's will be returned even if more | 23 // No more than |config_size| PP_VideoConfig's will be returned even if more |
23 // are available on the device. | 24 // are available on the device. |
24 // When this function is called with |configs| = NULL, then no configurations | 25 // When this function is called with |configs| = NULL, then no configurations |
25 // are returned, but the total number of configurations available will be | 26 // are returned, but the total number of configurations available will be |
26 // returned in |num_config|. | 27 // returned in |num_config|. |
27 // | 28 // |
28 // Returns true on success, false otherwise. | 29 // Returns PP_TRUE on success, PP_FALSE otherwise. |
29 // NOTE: browser owns the memory of all PP_VideoConfig's. | 30 // NOTE: browser owns the memory of all PP_VideoConfig's. |
30 bool (*GetConfig)(PP_Instance instance, | 31 PP_Bool (*GetConfig)(PP_Instance instance, |
31 PP_VideoCodecId_Dev codec, | 32 enum PP_VideoCodecId_Dev codec, |
32 PP_VideoConfig_Dev* configs, | 33 PP_VideoConfig_Dev* configs, |
33 int32_t config_size, | 34 int32_t config_size, |
34 int32_t* num_config); | 35 int32_t* num_config); |
35 | 36 |
36 // Creates a video decoder with requested |decoder_config|. | 37 // Creates a video decoder with requested |decoder_config|. |
37 // |input_format| in |decoder_config| specifies the format of input access | 38 // |input_format| in |decoder_config| specifies the format of input access |
38 // unit, with PP_VIDEOKEY_CODECID and PP_VIDEOKEY_PAYLOADFORMAT required. | 39 // unit, with PP_VIDEOKEY_CODECID and PP_VIDEOKEY_PAYLOADFORMAT required. |
39 // Plugin has the option to specify codec profile/level and other | 40 // Plugin has the option to specify codec profile/level and other |
40 // information such as PP_VIDEOKEY_ACCELERATION, to let browser choose | 41 // information such as PP_VIDEOKEY_ACCELERATION, to let browser choose |
41 // the most appropriate decoder. | 42 // the most appropriate decoder. |
42 // | 43 // |
43 // |output_format| in |decoder_config| specifies desired decoded frame buffer | 44 // |output_format| in |decoder_config| specifies desired decoded frame buffer |
44 // format, with PP_VIDEOKEY_COLORTYPE and PP_VIDEOKEY_SURFACETYPE required. | 45 // format, with PP_VIDEOKEY_COLORTYPE and PP_VIDEOKEY_SURFACETYPE required. |
(...skipping 14 matching lines...) Expand all Loading... |
59 // The created decoder is returned as PP_Resource. NULL means failure. | 60 // The created decoder is returned as PP_Resource. NULL means failure. |
60 PP_Resource (*Create)(PP_Instance instance, | 61 PP_Resource (*Create)(PP_Instance instance, |
61 const struct PP_VideoDecoderConfig_Dev* decoder_config); | 62 const struct PP_VideoDecoderConfig_Dev* decoder_config); |
62 | 63 |
63 // Sends bit stream in |input_buffer| to the decoder. | 64 // Sends bit stream in |input_buffer| to the decoder. |
64 // This is a non-blocking call. | 65 // This is a non-blocking call. |
65 // The decoded frame will be returned by decoder calling |output_callback| | 66 // The decoded frame will be returned by decoder calling |output_callback| |
66 // provided by plugin during creation of decoder. | 67 // provided by plugin during creation of decoder. |
67 // The input data buffer is returned to plugin by decoder only when plugin | 68 // The input data buffer is returned to plugin by decoder only when plugin |
68 // provides |input_callback|. | 69 // provides |input_callback|. |
69 // Returns true on decoder successfully accepting buffer, false otherwise. | 70 // Returns PP_TRUE on decoder successfully accepting buffer, PP_FALSE |
| 71 // otherwise. |
70 // | 72 // |
71 bool (*Decode)(PP_Resource decoder, | 73 PP_Bool (*Decode)(PP_Resource decoder, |
72 struct PP_VideoCompressedDataBuffer_Dev* input_buffer); | 74 struct PP_VideoCompressedDataBuffer_Dev* input_buffer); |
73 | 75 |
74 // Requests the decoder to flush its input and output buffers. Once done with | 76 // Requests the decoder to flush its input and output buffers. Once done with |
75 // flushing, the decode will call the |callback|. | 77 // flushing, the decode will call the |callback|. |
76 int32_t (*Flush)(PP_Resource decoder, | 78 int32_t (*Flush)(PP_Resource decoder, struct PP_CompletionCallback callback); |
77 PP_CompletionCallback callback); | |
78 | 79 |
79 // Plugin sends uncompressed data buffers to the decoder. | 80 // Plugin sends uncompressed data buffers to the decoder. |
80 // Returns true on decoder successfully accepting the buffer, false otherwise. | 81 // Returns PP_TRUE on decoder successfully accepting the buffer, PP_FALSE |
81 bool (*ReturnUncompressedDataBuffer)( | 82 // otherwise. |
82 PP_Resource decoder, | 83 PP_Bool (*ReturnUncompressedDataBuffer)(PP_Resource decoder, |
83 struct PP_VideoUncompressedDataBuffer_Dev* buffer); | 84 struct PP_VideoUncompressedDataBuffer_Dev* buffer); |
84 }; | 85 }; |
85 | 86 |
86 #endif // PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ | 87 #endif // PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ |
OLD | NEW |