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

Side by Side Diff: patched-ffmpeg-mt/libavformat/gxf.c

Issue 789004: ffmpeg roll of source to mar 9 version... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 9 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
OLDNEW
1 /* 1 /*
2 * GXF demuxer. 2 * GXF demuxer.
3 * Copyright (c) 2006 Reimar Doeffinger 3 * Copyright (c) 2006 Reimar Doeffinger
4 * 4 *
5 * This file is part of FFmpeg. 5 * This file is part of FFmpeg.
6 * 6 *
7 * FFmpeg is free software; you can redistribute it and/or 7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version. 10 * version 2.1 of the License, or (at your option) any later version.
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 if ((track_id & 0xc0) != 0xc0) { 306 if ((track_id & 0xc0) != 0xc0) {
307 av_log(s, AV_LOG_ERROR, "invalid track id %x\n", track_id); 307 av_log(s, AV_LOG_ERROR, "invalid track id %x\n", track_id);
308 continue; 308 continue;
309 } 309 }
310 track_id &= 0x3f; 310 track_id &= 0x3f;
311 idx = get_sindex(s, track_id, track_type); 311 idx = get_sindex(s, track_id, track_type);
312 if (idx < 0) continue; 312 if (idx < 0) continue;
313 st = s->streams[idx]; 313 st = s->streams[idx];
314 if (!main_timebase.num || !main_timebase.den) { 314 if (!main_timebase.num || !main_timebase.den) {
315 main_timebase.num = si.frames_per_second.den; 315 main_timebase.num = si.frames_per_second.den;
316 main_timebase.den = si.frames_per_second.num * si.fields_per_frame; 316 main_timebase.den = si.frames_per_second.num * 2;
317 } 317 }
318 st->start_time = si.first_field; 318 st->start_time = si.first_field;
319 if (si.first_field != AV_NOPTS_VALUE && si.last_field != AV_NOPTS_VALUE) 319 if (si.first_field != AV_NOPTS_VALUE && si.last_field != AV_NOPTS_VALUE)
320 st->duration = si.last_field - si.first_field; 320 st->duration = si.last_field - si.first_field;
321 } 321 }
322 if (len < 0) 322 if (len < 0)
323 av_log(s, AV_LOG_ERROR, "invalid track description length specified\n"); 323 av_log(s, AV_LOG_ERROR, "invalid track description length specified\n");
324 if (map_len) 324 if (map_len)
325 url_fskip(pb, map_len); 325 url_fskip(pb, map_len);
326 if (!parse_packet_header(pb, &pkt_type, &len)) { 326 if (!parse_packet_header(pb, &pkt_type, &len)) {
(...skipping 10 matching lines...) Expand all
337 if (pkt_type == PKT_UMF) { 337 if (pkt_type == PKT_UMF) {
338 if (len >= 0x39) { 338 if (len >= 0x39) {
339 AVRational fps; 339 AVRational fps;
340 len -= 0x39; 340 len -= 0x39;
341 url_fskip(pb, 5); // preamble 341 url_fskip(pb, 5); // preamble
342 url_fskip(pb, 0x30); // payload description 342 url_fskip(pb, 0x30); // payload description
343 fps = fps_umf2avr(get_le32(pb)); 343 fps = fps_umf2avr(get_le32(pb));
344 if (!main_timebase.num || !main_timebase.den) { 344 if (!main_timebase.num || !main_timebase.den) {
345 // this may not always be correct, but simply the best we can ge t 345 // this may not always be correct, but simply the best we can ge t
346 main_timebase.num = fps.den; 346 main_timebase.num = fps.den;
347 main_timebase.den = fps.num; 347 main_timebase.den = fps.num * 2;
348 } 348 }
349 } else 349 } else
350 av_log(s, AV_LOG_INFO, "UMF packet too short\n"); 350 av_log(s, AV_LOG_INFO, "UMF packet too short\n");
351 } else 351 } else
352 av_log(s, AV_LOG_INFO, "UMF packet missing\n"); 352 av_log(s, AV_LOG_INFO, "UMF packet missing\n");
353 url_fskip(pb, len); 353 url_fskip(pb, len);
354 // set a fallback value, 60000/1001 is specified for audio-only files
355 // so use that regardless of why we do not know the video frame rate.
354 if (!main_timebase.num || !main_timebase.den) 356 if (!main_timebase.num || !main_timebase.den)
355 main_timebase = (AVRational){1, 50}; // set some arbitrary fallback 357 main_timebase = (AVRational){1001, 60000};
356 for (i = 0; i < s->nb_streams; i++) { 358 for (i = 0; i < s->nb_streams; i++) {
357 AVStream *st = s->streams[i]; 359 AVStream *st = s->streams[i];
358 av_set_pts_info(st, 32, main_timebase.num, main_timebase.den); 360 av_set_pts_info(st, 32, main_timebase.num, main_timebase.den);
359 } 361 }
360 return 0; 362 return 0;
361 } 363 }
362 364
363 #define READ_ONE() \ 365 #define READ_ONE() \
364 { \ 366 { \
365 if (!max_interval-- || url_feof(pb)) \ 367 if (!max_interval-- || url_feof(pb)) \
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 "gxf", 509 "gxf",
508 NULL_IF_CONFIG_SMALL("GXF format"), 510 NULL_IF_CONFIG_SMALL("GXF format"),
509 0, 511 0,
510 gxf_probe, 512 gxf_probe,
511 gxf_header, 513 gxf_header,
512 gxf_packet, 514 gxf_packet,
513 NULL, 515 NULL,
514 gxf_seek, 516 gxf_seek,
515 gxf_read_timestamp, 517 gxf_read_timestamp,
516 }; 518 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698