diff mbox

[FFmpeg-devel,02/11] avformat/matroskaenc: print debug message with cluster offsets only if the output is seekable

Message ID 20161003233707.3624-3-jamrial@gmail.com
State Accepted
Commit d41aeea8a64bab5d7aacd602f7214f95baad109f
Headers show

Commit Message

James Almer Oct. 3, 2016, 11:36 p.m. UTC
Printing the dynamic buffer offset is useless.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/matroskaenc.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 32d5dcf..501bab2 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1934,10 +1934,15 @@  static void mkv_start_new_cluster(AVFormatContext *s, AVPacket *pkt)
         pb = mkv->dyn_bc;
     }
 
-    av_log(s, AV_LOG_DEBUG,
-            "Starting new cluster at offset %" PRIu64 " bytes, "
-            "pts %" PRIu64 "dts %" PRIu64 "\n",
-            avio_tell(pb), pkt->pts, pkt->dts);
+    if (s->pb->seekable)
+        av_log(s, AV_LOG_DEBUG,
+               "Starting new cluster at offset %" PRIu64 " bytes, "
+               "pts %" PRIu64 "dts %" PRIu64 "\n",
+               avio_tell(s->pb), pkt->pts, pkt->dts);
+    else
+        av_log(s, AV_LOG_DEBUG, "Starting new cluster, "
+               "pts %" PRIu64 "dts %" PRIu64 "\n",
+               pkt->pts, pkt->dts);
     end_ebml_master(pb, mkv->cluster);
     mkv->cluster_pos = -1;
     if (mkv->dyn_bc)
@@ -2120,9 +2125,12 @@  static int mkv_write_flush_packet(AVFormatContext *s, AVPacket *pkt)
         pb = mkv->dyn_bc;
     if (!pkt) {
         if (mkv->cluster_pos != -1) {
-            av_log(s, AV_LOG_DEBUG,
-                   "Flushing cluster at offset %" PRIu64 " bytes\n",
-                   avio_tell(pb));
+            if (s->pb->seekable)
+                av_log(s, AV_LOG_DEBUG,
+                       "Flushing cluster at offset %" PRIu64 " bytes\n",
+                       avio_tell(s->pb));
+            else
+                av_log(s, AV_LOG_DEBUG, "Flushing cluster\n");
             end_ebml_master(pb, mkv->cluster);
             mkv->cluster_pos = -1;
             if (mkv->dyn_bc)