| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "services/media/framework_ffmpeg/av_codec_context.h" |
| 6 #include "services/media/framework_ffmpeg/ffmpeg_decoder_base.h" | 7 #include "services/media/framework_ffmpeg/ffmpeg_decoder_base.h" |
| 7 #include "services/media/framework_ffmpeg/ffmpeg_type_converters.h" | |
| 8 | 8 |
| 9 namespace mojo { | 9 namespace mojo { |
| 10 namespace media { | 10 namespace media { |
| 11 | 11 |
| 12 FfmpegDecoderBase::FfmpegDecoderBase(AvCodecContextPtr av_codec_context) : | 12 FfmpegDecoderBase::FfmpegDecoderBase(AvCodecContextPtr av_codec_context) : |
| 13 av_codec_context_(std::move(av_codec_context)), | 13 av_codec_context_(std::move(av_codec_context)), |
| 14 av_frame_ptr_(av_frame_alloc()) { | 14 av_frame_ptr_(av_frame_alloc()) { |
| 15 DCHECK(av_codec_context_); | 15 DCHECK(av_codec_context_); |
| 16 } | 16 } |
| 17 | 17 |
| 18 FfmpegDecoderBase::~FfmpegDecoderBase() {} | 18 FfmpegDecoderBase::~FfmpegDecoderBase() {} |
| 19 | 19 |
| 20 std::unique_ptr<StreamType> FfmpegDecoderBase::output_stream_type() { | 20 std::unique_ptr<StreamType> FfmpegDecoderBase::output_stream_type() { |
| 21 return StreamTypeFromAVCodecContext(*av_codec_context_); | 21 return AvCodecContext::GetStreamType(*av_codec_context_); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void FfmpegDecoderBase::Flush() { | 24 void FfmpegDecoderBase::Flush() { |
| 25 DCHECK(av_codec_context_); | 25 DCHECK(av_codec_context_); |
| 26 avcodec_flush_buffers(av_codec_context_.get()); | 26 avcodec_flush_buffers(av_codec_context_.get()); |
| 27 } | 27 } |
| 28 | 28 |
| 29 bool FfmpegDecoderBase::TransformPacket( | 29 bool FfmpegDecoderBase::TransformPacket( |
| 30 const PacketPtr& input, | 30 const PacketPtr& input, |
| 31 bool new_input, | 31 bool new_input, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 av_packet_.size = 0; | 92 av_packet_.size = 0; |
| 93 av_packet_.data = nullptr; | 93 av_packet_.data = nullptr; |
| 94 | 94 |
| 95 return true; | 95 return true; |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace media | 98 } // namespace media |
| 99 } // namespace mojo | 99 } // namespace mojo |
| OLD | NEW |