| 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/ffmpeg_video_decoder.h" | 5 #include "media/filters/ffmpeg_video_decoder.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 video_frame.swap(reinterpret_cast<VideoFrame**>(&opaque)); | 142 video_frame.swap(reinterpret_cast<VideoFrame**>(&opaque)); |
| 143 frame->buf[0] = | 143 frame->buf[0] = |
| 144 av_buffer_create(frame->data[0], | 144 av_buffer_create(frame->data[0], |
| 145 VideoFrame::AllocationSize(format, coded_size), | 145 VideoFrame::AllocationSize(format, coded_size), |
| 146 ReleaseVideoBufferImpl, | 146 ReleaseVideoBufferImpl, |
| 147 opaque, | 147 opaque, |
| 148 0); | 148 0); |
| 149 return 0; | 149 return 0; |
| 150 } | 150 } |
| 151 | 151 |
| 152 std::string FFmpegVideoDecoder::GetDisplayName() const { |
| 153 return "FFmpegVideoDecoder"; |
| 154 } |
| 155 |
| 152 void FFmpegVideoDecoder::Initialize(const VideoDecoderConfig& config, | 156 void FFmpegVideoDecoder::Initialize(const VideoDecoderConfig& config, |
| 153 bool low_delay, | 157 bool low_delay, |
| 154 const PipelineStatusCB& status_cb, | 158 const PipelineStatusCB& status_cb, |
| 155 const OutputCB& output_cb) { | 159 const OutputCB& output_cb) { |
| 156 DCHECK(task_runner_->BelongsToCurrentThread()); | 160 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 157 DCHECK(!config.is_encrypted()); | 161 DCHECK(!config.is_encrypted()); |
| 158 DCHECK(!output_cb.is_null()); | 162 DCHECK(!output_cb.is_null()); |
| 159 | 163 |
| 160 FFmpegGlue::InitializeFFmpeg(); | 164 FFmpegGlue::InitializeFFmpeg(); |
| 161 | 165 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { | 345 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { |
| 342 ReleaseFFmpegResources(); | 346 ReleaseFFmpegResources(); |
| 343 return false; | 347 return false; |
| 344 } | 348 } |
| 345 | 349 |
| 346 av_frame_.reset(av_frame_alloc()); | 350 av_frame_.reset(av_frame_alloc()); |
| 347 return true; | 351 return true; |
| 348 } | 352 } |
| 349 | 353 |
| 350 } // namespace media | 354 } // namespace media |
| OLD | NEW |