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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 MEDIA_EXPORT int64 ConvertToTimeBase(const AVRational& time_base, | 67 MEDIA_EXPORT int64 ConvertToTimeBase(const AVRational& time_base, |
68 const base::TimeDelta& timestamp); | 68 const base::TimeDelta& timestamp); |
69 | 69 |
70 void AVCodecContextToAudioDecoderConfig( | 70 void AVCodecContextToAudioDecoderConfig( |
71 const AVCodecContext* codec_context, | 71 const AVCodecContext* codec_context, |
72 AudioDecoderConfig* config); | 72 AudioDecoderConfig* config); |
73 void AudioDecoderConfigToAVCodecContext( | 73 void AudioDecoderConfigToAVCodecContext( |
74 const AudioDecoderConfig& config, | 74 const AudioDecoderConfig& config, |
75 AVCodecContext* codec_context); | 75 AVCodecContext* codec_context); |
76 | 76 |
77 VideoCodec CodecIDToVideoCodec(CodecID codec_id); | 77 void AVCodecContextToVideoDecoderConfig( |
scherkus (not reviewing)
2011/10/25 22:42:15
I wonder whether this should be AVStreamToVideoDec
acolwell GONE FROM CHROMIUM
2011/10/26 17:09:13
If we are only likely to call this from contexts w
scherkus (not reviewing)
2011/10/26 19:08:00
Done.
| |
78 CodecID VideoCodecToCodecID(VideoCodec video_codec); | 78 const AVCodecContext* codec_context, |
79 const AVRational& frame_rate, | |
80 const AVRational& aspect_ratio, | |
81 VideoDecoderConfig* config); | |
82 void VideoDecoderConfigToAVCodecContext( | |
83 const VideoDecoderConfig& config, | |
84 AVCodecContext* codec_context); | |
79 | 85 |
80 // Converts FFmpeg's channel layout to chrome's ChannelLayout. |channels| can | 86 // Converts FFmpeg's channel layout to chrome's ChannelLayout. |channels| can |
81 // be used when FFmpeg's channel layout is not informative in order to make a | 87 // be used when FFmpeg's channel layout is not informative in order to make a |
82 // good guess about the plausible channel layout based on number of channels. | 88 // good guess about the plausible channel layout based on number of channels. |
83 ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, | 89 ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, |
84 int channels); | 90 int channels); |
85 | 91 |
86 // Converts FFmpeg's pixel formats to its corresponding supported video format. | 92 // Converts FFmpeg's pixel formats to its corresponding supported video format. |
87 VideoFrame::Format PixelFormatToVideoFormat(PixelFormat pixel_format); | 93 VideoFrame::Format PixelFormatToVideoFormat(PixelFormat pixel_format); |
88 | 94 |
89 // Converts video formats to its corresponding FFmpeg's pixel formats. | 95 // Converts video formats to its corresponding FFmpeg's pixel formats. |
90 PixelFormat VideoFormatToPixelFormat(VideoFrame::Format video_format); | 96 PixelFormat VideoFormatToPixelFormat(VideoFrame::Format video_format); |
91 | 97 |
92 // Calculates duration of one frame in the |stream| based on its frame rate. | 98 // Calculates the duration of one frame based on the frame rate specified by |
93 base::TimeDelta GetFrameDuration(AVStream* stream); | 99 // |config|. |
100 base::TimeDelta GetFrameDuration(const VideoDecoderConfig& config); | |
scherkus (not reviewing)
2011/10/25 22:42:15
should this be a method on VideoDecoderConfig?
I'
acolwell GONE FROM CHROMIUM
2011/10/26 17:09:13
Yes.
| |
101 | |
102 // Returns the aspect ratio based on the information contained inside |stream|. | |
103 AVRational GetAspectRatio(AVStream* stream); | |
94 | 104 |
95 // Calculates the natural width and height of the video using the video's | 105 // Calculates the natural width and height of the video using the video's |
96 // encoded dimensions and sample_aspect_ratio. | 106 // encoded dimensions and aspect ratio. |
97 gfx::Size GetNaturalSize(AVStream* stream); | 107 gfx::Size GetNaturalSize(const VideoDecoderConfig& config); |
scherkus (not reviewing)
2011/10/25 22:42:15
ditto here due to av_q2d()
acolwell GONE FROM CHROMIUM
2011/10/26 17:09:13
ditto
| |
98 | 108 |
99 // Closes & destroys all AVStreams in the context and then closes & | 109 // Closes & destroys all AVStreams in the context and then closes & |
100 // destroys the AVFormatContext. | 110 // destroys the AVFormatContext. |
101 void DestroyAVFormatContext(AVFormatContext* format_context); | 111 void DestroyAVFormatContext(AVFormatContext* format_context); |
102 | 112 |
103 } // namespace media | 113 } // namespace media |
104 | 114 |
105 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ | 115 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ |
OLD | NEW |