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 // Used for FFmpeg error codes. | 8 // Used for FFmpeg error codes. |
9 #include <cerrno> | 9 #include <cerrno> |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 inline void ScopedPtrAVFreeContext::operator()(void* x) const { | 68 inline void ScopedPtrAVFreeContext::operator()(void* x) const { |
69 AVCodecContext* codec_context = static_cast<AVCodecContext*>(x); | 69 AVCodecContext* codec_context = static_cast<AVCodecContext*>(x); |
70 avcodec_free_context(&codec_context); | 70 avcodec_free_context(&codec_context); |
71 } | 71 } |
72 | 72 |
73 inline void ScopedPtrAVFreeFrame::operator()(void* x) const { | 73 inline void ScopedPtrAVFreeFrame::operator()(void* x) const { |
74 AVFrame* frame = static_cast<AVFrame*>(x); | 74 AVFrame* frame = static_cast<AVFrame*>(x); |
75 av_frame_free(&frame); | 75 av_frame_free(&frame); |
76 } | 76 } |
77 | 77 |
78 // Converts an int64 timestamp in |time_base| units to a base::TimeDelta. | 78 // Converts an int64_t timestamp in |time_base| units to a base::TimeDelta. |
79 // For example if |timestamp| equals 11025 and |time_base| equals {1, 44100} | 79 // For example if |timestamp| equals 11025 and |time_base| equals {1, 44100} |
80 // then the return value will be a base::TimeDelta for 0.25 seconds since that | 80 // then the return value will be a base::TimeDelta for 0.25 seconds since that |
81 // is how much time 11025/44100ths of a second represents. | 81 // is how much time 11025/44100ths of a second represents. |
82 MEDIA_EXPORT base::TimeDelta ConvertFromTimeBase(const AVRational& time_base, | 82 MEDIA_EXPORT base::TimeDelta ConvertFromTimeBase(const AVRational& time_base, |
83 int64 timestamp); | 83 int64_t timestamp); |
84 | 84 |
85 // Converts a base::TimeDelta into an int64 timestamp in |time_base| units. | 85 // Converts a base::TimeDelta into an int64_t timestamp in |time_base| units. |
86 // For example if |timestamp| is 0.5 seconds and |time_base| is {1, 44100}, then | 86 // For example if |timestamp| is 0.5 seconds and |time_base| is {1, 44100}, then |
87 // the return value will be 22050 since that is how many 1/44100ths of a second | 87 // the return value will be 22050 since that is how many 1/44100ths of a second |
88 // represent 0.5 seconds. | 88 // represent 0.5 seconds. |
89 MEDIA_EXPORT int64 ConvertToTimeBase(const AVRational& time_base, | 89 MEDIA_EXPORT int64_t ConvertToTimeBase(const AVRational& time_base, |
90 const base::TimeDelta& timestamp); | 90 const base::TimeDelta& timestamp); |
91 | 91 |
92 // Returns true if AVStream is successfully converted to a AudioDecoderConfig. | 92 // Returns true if AVStream is successfully converted to a AudioDecoderConfig. |
93 // Returns false if conversion fails, in which case |config| is not modified. | 93 // Returns false if conversion fails, in which case |config| is not modified. |
94 MEDIA_EXPORT bool AVStreamToAudioDecoderConfig(const AVStream* stream, | 94 MEDIA_EXPORT bool AVStreamToAudioDecoderConfig(const AVStream* stream, |
95 AudioDecoderConfig* config); | 95 AudioDecoderConfig* config); |
96 void AudioDecoderConfigToAVCodecContext( | 96 void AudioDecoderConfigToAVCodecContext( |
97 const AudioDecoderConfig& config, | 97 const AudioDecoderConfig& config, |
98 AVCodecContext* codec_context); | 98 AVCodecContext* codec_context); |
99 | 99 |
100 // Returns true if AVStream is successfully converted to a VideoDecoderConfig. | 100 // Returns true if AVStream is successfully converted to a VideoDecoderConfig. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // date string. Otherwise returns fals and timeline_offset is unmodified. | 140 // date string. Otherwise returns fals and timeline_offset is unmodified. |
141 MEDIA_EXPORT bool FFmpegUTCDateToTime(const char* date_utc, base::Time* out); | 141 MEDIA_EXPORT bool FFmpegUTCDateToTime(const char* date_utc, base::Time* out); |
142 | 142 |
143 // Returns a 32-bit hash for the given codec name. See the VerifyUmaCodecHashes | 143 // Returns a 32-bit hash for the given codec name. See the VerifyUmaCodecHashes |
144 // unit test for more information and code for generating the histogram XML. | 144 // unit test for more information and code for generating the histogram XML. |
145 MEDIA_EXPORT int32_t HashCodecName(const char* codec_name); | 145 MEDIA_EXPORT int32_t HashCodecName(const char* codec_name); |
146 | 146 |
147 } // namespace media | 147 } // namespace media |
148 | 148 |
149 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ | 149 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ |
OLD | NEW |