Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: media/ffmpeg/ffmpeg_common.h

Issue 7601002: Revert r95841 due to failing media_unittests on linux_shared bot. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/yuv_convert.h ('k') | media/ffmpeg/file_protocol.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/channel_layout.h" 14 #include "media/base/channel_layout.h"
15 #include "media/base/media_export.h"
16 #include "media/video/video_decode_engine.h" 15 #include "media/video/video_decode_engine.h"
17 16
18 // Include FFmpeg header files. 17 // Include FFmpeg header files.
19 extern "C" { 18 extern "C" {
20 // Temporarily disable possible loss of data warning. 19 // Temporarily disable possible loss of data warning.
21 // TODO(scherkus): fix and upstream the compiler warnings. 20 // TODO(scherkus): fix and upstream the compiler warnings.
22 MSVC_PUSH_DISABLE_WARNING(4244); 21 MSVC_PUSH_DISABLE_WARNING(4244);
23 #include <libavcodec/avcodec.h> 22 #include <libavcodec/avcodec.h>
24 #include <libavformat/avformat.h> 23 #include <libavformat/avformat.h>
25 #include <libavformat/avio.h> 24 #include <libavformat/avio.h>
(...skipping 22 matching lines...) Expand all
48 AVPacket* packet = static_cast<AVPacket*>(x); 47 AVPacket* packet = static_cast<AVPacket*>(x);
49 av_free_packet(packet); 48 av_free_packet(packet);
50 delete packet; 49 delete packet;
51 } 50 }
52 }; 51 };
53 52
54 // Converts an int64 timestamp in |time_base| units to a base::TimeDelta. 53 // Converts an int64 timestamp in |time_base| units to a base::TimeDelta.
55 // For example if |timestamp| equals 11025 and |time_base| equals {1, 44100} 54 // For example if |timestamp| equals 11025 and |time_base| equals {1, 44100}
56 // then the return value will be a base::TimeDelta for 0.25 seconds since that 55 // then the return value will be a base::TimeDelta for 0.25 seconds since that
57 // is how much time 11025/44100ths of a second represents. 56 // is how much time 11025/44100ths of a second represents.
58 MEDIA_EXPORT base::TimeDelta ConvertFromTimeBase(const AVRational& time_base, 57 base::TimeDelta ConvertFromTimeBase(const AVRational& time_base,
59 int64 timestamp); 58 int64 timestamp);
60 59
61 // Converts a base::TimeDelta into an int64 timestamp in |time_base| units. 60 // 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 61 // 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 62 // the return value will be 22050 since that is how many 1/44100ths of a second
64 // represent 0.5 seconds. 63 // represent 0.5 seconds.
65 MEDIA_EXPORT int64 ConvertToTimeBase(const AVRational& time_base, 64 int64 ConvertToTimeBase(const AVRational& time_base,
66 const base::TimeDelta& timestamp); 65 const base::TimeDelta& timestamp);
67 66
68 VideoCodec CodecIDToVideoCodec(CodecID codec_id); 67 VideoCodec CodecIDToVideoCodec(CodecID codec_id);
69 CodecID VideoCodecToCodecID(VideoCodec video_codec); 68 CodecID VideoCodecToCodecID(VideoCodec video_codec);
70 69
71 // Converts FFmpeg's channel layout to chrome's ChannelLayout. |channels| can 70 // 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 71 // 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. 72 // good guess about the plausible channel layout based on number of channels.
74 ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, 73 ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout,
75 int channels); 74 int channels);
76 75
77 // Calculates duration of one frame in the |stream| based on its frame rate. 76 // Calculates duration of one frame in the |stream| based on its frame rate.
78 base::TimeDelta GetFrameDuration(AVStream* stream); 77 base::TimeDelta GetFrameDuration(AVStream* stream);
79 78
80 // Get the timestamp of the next seek point after |timestamp|. 79 // Get the timestamp of the next seek point after |timestamp|.
81 // Returns true if a valid seek point was found after |timestamp| and 80 // Returns true if a valid seek point was found after |timestamp| and
82 // |seek_time| was set. Returns false if a seek point could not be 81 // |seek_time| was set. Returns false if a seek point could not be
83 // found or the parameters are invalid. 82 // found or the parameters are invalid.
84 MEDIA_EXPORT bool GetSeekTimeAfter(AVStream* stream, 83 bool GetSeekTimeAfter(AVStream* stream,
85 const base::TimeDelta& timestamp, 84 const base::TimeDelta& timestamp,
86 base::TimeDelta* seek_time); 85 base::TimeDelta* seek_time);
87 86
88 // Get the number of bytes required to play the stream over a specified 87 // Get the number of bytes required to play the stream over a specified
89 // time range. This is an estimate based on the available index data. 88 // time range. This is an estimate based on the available index data.
90 // Returns true if input time range was valid and |bytes|, |range_start|, 89 // Returns true if input time range was valid and |bytes|, |range_start|,
91 // and |range_end|, were set. Returns false if the range was invalid or we don't 90 // and |range_end|, were set. Returns false if the range was invalid or we don't
92 // have enough index data to make an estimate. 91 // have enough index data to make an estimate.
93 // 92 //
94 // |bytes| - The number of bytes in the stream for the specified range. 93 // |bytes| - The number of bytes in the stream for the specified range.
95 // |range_start| - The start time for the range covered by |bytes|. This 94 // |range_start| - The start time for the range covered by |bytes|. This
96 // may be different than |start_time| if the index doesn't 95 // may be different than |start_time| if the index doesn't
97 // have data for that exact time. |range_start| <= |start_time| 96 // have data for that exact time. |range_start| <= |start_time|
98 // |range_end| - The end time for the range covered by |bytes|. This may be 97 // |range_end| - The end time for the range covered by |bytes|. This may be
99 // different than |end_time| if the index doesn't have data for 98 // different than |end_time| if the index doesn't have data for
100 // that exact time. |range_end| >= |end_time| 99 // that exact time. |range_end| >= |end_time|
101 MEDIA_EXPORT bool GetStreamByteCountOverRange(AVStream* stream, 100 bool GetStreamByteCountOverRange(AVStream* stream,
102 const base::TimeDelta& start_time, 101 const base::TimeDelta& start_time,
103 const base::TimeDelta& end_time, 102 const base::TimeDelta& end_time,
104 int64* bytes, 103 int64* bytes,
105 base::TimeDelta* range_start, 104 base::TimeDelta* range_start,
106 base::TimeDelta* range_end); 105 base::TimeDelta* range_end);
107 106
108 // Calculates the width and height of the video surface using the video's 107 // Calculates the width and height of the video surface using the video's
109 // encoded dimensions and sample_aspect_ratio. 108 // encoded dimensions and sample_aspect_ratio.
110 int GetSurfaceHeight(AVStream* stream); 109 int GetSurfaceHeight(AVStream* stream);
111 int GetSurfaceWidth(AVStream* stream); 110 int GetSurfaceWidth(AVStream* stream);
112 111
113 // Closes & destroys all AVStreams in the context and then closes & 112 // Closes & destroys all AVStreams in the context and then closes &
114 // destroys the AVFormatContext. 113 // destroys the AVFormatContext.
115 void DestroyAVFormatContext(AVFormatContext* format_context); 114 void DestroyAVFormatContext(AVFormatContext* format_context);
116 115
117 } // namespace media 116 } // namespace media
118 117
119 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ 118 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_
OLDNEW
« no previous file with comments | « media/base/yuv_convert.h ('k') | media/ffmpeg/file_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698