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

Side by Side Diff: media/base/mock_media_filters.h

Issue 42635: Lots of files touched for a very simple change. Everywhere we used a const M... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 9 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
« no previous file with comments | « media/base/filters.h ('k') | media/base/pipeline_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #ifndef MEDIA_BASE_MOCK_MEDIA_FILTERS_H_ 5 #ifndef MEDIA_BASE_MOCK_MEDIA_FILTERS_H_
6 #define MEDIA_BASE_MOCK_MEDIA_FILTERS_H_ 6 #define MEDIA_BASE_MOCK_MEDIA_FILTERS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/waitable_event.h" 10 #include "base/waitable_event.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 host_->Error(PIPELINE_ERROR_URL_NOT_FOUND); 117 host_->Error(PIPELINE_ERROR_URL_NOT_FOUND);
118 return false; 118 return false;
119 case MOCK_DATA_SOURCE_INIT_RETURN_FALSE: 119 case MOCK_DATA_SOURCE_INIT_RETURN_FALSE:
120 return false; 120 return false;
121 default: 121 default:
122 NOTREACHED(); 122 NOTREACHED();
123 return false; 123 return false;
124 } 124 }
125 } 125 }
126 126
127 virtual const MediaFormat* GetMediaFormat() { 127 virtual const MediaFormat& media_format() {
128 return &media_format_; 128 return media_format_;
129 } 129 }
130 130
131 virtual size_t Read(uint8* data, size_t size) { 131 virtual size_t Read(uint8* data, size_t size) {
132 size_t read = static_cast<size_t>(config_->media_total_bytes - position_); 132 size_t read = static_cast<size_t>(config_->media_total_bytes - position_);
133 if (size < read) { 133 if (size < read) {
134 read = size; 134 read = size;
135 } 135 }
136 memset(data, config_->data_source_value, read); 136 memset(data, config_->data_source_value, read);
137 return read; 137 return read;
138 } 138 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 config->compressed_audio_mime_type); 203 config->compressed_audio_mime_type);
204 } else { 204 } else {
205 media_format_.SetAsString(MediaFormat::kMimeType, 205 media_format_.SetAsString(MediaFormat::kMimeType,
206 config->compressed_video_mime_type); 206 config->compressed_video_mime_type);
207 media_format_.SetAsInteger(MediaFormat::kWidth, config->video_width); 207 media_format_.SetAsInteger(MediaFormat::kWidth, config->video_width);
208 media_format_.SetAsInteger(MediaFormat::kHeight, config->video_height); 208 media_format_.SetAsInteger(MediaFormat::kHeight, config->video_height);
209 } 209 }
210 } 210 }
211 211
212 // Implementation of DemuxerStream. 212 // Implementation of DemuxerStream.
213 virtual const MediaFormat* GetMediaFormat() { 213 virtual const MediaFormat& media_format() {
214 return &media_format_; 214 return media_format_;
215 } 215 }
216 216
217 virtual void Read(Assignable<Buffer>* buffer) { 217 virtual void Read(Assignable<Buffer>* buffer) {
218 NOTREACHED(); // TODO(ralphl): fix me!! 218 NOTREACHED(); // TODO(ralphl): fix me!!
219 } 219 }
220 220
221 private: 221 private:
222 virtual ~MockDemuxerStream() {} 222 virtual ~MockDemuxerStream() {}
223 223
224 MediaFormat media_format_; 224 MediaFormat media_format_;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 //------------------------------------------------------------------------------ 293 //------------------------------------------------------------------------------
294 294
295 class MockAudioDecoder : public AudioDecoder { 295 class MockAudioDecoder : public AudioDecoder {
296 public: 296 public:
297 static FilterFactory* CreateFactory(const MockFilterConfig* config) { 297 static FilterFactory* CreateFactory(const MockFilterConfig* config) {
298 return new FilterFactoryImpl1<MockAudioDecoder, 298 return new FilterFactoryImpl1<MockAudioDecoder,
299 const MockFilterConfig*>(config); 299 const MockFilterConfig*>(config);
300 } 300 }
301 301
302 static bool IsMediaFormatSupported(const MediaFormat* media_format) { 302 static bool IsMediaFormatSupported(const MediaFormat& media_format) {
303 return true; // TODO(ralphl): check for a supported format. 303 return true; // TODO(ralphl): check for a supported format.
304 } 304 }
305 305
306 explicit MockAudioDecoder(const MockFilterConfig* config) { 306 explicit MockAudioDecoder(const MockFilterConfig* config) {
307 media_format_.SetAsString(MediaFormat::kMimeType, 307 media_format_.SetAsString(MediaFormat::kMimeType,
308 config->uncompressed_audio_mime_type); 308 config->uncompressed_audio_mime_type);
309 } 309 }
310 310
311 // Implementation of MediaFilter. 311 // Implementation of MediaFilter.
312 virtual void Stop() {} 312 virtual void Stop() {}
313 313
314 // Implementation of AudioDecoder. 314 // Implementation of AudioDecoder.
315 virtual bool Initialize(DemuxerStream* stream) { 315 virtual bool Initialize(DemuxerStream* stream) {
316 host_->InitializationComplete(); 316 host_->InitializationComplete();
317 return true; 317 return true;
318 } 318 }
319 319
320 virtual const MediaFormat* GetMediaFormat() { 320 virtual const MediaFormat& media_format() {
321 return &media_format_; 321 return media_format_;
322 } 322 }
323 323
324 virtual void Read(Assignable<Buffer>* buffer) { 324 virtual void Read(Assignable<Buffer>* buffer) {
325 // TODO(ralphl): implement mock read. 325 // TODO(ralphl): implement mock read.
326 NOTREACHED(); 326 NOTREACHED();
327 } 327 }
328 328
329 private: 329 private:
330 virtual ~MockAudioDecoder() {} 330 virtual ~MockAudioDecoder() {}
331 331
332 MediaFormat media_format_; 332 MediaFormat media_format_;
333 333
334 DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder); 334 DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder);
335 }; 335 };
336 336
337 //------------------------------------------------------------------------------ 337 //------------------------------------------------------------------------------
338 338
339 class MockAudioRenderer : public AudioRenderer { 339 class MockAudioRenderer : public AudioRenderer {
340 public: 340 public:
341 static FilterFactory* CreateFactory(const MockFilterConfig* config) { 341 static FilterFactory* CreateFactory(const MockFilterConfig* config) {
342 return new FilterFactoryImpl1<MockAudioRenderer, 342 return new FilterFactoryImpl1<MockAudioRenderer,
343 const MockFilterConfig*>(config); 343 const MockFilterConfig*>(config);
344 } 344 }
345 345
346 static bool IsMediaFormatSupported(const MediaFormat* media_format) { 346 static bool IsMediaFormatSupported(const MediaFormat& media_format) {
347 return true; // TODO(ralphl): check for a supported format 347 return true; // TODO(ralphl): check for a supported format
348 } 348 }
349 349
350 explicit MockAudioRenderer(const MockFilterConfig* config) {} 350 explicit MockAudioRenderer(const MockFilterConfig* config) {}
351 351
352 // Implementation of MediaFilter. 352 // Implementation of MediaFilter.
353 virtual void Stop() {} 353 virtual void Stop() {}
354 354
355 // Implementation of AudioRenderer. 355 // Implementation of AudioRenderer.
356 virtual bool Initialize(AudioDecoder* decoder) { 356 virtual bool Initialize(AudioDecoder* decoder) {
(...skipping 11 matching lines...) Expand all
368 368
369 //------------------------------------------------------------------------------ 369 //------------------------------------------------------------------------------
370 370
371 class MockVideoDecoder : public VideoDecoder { 371 class MockVideoDecoder : public VideoDecoder {
372 public: 372 public:
373 static FilterFactory* CreateFactory(const MockFilterConfig* config) { 373 static FilterFactory* CreateFactory(const MockFilterConfig* config) {
374 return new FilterFactoryImpl1<MockVideoDecoder, 374 return new FilterFactoryImpl1<MockVideoDecoder,
375 const MockFilterConfig*>(config); 375 const MockFilterConfig*>(config);
376 } 376 }
377 377
378 static bool IsMediaFormatSupported(const MediaFormat* media_format) { 378 static bool IsMediaFormatSupported(const MediaFormat& media_format) {
379 return true; // TODO(ralphl): check for a supported format. 379 return true; // TODO(ralphl): check for a supported format.
380 } 380 }
381 381
382 // Helper function that initializes a YV12 frame with white and black scan 382 // Helper function that initializes a YV12 frame with white and black scan
383 // lines based on the |white_to_black| parameter. If 0, then the entire 383 // lines based on the |white_to_black| parameter. If 0, then the entire
384 // frame will be black, if 1 then the entire frame will be white. 384 // frame will be black, if 1 then the entire frame will be white.
385 static void InitializeYV12Frame(VideoFrame* frame, double white_to_black) { 385 static void InitializeYV12Frame(VideoFrame* frame, double white_to_black) {
386 VideoSurface surface; 386 VideoSurface surface;
387 if (!frame->Lock(&surface)) { 387 if (!frame->Lock(&surface)) {
388 ADD_FAILURE(); 388 ADD_FAILURE();
(...skipping 29 matching lines...) Expand all
418 418
419 // Implementation of MediaFilter. 419 // Implementation of MediaFilter.
420 virtual void Stop() {} 420 virtual void Stop() {}
421 421
422 // Implementation of VideoDecoder. 422 // Implementation of VideoDecoder.
423 virtual bool Initialize(DemuxerStream* stream) { 423 virtual bool Initialize(DemuxerStream* stream) {
424 host_->InitializationComplete(); 424 host_->InitializationComplete();
425 return true; 425 return true;
426 } 426 }
427 427
428 virtual const MediaFormat* GetMediaFormat() { 428 virtual const MediaFormat& media_format() {
429 return &media_format_; 429 return media_format_;
430 } 430 }
431 431
432 virtual void Read(Assignable<VideoFrame>* buffer) { 432 virtual void Read(Assignable<VideoFrame>* buffer) {
433 buffer->AddRef(); 433 buffer->AddRef();
434 host_->PostTask(NewRunnableMethod(this, &MockVideoDecoder::DoRead, buffer)); 434 host_->PostTask(NewRunnableMethod(this, &MockVideoDecoder::DoRead, buffer));
435 } 435 }
436 436
437 private: 437 private:
438 virtual ~MockVideoDecoder() {} 438 virtual ~MockVideoDecoder() {}
439 439
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 475
476 //------------------------------------------------------------------------------ 476 //------------------------------------------------------------------------------
477 477
478 class MockVideoRenderer : public VideoRenderer { 478 class MockVideoRenderer : public VideoRenderer {
479 public: 479 public:
480 static FilterFactory* CreateFactory(const MockFilterConfig* config) { 480 static FilterFactory* CreateFactory(const MockFilterConfig* config) {
481 return new FilterFactoryImpl1<MockVideoRenderer, 481 return new FilterFactoryImpl1<MockVideoRenderer,
482 const MockFilterConfig*>(config); 482 const MockFilterConfig*>(config);
483 } 483 }
484 484
485 static bool IsMediaFormatSupported(const MediaFormat* media_format) { 485 static bool IsMediaFormatSupported(const MediaFormat& media_format) {
486 return true; // TODO(ralphl): check for a supported format 486 return true; // TODO(ralphl): check for a supported format
487 } 487 }
488 488
489 explicit MockVideoRenderer(const MockFilterConfig* config) 489 explicit MockVideoRenderer(const MockFilterConfig* config)
490 : config_(config) { 490 : config_(config) {
491 } 491 }
492 492
493 // Implementation of MediaFilter. 493 // Implementation of MediaFilter.
494 virtual void Stop() {} 494 virtual void Stop() {}
495 495
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 base::WaitableEvent event_; 588 base::WaitableEvent event_;
589 bool callback_success_status_; 589 bool callback_success_status_;
590 bool waiting_for_callback_; 590 bool waiting_for_callback_;
591 591
592 DISALLOW_COPY_AND_ASSIGN(InitializationHelper); 592 DISALLOW_COPY_AND_ASSIGN(InitializationHelper);
593 }; 593 };
594 594
595 } // namespace media 595 } // namespace media
596 596
597 #endif // MEDIA_BASE_MOCK_MEDIA_FILTERS_H_ 597 #endif // MEDIA_BASE_MOCK_MEDIA_FILTERS_H_
OLDNEW
« no previous file with comments | « media/base/filters.h ('k') | media/base/pipeline_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698