Re: [FFmpeg-devel] [PATCH V2] tests/api/api-h264-test: Add AV_NOPTS_VALUE check for AVFrame.pkt_dts
On Tue, Feb 12, 2019 at 7:38 AM Michael Niedermayer wrote: > > On Mon, Feb 11, 2019 at 11:21:27AM +0800, Jun Zhao wrote: > > Add AV_NOPTS_VALUE check for AVFrame.pkt_dts to avoid print the > > pkt_dts as negative number like: > > "0,3616613, -9223372036854775808, 1001, 3110400, 0x75e37a65" > > > > Signed-off-by: Jun Zhao > > --- > > tests/api/api-h264-test.c | 10 +++--- > > 1 files changed, 7 insertions(+), 3 deletions(-) > > > > diff --git a/tests/api/api-h264-test.c b/tests/api/api-h264-test.c > > index 9fa..55cd6cf 100644 > > --- a/tests/api/api-h264-test.c > > +++ b/tests/api/api-h264-test.c > > @@ -131,9 +131,13 @@ static int video_decode_example(const char > > *input_filename) > > av_log(NULL, AV_LOG_ERROR, "Can't copy image to > > buffer\n"); > > return number_of_written_bytes; > > } > > -printf("%d, %10"PRId64", %10"PRId64", %8"PRId64", %8d, > > 0x%08lx\n", video_stream, > > -fr->pts, fr->pkt_dts, fr->pkt_duration, > > -number_of_written_bytes, av_adler32_update(0, > > (const uint8_t*)byte_buffer, number_of_written_bytes)); > > + > > +if (fr->pkt_dts == AV_NOPTS_VALUE) > > +printf("%d, %10"PRId64", %s,", video_stream, fr->pts, > > "N/A"); > > you can simplify this by replacing %s by N/A > also the if() else could have {} added so any future additions > would not require the lines to be changed making future patches cleaner > > also av_ts2str() could be used > > either way, patch LGTM > > thanks > Will use av_ts2str() in the V3 patch, Tks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH V2] tests/api/api-h264-test: Add AV_NOPTS_VALUE check for AVFrame.pkt_dts
On Mon, Feb 11, 2019 at 11:21:27AM +0800, Jun Zhao wrote: > Add AV_NOPTS_VALUE check for AVFrame.pkt_dts to avoid print the > pkt_dts as negative number like: > "0,3616613, -9223372036854775808, 1001, 3110400, 0x75e37a65" > > Signed-off-by: Jun Zhao > --- > tests/api/api-h264-test.c | 10 +++--- > 1 files changed, 7 insertions(+), 3 deletions(-) > > diff --git a/tests/api/api-h264-test.c b/tests/api/api-h264-test.c > index 9fa..55cd6cf 100644 > --- a/tests/api/api-h264-test.c > +++ b/tests/api/api-h264-test.c > @@ -131,9 +131,13 @@ static int video_decode_example(const char > *input_filename) > av_log(NULL, AV_LOG_ERROR, "Can't copy image to > buffer\n"); > return number_of_written_bytes; > } > -printf("%d, %10"PRId64", %10"PRId64", %8"PRId64", %8d, > 0x%08lx\n", video_stream, > -fr->pts, fr->pkt_dts, fr->pkt_duration, > -number_of_written_bytes, av_adler32_update(0, (const > uint8_t*)byte_buffer, number_of_written_bytes)); > + > +if (fr->pkt_dts == AV_NOPTS_VALUE) > +printf("%d, %10"PRId64", %s,", video_stream, fr->pts, > "N/A"); you can simplify this by replacing %s by N/A also the if() else could have {} added so any future additions would not require the lines to be changed making future patches cleaner also av_ts2str() could be used either way, patch LGTM thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH V2] tests/api/api-h264-test: Add AV_NOPTS_VALUE check for AVFrame.pkt_dts
Add AV_NOPTS_VALUE check for AVFrame.pkt_dts to avoid print the pkt_dts as negative number like: "0,3616613, -9223372036854775808, 1001, 3110400, 0x75e37a65" Signed-off-by: Jun Zhao --- tests/api/api-h264-test.c | 10 +++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/api/api-h264-test.c b/tests/api/api-h264-test.c index 9fa..55cd6cf 100644 --- a/tests/api/api-h264-test.c +++ b/tests/api/api-h264-test.c @@ -131,9 +131,13 @@ static int video_decode_example(const char *input_filename) av_log(NULL, AV_LOG_ERROR, "Can't copy image to buffer\n"); return number_of_written_bytes; } -printf("%d, %10"PRId64", %10"PRId64", %8"PRId64", %8d, 0x%08lx\n", video_stream, -fr->pts, fr->pkt_dts, fr->pkt_duration, -number_of_written_bytes, av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes)); + +if (fr->pkt_dts == AV_NOPTS_VALUE) +printf("%d, %10"PRId64", %s,", video_stream, fr->pts, "N/A"); +else +printf("%d, %10"PRId64", %10"PRId64",", video_stream, fr->pts, fr->pkt_dts); +printf("%8"PRId64", %8d, 0x%08lx\n", fr->pkt_duration, + number_of_written_bytes, av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes)); } av_packet_unref(); av_init_packet(); -- 1.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel