comparison mov.c @ 653:c61da0556426 libavformat

Revert the fixed-size-sample patch as it brokes and others WTF I thought I had commited this yesterday... was probably too asleep :бы)
author mmu_man
date Sun, 23 Jan 2005 09:59:36 +0000
parents b47948262721
children 125ce04416b5
comparison
equal deleted inserted replaced
652:b47948262721 653:c61da0556426
1245 if (!sc->sample_sizes) 1245 if (!sc->sample_sizes)
1246 return -1; 1246 return -1;
1247 for(i=0; i<entries; i++) { 1247 for(i=0; i<entries; i++) {
1248 sc->sample_sizes[i] = get_be32(pb); 1248 sc->sample_sizes[i] = get_be32(pb);
1249 #ifdef DEBUG 1249 #ifdef DEBUG
1250 /* av_log(NULL, AV_LOG_DEBUG, "sample_sizes[]=%ld\n", sc->sample_sizes[i]); */ 1250 av_log(NULL, AV_LOG_DEBUG, "sample_sizes[]=%ld\n", sc->sample_sizes[i]);
1251 #endif 1251 #endif
1252 } 1252 }
1253 return 0; 1253 return 0;
1254 } 1254 }
1255 1255
1720 int idx; 1720 int idx;
1721 size = 0x0FFFFFFF; 1721 size = 0x0FFFFFFF;
1722 1722
1723 #ifdef MOV_SPLIT_CHUNKS 1723 #ifdef MOV_SPLIT_CHUNKS
1724 if (mov->partial) { 1724 if (mov->partial) {
1725
1726 int idx;
1727
1728 sc = mov->partial; 1725 sc = mov->partial;
1729 idx = sc->sample_to_chunk_index; 1726 idx = sc->sample_to_chunk_index;
1730 1727
1731 if (idx < 0) return 0; 1728 if (idx < 0) return 0;
1732 size = (sc->sample_size)?sc->sample_size:sc->sample_sizes[sc->current_sample]; 1729 #ifdef DEBUG
1730 fprintf(stderr, "sc[ffid %d]->sample_size = %d\n", sc->ffindex, sc->sample_size);
1731 #endif
1732 //size = sc->sample_sizes[sc->current_sample];
1733 // that ain't working...
1734 //size = (sc->sample_size)?sc->sample_size:sc->sample_sizes[sc->current_sample];
1735 size = (sc->sample_size > 1)?sc->sample_size:sc->sample_sizes[sc->current_sample];
1733 1736
1734 sc->current_sample++; 1737 sc->current_sample++;
1735 sc->left_in_chunk--; 1738 sc->left_in_chunk--;
1736 1739
1737 if (sc->left_in_chunk <= 0) 1740 if (sc->left_in_chunk <= 0)
1814 } 1817 }
1815 #endif //MOV_MINOLTA_FIX 1818 #endif //MOV_MINOLTA_FIX
1816 1819
1817 #ifdef MOV_SPLIT_CHUNKS 1820 #ifdef MOV_SPLIT_CHUNKS
1818 /* split chunks into samples */ 1821 /* split chunks into samples */
1819 idx = sc->sample_to_chunk_index; 1822 if (sc->sample_size == 0) {
1820 if ((idx + 1 < sc->sample_to_chunk_sz) 1823 idx = sc->sample_to_chunk_index;
1821 && (sc->next_chunk >= sc->sample_to_chunk[idx + 1].first)) 1824 if ((idx + 1 < sc->sample_to_chunk_sz)
1822 idx++; 1825 && (sc->next_chunk >= sc->sample_to_chunk[idx + 1].first))
1823 sc->sample_to_chunk_index = idx; 1826 idx++;
1824 if (idx >= 0 && sc->sample_to_chunk[idx].count != 1) { 1827 sc->sample_to_chunk_index = idx;
1825 mov->partial = sc; 1828 if (idx >= 0 && sc->sample_to_chunk[idx].count != 1) {
1826 /* we'll have to get those samples before next chunk */ 1829 mov->partial = sc;
1827 sc->left_in_chunk = sc->sample_to_chunk[idx].count - 1; 1830 /* we'll have to get those samples before next chunk */
1828 size = (sc->sample_size)?sc->sample_size:sc->sample_sizes[sc->current_sample]; 1831 sc->left_in_chunk = sc->sample_to_chunk[idx].count - 1;
1829 } 1832 size = (sc->sample_size > 1)?sc->sample_size:sc->sample_sizes[sc->current_sample];
1830 1833 }
1831 sc->current_sample++; 1834
1835 sc->current_sample++;
1836 }
1832 #endif 1837 #endif
1833 1838
1834 readchunk: 1839 readchunk:
1835 #ifdef DEBUG 1840 #ifdef DEBUG
1836 av_log(NULL, AV_LOG_DEBUG, "chunk: %lli -> %lli (%i)\n", offset, offset + size, size); 1841 av_log(NULL, AV_LOG_DEBUG, "chunk: %lli -> %lli (%i)\n", offset, offset + size, size);
1877 } 1882 }
1878 else 1883 else
1879 pkt->flags |= PKT_FLAG_KEY; 1884 pkt->flags |= PKT_FLAG_KEY;
1880 1885
1881 #ifdef DEBUG 1886 #ifdef DEBUG
1882 1887 /*
1883 av_log(NULL, AV_LOG_DEBUG, "Packet (%d, %ld) ", pkt->stream_index, pkt->size); 1888 av_log(NULL, AV_LOG_DEBUG, "Packet (%d, %ld) ", pkt->stream_index, pkt->size);
1884 for(i=0; i<8; i++) 1889 for(i=0; i<8; i++)
1885 av_log(NULL, AV_LOG_DEBUG, "%02x ", pkt->data[i]); 1890 av_log(NULL, AV_LOG_DEBUG, "%02x ", pkt->data[i]);
1886 for(i=0; i<8; i++) 1891 for(i=0; i<8; i++)
1887 av_log(NULL, AV_LOG_DEBUG, "%c ", (pkt->data[i]) & 0x7F); 1892 av_log(NULL, AV_LOG_DEBUG, "%c ", (pkt->data[i]) & 0x7F);
1888 av_log(NULL, AV_LOG_DEBUG, "\n"); 1893 av_log(NULL, AV_LOG_DEBUG, "\n");
1889 1894 */
1890 #endif 1895 #endif
1891 1896
1892 mov->next_chunk_offset = offset + size; 1897 mov->next_chunk_offset = offset + size;
1893 1898
1894 return 0; 1899 return 0;