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

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

Issue 7932005: Reland r101418: Fix aspect ratio and clarify video frame dimensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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/ffmpeg/ffmpeg_common.h ('k') | media/filters/ffmpeg_video_decoder.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 #include "media/ffmpeg/ffmpeg_common.h" 5 #include "media/ffmpeg/ffmpeg_common.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 start_ie->pos >= end_ie->pos) { 180 start_ie->pos >= end_ie->pos) {
181 return false; 181 return false;
182 } 182 }
183 183
184 *bytes = end_ie->pos - start_ie->pos; 184 *bytes = end_ie->pos - start_ie->pos;
185 *range_start = ConvertFromTimeBase(stream->time_base, start_ie->timestamp); 185 *range_start = ConvertFromTimeBase(stream->time_base, start_ie->timestamp);
186 *range_end = ConvertFromTimeBase(stream->time_base, end_ie->timestamp); 186 *range_end = ConvertFromTimeBase(stream->time_base, end_ie->timestamp);
187 return true; 187 return true;
188 } 188 }
189 189
190 int GetSurfaceHeight(AVStream* stream) { 190 int GetNaturalHeight(AVStream* stream) {
191 return stream->codec->height; 191 return stream->codec->height;
192 } 192 }
193 193
194 int GetSurfaceWidth(AVStream* stream) { 194 int GetNaturalWidth(AVStream* stream) {
195 double aspect_ratio; 195 double aspect_ratio;
196 196
197 if (stream->sample_aspect_ratio.num) 197 if (stream->sample_aspect_ratio.num)
198 aspect_ratio = av_q2d(stream->sample_aspect_ratio); 198 aspect_ratio = av_q2d(stream->sample_aspect_ratio);
199 else if (stream->codec->sample_aspect_ratio.num) 199 else if (stream->codec->sample_aspect_ratio.num)
200 aspect_ratio = av_q2d(stream->codec->sample_aspect_ratio); 200 aspect_ratio = av_q2d(stream->codec->sample_aspect_ratio);
201 else 201 else
202 aspect_ratio = 1.0; 202 aspect_ratio = 1.0;
203 203
204 int width = floor(stream->codec->width * aspect_ratio + 0.5); 204 int width = floor(stream->codec->width * aspect_ratio + 0.5);
(...skipping 23 matching lines...) Expand all
228 avcodec_close(stream->codec); 228 avcodec_close(stream->codec);
229 } 229 }
230 } 230 }
231 } 231 }
232 232
233 // Then finally cleanup the format context. 233 // Then finally cleanup the format context.
234 av_close_input_file(format_context); 234 av_close_input_file(format_context);
235 } 235 }
236 236
237 } // namespace media 237 } // namespace media
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_common.h ('k') | media/filters/ffmpeg_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698