| 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 "services/media/framework_ffmpeg/av_codec_context.h" |
| 5 #include "services/media/framework_ffmpeg/ffmpeg_audio_decoder.h" | 6 #include "services/media/framework_ffmpeg/ffmpeg_audio_decoder.h" |
| 6 #include "services/media/framework_ffmpeg/ffmpeg_decoder.h" | 7 #include "services/media/framework_ffmpeg/ffmpeg_decoder.h" |
| 7 #include "services/media/framework_ffmpeg/ffmpeg_type_converters.h" | |
| 8 #include "services/media/framework_ffmpeg/ffmpeg_video_decoder.h" | 8 #include "services/media/framework_ffmpeg/ffmpeg_video_decoder.h" |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| 11 namespace media { | 11 namespace media { |
| 12 | 12 |
| 13 Result FfmpegDecoder::Create( | 13 Result FfmpegDecoder::Create( |
| 14 const StreamType& stream_type, | 14 const StreamType& stream_type, |
| 15 std::shared_ptr<Decoder>* decoder_out) { | 15 std::shared_ptr<Decoder>* decoder_out) { |
| 16 DCHECK(decoder_out); | 16 DCHECK(decoder_out); |
| 17 | 17 |
| 18 AvCodecContextPtr av_codec_context(AVCodecContextFromStreamType(stream_type)); | 18 AvCodecContextPtr av_codec_context(AvCodecContext::Create(stream_type)); |
| 19 if (!av_codec_context) { | 19 if (!av_codec_context) { |
| 20 return Result::kUnsupportedOperation; | 20 return Result::kUnsupportedOperation; |
| 21 } | 21 } |
| 22 | 22 |
| 23 AVCodec* ffmpeg_decoder = avcodec_find_decoder(av_codec_context->codec_id); | 23 AVCodec* ffmpeg_decoder = avcodec_find_decoder(av_codec_context->codec_id); |
| 24 if (ffmpeg_decoder == nullptr) { | 24 if (ffmpeg_decoder == nullptr) { |
| 25 return Result::kUnsupportedOperation; | 25 return Result::kUnsupportedOperation; |
| 26 } | 26 } |
| 27 | 27 |
| 28 int r = avcodec_open2(av_codec_context.get(), ffmpeg_decoder, nullptr); | 28 int r = avcodec_open2(av_codec_context.get(), ffmpeg_decoder, nullptr); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 41 break; | 41 break; |
| 42 default: | 42 default: |
| 43 return Result::kUnsupportedOperation; | 43 return Result::kUnsupportedOperation; |
| 44 } | 44 } |
| 45 | 45 |
| 46 return Result::kOk; | 46 return Result::kOk; |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace media | 49 } // namespace media |
| 50 } // namespace mojo | 50 } // namespace mojo |
| OLD | NEW |