OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/filters/vpx_video_decoder.h" | 5 #include "media/filters/vpx_video_decoder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 return context; | 117 return context; |
118 } | 118 } |
119 | 119 |
120 bool VpxVideoDecoder::ConfigureDecoder() { | 120 bool VpxVideoDecoder::ConfigureDecoder() { |
121 const VideoDecoderConfig& config = demuxer_stream_->video_decoder_config(); | 121 const VideoDecoderConfig& config = demuxer_stream_->video_decoder_config(); |
122 DCHECK(config.IsValidConfig()); | 122 DCHECK(config.IsValidConfig()); |
123 | 123 |
124 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 124 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
125 bool can_handle = false; | 125 bool can_handle = false; |
126 if (cmd_line->HasSwitch(switches::kEnableVp9Playback) && | 126 if (config.codec() == kCodecVP9) |
127 config.codec() == kCodecVP9) { | |
128 can_handle = true; | 127 can_handle = true; |
129 } | |
130 if (cmd_line->HasSwitch(switches::kEnableVp8AlphaPlayback) && | 128 if (cmd_line->HasSwitch(switches::kEnableVp8AlphaPlayback) && |
131 config.codec() == kCodecVP8 && config.format() == VideoFrame::YV12A) { | 129 config.codec() == kCodecVP8 && config.format() == VideoFrame::YV12A) { |
132 can_handle = true; | 130 can_handle = true; |
133 } | 131 } |
134 if (!can_handle) | 132 if (!can_handle) |
135 return false; | 133 return false; |
136 | 134 |
137 CloseDecoder(); | 135 CloseDecoder(); |
138 | 136 |
139 vpx_codec_ = InitializeVpxContext(vpx_codec_, config); | 137 vpx_codec_ = InitializeVpxContext(vpx_codec_, config); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); | 409 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); |
412 return; | 410 return; |
413 } | 411 } |
414 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], | 412 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], |
415 vpx_image->stride[VPX_PLANE_Y], | 413 vpx_image->stride[VPX_PLANE_Y], |
416 vpx_image->d_h, | 414 vpx_image->d_h, |
417 video_frame->get()); | 415 video_frame->get()); |
418 } | 416 } |
419 | 417 |
420 } // namespace media | 418 } // namespace media |
OLD | NEW |