OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CPP_DEV_VIDEO_DECODER_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_VIDEO_DECODER_DEV_H_ |
6 #define PPAPI_CPP_DEV_VIDEO_DECODER_DEV_H_ | 6 #define PPAPI_CPP_DEV_VIDEO_DECODER_DEV_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ppapi/c/dev/pp_video_dev.h" | 10 #include "ppapi/c/dev/pp_video_dev.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // C++ version of the PPB_VideoDecoder_Dev interface. | 23 // C++ version of the PPB_VideoDecoder_Dev interface. |
24 class VideoDecoder : public Resource { | 24 class VideoDecoder : public Resource { |
25 public: | 25 public: |
26 // C++ version of PPP_VideoDecoder_Dev interface. | 26 // C++ version of PPP_VideoDecoder_Dev interface. |
27 class Client { | 27 class Client { |
28 public: | 28 public: |
29 virtual ~Client(); | 29 virtual ~Client(); |
30 | 30 |
31 // Callback to provide buffers for the decoded output pictures. | 31 // Callback to provide buffers for the decoded output pictures. |
32 virtual void ProvidePictureBuffers( | 32 virtual void ProvidePictureBuffers( |
33 uint32_t requested_num_of_buffers, | 33 uint32_t req_num_of_bufs, |
34 const std::vector<uint32_t>& buffer_properties) = 0; | 34 struct PP_Size dimensions, |
| 35 enum PP_PictureBufferType_Dev type); |
35 | 36 |
36 // Callback for decoder to delivered unneeded picture buffers back to the | 37 // Callback for decoder to delivered unneeded picture buffers back to the |
37 // plugin. | 38 // plugin. |
38 virtual void DismissPictureBuffer(int32_t picture_buffer_id) = 0; | 39 virtual void DismissPictureBuffer(int32_t picture_buffer_id) = 0; |
39 | 40 |
40 // Callback to deliver decoded pictures ready to be displayed. | 41 // Callback to deliver decoded pictures ready to be displayed. |
41 virtual void PictureReady(const PP_Picture_Dev& picture) = 0; | 42 virtual void PictureReady(const PP_Picture_Dev& picture) = 0; |
42 | 43 |
43 // Callback to notify that decoder has decoded end of stream marker and has | 44 // Callback to notify that decoder has decoded end of stream marker and has |
44 // outputted all displayable pictures. | 45 // outputted all displayable pictures. |
45 virtual void NotifyEndOfStream() = 0; | 46 virtual void EndOfStream() = 0; |
46 | 47 |
47 // Callback to notify about decoding errors. | 48 // Callback to notify about decoding errors. |
48 virtual void NotifyError(PP_VideoDecodeError_Dev error) = 0; | 49 virtual void NotifyError(PP_VideoDecodeError_Dev error) = 0; |
49 }; | 50 }; |
50 | 51 |
51 // Constructor for the video decoder. Calls the Create on the | 52 // Constructor for the video decoder. Calls the Create on the |
52 // PPB_VideoDecoder_Dev interface. | 53 // PPB_VideoDecoder_Dev interface. |
53 // | 54 // |
54 // Parameters: | 55 // Parameters: |
55 // |instance| is the pointer to the plug-in instance. | 56 // |instance| is the pointer to the plug-in instance. |
56 // |config| is the configuration on which the decoder should be initialized. | 57 // |config| is the configuration on which the decoder should be initialized. |
57 // |callback| will be called when decoder is initialized. | 58 // |callback| will be called when decoder is initialized. |
58 // |client| is the pointer to the client object. Ownership of the object is | 59 // |client| is the pointer to the client object. Ownership of the object is |
59 // not transferred and it must outlive the lifetime of this class. | 60 // not transferred and it must outlive the lifetime of this class. |
60 VideoDecoder(const Instance* instance, const std::vector<uint32_t>& config, | 61 VideoDecoder(const Instance* instance, |
| 62 const PP_VideoConfigElement* config, |
61 CompletionCallback callback, Client* client); | 63 CompletionCallback callback, Client* client); |
62 ~VideoDecoder(); | 64 ~VideoDecoder(); |
63 | 65 |
64 // GetConfigs returns supported configurations that are subsets of given | 66 // GetConfigs returns supported configurations that are subsets of given |
65 // |prototype_config|. | 67 // |prototype_config|. |
66 static std::vector<uint32_t> GetConfigs( | 68 bool GetConfigs(Instance* instance, |
67 Instance* instance, | 69 const PP_VideoConfigElement* prototype_config, |
68 const std::vector<uint32_t>& prototype_config); | 70 PP_VideoConfigElement* matching_configs, |
| 71 uint32_t matching_configs_size, |
| 72 uint32_t* num_of_matching_configs); |
69 | 73 |
70 // Provides the decoder with picture buffers for video decoding. | 74 // Provides the decoder with picture buffers for video decoding. |
71 // AssignGLESBuffers provides texture-backed buffers, whereas | 75 // AssignGLESBuffers provides texture-backed buffers, whereas |
72 // AssignSysmemBuffers provides system memory-backed buffers. | 76 // AssignSysmemBuffers provides system memory-backed buffers. |
73 void AssignGLESBuffers(uint32_t no_of_buffers, | 77 void AssignGLESBuffers(const std::vector<PP_GLESBuffer_Dev>& buffers); |
74 const PP_GLESBuffer_Dev& buffers); | 78 void AssignSysmemBuffers(const std::vector<PP_SysmemBuffer_Dev>& buffers); |
75 void AssignSysmemBuffers(uint32_t no_of_buffers, | |
76 const PP_SysmemBuffer_Dev& buffers); | |
77 | 79 |
78 // Decodes given bitstream buffer. Once decoder is done with processing | 80 // Decodes given bitstream buffer. Once decoder is done with processing |
79 // |bitstream_buffer| is will call |callback| with provided user data. | 81 // |bitstream_buffer| is will call |callback| with provided user data. |
80 bool Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer, | 82 bool Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer, |
81 CompletionCallback callback); | 83 CompletionCallback callback); |
82 | 84 |
83 // Tells the decoder to reuse given picture buffer. | 85 // Tells the decoder to reuse given picture buffer. |
84 void ReusePictureBuffer(int32_t picture_buffer_id); | 86 void ReusePictureBuffer(int32_t picture_buffer_id); |
85 | 87 |
86 // Flushes the decoder. |callback| will be called as soon as Flush has been | 88 // Flushes the decoder. |callback| will be called as soon as Flush has been |
(...skipping 10 matching lines...) Expand all Loading... |
97 Client* client_; | 99 Client* client_; |
98 | 100 |
99 // Suppress compiler-generated copy constructors. | 101 // Suppress compiler-generated copy constructors. |
100 VideoDecoder(const VideoDecoder&); | 102 VideoDecoder(const VideoDecoder&); |
101 void operator=(const VideoDecoder&); | 103 void operator=(const VideoDecoder&); |
102 }; | 104 }; |
103 | 105 |
104 } // namespace pp | 106 } // namespace pp |
105 | 107 |
106 #endif // PPAPI_CPP_DEV_VIDEO_DECODER_DEV_H_ | 108 #endif // PPAPI_CPP_DEV_VIDEO_DECODER_DEV_H_ |
OLD | NEW |