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

Side by Side Diff: media/base/media_posix.cc

Issue 113598: Use av_rescale_q() for converting FFmpeg timestamps to base::TimeDelta. (Closed)
Patch Set: Tweaksd Created 11 years, 7 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
« no previous file with comments | « no previous file | media/filters/ffmpeg_audio_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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/base/media.h" 5 #include "media/base/media.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include <dlfcn.h> 9 #include <dlfcn.h>
10 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 void* (*av_malloc_ptr)(unsigned int size) = NULL; 115 void* (*av_malloc_ptr)(unsigned int size) = NULL;
116 void* av_malloc(unsigned int size) { 116 void* av_malloc(unsigned int size) {
117 return av_malloc_ptr(size); 117 return av_malloc_ptr(size);
118 } 118 }
119 119
120 void (*av_free_ptr)(void* ptr) = NULL; 120 void (*av_free_ptr)(void* ptr) = NULL;
121 void av_free(void* ptr) { 121 void av_free(void* ptr) {
122 return av_free_ptr(ptr); 122 return av_free_ptr(ptr);
123 } 123 }
124 124
125 int64_t (*av_rescale_q_ptr)(int64_t a, AVRational bq, AVRational cq) = NULL;
126 int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) {
127 return av_rescale_q_ptr(a, bq, cq);
128 }
129
125 } // extern "C" 130 } // extern "C"
126 131
127 132
128 namespace media { 133 namespace media {
129 134
130 namespace { 135 namespace {
131 136
132 enum FFmpegDSOKeys { 137 enum FFmpegDSOKeys {
133 FILE_LIBAVCODEC, // full path to libavcodec media decoding library. 138 FILE_LIBAVCODEC, // full path to libavcodec media decoding library.
134 FILE_LIBAVFORMAT, // full path to libavformat media parsing library. 139 FILE_LIBAVFORMAT, // full path to libavformat media parsing library.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 av_register_protocol_ptr = 238 av_register_protocol_ptr =
234 reinterpret_cast<int (*)(URLProtocol*)>( 239 reinterpret_cast<int (*)(URLProtocol*)>(
235 dlsym(libs[FILE_LIBAVFORMAT], "av_register_protocol")); 240 dlsym(libs[FILE_LIBAVFORMAT], "av_register_protocol"));
236 241
237 av_malloc_ptr = 242 av_malloc_ptr =
238 reinterpret_cast<void* (*)(unsigned int)>( 243 reinterpret_cast<void* (*)(unsigned int)>(
239 dlsym(libs[FILE_LIBAVUTIL], "av_malloc")); 244 dlsym(libs[FILE_LIBAVUTIL], "av_malloc"));
240 av_free_ptr = 245 av_free_ptr =
241 reinterpret_cast<void (*)(void*)>( 246 reinterpret_cast<void (*)(void*)>(
242 dlsym(libs[FILE_LIBAVUTIL], "av_free")); 247 dlsym(libs[FILE_LIBAVUTIL], "av_free"));
248 av_rescale_q_ptr =
249 reinterpret_cast<int64_t (*)(int64_t, AVRational, AVRational)>(
250 dlsym(libs[FILE_LIBAVUTIL], "av_rescale_q"));
243 251
244 // Check that all the symbols were loaded correctly before returning true. 252 // Check that all the symbols were loaded correctly before returning true.
245 if (av_get_bits_per_sample_format_ptr && 253 if (av_get_bits_per_sample_format_ptr &&
246 avcodec_init_ptr && 254 avcodec_init_ptr &&
247 avcodec_find_decoder_ptr && 255 avcodec_find_decoder_ptr &&
248 avcodec_thread_init_ptr && 256 avcodec_thread_init_ptr &&
249 avcodec_open_ptr && 257 avcodec_open_ptr &&
250 avcodec_alloc_frame_ptr && 258 avcodec_alloc_frame_ptr &&
251 avcodec_decode_audio2_ptr && 259 avcodec_decode_audio2_ptr &&
252 avcodec_decode_video_ptr && 260 avcodec_decode_video_ptr &&
253 261
254 av_register_all_ptr && 262 av_register_all_ptr &&
255 av_open_input_file_ptr && 263 av_open_input_file_ptr &&
256 av_find_stream_info_ptr && 264 av_find_stream_info_ptr &&
257 av_read_frame_ptr && 265 av_read_frame_ptr &&
258 av_seek_frame_ptr && 266 av_seek_frame_ptr &&
259 av_register_protocol_ptr && 267 av_register_protocol_ptr &&
260 268
261 av_malloc_ptr && 269 av_malloc_ptr &&
262 av_free_ptr) { 270 av_free_ptr &&
271 av_rescale_q_ptr) {
263 return true; 272 return true;
264 } 273 }
265 274
266 return false; 275 return false;
267 } 276 }
268 277
269 } // namespace media 278 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/ffmpeg_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698