comparison mov.c @ 3041:f68603a02de9 libavformat

honor stsd v1 first, fix mace surge-2-8-MAC3.mov, beware of mulaw,alaw
author bcoudurier
date Wed, 13 Feb 2008 19:26:45 +0000
parents ca38ffc89883
children 79fcc3c853d4
comparison
equal deleted inserted replaced
3040:ca38ffc89883 3041:f68603a02de9
1384 current_offset = sc->chunk_offsets[i]; 1384 current_offset = sc->chunk_offsets[i];
1385 if (stsc_index + 1 < sc->sample_to_chunk_sz && 1385 if (stsc_index + 1 < sc->sample_to_chunk_sz &&
1386 i + 1 == sc->sample_to_chunk[stsc_index + 1].first) 1386 i + 1 == sc->sample_to_chunk[stsc_index + 1].first)
1387 stsc_index++; 1387 stsc_index++;
1388 chunk_samples = sc->sample_to_chunk[stsc_index].count; 1388 chunk_samples = sc->sample_to_chunk[stsc_index].count;
1389 /* get chunk size */ 1389 /* get chunk size, beware of alaw/ulaw/mace */
1390 if (sc->sample_size > 1 || st->codec->bits_per_sample == 8) 1390 if (sc->samples_per_frame > 0 &&
1391 chunk_size = chunk_samples * sc->sample_size; 1391 (chunk_samples * sc->bytes_per_frame % sc->samples_per_frame == 0)) {
1392 else if (sc->samples_per_frame > 0 &&
1393 (chunk_samples * sc->bytes_per_frame % sc->samples_per_frame == 0)) {
1394 if (sc->samples_per_frame < 1024) 1392 if (sc->samples_per_frame < 1024)
1395 chunk_size = chunk_samples * sc->bytes_per_frame / sc->samples_per_frame; 1393 chunk_size = chunk_samples * sc->bytes_per_frame / sc->samples_per_frame;
1396 else { 1394 else {
1397 chunk_size = sc->bytes_per_frame; 1395 chunk_size = sc->bytes_per_frame;
1398 frames = chunk_samples / sc->samples_per_frame; 1396 frames = chunk_samples / sc->samples_per_frame;
1399 chunk_samples = sc->samples_per_frame; 1397 chunk_samples = sc->samples_per_frame;
1400 } 1398 }
1399 } else if (sc->sample_size > 1 || st->codec->bits_per_sample == 8) {
1400 chunk_size = chunk_samples * sc->sample_size;
1401 } else { 1401 } else {
1402 av_log(mov->fc, AV_LOG_ERROR, "could not determine chunk size, report problem\n"); 1402 av_log(mov->fc, AV_LOG_ERROR, "could not determine chunk size, report problem\n");
1403 goto out; 1403 goto out;
1404 } 1404 }
1405 for (j = 0; j < frames; j++) { 1405 for (j = 0; j < frames; j++) {