| 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 | 9 |
| 10 // Used for FFmpeg error codes. | 10 // Used for FFmpeg error codes. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include <libavutil/imgutils.h> | 45 #include <libavutil/imgutils.h> |
| 46 #include <libavutil/log.h> | 46 #include <libavutil/log.h> |
| 47 #include <libavutil/mathematics.h> | 47 #include <libavutil/mathematics.h> |
| 48 #include <libavutil/opt.h> | 48 #include <libavutil/opt.h> |
| 49 MSVC_POP_WARNING(); | 49 MSVC_POP_WARNING(); |
| 50 } // extern "C" | 50 } // extern "C" |
| 51 | 51 |
| 52 namespace media { | 52 namespace media { |
| 53 | 53 |
| 54 class AudioDecoderConfig; | 54 class AudioDecoderConfig; |
| 55 class EncryptionScheme; |
| 55 class VideoDecoderConfig; | 56 class VideoDecoderConfig; |
| 56 | 57 |
| 57 // The following implement the deleters declared in ffmpeg_deleters.h (which | 58 // The following implement the deleters declared in ffmpeg_deleters.h (which |
| 58 // contains the declarations needed for use with |scoped_ptr| without #include | 59 // contains the declarations needed for use with |scoped_ptr| without #include |
| 59 // "pollution"). | 60 // "pollution"). |
| 60 | 61 |
| 61 inline void ScopedPtrAVFree::operator()(void* x) const { | 62 inline void ScopedPtrAVFree::operator()(void* x) const { |
| 62 av_free(x); | 63 av_free(x); |
| 63 } | 64 } |
| 64 | 65 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 VideoDecoderConfig* config); | 107 VideoDecoderConfig* config); |
| 107 void VideoDecoderConfigToAVCodecContext( | 108 void VideoDecoderConfigToAVCodecContext( |
| 108 const VideoDecoderConfig& config, | 109 const VideoDecoderConfig& config, |
| 109 AVCodecContext* codec_context); | 110 AVCodecContext* codec_context); |
| 110 | 111 |
| 111 // Returns true if AVCodecContext is successfully converted to an | 112 // Returns true if AVCodecContext is successfully converted to an |
| 112 // AudioDecoderConfig. Returns false if conversion fails, in which case |config| | 113 // AudioDecoderConfig. Returns false if conversion fails, in which case |config| |
| 113 // is not modified. | 114 // is not modified. |
| 114 MEDIA_EXPORT bool AVCodecContextToAudioDecoderConfig( | 115 MEDIA_EXPORT bool AVCodecContextToAudioDecoderConfig( |
| 115 const AVCodecContext* codec_context, | 116 const AVCodecContext* codec_context, |
| 116 bool is_encrypted, | 117 const EncryptionScheme& encryption_scheme, |
| 117 AudioDecoderConfig* config); | 118 AudioDecoderConfig* config); |
| 118 | 119 |
| 119 // Converts FFmpeg's channel layout to chrome's ChannelLayout. |channels| can | 120 // Converts FFmpeg's channel layout to chrome's ChannelLayout. |channels| can |
| 120 // be used when FFmpeg's channel layout is not informative in order to make a | 121 // be used when FFmpeg's channel layout is not informative in order to make a |
| 121 // good guess about the plausible channel layout based on number of channels. | 122 // good guess about the plausible channel layout based on number of channels. |
| 122 MEDIA_EXPORT ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, | 123 MEDIA_EXPORT ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, |
| 123 int channels); | 124 int channels); |
| 124 | 125 |
| 125 MEDIA_EXPORT AVCodecID AudioCodecToCodecID(AudioCodec audio_codec, | 126 MEDIA_EXPORT AVCodecID AudioCodecToCodecID(AudioCodec audio_codec, |
| 126 SampleFormat sample_format); | 127 SampleFormat sample_format); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 145 // date string. Otherwise returns fals and timeline_offset is unmodified. | 146 // date string. Otherwise returns fals and timeline_offset is unmodified. |
| 146 MEDIA_EXPORT bool FFmpegUTCDateToTime(const char* date_utc, base::Time* out); | 147 MEDIA_EXPORT bool FFmpegUTCDateToTime(const char* date_utc, base::Time* out); |
| 147 | 148 |
| 148 // Returns a 32-bit hash for the given codec name. See the VerifyUmaCodecHashes | 149 // Returns a 32-bit hash for the given codec name. See the VerifyUmaCodecHashes |
| 149 // unit test for more information and code for generating the histogram XML. | 150 // unit test for more information and code for generating the histogram XML. |
| 150 MEDIA_EXPORT int32_t HashCodecName(const char* codec_name); | 151 MEDIA_EXPORT int32_t HashCodecName(const char* codec_name); |
| 151 | 152 |
| 152 } // namespace media | 153 } // namespace media |
| 153 | 154 |
| 154 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ | 155 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ |
| OLD | NEW |