Revision dfd2a005 libavformat/mov.c

View differences:

libavformat/mov.c
266 266
            a.size = get_be32(pb);
267 267
            a.type = get_le32(pb);
268 268
        }
269
        dprintf(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
269
        av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
270 270
                a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size);
271 271
        total_size += 8;
272 272
        if (a.size == 1) { /* 64 bit extended size */
......
349 349

  
350 350
        dref->type = get_le32(pb);
351 351
        get_be32(pb); // version + flags
352
        dprintf(c->fc, "type %.4s size %d\n", (char*)&dref->type, size);
352
        av_dlog(c->fc, "type %.4s size %d\n", (char*)&dref->type, size);
353 353

  
354 354
        if (dref->type == MKTAG('a','l','i','s') && size > 150) {
355 355
            /* macintosh alias record */
......
441 441
    ctype = get_le32(pb);
442 442
    type = get_le32(pb); /* component subtype */
443 443

  
444
    dprintf(c->fc, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype);
445
    dprintf(c->fc, "stype= %.4s\n", (char*)&type);
444
    av_dlog(c->fc, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype);
445
    av_dlog(c->fc, "stype= %.4s\n", (char*)&type);
446 446

  
447 447
    if     (type == MKTAG('v','i','d','e'))
448 448
        st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
......
583 583
static int mov_read_moof(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
584 584
{
585 585
    c->fragment.moof_offset = url_ftell(pb) - 8;
586
    dprintf(c->fc, "moof offset %llx\n", c->fragment.moof_offset);
586
    av_dlog(c->fc, "moof offset %llx\n", c->fragment.moof_offset);
587 587
    return mov_read_default(c, pb, atom);
588 588
}
589 589

  
......
655 655
    mov_metadata_creation_time(&c->fc->metadata, creation_time);
656 656
    c->time_scale = get_be32(pb); /* time scale */
657 657

  
658
    dprintf(c->fc, "time scale = %i\n", c->time_scale);
658
    av_dlog(c->fc, "time scale = %i\n", c->time_scale);
659 659

  
660 660
    c->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */
661 661
    get_be32(pb); /* preferred scale */
......
697 697
    st->codec->extradata_size = 0x5a + atom.size;
698 698
    memcpy(st->codec->extradata, "SVQ3", 4); // fake
699 699
    get_buffer(pb, st->codec->extradata + 0x5a, atom.size);
700
    dprintf(c->fc, "Reading SMI %"PRId64"  %s\n", atom.size, st->codec->extradata + 0x5a);
700
    av_dlog(c->fc, "Reading SMI %"PRId64"  %s\n", atom.size, st->codec->extradata + 0x5a);
701 701
    return 0;
702 702
}
703 703

  
......
711 711
    st = c->fc->streams[c->fc->nb_streams-1];
712 712

  
713 713
    little_endian = get_be16(pb);
714
    dprintf(c->fc, "enda %d\n", little_endian);
714
    av_dlog(c->fc, "enda %d\n", little_endian);
715 715
    if (little_endian == 1) {
716 716
        switch (st->codec->codec_id) {
717 717
        case CODEC_ID_PCM_S24BE:
......
974 974
            }
975 975
        }
976 976

  
977
        dprintf(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size,
977
        av_dlog(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size,
978 978
                (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff,
979 979
                (format >> 24) & 0xff, st->codec->codec_type);
980 980

  
......
1009 1009

  
1010 1010
            st->codec->bits_per_coded_sample = get_be16(pb); /* depth */
1011 1011
            st->codec->color_table_id = get_be16(pb); /* colortable id */
1012
            dprintf(c->fc, "depth %d, ctab id %d\n",
1012
            av_dlog(c->fc, "depth %d, ctab id %d\n",
1013 1013
                   st->codec->bits_per_coded_sample, st->codec->color_table_id);
1014 1014
            /* figure out the palette situation */
1015 1015
            color_depth = st->codec->bits_per_coded_sample & 0x1F;
......
1091 1091
            get_be32(pb); /* vendor */
1092 1092

  
1093 1093
            st->codec->channels = get_be16(pb);             /* channel count */
1094
            dprintf(c->fc, "audio channels %d\n", st->codec->channels);
1094
            av_dlog(c->fc, "audio channels %d\n", st->codec->channels);
1095 1095
            st->codec->bits_per_coded_sample = get_be16(pb);      /* sample size */
1096 1096

  
1097 1097
            sc->audio_cid = get_be16(pb);
......
1100 1100
            st->codec->sample_rate = ((get_be32(pb) >> 16));
1101 1101

  
1102 1102
            //Read QT version 1 fields. In version 0 these do not exist.
1103
            dprintf(c->fc, "version =%d, isom =%d\n",version,c->isom);
1103
            av_dlog(c->fc, "version =%d, isom =%d\n",version,c->isom);
1104 1104
            if(!c->isom) {
1105 1105
                if(version==1) {
1106 1106
                    sc->samples_per_frame = get_be32(pb);
......
1271 1271

  
1272 1272
    entries = get_be32(pb);
1273 1273

  
1274
    dprintf(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries);
1274
    av_dlog(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries);
1275 1275

  
1276 1276
    if(entries >= UINT_MAX / sizeof(*sc->stsc_data))
1277 1277
        return -1;
......
1311 1311

  
1312 1312
    for (i = 0; i < entries; i++) {
1313 1313
        sc->stps_data[i] = get_be32(pb);
1314
        //dprintf(c->fc, "stps %d\n", sc->stps_data[i]);
1314
        //av_dlog(c->fc, "stps %d\n", sc->stps_data[i]);
1315 1315
    }
1316 1316

  
1317 1317
    return 0;
......
1333 1333

  
1334 1334
    entries = get_be32(pb);
1335 1335

  
1336
    dprintf(c->fc, "keyframe_count = %d\n", entries);
1336
    av_dlog(c->fc, "keyframe_count = %d\n", entries);
1337 1337

  
1338 1338
    if(entries >= UINT_MAX / sizeof(int))
1339 1339
        return -1;
......
1344 1344

  
1345 1345
    for(i=0; i<entries; i++) {
1346 1346
        sc->keyframes[i] = get_be32(pb);
1347
        //dprintf(c->fc, "keyframes[]=%d\n", sc->keyframes[i]);
1347
        //av_dlog(c->fc, "keyframes[]=%d\n", sc->keyframes[i]);
1348 1348
    }
1349 1349
    return 0;
1350 1350
}
......
1377 1377
    }
1378 1378
    entries = get_be32(pb);
1379 1379

  
1380
    dprintf(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries);
1380
    av_dlog(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries);
1381 1381

  
1382 1382
    sc->sample_count = entries;
1383 1383
    if (sample_size)
......
1434 1434
    get_be24(pb); /* flags */
1435 1435
    entries = get_be32(pb);
1436 1436

  
1437
    dprintf(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries);
1437
    av_dlog(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries);
1438 1438

  
1439 1439
    if(entries >= UINT_MAX / sizeof(*sc->stts_data))
1440 1440
        return -1;
......
1452 1452
        sc->stts_data[i].count= sample_count;
1453 1453
        sc->stts_data[i].duration= sample_duration;
1454 1454

  
1455
        dprintf(c->fc, "sample_count=%d, sample_duration=%d\n",sample_count,sample_duration);
1455
        av_dlog(c->fc, "sample_count=%d, sample_duration=%d\n",sample_count,sample_duration);
1456 1456

  
1457 1457
        duration+=(int64_t)sample_duration*sample_count;
1458 1458
        total_sample_count+=sample_count;
......
1479 1479
    get_be24(pb); /* flags */
1480 1480
    entries = get_be32(pb);
1481 1481

  
1482
    dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
1482
    av_dlog(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
1483 1483

  
1484 1484
    if(entries >= UINT_MAX / sizeof(*sc->ctts_data))
1485 1485
        return -1;
......
1498 1498
            sc->dts_shift = FFMAX(sc->dts_shift, -duration);
1499 1499
    }
1500 1500

  
1501
    dprintf(c->fc, "dts shift %d\n", sc->dts_shift);
1501
    av_dlog(c->fc, "dts shift %d\n", sc->dts_shift);
1502 1502

  
1503 1503
    return 0;
1504 1504
}
......
1578 1578
                    e->size = sample_size;
1579 1579
                    e->min_distance = distance;
1580 1580
                    e->flags = keyframe ? AVINDEX_KEYFRAME : 0;
1581
                    dprintf(mov->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", "
1581
                    av_dlog(mov->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", "
1582 1582
                            "size %d, distance %d, keyframe %d\n", st->index, current_sample,
1583 1583
                            current_offset, current_dts, sample_size, distance, keyframe);
1584 1584
                }
......
1626 1626
            total += chunk_count * count;
1627 1627
        }
1628 1628

  
1629
        dprintf(mov->fc, "chunk count %d\n", total);
1629
        av_dlog(mov->fc, "chunk count %d\n", total);
1630 1630
        if (total >= UINT_MAX / sizeof(*st->index_entries))
1631 1631
            return;
1632 1632
        st->index_entries = av_malloc(total*sizeof(*st->index_entries));
......
1670 1670
                e->size = size;
1671 1671
                e->min_distance = 0;
1672 1672
                e->flags = AVINDEX_KEYFRAME;
1673
                dprintf(mov->fc, "AVIndex stream %d, chunk %d, offset %"PRIx64", dts %"PRId64", "
1673
                av_dlog(mov->fc, "AVIndex stream %d, chunk %d, offset %"PRIx64", dts %"PRId64", "
1674 1674
                        "size %d, duration %d\n", st->index, i, current_offset, current_dts,
1675 1675
                        size, samples);
1676 1676

  
......
1764 1764
        !st->codec->frame_size && sc->stts_count == 1) {
1765 1765
        st->codec->frame_size = av_rescale(sc->stts_data[0].duration,
1766 1766
                                           st->codec->sample_rate, sc->time_scale);
1767
        dprintf(c->fc, "frame size %d\n", st->codec->frame_size);
1767
        av_dlog(c->fc, "frame size %d\n", st->codec->frame_size);
1768 1768
    }
1769 1769

  
1770 1770
    mov_build_index(c, st);
......
1961 1961
    frag->duration = flags & 0x08 ? get_be32(pb) : trex->duration;
1962 1962
    frag->size     = flags & 0x10 ? get_be32(pb) : trex->size;
1963 1963
    frag->flags    = flags & 0x20 ? get_be32(pb) : trex->flags;
1964
    dprintf(c->fc, "frag flags 0x%x\n", frag->flags);
1964
    av_dlog(c->fc, "frag flags 0x%x\n", frag->flags);
1965 1965
    return 0;
1966 1966
}
1967 1967

  
......
2019 2019
    get_byte(pb); /* version */
2020 2020
    flags = get_be24(pb);
2021 2021
    entries = get_be32(pb);
2022
    dprintf(c->fc, "flags 0x%x entries %d\n", flags, entries);
2022
    av_dlog(c->fc, "flags 0x%x entries %d\n", flags, entries);
2023 2023
    if (flags & 0x001) data_offset        = get_be32(pb);
2024 2024
    if (flags & 0x004) first_sample_flags = get_be32(pb);
2025 2025
    if (flags & 0x800) {
......
2035 2035
    dts = st->duration;
2036 2036
    offset = frag->base_data_offset + data_offset;
2037 2037
    distance = 0;
2038
    dprintf(c->fc, "first sample flags 0x%x\n", first_sample_flags);
2038
    av_dlog(c->fc, "first sample flags 0x%x\n", first_sample_flags);
2039 2039
    for (i = 0; i < entries; i++) {
2040 2040
        unsigned sample_size = frag->size;
2041 2041
        int sample_flags = i ? frag->flags : first_sample_flags;
......
2055 2055
            distance = 0;
2056 2056
        av_add_index_entry(st, offset, dts, sample_size, distance,
2057 2057
                           keyframe ? AVINDEX_KEYFRAME : 0);
2058
        dprintf(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", "
2058
        av_dlog(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", "
2059 2059
                "size %d, distance %d, keyframe %d\n", st->index, sc->sample_count+i,
2060 2060
                offset, dts, sample_size, distance, keyframe);
2061 2061
        distance++;
......
2172 2172
        av_log(c->fc, AV_LOG_WARNING, "multiple edit list entries, "
2173 2173
               "a/v desync might occur, patch welcome\n");
2174 2174

  
2175
    dprintf(c->fc, "track[%i].edit_count = %i\n", c->fc->nb_streams-1, edit_count);
2175
    av_dlog(c->fc, "track[%i].edit_count = %i\n", c->fc->nb_streams-1, edit_count);
2176 2176
    return 0;
2177 2177
}
2178 2178

  
......
2363 2363
        av_log(s, AV_LOG_ERROR, "moov atom not found\n");
2364 2364
        return -1;
2365 2365
    }
2366
    dprintf(mov->fc, "on_parse_exit_offset=%lld\n", url_ftell(pb));
2366
    av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", url_ftell(pb));
2367 2367

  
2368 2368
    if (!url_is_streamed(pb) && mov->chapter_track > 0)
2369 2369
        mov_read_chapters(s);
......
2382 2382
        if (msc->pb && msc->current_sample < avst->nb_index_entries) {
2383 2383
            AVIndexEntry *current_sample = &avst->index_entries[msc->current_sample];
2384 2384
            int64_t dts = av_rescale(current_sample->timestamp, AV_TIME_BASE, msc->time_scale);
2385
            dprintf(s, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts);
2385
            av_dlog(s, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts);
2386 2386
            if (!sample || (url_is_streamed(s->pb) && current_sample->pos < sample->pos) ||
2387 2387
                (!url_is_streamed(s->pb) &&
2388 2388
                 ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb &&
......
2412 2412
            mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
2413 2413
            url_feof(s->pb))
2414 2414
            return AVERROR_EOF;
2415
        dprintf(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb));
2415
        av_dlog(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb));
2416 2416
        goto retry;
2417 2417
    }
2418 2418
    sc = st->priv_data;
......
2463 2463
        goto retry;
2464 2464
    pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0;
2465 2465
    pkt->pos = sample->pos;
2466
    dprintf(s, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n",
2466
    av_dlog(s, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n",
2467 2467
            pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration);
2468 2468
    return 0;
2469 2469
}
......
2475 2475
    int i;
2476 2476

  
2477 2477
    sample = av_index_search_timestamp(st, timestamp, flags);
2478
    dprintf(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample);
2478
    av_dlog(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample);
2479 2479
    if (sample < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp)
2480 2480
        sample = 0;
2481 2481
    if (sample < 0) /* not sure what to do */
2482 2482
        return -1;
2483 2483
    sc->current_sample = sample;
2484
    dprintf(s, "stream %d, found sample %d\n", st->index, sc->current_sample);
2484
    av_dlog(s, "stream %d, found sample %d\n", st->index, sc->current_sample);
2485 2485
    /* adjust ctts index */
2486 2486
    if (sc->ctts_data) {
2487 2487
        time_sample = 0;

Also available in: Unified diff