From 7dbab4a9b4997d401993688968220b6e8260296f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 23 Jan 2005 09:59:36 +0000 Subject: [PATCH] =?UTF-8?q?Revert=20the=20fixed-size-sample=20patch=20as?= =?UTF-8?q?=20it=20brokes=20=20and=20others=20WTF=20I=20thought=20I=20had?= =?UTF-8?q?=20commited=20this=20yesterday...=20was=20probably=20too=20asle?= =?UTF-8?q?ep=20:=C2=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally committed as revision 3864 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/mov.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 4ea401f95d..cd87fa6540 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1247,7 +1247,7 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) for(i=0; isample_sizes[i] = get_be32(pb); #ifdef DEBUG -/* av_log(NULL, AV_LOG_DEBUG, "sample_sizes[]=%ld\n", sc->sample_sizes[i]); */ + av_log(NULL, AV_LOG_DEBUG, "sample_sizes[]=%ld\n", sc->sample_sizes[i]); #endif } return 0; @@ -1722,14 +1722,17 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) #ifdef MOV_SPLIT_CHUNKS if (mov->partial) { - - int idx; - sc = mov->partial; idx = sc->sample_to_chunk_index; if (idx < 0) return 0; - size = (sc->sample_size)?sc->sample_size:sc->sample_sizes[sc->current_sample]; +#ifdef DEBUG + fprintf(stderr, "sc[ffid %d]->sample_size = %d\n", sc->ffindex, sc->sample_size); +#endif + //size = sc->sample_sizes[sc->current_sample]; + // that ain't working... + //size = (sc->sample_size)?sc->sample_size:sc->sample_sizes[sc->current_sample]; + size = (sc->sample_size > 1)?sc->sample_size:sc->sample_sizes[sc->current_sample]; sc->current_sample++; sc->left_in_chunk--; @@ -1816,19 +1819,21 @@ again: #ifdef MOV_SPLIT_CHUNKS /* split chunks into samples */ - idx = sc->sample_to_chunk_index; - if ((idx + 1 < sc->sample_to_chunk_sz) - && (sc->next_chunk >= sc->sample_to_chunk[idx + 1].first)) - idx++; - sc->sample_to_chunk_index = idx; - if (idx >= 0 && sc->sample_to_chunk[idx].count != 1) { - mov->partial = sc; - /* we'll have to get those samples before next chunk */ - sc->left_in_chunk = sc->sample_to_chunk[idx].count - 1; - size = (sc->sample_size)?sc->sample_size:sc->sample_sizes[sc->current_sample]; - } + if (sc->sample_size == 0) { + idx = sc->sample_to_chunk_index; + if ((idx + 1 < sc->sample_to_chunk_sz) + && (sc->next_chunk >= sc->sample_to_chunk[idx + 1].first)) + idx++; + sc->sample_to_chunk_index = idx; + if (idx >= 0 && sc->sample_to_chunk[idx].count != 1) { + mov->partial = sc; + /* we'll have to get those samples before next chunk */ + sc->left_in_chunk = sc->sample_to_chunk[idx].count - 1; + size = (sc->sample_size > 1)?sc->sample_size:sc->sample_sizes[sc->current_sample]; + } - sc->current_sample++; + sc->current_sample++; + } #endif readchunk: @@ -1879,14 +1884,14 @@ readchunk: pkt->flags |= PKT_FLAG_KEY; #ifdef DEBUG - +/* av_log(NULL, AV_LOG_DEBUG, "Packet (%d, %ld) ", pkt->stream_index, pkt->size); for(i=0; i<8; i++) av_log(NULL, AV_LOG_DEBUG, "%02x ", pkt->data[i]); for(i=0; i<8; i++) av_log(NULL, AV_LOG_DEBUG, "%c ", (pkt->data[i]) & 0x7F); av_log(NULL, AV_LOG_DEBUG, "\n"); - +*/ #endif mov->next_chunk_offset = offset + size;