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