Mercurial > libavformat.hg
comparison mov.c @ 660:758929a1744c libavformat
chunk support in mov patch by Roine Gustafsson <roine AT users DOT sourceforge DOT net>
author | mmu_man |
---|---|
date | Thu, 27 Jan 2005 15:39:13 +0000 |
parents | 0624def73c76 |
children | 856b151f926a |
comparison
equal
deleted
inserted
replaced
659:6d7c0e6d929e | 660:758929a1744c |
---|---|
1744 | 1744 |
1745 if (idx < 0) return 0; | 1745 if (idx < 0) return 0; |
1746 #ifdef DEBUG | 1746 #ifdef DEBUG |
1747 fprintf(stderr, "sc[ffid %d]->sample_size = %d\n", sc->ffindex, sc->sample_size); | 1747 fprintf(stderr, "sc[ffid %d]->sample_size = %d\n", sc->ffindex, sc->sample_size); |
1748 #endif | 1748 #endif |
1749 //size = sc->sample_sizes[sc->current_sample]; | 1749 // sample_size is not always correct for audio. Quicktime ignores this value and |
1750 // that ain't working... | 1750 // computes it differently. |
1751 //size = (sc->sample_size)?sc->sample_size:sc->sample_sizes[sc->current_sample]; | 1751 if(s->streams[sc->ffindex]->codec.codec_type == CODEC_TYPE_VIDEO) |
1752 size = (sc->sample_size > 1)?sc->sample_size:sc->sample_sizes[sc->current_sample]; | 1752 size = sc->sample_size?sc->sample_size:sc->sample_sizes[sc->current_sample]; |
1753 | |
1754 sc->current_sample++; | 1753 sc->current_sample++; |
1755 sc->left_in_chunk--; | 1754 sc->left_in_chunk--; |
1756 | 1755 |
1757 if (sc->left_in_chunk <= 0) | 1756 if (sc->left_in_chunk <= 0) |
1758 mov->partial = 0; | 1757 mov->partial = 0; |
1808 //Maybe we should really not only check sc->sample_size, but also sc->sample_sizes | 1807 //Maybe we should really not only check sc->sample_size, but also sc->sample_sizes |
1809 //but I have no such movies | 1808 //but I have no such movies |
1810 if (sc->sample_size > 0) { | 1809 if (sc->sample_size > 0) { |
1811 int foundsize=0; | 1810 int foundsize=0; |
1812 for(i=0; i<(sc->sample_to_chunk_sz); i++) { | 1811 for(i=0; i<(sc->sample_to_chunk_sz); i++) { |
1813 if( (sc->sample_to_chunk[i].first)<=(sc->next_chunk) && (sc->sample_size>0) ) | 1812 if( (sc->sample_to_chunk[i].first)<=(sc->next_chunk) ) |
1814 { | 1813 { |
1815 // I can't figure out why for PCM audio sample_size is always 1 | 1814 // I can't figure out why for PCM audio sample_size is always 1 |
1816 // (it should actually be channels*bits_per_second/8) but it is. | 1815 // (it should actually be channels*bits_per_second/8) but it is. |
1817 AVCodecContext* cod = &s->streams[sc->ffindex]->codec; | 1816 AVCodecContext* cod = &s->streams[sc->ffindex]->codec; |
1818 if (sc->sample_size == 1 && (cod->codec_id == CODEC_ID_PCM_S16BE || cod->codec_id == CODEC_ID_PCM_S16LE)) | 1817 if (sc->sample_size == 1 && (cod->codec_id == CODEC_ID_PCM_S16BE || cod->codec_id == CODEC_ID_PCM_S16LE)) |
1834 } | 1833 } |
1835 #endif //MOV_MINOLTA_FIX | 1834 #endif //MOV_MINOLTA_FIX |
1836 | 1835 |
1837 #ifdef MOV_SPLIT_CHUNKS | 1836 #ifdef MOV_SPLIT_CHUNKS |
1838 /* split chunks into samples */ | 1837 /* split chunks into samples */ |
1839 if (sc->sample_size == 0) { | 1838 if (s->streams[sc->ffindex]->codec.codec_type == CODEC_TYPE_VIDEO) { |
1839 // This does not support split audio, as the sample_size is often not correct | |
1840 idx = sc->sample_to_chunk_index; | 1840 idx = sc->sample_to_chunk_index; |
1841 if ((idx + 1 < sc->sample_to_chunk_sz) | 1841 if ((idx + 1 < sc->sample_to_chunk_sz) |
1842 && (sc->next_chunk >= sc->sample_to_chunk[idx + 1].first)) | 1842 && (sc->next_chunk >= sc->sample_to_chunk[idx + 1].first)) |
1843 idx++; | 1843 idx++; |
1844 sc->sample_to_chunk_index = idx; | 1844 sc->sample_to_chunk_index = idx; |
1845 if (idx >= 0 && sc->sample_to_chunk[idx].count != 1) { | 1845 if (idx >= 0 && sc->sample_to_chunk[idx].count != 1) { |
1846 mov->partial = sc; | 1846 mov->partial = sc; |
1847 /* we'll have to get those samples before next chunk */ | 1847 /* we'll have to get those samples before next chunk */ |
1848 sc->left_in_chunk = sc->sample_to_chunk[idx].count - 1; | 1848 sc->left_in_chunk = sc->sample_to_chunk[idx].count - 1; |
1849 size = (sc->sample_size > 1)?sc->sample_size:sc->sample_sizes[sc->current_sample]; | 1849 size = sc->sample_size?sc->sample_size:sc->sample_sizes[sc->current_sample]; |
1850 } | 1850 } |
1851 | 1851 |
1852 sc->current_sample++; | 1852 sc->current_sample++; |
1853 } | 1853 } |
1854 #endif | 1854 #endif |