| 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 #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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |