Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: services/media/framework_ffmpeg/ffmpeg_decoder.cc

Issue 1814583002: Motown: New wrapper classes for ffmpeg format context and io context (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Tweaks based on feedback. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « services/media/framework_ffmpeg/av_io_context.cc ('k') | services/media/framework_ffmpeg/ffmpeg_decoder_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698