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

Side by Side Diff: services/media/framework_ffmpeg/av_codec_context.h

Issue 1923763002: Motown: Ffmpeg video decoder (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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 #ifndef SERVICES_MEDIA_FRAMEWORK_FFMPEG_AV_CODEC_CONTEXT_H_ 5 #ifndef SERVICES_MEDIA_FRAMEWORK_FFMPEG_AV_CODEC_CONTEXT_H_
6 #define SERVICES_MEDIA_FRAMEWORK_FFMPEG_AV_CODEC_CONTEXT_H_ 6 #define SERVICES_MEDIA_FRAMEWORK_FFMPEG_AV_CODEC_CONTEXT_H_
7 7
8 #include "services/media/framework/types/stream_type.h" 8 #include "services/media/framework/types/stream_type.h"
9 #include "services/media/framework/types/video_stream_type.h" 9 #include "services/media/framework/types/video_stream_type.h"
10 extern "C" { 10 extern "C" {
11 #include "third_party/ffmpeg/libavformat/avformat.h" 11 #include "third_party/ffmpeg/libavformat/avformat.h"
12 } 12 }
13 13
14 // Ffmeg defines this...undefine.
15 #undef PixelFormat
16
14 namespace mojo { 17 namespace mojo {
15 namespace media { 18 namespace media {
16 19
17 struct AVCodecContextDeleter { 20 struct AVCodecContextDeleter {
18 void operator()(AVCodecContext* context) const { 21 void operator()(AVCodecContext* context) const {
19 avcodec_free_context(&context); 22 avcodec_free_context(&context);
20 } 23 }
21 }; 24 };
22 25
23 using AvCodecContextPtr = 26 using AvCodecContextPtr =
24 std::unique_ptr<AVCodecContext, AVCodecContextDeleter>; 27 std::unique_ptr<AVCodecContext, AVCodecContextDeleter>;
25 28
26 struct AvCodecContext { 29 struct AvCodecContext {
27 static AvCodecContextPtr Create(const StreamType& stream_type); 30 static AvCodecContextPtr Create(const StreamType& stream_type);
28 31
29 static std::unique_ptr<StreamType> GetStreamType(const AVCodecContext& from); 32 static std::unique_ptr<StreamType> GetStreamType(const AVCodecContext& from);
30 }; 33 };
31 34
35 // Converts an AVPixelFormat to a PixelFormat.
36 VideoStreamType::PixelFormat PixelFormatFromAVPixelFormat(
37 AVPixelFormat av_pixel_format);
38
39 // Converts a PixelFormat to an AVPixelFormat.
40 AVPixelFormat AVPixelFormatFromPixelFormat(
41 VideoStreamType::PixelFormat pixel_format);
42
32 } // namespace media 43 } // namespace media
33 } // namespace mojo 44 } // namespace mojo
34 45
35 #endif // SERVICES_MEDIA_FRAMEWORK_FFMPEG_AV_CODEC_CONTEXT_H_ 46 #endif // SERVICES_MEDIA_FRAMEWORK_FFMPEG_AV_CODEC_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698