| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 delete context; | 285 delete context; |
| 286 return NULL; | 286 return NULL; |
| 287 } | 287 } |
| 288 return context; | 288 return context; |
| 289 } | 289 } |
| 290 | 290 |
| 291 bool VpxVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config) { | 291 bool VpxVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config) { |
| 292 if (config.codec() != kCodecVP8 && config.codec() != kCodecVP9) | 292 if (config.codec() != kCodecVP8 && config.codec() != kCodecVP9) |
| 293 return false; | 293 return false; |
| 294 | 294 |
| 295 // In VP8 videos, only those with alpha are handled by VpxVideoDecoder. All | 295 #if !defined(DISABLE_FFMPEG_VIDEO_DECODERS) |
| 296 // other VP8 videos go to FFmpegVideoDecoder. | 296 // When FFmpegVideoDecoder is available it handles VP8 that doesn't have |
| 297 // alpha, and VpxVideoDecoder will handle VP8 with alpha. |
| 297 if (config.codec() == kCodecVP8 && config.format() != PIXEL_FORMAT_YV12A) | 298 if (config.codec() == kCodecVP8 && config.format() != PIXEL_FORMAT_YV12A) |
| 298 return false; | 299 return false; |
| 300 #endif |
| 299 | 301 |
| 300 CloseDecoder(); | 302 CloseDecoder(); |
| 301 | 303 |
| 302 vpx_codec_ = InitializeVpxContext(vpx_codec_, config); | 304 vpx_codec_ = InitializeVpxContext(vpx_codec_, config); |
| 303 if (!vpx_codec_) | 305 if (!vpx_codec_) |
| 304 return false; | 306 return false; |
| 305 | 307 |
| 306 // We use our own buffers for VP9 so that there is no need to copy data after | 308 // We use our own buffers for VP9 so that there is no need to copy data after |
| 307 // decoding. | 309 // decoding. |
| 308 if (config.codec() == kCodecVP9) { | 310 if (config.codec() == kCodecVP9) { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); | 573 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); |
| 572 return; | 574 return; |
| 573 } | 575 } |
| 574 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], | 576 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], |
| 575 vpx_image_alpha->stride[VPX_PLANE_Y], | 577 vpx_image_alpha->stride[VPX_PLANE_Y], |
| 576 vpx_image_alpha->d_h, | 578 vpx_image_alpha->d_h, |
| 577 video_frame->get()); | 579 video_frame->get()); |
| 578 } | 580 } |
| 579 | 581 |
| 580 } // namespace media | 582 } // namespace media |
| OLD | NEW |