OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 } | 494 } |
495 | 495 |
496 | 496 |
497 static int | 497 static int |
498 webm_guess_framerate(struct input_ctx *input, | 498 webm_guess_framerate(struct input_ctx *input, |
499 unsigned int *fps_den, | 499 unsigned int *fps_den, |
500 unsigned int *fps_num) { | 500 unsigned int *fps_num) { |
501 unsigned int i; | 501 unsigned int i; |
502 uint64_t tstamp = 0; | 502 uint64_t tstamp = 0; |
503 | 503 |
| 504 /* Check to see if we can seek before we parse any data. */ |
| 505 if (nestegg_track_seek(input->nestegg_ctx, input->video_track, 0)) { |
| 506 fprintf(stderr, |
| 507 "WARNING: Failed to guess framerate (no Cues), set to 30fps.\n"); |
| 508 *fps_num = 30; |
| 509 *fps_den = 1; |
| 510 return 0; |
| 511 } |
| 512 |
504 /* Guess the framerate. Read up to 1 second, or 50 video packets, | 513 /* Guess the framerate. Read up to 1 second, or 50 video packets, |
505 * whichever comes first. | 514 * whichever comes first. |
506 */ | 515 */ |
507 for (i = 0; tstamp < 1000000000 && i < 50;) { | 516 for (i = 0; tstamp < 1000000000 && i < 50;) { |
508 nestegg_packet *pkt; | 517 nestegg_packet *pkt; |
509 unsigned int track; | 518 unsigned int track; |
510 | 519 |
511 if (nestegg_read_packet(input->nestegg_ctx, &pkt) <= 0) | 520 if (nestegg_read_packet(input->nestegg_ctx, &pkt) <= 0) |
512 break; | 521 break; |
513 | 522 |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 if (arg_match(&arg, &looparg, argi)) { | 1180 if (arg_match(&arg, &looparg, argi)) { |
1172 loops = arg_parse_uint(&arg); | 1181 loops = arg_parse_uint(&arg); |
1173 break; | 1182 break; |
1174 } | 1183 } |
1175 } | 1184 } |
1176 free(argv); | 1185 free(argv); |
1177 for (i = 0; !error && i < loops; i++) | 1186 for (i = 0; !error && i < loops; i++) |
1178 error = main_loop(argc, argv_); | 1187 error = main_loop(argc, argv_); |
1179 return error; | 1188 return error; |
1180 } | 1189 } |
OLD | NEW |