Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: ppapi/examples/gles2/gles2.cc

Issue 7021020: Clean up video frame sizes, types in Video Decode API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include <string.h> 5 #include <string.h>
6 6
7 #include <iostream> 7 #include <iostream>
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 virtual void Graphics3DContextLost() { 51 virtual void Graphics3DContextLost() {
52 // TODO(vrk/fischman): Properly reset after a lost graphics context. In 52 // TODO(vrk/fischman): Properly reset after a lost graphics context. In
53 // particular need to delete context_ & surface_ and re-create textures. 53 // particular need to delete context_ & surface_ and re-create textures.
54 // Probably have to recreate the decoder from scratch, because old textures 54 // Probably have to recreate the decoder from scratch, because old textures
55 // can still be outstanding in the decoder! 55 // can still be outstanding in the decoder!
56 assert(!"Unexpectedly lost graphics context"); 56 assert(!"Unexpectedly lost graphics context");
57 } 57 }
58 58
59 // pp::VideoDecoderClient_Dev implementation. 59 // pp::VideoDecoderClient_Dev implementation.
60 virtual void ProvidePictureBuffers( 60 virtual void ProvidePictureBuffers(
61 uint32_t req_num_of_bufs, PP_Size dimensions, 61 uint32_t req_num_of_bufs, PP_Size dimensions);
62 PP_PictureBufferType_Dev type);
63 virtual void DismissPictureBuffer(int32_t picture_buffer_id); 62 virtual void DismissPictureBuffer(int32_t picture_buffer_id);
64 virtual void PictureReady(const PP_Picture_Dev& picture); 63 virtual void PictureReady(const PP_Picture_Dev& picture);
65 virtual void EndOfStream(); 64 virtual void EndOfStream();
66 virtual void NotifyError(PP_VideoDecodeError_Dev error); 65 virtual void NotifyError(PP_VideoDecodeError_Dev error);
67 66
68 private: 67 private:
69 enum { kNumConcurrentDecodes = 7 }; 68 enum { kNumConcurrentDecodes = 7 };
70 69
71 // Initialize Video Decoder. 70 // Initialize Video Decoder.
72 void InitializeDecoder(); 71 void InitializeDecoder();
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 243
245 pp::CompletionCallback cb = 244 pp::CompletionCallback cb =
246 callback_factory_.NewCallback( 245 callback_factory_.NewCallback(
247 &GLES2DemoInstance::DecoderBitstreamDone, id); 246 &GLES2DemoInstance::DecoderBitstreamDone, id);
248 assert(bitstream_ids_at_decoder_.insert(id).second); 247 assert(bitstream_ids_at_decoder_.insert(id).second);
249 video_decoder_->Decode(bitstream_buffer, cb); 248 video_decoder_->Decode(bitstream_buffer, cb);
250 encoded_data_next_pos_to_decode_ = end_pos; 249 encoded_data_next_pos_to_decode_ = end_pos;
251 } 250 }
252 251
253 void GLES2DemoInstance::ProvidePictureBuffers( 252 void GLES2DemoInstance::ProvidePictureBuffers(
254 uint32_t req_num_of_bufs, PP_Size dimensions, 253 uint32_t req_num_of_bufs, PP_Size dimensions) {
255 PP_PictureBufferType_Dev type) {
256 std::vector<PP_GLESBuffer_Dev> buffers; 254 std::vector<PP_GLESBuffer_Dev> buffers;
257 for (uint32_t i = 0; i < req_num_of_bufs; i++) { 255 for (uint32_t i = 0; i < req_num_of_bufs; i++) {
258 PP_GLESBuffer_Dev buffer; 256 PP_GLESBuffer_Dev buffer;
259 buffer.texture_id = CreateTexture(dimensions.width, dimensions.height); 257 buffer.texture_id = CreateTexture(dimensions.width, dimensions.height);
260 int id = ++next_picture_buffer_id_; 258 int id = ++next_picture_buffer_id_;
261 buffer.info.id= id; 259 buffer.info.id= id;
262 buffers.push_back(buffer); 260 buffers.push_back(buffer);
263 assert(buffers_by_id_.insert(std::make_pair(id, buffer)).second); 261 assert(buffers_by_id_.insert(std::make_pair(id, buffer)).second);
264 } 262 }
265 video_decoder_->AssignGLESBuffers(buffers); 263 video_decoder_->AssignGLESBuffers(buffers);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 gles2_if_->DeleteShader(context_->pp_resource(), shader); 470 gles2_if_->DeleteShader(context_->pp_resource(), shader);
473 } 471 }
474 } // anonymous namespace 472 } // anonymous namespace
475 473
476 namespace pp { 474 namespace pp {
477 // Factory function for your specialization of the Module object. 475 // Factory function for your specialization of the Module object.
478 Module* CreateModule() { 476 Module* CreateModule() {
479 return new GLES2DemoModule(); 477 return new GLES2DemoModule();
480 } 478 }
481 } // namespace pp 479 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698