comparison mov.c @ 1010:62623b1abf81 libavformat

use of PRI macros in dprintf
author bcoudurier
date Sun, 12 Mar 2006 15:43:22 +0000
parents 1e37927ea0bd
children a149521570f8
comparison
equal deleted inserted replaced
1009:1e37927ea0bd 1010:62623b1abf81
437 a.size = get_be32(pb); 437 a.size = get_be32(pb);
438 a.type = get_le32(pb); 438 a.type = get_le32(pb);
439 } 439 }
440 total_size += 8; 440 total_size += 8;
441 a.offset += 8; 441 a.offset += 8;
442 dprintf("type: %08x %.4s sz: %PRIx64 %PRIx64 %PRIx64\n", a.type, (char*)&a.type, a.size, atom.size, total_size); 442 dprintf("type: %08x %.4s sz: %"PRIx64" %"PRIx64" %"PRIx64"\n", a.type, (char*)&a.type, a.size, atom.size, total_size);
443 if (a.size == 1) { /* 64 bit extended size */ 443 if (a.size == 1) { /* 64 bit extended size */
444 a.size = get_be64(pb) - 8; 444 a.size = get_be64(pb) - 8;
445 a.offset += 8; 445 a.offset += 8;
446 total_size += 8; 446 total_size += 8;
447 } 447 }
736 st->codec->extradata = (uint8_t*) av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); 736 st->codec->extradata = (uint8_t*) av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
737 737
738 if (st->codec->extradata) { 738 if (st->codec->extradata) {
739 strcpy(st->codec->extradata, "SVQ3"); // fake 739 strcpy(st->codec->extradata, "SVQ3"); // fake
740 get_buffer(pb, st->codec->extradata + 0x5a, atom.size); 740 get_buffer(pb, st->codec->extradata + 0x5a, atom.size);
741 dprintf("Reading SMI %PRId64 %s\n", atom.size, (char*)st->codec->extradata + 0x5a); 741 dprintf("Reading SMI %"PRId64" %s\n", atom.size, (char*)st->codec->extradata + 0x5a);
742 } else 742 } else
743 url_fskip(pb, atom.size); 743 url_fskip(pb, atom.size);
744 744
745 return 0; 745 return 0;
746 } 746 }
1715 index ++; 1715 index ++;
1716 duration = msc->stts_data[index].duration; 1716 duration = msc->stts_data[index].duration;
1717 } 1717 }
1718 dts = time + (msc->current_sample-1 - sample) * (int64_t)duration; 1718 dts = time + (msc->current_sample-1 - sample) * (int64_t)duration;
1719 dts = av_rescale(dts, AV_TIME_BASE, msc->time_scale); 1719 dts = av_rescale(dts, AV_TIME_BASE, msc->time_scale);
1720 dprintf("stream: %d dts: %PRId64 best_dts: %PRId64 offset: %PRId64 \n", i, dts, best_dts, offset); 1720 dprintf("stream: %d dts: %"PRId64" best_dts: %"PRId64" offset: %"PRId64"\n", i, dts, best_dts, offset);
1721 if(dts < best_dts){ 1721 if(dts < best_dts){
1722 best_dts= dts; 1722 best_dts= dts;
1723 sc = msc; 1723 sc = msc;
1724 offset = msc->chunk_offsets[msc->next_chunk]; 1724 offset = msc->chunk_offsets[msc->next_chunk];
1725 } 1725 }
1802 }else if(idx + 1 < sc->sample_to_chunk_sz){ 1802 }else if(idx + 1 < sc->sample_to_chunk_sz){
1803 sc->current_sample += sc->sample_to_chunk[idx].count; 1803 sc->current_sample += sc->sample_to_chunk[idx].count;
1804 } 1804 }
1805 1805
1806 readchunk: 1806 readchunk:
1807 dprintf("chunk: %lli -> %lli (%i)\n", offset, offset + size, size); 1807 dprintf("chunk: %"PRId64" -> %"PRId64" (%i)\n", offset, offset + size, size);
1808 if(size == 0x0FFFFFFF) 1808 if(size == 0x0FFFFFFF)
1809 size = mov->mdat_size + mov->mdat_offset - offset; 1809 size = mov->mdat_size + mov->mdat_offset - offset;
1810 if(size < 0) 1810 if(size < 0)
1811 return -1; 1811 return -1;
1812 if(size == 0) 1812 if(size == 0)
1870 assert(pts % st->time_base.num == 0); 1870 assert(pts % st->time_base.num == 0);
1871 assert(dts % st->time_base.num == 0); 1871 assert(dts % st->time_base.num == 0);
1872 1872
1873 pkt->pts = pts / st->time_base.num; 1873 pkt->pts = pts / st->time_base.num;
1874 pkt->dts = dts / st->time_base.num; 1874 pkt->dts = dts / st->time_base.num;
1875 dprintf("stream #%d smp #%ld dts = %lld pts = %lld (smp:%ld time:%lld idx:%d ent:%d count:%d dur:%d)\n" 1875 dprintf("stream #%d smp #%ld dts = %"PRId64" pts = %"PRId64" (smp:%ld time:%"PRId64" idx:%d ent:%d count:%d dur:%d)\n"
1876 , pkt->stream_index, sc->current_sample-1, pkt->dts, pkt->pts 1876 , pkt->stream_index, sc->current_sample-1, pkt->dts, pkt->pts
1877 , sc->sample_to_time_sample 1877 , sc->sample_to_time_sample
1878 , sc->sample_to_time_time 1878 , sc->sample_to_time_time
1879 , sc->sample_to_time_index 1879 , sc->sample_to_time_index
1880 , sc->stts_count 1880 , sc->stts_count
1998 if (chunk > sc->chunk_count) { 1998 if (chunk > sc->chunk_count) {
1999 av_log(s, AV_LOG_ERROR, "mov: chunk offset atom too short, unable to seek (req. chunk=%i, chunk count=%li)\n", chunk, sc->chunk_count); 1999 av_log(s, AV_LOG_ERROR, "mov: chunk offset atom too short, unable to seek (req. chunk=%i, chunk count=%li)\n", chunk, sc->chunk_count);
2000 return -1; 2000 return -1;
2001 } 2001 }
2002 chunk_file_offset = sc->chunk_offsets[chunk - 1]; 2002 chunk_file_offset = sc->chunk_offsets[chunk - 1];
2003 dprintf("Chunk file offset is #%llu \n", chunk_file_offset); 2003 dprintf("Chunk file offset is #%"PRIu64"\n", chunk_file_offset);
2004 2004
2005 // Step 6. Find the byte offset within the chunk using the sample size atom 2005 // Step 6. Find the byte offset within the chunk using the sample size atom
2006 sample_file_offset = chunk_file_offset; 2006 sample_file_offset = chunk_file_offset;
2007 if (sc->sample_size) 2007 if (sc->sample_size)
2008 sample_file_offset += (seek_sample - first_chunk_sample) * sc->sample_size; 2008 sample_file_offset += (seek_sample - first_chunk_sample) * sc->sample_size;
2009 else { 2009 else {
2010 for (i = 0; i < (seek_sample - first_chunk_sample); i++) { 2010 for (i = 0; i < (seek_sample - first_chunk_sample); i++) {
2011 sample_file_offset += sc->sample_sizes[first_chunk_sample + i - 1]; 2011 sample_file_offset += sc->sample_sizes[first_chunk_sample + i - 1];
2012 } 2012 }
2013 } 2013 }
2014 dprintf("Sample file offset is #%llu \n", sample_file_offset); 2014 dprintf("Sample file offset is #%"PRIu64"\n", sample_file_offset);
2015 2015
2016 // Step 6. Update the parser 2016 // Step 6. Update the parser
2017 mov->partial = sc; 2017 mov->partial = sc;
2018 mov->next_chunk_offset = sample_file_offset; 2018 mov->next_chunk_offset = sample_file_offset;
2019 // Update current stream state 2019 // Update current stream state
2039 } 2039 }
2040 } 2040 }
2041 msc->next_chunk = a; 2041 msc->next_chunk = a;
2042 if (msc->chunk_offsets[a] < chunk_file_offset && a < (msc->chunk_count-1)) 2042 if (msc->chunk_offsets[a] < chunk_file_offset && a < (msc->chunk_count-1))
2043 msc->next_chunk ++; 2043 msc->next_chunk ++;
2044 dprintf("Nearest next chunk for stream #%i is #%li @%lli\n", i, msc->next_chunk+1, msc->chunk_offsets[msc->next_chunk]); 2044 dprintf("Nearest next chunk for stream #%i is #%li @%"PRId64"\n", i, msc->next_chunk+1, msc->chunk_offsets[msc->next_chunk]);
2045 2045
2046 // Compute sample count and index in the sample_to_chunk table (what a pity) 2046 // Compute sample count and index in the sample_to_chunk table (what a pity)
2047 msc->sample_to_chunk_index = 0; 2047 msc->sample_to_chunk_index = 0;
2048 msc->current_sample = 0; 2048 msc->current_sample = 0;
2049 for(; msc->sample_to_chunk_index < (msc->sample_to_chunk_sz - 1) 2049 for(; msc->sample_to_chunk_index < (msc->sample_to_chunk_sz - 1)