OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 MEDIA_FFMPEG_FFMPEG_COMMON_H_ | 5 #ifndef MEDIA_FFMPEG_FFMPEG_COMMON_H_ |
6 #define MEDIA_FFMPEG_FFMPEG_COMMON_H_ | 6 #define MEDIA_FFMPEG_FFMPEG_COMMON_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 // Used for FFmpeg error codes. | 11 // Used for FFmpeg error codes. |
12 #include <cerrno> | 12 #include <cerrno> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "media/base/audio_codecs.h" | 16 #include "media/base/audio_codecs.h" |
17 #include "media/base/channel_layout.h" | 17 #include "media/base/channel_layout.h" |
18 #include "media/base/media_export.h" | 18 #include "media/base/media_export.h" |
19 #include "media/base/sample_format.h" | 19 #include "media/base/sample_format.h" |
20 #include "media/base/video_codecs.h" | 20 #include "media/base/video_codecs.h" |
21 #include "media/base/video_frame.h" | 21 #include "media/base/video_frame.h" |
22 #include "media/ffmpeg/ffmpeg_deleters.h" | 22 #include "media/ffmpeg/ffmpeg_deleters.h" |
| 23 #include "third_party/ffmpeg/ffmpeg_features.h" |
23 | 24 |
24 // Include FFmpeg header files. | 25 // Include FFmpeg header files. |
25 extern "C" { | 26 extern "C" { |
26 #if !defined(USE_SYSTEM_FFMPEG) | 27 #if !BUILDFLAG(USE_SYSTEM_FFMPEG) |
27 // Disable deprecated features which result in spammy compile warnings. This | 28 // Disable deprecated features which result in spammy compile warnings. This |
28 // list of defines must mirror those in the 'defines' section of FFmpeg's | 29 // list of defines must mirror those in the 'defines' section of FFmpeg's |
29 // BUILD.gn file or the headers below will generate different structures! | 30 // BUILD.gn file or the headers below will generate different structures! |
30 #define FF_API_CONVERGENCE_DURATION 0 | 31 #define FF_API_CONVERGENCE_DURATION 0 |
31 #endif // !defined(USE_SYSTEM_FFMPEG) | 32 #endif // !BUILDFLAG(USE_SYSTEM_FFMPEG) |
32 // Upstream libavcodec/utils.c still uses the deprecated | 33 // Upstream libavcodec/utils.c still uses the deprecated |
33 // av_dup_packet(), causing deprecation warnings. | 34 // av_dup_packet(), causing deprecation warnings. |
34 // The normal fix for such things is to disable the feature as below, | 35 // The normal fix for such things is to disable the feature as below, |
35 // but the upstream code does not yet compile with it disabled. | 36 // but the upstream code does not yet compile with it disabled. |
36 // (In this case, the fix is replacing the call with a new function.) | 37 // (In this case, the fix is replacing the call with a new function.) |
37 // In the meantime, we directly disable those warnings in the C file. | 38 // In the meantime, we directly disable those warnings in the C file. |
38 //#define FF_API_AVPACKET_OLD_API 0 | 39 //#define FF_API_AVPACKET_OLD_API 0 |
39 | 40 |
40 // Temporarily disable possible loss of data warning. | 41 // Temporarily disable possible loss of data warning. |
41 // TODO(scherkus): fix and upstream the compiler warnings. | 42 // TODO(scherkus): fix and upstream the compiler warnings. |
42 MSVC_PUSH_DISABLE_WARNING(4244); | 43 MSVC_PUSH_DISABLE_WARNING(4244); |
43 #include <libavcodec/avcodec.h> | 44 #include <libavcodec/avcodec.h> |
44 #include <libavformat/avformat.h> | 45 #include <libavformat/avformat.h> |
45 #if !defined(USE_SYSTEM_FFMPEG) | 46 #if !BUILDFLAG(USE_SYSTEM_FFMPEG) |
46 #include <libavformat/internal.h> | 47 #include <libavformat/internal.h> |
47 #endif // !defined(USE_SYSTEM_FFMPEG) | 48 #endif // !BUILDFLAG(USE_SYSTEM_FFMPEG) |
48 #include <libavformat/avio.h> | 49 #include <libavformat/avio.h> |
49 #include <libavutil/avutil.h> | 50 #include <libavutil/avutil.h> |
50 #include <libavutil/imgutils.h> | 51 #include <libavutil/imgutils.h> |
51 #include <libavutil/log.h> | 52 #include <libavutil/log.h> |
52 #include <libavutil/mathematics.h> | 53 #include <libavutil/mathematics.h> |
53 #include <libavutil/opt.h> | 54 #include <libavutil/opt.h> |
54 MSVC_POP_WARNING(); | 55 MSVC_POP_WARNING(); |
55 } // extern "C" | 56 } // extern "C" |
56 | 57 |
57 namespace media { | 58 namespace media { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // Converts an AVERROR error number to a description. | 159 // Converts an AVERROR error number to a description. |
159 std::string AVErrorToString(int errnum); | 160 std::string AVErrorToString(int errnum); |
160 | 161 |
161 // Returns a 32-bit hash for the given codec name. See the VerifyUmaCodecHashes | 162 // Returns a 32-bit hash for the given codec name. See the VerifyUmaCodecHashes |
162 // unit test for more information and code for generating the histogram XML. | 163 // unit test for more information and code for generating the histogram XML. |
163 MEDIA_EXPORT int32_t HashCodecName(const char* codec_name); | 164 MEDIA_EXPORT int32_t HashCodecName(const char* codec_name); |
164 | 165 |
165 } // namespace media | 166 } // namespace media |
166 | 167 |
167 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ | 168 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ |
OLD | NEW |