lavf/srtenc: simplify timing printing.
authorClément Bœsch <ubitux@gmail.com>
Sun, 21 Oct 2012 00:49:01 +0000 (02:49 +0200)
committerClément Bœsch <ubitux@gmail.com>
Wed, 24 Oct 2012 22:17:46 +0000 (00:17 +0200)
libavformat/srtenc.c

index 0b094b0..42a264e 100644 (file)
@@ -60,9 +60,7 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt)
 
     srt->index++;
     if (write_ts) {
-        char buf[64];
         int64_t s = pkt->pts, e, d = pkt->duration;
-        int len;
 
         if (d <= 0)
             /* For backward compatibility, fallback to convergence_duration. */
@@ -72,14 +70,12 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt)
             return AVERROR(EINVAL);
         }
         e = s + d;
-        len = snprintf(buf, sizeof(buf),
-                       "%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n",
+        avio_printf(avf->pb, "%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n",
                        srt->index,
                        (int)(s / 3600000),      (int)(s / 60000) % 60,
                        (int)(s /    1000) % 60, (int)(s %  1000),
                        (int)(e / 3600000),      (int)(e / 60000) % 60,
                        (int)(e /    1000) % 60, (int)(e %  1000));
-        avio_write(avf->pb, buf, len);
     }
     avio_write(avf->pb, pkt->data, pkt->size);
     if (write_ts)