OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chromecast/media/cma/backend/alsa/video_decoder_alsa.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/location.h" |
| 9 #include "base/logging.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "chromecast/public/media/cast_decoder_buffer.h" |
| 12 |
| 13 namespace chromecast { |
| 14 namespace media { |
| 15 |
| 16 VideoDecoderAlsa::VideoDecoderAlsa() |
| 17 : delegate_(nullptr), weak_factory_(this) {} |
| 18 |
| 19 VideoDecoderAlsa::~VideoDecoderAlsa() {} |
| 20 |
| 21 void VideoDecoderAlsa::SetDelegate(Delegate* delegate) { |
| 22 DCHECK(delegate); |
| 23 delegate_ = delegate; |
| 24 } |
| 25 |
| 26 MediaPipelineBackend::BufferStatus VideoDecoderAlsa::PushBuffer( |
| 27 CastDecoderBuffer* buffer) { |
| 28 DCHECK(delegate_); |
| 29 DCHECK(buffer); |
| 30 if (buffer->end_of_stream()) { |
| 31 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 32 FROM_HERE, base::Bind(&VideoDecoderAlsa::OnEndOfStream, |
| 33 weak_factory_.GetWeakPtr())); |
| 34 } |
| 35 return MediaPipelineBackend::kBufferSuccess; |
| 36 } |
| 37 |
| 38 void VideoDecoderAlsa::GetStatistics(Statistics* statistics) {} |
| 39 |
| 40 bool VideoDecoderAlsa::SetConfig(const VideoConfig& config) { |
| 41 return true; |
| 42 } |
| 43 |
| 44 void VideoDecoderAlsa::OnEndOfStream() { |
| 45 delegate_->OnEndOfStream(); |
| 46 } |
| 47 |
| 48 } // namespace media |
| 49 } // namespace chromecast |
OLD | NEW |