summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2017-05-23 11:50:40 +0200
committerStefano Sabatini <stefasab@gmail.com>2017-05-31 15:46:14 +0200
commit002dbc5a1f2a6008acd29bd7cfa6733a745224bf (patch)
treef2b86157c671adfd706f76e8fab8898918626bc6
parent47c43ce36f0c48b800b5367674839c16f10dc597 (diff)
examples/encode_video: add log
This helps to visualize how the send/receive API works.
-rw-r--r--doc/examples/encode_video.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c
index d2075c12bf..107bea2992 100644
--- a/doc/examples/encode_video.c
+++ b/doc/examples/encode_video.c
@@ -42,6 +42,9 @@ static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,
int ret;
/* send the frame to the encoder */
+ if (frame)
+ printf("Send frame %3"PRId64"\n", frame->pts);
+
ret = avcodec_send_frame(enc_ctx, frame);
if (ret < 0) {
fprintf(stderr, "Error sending a frame for encoding\n");
@@ -57,7 +60,7 @@ static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,
exit(1);
}
- printf("Write frame %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
+ printf("Write packet %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
fwrite(pkt->data, 1, pkt->size, outfile);
av_packet_unref(pkt);
}