OLD | NEW |
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 | 5 |
6 #ifndef MEDIA_FILTERS_TEST_VIDEO_DECODER_H_ | 6 #ifndef MEDIA_FILTERS_TEST_VIDEO_DECODER_H_ |
7 #define MEDIA_FILTERS_TEST_VIDEO_DECODER_H_ | 7 #define MEDIA_FILTERS_TEST_VIDEO_DECODER_H_ |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "media/base/buffers.h" | 11 #include "media/base/buffers.h" |
12 #include "media/base/factory.h" | 12 #include "media/base/factory.h" |
13 #include "media/base/filters.h" | 13 #include "media/base/filters.h" |
| 14 #include "media/base/mock_media_filters.h" |
14 #include "media/base/video_frame_impl.h" | 15 #include "media/base/video_frame_impl.h" |
15 #include "media/filters/decoder_base.h" | 16 #include "media/filters/decoder_base.h" |
16 | 17 |
17 namespace media { | 18 namespace media { |
18 | 19 |
19 class TestVideoDecoder : public DecoderBase<VideoDecoder, VideoFrame> { | 20 class TestVideoDecoder : public DecoderBase<VideoDecoder, VideoFrame> { |
20 public: | 21 public: |
21 TestVideoDecoder() | 22 TestVideoDecoder() |
22 : DecoderBase<VideoDecoder, VideoFrame>("VideoDecoderThread"), | 23 : DecoderBase<VideoDecoder, VideoFrame>("VideoDecoderThread"), |
23 video_width_(0), | 24 video_width_(0), |
(...skipping 21 matching lines...) Expand all Loading... |
45 | 46 |
46 void OnDecode(Buffer* buffer) { | 47 void OnDecode(Buffer* buffer) { |
47 scoped_refptr<VideoFrame> frame; | 48 scoped_refptr<VideoFrame> frame; |
48 VideoFrameImpl::CreateFrame(VideoSurface::YV12, | 49 VideoFrameImpl::CreateFrame(VideoSurface::YV12, |
49 video_width_, | 50 video_width_, |
50 video_height_, | 51 video_height_, |
51 buffer->GetTimestamp(), | 52 buffer->GetTimestamp(), |
52 buffer->GetDuration(), | 53 buffer->GetDuration(), |
53 &frame); | 54 &frame); |
54 if (frame) { | 55 if (frame) { |
55 MockVideoDecoder::InitializeYV12Frame(frame, 0.5f); | 56 old_mocks::MockVideoDecoder::InitializeYV12Frame(frame, 0.5f); |
56 EnqueueResult(frame); | 57 EnqueueResult(frame); |
57 } else { | 58 } else { |
58 host_->Error(PIPELINE_ERROR_OUT_OF_MEMORY); | 59 host_->Error(PIPELINE_ERROR_OUT_OF_MEMORY); |
59 } | 60 } |
60 } | 61 } |
61 | 62 |
62 static bool IsMediaFormatSupported(const MediaFormat& media_format) { | 63 static bool IsMediaFormatSupported(const MediaFormat& media_format) { |
63 std::string mime_type; | 64 std::string mime_type; |
64 return (media_format.GetAsString(MediaFormat::kMimeType, &mime_type) && | 65 return (media_format.GetAsString(MediaFormat::kMimeType, &mime_type) && |
65 mime_type == mime_type::kH264AnnexB); | 66 mime_type == mime_type::kH264AnnexB); |
66 } | 67 } |
67 | 68 |
68 private: | 69 private: |
69 friend class scoped_refptr<TestVideoDecoder>; | 70 friend class scoped_refptr<TestVideoDecoder>; |
70 virtual ~TestVideoDecoder() {} | 71 virtual ~TestVideoDecoder() {} |
71 | 72 |
72 size_t video_width_; | 73 size_t video_width_; |
73 size_t video_height_; | 74 size_t video_height_; |
74 | 75 |
75 DISALLOW_COPY_AND_ASSIGN(TestVideoDecoder); | 76 DISALLOW_COPY_AND_ASSIGN(TestVideoDecoder); |
76 }; | 77 }; |
77 | 78 |
78 } // namespace | 79 } // namespace |
79 | 80 |
80 #endif // MEDIA_FILTERS_TEST_VIDEO_DECODER_H_ | 81 #endif // MEDIA_FILTERS_TEST_VIDEO_DECODER_H_ |
OLD | NEW |