45 int field = timecode & 0xff;
46 int frame = fields_per_frame ? field / fields_per_frame : field;
47 int second = (timecode >> 8) & 0xff;
48 int minute = (timecode >> 16) & 0xff;
49 int hour = (timecode >> 24) & 0x1f;
50 int drop = (timecode >> 29) & 1;
55 snprintf(tmp,
sizeof(tmp),
"%02d:%02d:%02d%c%02d",
56 hour, minute, second, drop ?
';' :
':', frame);
74 if ((*length >> 24) || *length < 16)
90 static const uint8_t startcode[] = {0, 0, 0, 0, 1, 0xbc};
91 static const uint8_t endcode[] = {0, 0, 0, 0, 0xe1, 0xe2};
92 if (!memcmp(p->
buf, startcode,
sizeof(startcode)) &&
93 !memcmp(&p->
buf[16 -
sizeof(endcode)], endcode,
sizeof(endcode)))
237 if (fps < 1 || fps > 9) fps = 9;
238 return frame_rate_tab[fps - 1];
247 static const AVRational map[] = {{50, 1}, {60000, 1001}, {24, 1},
248 {25, 1}, {30000, 1001}};
249 int idx =
av_log2((flags & 0x7c0) >> 6);
273 else if (tag ==
TRACK_FPF && (value == 1 || value == 2))
275 }
else if (tlen == 8 && tag ==
TRACK_AUX)
297 if (map_cnt > 1000) {
299 "too many index entries %"PRIu32
" (%"PRIx32
")\n",
303 if (pkt_len < 4 * map_cnt) {
308 pkt_len -= 4 * map_cnt;
310 for (i = 0; i < map_cnt; i++)
312 i * (uint64_t)fields_per_map + 1, 0, 0, 0);
350 int track_type, track_id, track_len;
358 if (!(track_type & 0x80)) {
363 if ((track_id & 0xc0) != 0xc0) {
370 if (track_type == 7 || track_type == 8 || track_type == 24) {
379 if (idx < 0)
continue;
381 if (!main_timebase.
num || !main_timebase.
den) {
411 if (!main_timebase.
num || !main_timebase.
den) {
413 " This might give wrong results.\n");
415 main_timebase.
num = fps.
den;
416 main_timebase.
den = fps.
num * 2;
434 if (!main_timebase.
num || !main_timebase.
den)
445 if (!max_interval-- || avio_feof(pb)) \
447 tmp = tmp << 8 | avio_r8(pb); \
460 uint64_t last_found_pos = 0;
477 if (
avio_seek(pb, last_pos, SEEK_SET) < 0)
485 if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
486 if (
avio_seek(pb, last_pos, SEEK_SET) >= 0)
492 return cur_timestamp;
503 int track_type, track_id,
ret;
504 int field_nr, field_info, skip = 0;
526 stream_index =
get_sindex(s, track_id, track_type);
527 if (stream_index < 0)
537 int first = field_info >> 16;
538 int last = field_info & 0xffff;
540 if (first <= last && last*bps <= pkt_len) {
542 skip = pkt_len - last*
bps;
543 pkt_len = (last-first)*bps;
565 uint64_t maxlen = 100 * 1024 * 1024;
570 if (timestamp < start_time) timestamp =
start_time;
576 if (idx < st->nb_index_entries - 2)
578 maxlen =
FFMAX(maxlen, 200 * 1024);
583 if (
FFABS(found - timestamp) > 4)
589 int64_t *pos, int64_t pos_limit) {