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

Side by Side Diff: services/media/framework_ffmpeg/av_codec_context.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: 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "services/media/framework_ffmpeg/ffmpeg_type_converters.h" 6 #include "services/media/framework_ffmpeg/av_codec_context.h"
7 extern "C" { 7 extern "C" {
8 #include "third_party/ffmpeg/libavformat/avformat.h" 8 #include "third_party/ffmpeg/libavformat/avformat.h"
9 } 9 }
10 10
11 // Ffmeg defines this...undefine. 11 // Ffmeg defines this...undefine.
12 #undef PixelFormat 12 #undef PixelFormat
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace media { 15 namespace media {
16 16
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 327
328 if (stream_type.encoding_details()) { 328 if (stream_type.encoding_details()) {
329 ExtraDataFromBytes(*stream_type.encoding_details(), context); 329 ExtraDataFromBytes(*stream_type.encoding_details(), context);
330 } 330 }
331 331
332 return context; 332 return context;
333 } 333 }
334 334
335 } // namespace 335 } // namespace
336 336
337 std::unique_ptr<StreamType> StreamTypeFromAVCodecContext( 337 // static
338 std::unique_ptr<StreamType> AvCodecContext::GetStreamType(
338 const AVCodecContext& from) { 339 const AVCodecContext& from) {
339 switch (from.codec_type) { 340 switch (from.codec_type) {
340 case AVMEDIA_TYPE_AUDIO: 341 case AVMEDIA_TYPE_AUDIO:
341 switch (from.codec_id) { 342 switch (from.codec_id) {
342 case CODEC_ID_PCM_S16BE: 343 case CODEC_ID_PCM_S16BE:
343 case CODEC_ID_PCM_S16LE: 344 case CODEC_ID_PCM_S16LE:
344 case CODEC_ID_PCM_S24BE: 345 case CODEC_ID_PCM_S24BE:
345 case CODEC_ID_PCM_S24LE: 346 case CODEC_ID_PCM_S24LE:
346 case CODEC_ID_PCM_U8: 347 case CODEC_ID_PCM_U8:
347 return StreamTypeFromLpcmCodecContext(from); 348 return StreamTypeFromLpcmCodecContext(from);
(...skipping 12 matching lines...) Expand all
360 return StreamTypeFromDataCodecContext(from); 361 return StreamTypeFromDataCodecContext(from);
361 case AVMEDIA_TYPE_SUBTITLE: 362 case AVMEDIA_TYPE_SUBTITLE:
362 return StreamTypeFromSubtitleCodecContext(from); 363 return StreamTypeFromSubtitleCodecContext(from);
363 case AVMEDIA_TYPE_ATTACHMENT: 364 case AVMEDIA_TYPE_ATTACHMENT:
364 case AVMEDIA_TYPE_NB: 365 case AVMEDIA_TYPE_NB:
365 default: 366 default:
366 return StreamType::Create(StreamType::Scheme::kUnknown); 367 return StreamType::Create(StreamType::Scheme::kUnknown);
367 } 368 }
368 } 369 }
369 370
370 AvCodecContextPtr AVCodecContextFromStreamType(const StreamType& stream_type) { 371 // static
372 AvCodecContextPtr AvCodecContext::Create(const StreamType& stream_type) {
371 switch (stream_type.scheme()) { 373 switch (stream_type.scheme()) {
372 case StreamType::Scheme::kLpcm: 374 case StreamType::Scheme::kLpcm:
373 return CodecContextFromLpcmDetails(*stream_type.lpcm()); 375 return CodecContextFromLpcmDetails(*stream_type.lpcm());
374 case StreamType::Scheme::kCompressedAudio: 376 case StreamType::Scheme::kCompressedAudio:
375 return AVCodecContextFromCompressedAudioStreamType( 377 return AVCodecContextFromCompressedAudioStreamType(
376 *stream_type.compressed_audio()); 378 *stream_type.compressed_audio());
377 case StreamType::Scheme::kVideo: 379 case StreamType::Scheme::kVideo:
378 return AVCodecContextFromVideoStreamType(*stream_type.video()); 380 return AVCodecContextFromVideoStreamType(*stream_type.video());
379 default: 381 default:
380 return nullptr; 382 return nullptr;
381 } 383 }
382 } 384 }
383 385
384 } // namespace media 386 } // namespace media
385 } // namespace mojo 387 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698