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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 inline void ScopedPtrAVFreeContext::operator()(void* x) const { | 55 inline void ScopedPtrAVFreeContext::operator()(void* x) const { |
56 AVCodecContext* codec_context = static_cast<AVCodecContext*>(x); | 56 AVCodecContext* codec_context = static_cast<AVCodecContext*>(x); |
57 av_free(codec_context->extradata); | 57 av_free(codec_context->extradata); |
58 avcodec_close(codec_context); | 58 avcodec_close(codec_context); |
59 av_free(codec_context); | 59 av_free(codec_context); |
60 } | 60 } |
61 | 61 |
62 inline void ScopedPtrAVFreeFrame::operator()(void* x) const { | 62 inline void ScopedPtrAVFreeFrame::operator()(void* x) const { |
63 AVFrame* frame = static_cast<AVFrame*>(x); | 63 AVFrame* frame = static_cast<AVFrame*>(x); |
64 avcodec_free_frame(&frame); | 64 av_frame_free(&frame); |
65 } | 65 } |
66 | 66 |
67 // Converts an int64 timestamp in |time_base| units to a base::TimeDelta. | 67 // Converts an int64 timestamp in |time_base| units to a base::TimeDelta. |
68 // For example if |timestamp| equals 11025 and |time_base| equals {1, 44100} | 68 // For example if |timestamp| equals 11025 and |time_base| equals {1, 44100} |
69 // then the return value will be a base::TimeDelta for 0.25 seconds since that | 69 // then the return value will be a base::TimeDelta for 0.25 seconds since that |
70 // is how much time 11025/44100ths of a second represents. | 70 // is how much time 11025/44100ths of a second represents. |
71 MEDIA_EXPORT base::TimeDelta ConvertFromTimeBase(const AVRational& time_base, | 71 MEDIA_EXPORT base::TimeDelta ConvertFromTimeBase(const AVRational& time_base, |
72 int64 timestamp); | 72 int64 timestamp); |
73 | 73 |
74 // Converts a base::TimeDelta into an int64 timestamp in |time_base| units. | 74 // Converts a base::TimeDelta into an int64 timestamp in |time_base| units. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 PixelFormat VideoFormatToPixelFormat(VideoFrame::Format video_format); | 118 PixelFormat VideoFormatToPixelFormat(VideoFrame::Format video_format); |
119 | 119 |
120 // Convert FFmpeg UTC representation (YYYY-MM-DD HH:MM:SS) to base::Time. | 120 // Convert FFmpeg UTC representation (YYYY-MM-DD HH:MM:SS) to base::Time. |
121 // Returns true and sets |*out| if |date_utc| contains a valid | 121 // Returns true and sets |*out| if |date_utc| contains a valid |
122 // date string. Otherwise returns fals and timeline_offset is unmodified. | 122 // date string. Otherwise returns fals and timeline_offset is unmodified. |
123 MEDIA_EXPORT bool FFmpegUTCDateToTime(const char* date_utc, base::Time* out); | 123 MEDIA_EXPORT bool FFmpegUTCDateToTime(const char* date_utc, base::Time* out); |
124 | 124 |
125 } // namespace media | 125 } // namespace media |
126 | 126 |
127 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ | 127 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ |
OLD | NEW |