comparison mov.c @ 1443:404048ea11bc libavformat

Replace most of the %lld and %llx by their (cleaner) PRI*64 counterparts. patch by Steve Lhomme, slhomme divxcorp com
author diego
date Wed, 01 Nov 2006 22:39:58 +0000
parents 7687091df65e
children a353426e83e5
comparison
equal deleted inserted replaced
1442:c2b748de9b35 1443:404048ea11bc
1485 distance = 0; 1485 distance = 0;
1486 if (stss_index + 1 < sc->keyframe_count) 1486 if (stss_index + 1 < sc->keyframe_count)
1487 stss_index++; 1487 stss_index++;
1488 } 1488 }
1489 sample_size = sc->sample_size > 0 ? sc->sample_size : sc->sample_sizes[current_sample]; 1489 sample_size = sc->sample_size > 0 ? sc->sample_size : sc->sample_sizes[current_sample];
1490 dprintf("AVIndex stream %d, sample %d, offset %llx, dts %lld, size %d, distance %d, keyframe %d\n", 1490 dprintf("AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", size %d, distance %d, keyframe %d\n",
1491 st->index, current_sample, current_offset, current_dts, sample_size, distance, keyframe); 1491 st->index, current_sample, current_offset, current_dts, sample_size, distance, keyframe);
1492 av_add_index_entry(st, current_offset, current_dts, sample_size, distance, keyframe ? AVINDEX_KEYFRAME : 0); 1492 av_add_index_entry(st, current_offset, current_dts, sample_size, distance, keyframe ? AVINDEX_KEYFRAME : 0);
1493 current_offset += sample_size; 1493 current_offset += sample_size;
1494 assert(sc->stts_data[stts_index].duration % sc->time_rate == 0); 1494 assert(sc->stts_data[stts_index].duration % sc->time_rate == 0);
1495 current_dts += sc->stts_data[stts_index].duration / sc->time_rate; 1495 current_dts += sc->stts_data[stts_index].duration / sc->time_rate;
1530 } 1530 }
1531 } 1531 }
1532 /* check for last chunk */ 1532 /* check for last chunk */
1533 if (chunk_size == INT_MAX) 1533 if (chunk_size == INT_MAX)
1534 for (j = 0; j < mov->mdat_count; j++) { 1534 for (j = 0; j < mov->mdat_count; j++) {
1535 dprintf("mdat %d, offset %llx, size %lld, current offset %llx\n", 1535 dprintf("mdat %d, offset %"PRIx64", size %"PRId64", current offset %"PRIx64"\n",
1536 j, mov->mdat_list[j].offset, mov->mdat_list[j].size, current_offset); 1536 j, mov->mdat_list[j].offset, mov->mdat_list[j].size, current_offset);
1537 if (mov->mdat_list[j].offset <= current_offset && mov->mdat_list[j].offset + mov->mdat_list[j].size > current_offset) 1537 if (mov->mdat_list[j].offset <= current_offset && mov->mdat_list[j].offset + mov->mdat_list[j].size > current_offset)
1538 chunk_size = mov->mdat_list[j].offset + mov->mdat_list[j].size - current_offset; 1538 chunk_size = mov->mdat_list[j].offset + mov->mdat_list[j].size - current_offset;
1539 } 1539 }
1540 assert(chunk_size != INT_MAX); 1540 assert(chunk_size != INT_MAX);
1556 if (stts_index + 1 < sc->stts_count) { 1556 if (stts_index + 1 < sc->stts_count) {
1557 stts_index++; 1557 stts_index++;
1558 } 1558 }
1559 } 1559 }
1560 } 1560 }
1561 dprintf("AVIndex stream %d, chunk %d, offset %llx, dts %lld, size %d, duration %d\n", 1561 dprintf("AVIndex stream %d, chunk %d, offset %"PRIx64", dts %"PRId64", size %d, duration %d\n",
1562 st->index, i, current_offset, current_dts, chunk_size, chunk_duration); 1562 st->index, i, current_offset, current_dts, chunk_size, chunk_duration);
1563 assert(chunk_duration % sc->time_rate == 0); 1563 assert(chunk_duration % sc->time_rate == 0);
1564 current_dts += chunk_duration / sc->time_rate; 1564 current_dts += chunk_duration / sc->time_rate;
1565 } 1565 }
1566 } 1566 }
1640 1640
1641 if (s->streams[i]->discard != AVDISCARD_ALL && msc->current_sample < msc->sample_count) { 1641 if (s->streams[i]->discard != AVDISCARD_ALL && msc->current_sample < msc->sample_count) {
1642 AVIndexEntry *current_sample = &s->streams[i]->index_entries[msc->current_sample]; 1642 AVIndexEntry *current_sample = &s->streams[i]->index_entries[msc->current_sample];
1643 int64_t dts = av_rescale(current_sample->timestamp * (int64_t)msc->time_rate, AV_TIME_BASE, msc->time_scale); 1643 int64_t dts = av_rescale(current_sample->timestamp * (int64_t)msc->time_rate, AV_TIME_BASE, msc->time_scale);
1644 1644
1645 dprintf("stream %d, sample %ld, dts %lld\n", i, msc->current_sample, dts); 1645 dprintf("stream %d, sample %ld, dts %"PRId64"\n", i, msc->current_sample, dts);
1646 if (dts < best_dts) { 1646 if (dts < best_dts) {
1647 sample = current_sample; 1647 sample = current_sample;
1648 best_dts = dts; 1648 best_dts = dts;
1649 sc = msc; 1649 sc = msc;
1650 } 1650 }
1688 } else { 1688 } else {
1689 pkt->pts = pkt->dts; 1689 pkt->pts = pkt->dts;
1690 } 1690 }
1691 pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? PKT_FLAG_KEY : 0; 1691 pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? PKT_FLAG_KEY : 0;
1692 pkt->pos = sample->pos; 1692 pkt->pos = sample->pos;
1693 dprintf("stream %d, pts %lld, dts %lld, pos 0x%llx, duration %d\n", pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration); 1693 dprintf("stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n", pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration);
1694 return 0; 1694 return 0;
1695 } 1695 }
1696 1696
1697 static int mov_seek_stream(AVStream *st, int64_t timestamp, int flags) 1697 static int mov_seek_stream(AVStream *st, int64_t timestamp, int flags)
1698 { 1698 {
1699 MOVStreamContext *sc = st->priv_data; 1699 MOVStreamContext *sc = st->priv_data;
1700 int sample, time_sample; 1700 int sample, time_sample;
1701 int i; 1701 int i;
1702 1702
1703 sample = av_index_search_timestamp(st, timestamp, flags); 1703 sample = av_index_search_timestamp(st, timestamp, flags);
1704 dprintf("stream %d, timestamp %lld, sample %d\n", st->index, timestamp, sample); 1704 dprintf("stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample);
1705 if (sample < 0) /* not sure what to do */ 1705 if (sample < 0) /* not sure what to do */
1706 return -1; 1706 return -1;
1707 sc->current_sample = sample; 1707 sc->current_sample = sample;
1708 dprintf("stream %d, found sample %ld\n", st->index, sc->current_sample); 1708 dprintf("stream %d, found sample %ld\n", st->index, sc->current_sample);
1709 /* adjust ctts index */ 1709 /* adjust ctts index */