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/av_codec_context.h" |
6 #include "services/media/framework_ffmpeg/ffmpeg_audio_decoder.h" | 6 #include "services/media/framework_ffmpeg/ffmpeg_audio_decoder.h" |
7 #include "services/media/framework_ffmpeg/ffmpeg_decoder.h" | 7 #include "services/media/framework_ffmpeg/ffmpeg_decoder.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(const StreamType& stream_type, |
14 const StreamType& stream_type, | 14 std::shared_ptr<Decoder>* decoder_out) { |
15 std::shared_ptr<Decoder>* decoder_out) { | |
16 DCHECK(decoder_out); | 15 DCHECK(decoder_out); |
17 | 16 |
18 AvCodecContextPtr av_codec_context(AvCodecContext::Create(stream_type)); | 17 AvCodecContextPtr av_codec_context(AvCodecContext::Create(stream_type)); |
19 if (!av_codec_context) { | 18 if (!av_codec_context) { |
20 return Result::kUnsupportedOperation; | 19 return Result::kUnsupportedOperation; |
21 } | 20 } |
22 | 21 |
23 AVCodec* ffmpeg_decoder = avcodec_find_decoder(av_codec_context->codec_id); | 22 AVCodec* ffmpeg_decoder = avcodec_find_decoder(av_codec_context->codec_id); |
24 if (ffmpeg_decoder == nullptr) { | 23 if (ffmpeg_decoder == nullptr) { |
25 return Result::kUnsupportedOperation; | 24 return Result::kUnsupportedOperation; |
(...skipping 13 matching lines...) Expand all Loading... |
39 *decoder_out = std::shared_ptr<Decoder>( | 38 *decoder_out = std::shared_ptr<Decoder>( |
40 new FfmpegVideoDecoder(std::move(av_codec_context))); | 39 new FfmpegVideoDecoder(std::move(av_codec_context))); |
41 break; | 40 break; |
42 default: | 41 default: |
43 return Result::kUnsupportedOperation; | 42 return Result::kUnsupportedOperation; |
44 } | 43 } |
45 | 44 |
46 return Result::kOk; | 45 return Result::kOk; |
47 } | 46 } |
48 | 47 |
49 } // namespace media | 48 } // namespace media |
50 } // namespace mojo | 49 } // namespace mojo |
OLD | NEW |