OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 VideoCodec CodecIDToVideoCodec(CodecID codec_id); | 76 VideoCodec CodecIDToVideoCodec(CodecID codec_id); |
77 CodecID VideoCodecToCodecID(VideoCodec video_codec); | 77 CodecID VideoCodecToCodecID(VideoCodec video_codec); |
78 | 78 |
79 // Converts FFmpeg's channel layout to chrome's ChannelLayout. |channels| can | 79 // Converts FFmpeg's channel layout to chrome's ChannelLayout. |channels| can |
80 // be used when FFmpeg's channel layout is not informative in order to make a | 80 // be used when FFmpeg's channel layout is not informative in order to make a |
81 // good guess about the plausible channel layout based on number of channels. | 81 // good guess about the plausible channel layout based on number of channels. |
82 ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, | 82 ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, |
83 int channels); | 83 int channels); |
84 | 84 |
| 85 // Converts FFmpeg's pixel formats to its corresponding supported video format. |
| 86 VideoFrame::Format PixelFormatToVideoFormat(PixelFormat pixel_format); |
| 87 |
| 88 // Converts video formats to its corresponding FFmpeg's pixel formats. |
| 89 PixelFormat VideoFormatToPixelFormat(VideoFrame::Format video_format); |
| 90 |
85 // Calculates duration of one frame in the |stream| based on its frame rate. | 91 // Calculates duration of one frame in the |stream| based on its frame rate. |
86 base::TimeDelta GetFrameDuration(AVStream* stream); | 92 base::TimeDelta GetFrameDuration(AVStream* stream); |
87 | 93 |
88 // Get the timestamp of the next seek point after |timestamp|. | 94 // Get the timestamp of the next seek point after |timestamp|. |
89 // Returns true if a valid seek point was found after |timestamp| and | 95 // Returns true if a valid seek point was found after |timestamp| and |
90 // |seek_time| was set. Returns false if a seek point could not be | 96 // |seek_time| was set. Returns false if a seek point could not be |
91 // found or the parameters are invalid. | 97 // found or the parameters are invalid. |
92 MEDIA_EXPORT bool GetSeekTimeAfter(AVStream* stream, | 98 MEDIA_EXPORT bool GetSeekTimeAfter(AVStream* stream, |
93 const base::TimeDelta& timestamp, | 99 const base::TimeDelta& timestamp, |
94 base::TimeDelta* seek_time); | 100 base::TimeDelta* seek_time); |
(...skipping 23 matching lines...) Expand all Loading... |
118 int GetNaturalHeight(AVStream* stream); | 124 int GetNaturalHeight(AVStream* stream); |
119 int GetNaturalWidth(AVStream* stream); | 125 int GetNaturalWidth(AVStream* stream); |
120 | 126 |
121 // Closes & destroys all AVStreams in the context and then closes & | 127 // Closes & destroys all AVStreams in the context and then closes & |
122 // destroys the AVFormatContext. | 128 // destroys the AVFormatContext. |
123 void DestroyAVFormatContext(AVFormatContext* format_context); | 129 void DestroyAVFormatContext(AVFormatContext* format_context); |
124 | 130 |
125 } // namespace media | 131 } // namespace media |
126 | 132 |
127 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ | 133 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ |
OLD | NEW |