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

Side by Side Diff: media/mf/mft_h264_decoder_example.cc

Issue 3335014: Added FakeGlVideoDecodeEngine to exercise the IPC protocol for hardware video decoding (Closed)
Patch Set: compile man... Created 10 years, 3 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
OLDNEW
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 // Demonstrates the use of MftH264Decoder. 5 // Demonstrates the use of MftH264Decoder.
6 6
7 #include <cstdio> 7 #include <cstdio>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 virtual void OnInitializeComplete(const VideoCodecInfo& info) { 141 virtual void OnInitializeComplete(const VideoCodecInfo& info) {
142 info_ = info; 142 info_ = info;
143 } 143 }
144 virtual void OnUninitializeComplete() { 144 virtual void OnUninitializeComplete() {
145 } 145 }
146 virtual void OnFlushComplete() { 146 virtual void OnFlushComplete() {
147 } 147 }
148 virtual void OnSeekComplete() {} 148 virtual void OnSeekComplete() {}
149 virtual void OnError() {} 149 virtual void OnError() {}
150 virtual void OnFormatChange(VideoStreamInfo stream_info) { 150 virtual void OnFormatChange(VideoStreamInfo stream_info) {
151 info_.stream_info_ = stream_info; 151 info_.stream_info = stream_info;
152 } 152 }
153 virtual void ProduceVideoSample(scoped_refptr<Buffer> buffer) { 153 virtual void ProduceVideoSample(scoped_refptr<Buffer> buffer) {
154 if (reader_ && decoder_) { 154 if (reader_ && decoder_) {
155 scoped_refptr<DataBuffer> input; 155 scoped_refptr<DataBuffer> input;
156 reader_->Read(&input); 156 reader_->Read(&input);
157 if (!input->IsEndOfStream()) 157 if (!input->IsEndOfStream())
158 frames_read_++; 158 frames_read_++;
159 decoder_->ConsumeVideoSample(input); 159 decoder_->ConsumeVideoSample(input);
160 } 160 }
161 } 161 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 scoped_ptr<FFmpegFileReader> reader(new FFmpegFileReader(input_file)); 277 scoped_ptr<FFmpegFileReader> reader(new FFmpegFileReader(input_file));
278 if (reader.get() == NULL || !reader->Initialize()) { 278 if (reader.get() == NULL || !reader->Initialize()) {
279 LOG(ERROR) << "Failed to create/initialize reader"; 279 LOG(ERROR) << "Failed to create/initialize reader";
280 return -1; 280 return -1;
281 } 281 }
282 int width = 0, height = 0; 282 int width = 0, height = 0;
283 if (!reader->GetWidth(&width) || !reader->GetHeight(&height)) { 283 if (!reader->GetWidth(&width) || !reader->GetHeight(&height)) {
284 LOG(WARNING) << "Failed to get width/height from reader"; 284 LOG(WARNING) << "Failed to get width/height from reader";
285 } 285 }
286 VideoCodecConfig config; 286 VideoCodecConfig config;
287 config.width_ = width; 287 config.width = width;
288 config.height_ = height; 288 config.height = height;
289 HWND window = NULL; 289 HWND window = NULL;
290 if (render) { 290 if (render) {
291 window = CreateDrawWindow(width, height); 291 window = CreateDrawWindow(width, height);
292 if (window == NULL) { 292 if (window == NULL) {
293 LOG(ERROR) << "Failed to create window"; 293 LOG(ERROR) << "Failed to create window";
294 return -1; 294 return -1;
295 } 295 }
296 } 296 }
297 297
298 scoped_ptr<MftH264Decoder> mft(new MftH264Decoder(use_dxva)); 298 scoped_ptr<MftH264Decoder> mft(new MftH264Decoder(use_dxva));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 362
363 if (!InitFFmpeg()) { 363 if (!InitFFmpeg()) {
364 LOG(ERROR) << "InitFFMpeg() failed"; 364 LOG(ERROR) << "InitFFMpeg() failed";
365 return -1; 365 return -1;
366 } 366 }
367 int ret = Run(use_dxva, render, input_file); 367 int ret = Run(use_dxva, render, input_file);
368 368
369 printf("Done\n"); 369 printf("Done\n");
370 return ret; 370 return ret;
371 } 371 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698