| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 // The FFmpeg API expects us to zero the data pointers in | 127 // The FFmpeg API expects us to zero the data pointers in |
| 128 // this callback | 128 // this callback |
| 129 memset(frame->data, 0, sizeof(frame->data)); | 129 memset(frame->data, 0, sizeof(frame->data)); |
| 130 frame->opaque = NULL; | 130 frame->opaque = NULL; |
| 131 } | 131 } |
| 132 | 132 |
| 133 void FFmpegVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream, | 133 void FFmpegVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream, |
| 134 const PipelineStatusCB& status_cb, | 134 const PipelineStatusCB& status_cb, |
| 135 const StatisticsCB& statistics_cb) { | 135 const StatisticsCB& statistics_cb) { |
| 136 // Ensure FFmpeg has been initialized | 136 FFmpegGlue::InitializeFFmpeg(); |
| 137 FFmpegGlue::GetInstance(); | |
| 138 | 137 |
| 139 if (!message_loop_) { | 138 if (!message_loop_) { |
| 140 message_loop_ = base::ResetAndReturn(&message_loop_factory_cb_).Run(); | 139 message_loop_ = base::ResetAndReturn(&message_loop_factory_cb_).Run(); |
| 141 message_loop_->PostTask(FROM_HERE, base::Bind( | 140 message_loop_->PostTask(FROM_HERE, base::Bind( |
| 142 &FFmpegVideoDecoder::Initialize, this, | 141 &FFmpegVideoDecoder::Initialize, this, |
| 143 stream, status_cb, statistics_cb)); | 142 stream, status_cb, statistics_cb)); |
| 144 return; | 143 return; |
| 145 } | 144 } |
| 146 | 145 |
| 147 DCHECK(message_loop_->BelongsToCurrentThread()); | 146 DCHECK(message_loop_->BelongsToCurrentThread()); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 return false; | 531 return false; |
| 533 | 532 |
| 534 if (avcodec_open2(codec_context_, codec, NULL) < 0) | 533 if (avcodec_open2(codec_context_, codec, NULL) < 0) |
| 535 return false; | 534 return false; |
| 536 | 535 |
| 537 av_frame_ = avcodec_alloc_frame(); | 536 av_frame_ = avcodec_alloc_frame(); |
| 538 return true; | 537 return true; |
| 539 } | 538 } |
| 540 | 539 |
| 541 } // namespace media | 540 } // namespace media |
| OLD | NEW |