diff options
author | Martin Storsjö <martin@martin.st> | 2011-02-24 10:08:06 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2011-03-02 11:29:38 +0100 |
commit | 863c471638fa667e6e5c5df059b67af263e1cd40 (patch) | |
tree | 06a4365dd6e96844c95b5c4fe52d7fe8a2130bc7 /libavformat/utils.c | |
parent | e360ada2d13af36ab7afd9ebcd2bd236d23d9b96 (diff) | |
download | ffmpeg-streaming-863c471638fa667e6e5c5df059b67af263e1cd40.zip ffmpeg-streaming-863c471638fa667e6e5c5df059b67af263e1cd40.tar.gz |
libavformat: Add av_pkt_dump{, _log}2, taking an AVStream parameter
This removes a fixme issue, by allowing the av_pkt_dump functions
to use the correct time base.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 70da4ca..f48ed2a 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3494,26 +3494,25 @@ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size) hex_dump_internal(avcl, NULL, level, buf, size); } - //FIXME needs to know the time_base -static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload) +static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload, AVRational time_base) { #undef fprintf #define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0) PRINT("stream #%d:\n", pkt->stream_index); PRINT(" keyframe=%d\n", ((pkt->flags & AV_PKT_FLAG_KEY) != 0)); - PRINT(" duration=%0.3f\n", (double)pkt->duration / AV_TIME_BASE); + PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base)); /* DTS is _always_ valid after av_read_frame() */ PRINT(" dts="); if (pkt->dts == AV_NOPTS_VALUE) PRINT("N/A"); else - PRINT("%0.3f", (double)pkt->dts / AV_TIME_BASE); + PRINT("%0.3f", pkt->dts * av_q2d(time_base)); /* PTS may not be known if B-frames are present. */ PRINT(" pts="); if (pkt->pts == AV_NOPTS_VALUE) PRINT("N/A"); else - PRINT("%0.3f", (double)pkt->pts / AV_TIME_BASE); + PRINT("%0.3f", pkt->pts * av_q2d(time_base)); PRINT("\n"); PRINT(" size=%d\n", pkt->size); #undef PRINT @@ -3523,12 +3522,25 @@ static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload) { - pkt_dump_internal(NULL, f, 0, pkt, dump_payload); + AVRational tb = { 1, AV_TIME_BASE }; + pkt_dump_internal(NULL, f, 0, pkt, dump_payload, tb); +} + +void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st) +{ + pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base); } void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload) { - pkt_dump_internal(avcl, NULL, level, pkt, dump_payload); + AVRational tb = { 1, AV_TIME_BASE }; + pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, tb); +} + +void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, + AVStream *st) +{ + pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base); } #if FF_API_URL_SPLIT |