Revision 08ad81cb libavformat/utils.c

View differences:

libavformat/utils.c
3494 3494
    hex_dump_internal(avcl, NULL, level, buf, size);
3495 3495
}
3496 3496

  
3497
 //FIXME needs to know the time_base
3498
static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload)
3497
static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload, AVRational time_base)
3499 3498
{
3500 3499
#undef fprintf
3501 3500
#define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
3502 3501
    PRINT("stream #%d:\n", pkt->stream_index);
3503 3502
    PRINT("  keyframe=%d\n", ((pkt->flags & AV_PKT_FLAG_KEY) != 0));
3504
    PRINT("  duration=%0.3f\n", (double)pkt->duration / AV_TIME_BASE);
3503
    PRINT("  duration=%0.3f\n", pkt->duration * av_q2d(time_base));
3505 3504
    /* DTS is _always_ valid after av_read_frame() */
3506 3505
    PRINT("  dts=");
3507 3506
    if (pkt->dts == AV_NOPTS_VALUE)
3508 3507
        PRINT("N/A");
3509 3508
    else
3510
        PRINT("%0.3f", (double)pkt->dts / AV_TIME_BASE);
3509
        PRINT("%0.3f", pkt->dts * av_q2d(time_base));
3511 3510
    /* PTS may not be known if B-frames are present. */
3512 3511
    PRINT("  pts=");
3513 3512
    if (pkt->pts == AV_NOPTS_VALUE)
3514 3513
        PRINT("N/A");
3515 3514
    else
3516
        PRINT("%0.3f", (double)pkt->pts / AV_TIME_BASE);
3515
        PRINT("%0.3f", pkt->pts * av_q2d(time_base));
3517 3516
    PRINT("\n");
3518 3517
    PRINT("  size=%d\n", pkt->size);
3519 3518
#undef PRINT
......
3523 3522

  
3524 3523
void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload)
3525 3524
{
3526
    pkt_dump_internal(NULL, f, 0, pkt, dump_payload);
3525
    AVRational tb = { 1, AV_TIME_BASE };
3526
    pkt_dump_internal(NULL, f, 0, pkt, dump_payload, tb);
3527
}
3528

  
3529
void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st)
3530
{
3531
    pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
3527 3532
}
3528 3533

  
3529 3534
void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload)
3530 3535
{
3531
    pkt_dump_internal(avcl, NULL, level, pkt, dump_payload);
3536
    AVRational tb = { 1, AV_TIME_BASE };
3537
    pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, tb);
3538
}
3539

  
3540
void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
3541
                      AVStream *st)
3542
{
3543
    pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
3532 3544
}
3533 3545

  
3534 3546
#if FF_API_URL_SPLIT

Also available in: Unified diff