Chromium Code Reviews| 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 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "media/base/audio_decoder_config.h" | |
| 14 #include "media/base/channel_layout.h" | 15 #include "media/base/channel_layout.h" |
| 15 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" |
| 16 #include "media/video/video_decode_engine.h" | 17 #include "media/video/video_decode_engine.h" |
| 17 | 18 |
| 18 // Include FFmpeg header files. | 19 // Include FFmpeg header files. |
| 19 extern "C" { | 20 extern "C" { |
| 20 // Temporarily disable possible loss of data warning. | 21 // Temporarily disable possible loss of data warning. |
| 21 // TODO(scherkus): fix and upstream the compiler warnings. | 22 // TODO(scherkus): fix and upstream the compiler warnings. |
| 22 MSVC_PUSH_DISABLE_WARNING(4244); | 23 MSVC_PUSH_DISABLE_WARNING(4244); |
| 23 #include <libavcodec/avcodec.h> | 24 #include <libavcodec/avcodec.h> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 MEDIA_EXPORT base::TimeDelta ConvertFromTimeBase(const AVRational& time_base, | 59 MEDIA_EXPORT base::TimeDelta ConvertFromTimeBase(const AVRational& time_base, |
| 59 int64 timestamp); | 60 int64 timestamp); |
| 60 | 61 |
| 61 // Converts a base::TimeDelta into an int64 timestamp in |time_base| units. | 62 // Converts a base::TimeDelta into an int64 timestamp in |time_base| units. |
| 62 // For example if |timestamp| is 0.5 seconds and |time_base| is {1, 44100}, then | 63 // For example if |timestamp| is 0.5 seconds and |time_base| is {1, 44100}, then |
| 63 // the return value will be 22050 since that is how many 1/44100ths of a second | 64 // the return value will be 22050 since that is how many 1/44100ths of a second |
| 64 // represent 0.5 seconds. | 65 // represent 0.5 seconds. |
| 65 MEDIA_EXPORT int64 ConvertToTimeBase(const AVRational& time_base, | 66 MEDIA_EXPORT int64 ConvertToTimeBase(const AVRational& time_base, |
| 66 const base::TimeDelta& timestamp); | 67 const base::TimeDelta& timestamp); |
| 67 | 68 |
| 69 AudioDecoderConfig* AVCodecContextToAudioDecoderConfig( | |
|
Ami GONE FROM CHROMIUM
2011/09/12 20:54:21
Returning a new'd struct isn't very google-c++-sty
scherkus (not reviewing)
2011/09/19 21:19:45
Done.
| |
| 70 AVCodecContext* codec_context); | |
| 71 void AudioDecoderConfigToAVCodecContext( | |
| 72 const AudioDecoderConfig* config, | |
| 73 AVCodecContext* codec_context); | |
| 74 | |
| 68 VideoCodec CodecIDToVideoCodec(CodecID codec_id); | 75 VideoCodec CodecIDToVideoCodec(CodecID codec_id); |
| 69 CodecID VideoCodecToCodecID(VideoCodec video_codec); | 76 CodecID VideoCodecToCodecID(VideoCodec video_codec); |
| 70 | 77 |
| 71 // Converts FFmpeg's channel layout to chrome's ChannelLayout. |channels| can | 78 // Converts FFmpeg's channel layout to chrome's ChannelLayout. |channels| can |
| 72 // be used when FFmpeg's channel layout is not informative in order to make a | 79 // be used when FFmpeg's channel layout is not informative in order to make a |
| 73 // good guess about the plausible channel layout based on number of channels. | 80 // good guess about the plausible channel layout based on number of channels. |
| 74 ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, | 81 ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, |
| 75 int channels); | 82 int channels); |
| 76 | 83 |
| 77 // Calculates duration of one frame in the |stream| based on its frame rate. | 84 // Calculates duration of one frame in the |stream| based on its frame rate. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 int GetSurfaceHeight(AVStream* stream); | 117 int GetSurfaceHeight(AVStream* stream); |
| 111 int GetSurfaceWidth(AVStream* stream); | 118 int GetSurfaceWidth(AVStream* stream); |
| 112 | 119 |
| 113 // Closes & destroys all AVStreams in the context and then closes & | 120 // Closes & destroys all AVStreams in the context and then closes & |
| 114 // destroys the AVFormatContext. | 121 // destroys the AVFormatContext. |
| 115 void DestroyAVFormatContext(AVFormatContext* format_context); | 122 void DestroyAVFormatContext(AVFormatContext* format_context); |
| 116 | 123 |
| 117 } // namespace media | 124 } // namespace media |
| 118 | 125 |
| 119 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ | 126 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ |
| OLD | NEW |