Commit 84e7aff6 authored by Jun Zhao's avatar Jun Zhao

tests/api/api-h264-test: Add AV_NOPTS_VALUE check for AVFrame.pkt_dts/pts

Use av_ts2str() for AVFrame.pkt_dts/pts to avoid print the
pkt_dts/pts as negative number like:
"0,    3616613, -9223372036854775808,     1001,  3110400, 0x75e37a65"
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarJun Zhao <mypopydev@gmail.com>
parent 9f33b0ed
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "libavcodec/avcodec.h" #include "libavcodec/avcodec.h"
#include "libavformat/avformat.h" #include "libavformat/avformat.h"
#include "libavutil/imgutils.h" #include "libavutil/imgutils.h"
#include "libavutil/timestamp.h"
static int video_decode_example(const char *input_filename) static int video_decode_example(const char *input_filename)
{ {
...@@ -131,9 +132,9 @@ static int video_decode_example(const char *input_filename) ...@@ -131,9 +132,9 @@ static int video_decode_example(const char *input_filename)
av_log(NULL, AV_LOG_ERROR, "Can't copy image to buffer\n"); av_log(NULL, AV_LOG_ERROR, "Can't copy image to buffer\n");
return number_of_written_bytes; return number_of_written_bytes;
} }
printf("%d, %10"PRId64", %10"PRId64", %8"PRId64", %8d, 0x%08lx\n", video_stream, printf("%d, %s, %s, %8"PRId64", %8d, 0x%08lx\n", video_stream,
fr->pts, fr->pkt_dts, fr->pkt_duration, av_ts2str(fr->pts), av_ts2str(fr->pkt_dts), fr->pkt_duration,
number_of_written_bytes, av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes)); number_of_written_bytes, av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes));
} }
av_packet_unref(&pkt); av_packet_unref(&pkt);
av_init_packet(&pkt); av_init_packet(&pkt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment