[FFmpeg-cvslog] avformat/cutils, dvenc: Move ff_brktimegm to its only user

Andreas Rheinhardt git at videolan.org
Wed Feb 3 23:38:52 EET 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Fri Jan 29 18:02:51 2021 +0100| [a703410d254b9d7097d7da8340d7eb5a60d09162] | committer: Andreas Rheinhardt

avformat/cutils, dvenc: Move ff_brktimegm to its only user

This also allows to completely remove cutils.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a703410d254b9d7097d7da8340d7eb5a60d09162
---

 libavformat/Makefile   |  1 -
 libavformat/cutils.c   | 39 ---------------------------------------
 libavformat/dvenc.c    | 13 +++++++++++--
 libavformat/internal.h |  2 --
 4 files changed, 11 insertions(+), 44 deletions(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 3a8fbcbe5f..c820dd35f4 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -8,7 +8,6 @@ HEADERS = avformat.h                                                    \
 OBJS = allformats.o         \
        avio.o               \
        aviobuf.o            \
-       cutils.o             \
        dump.o               \
        format.o             \
        id3v1.o              \
diff --git a/libavformat/cutils.c b/libavformat/cutils.c
deleted file mode 100644
index d86ba05441..0000000000
--- a/libavformat/cutils.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * various simple utilities for libavformat
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/time_internal.h"
-#include "avformat.h"
-#include "internal.h"
-
-#define ISLEAP(y) (((y) % 4 == 0) && (((y) % 100) != 0 || ((y) % 400) == 0))
-#define LEAPS_COUNT(y) ((y)/4 - (y)/100 + (y)/400)
-
-/* This is our own gmtime_r. It differs from its POSIX counterpart in a
-   couple of places, though. */
-struct tm *ff_brktimegm(time_t secs, struct tm *tm)
-{
-    tm = gmtime_r(&secs, tm);
-
-    tm->tm_year += 1900; /* unlike gmtime_r we store complete year here */
-    tm->tm_mon  += 1;    /* unlike gmtime_r tm_mon is from 1 to 12 */
-
-    return tm;
-}
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
index 6c0d40f819..320f8479f0 100644
--- a/libavformat/dvenc.c
+++ b/libavformat/dvenc.c
@@ -29,6 +29,7 @@
  */
 #include <time.h>
 
+#include "libavutil/time_internal.h"
 #include "avformat.h"
 #include "internal.h"
 #include "libavcodec/dv_profile.h"
@@ -72,6 +73,14 @@ static const int dv_aaux_packs_dist[12][9] = {
     { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
 };
 
+static void brktimegm(time_t secs, struct tm *tm)
+{
+    tm = gmtime_r(&secs, tm);
+
+    tm->tm_year += 1900; /* unlike gmtime_r we store complete year here */
+    tm->tm_mon  += 1;    /* unlike gmtime_r tm_mon is from 1 to 12 */
+}
+
 static int dv_audio_frame_size(const AVDVProfile* sys, int frame, int sample_rate)
 {
     if ((sys->time_base.den == 25 || sys->time_base.den == 50) && sys->time_base.num == 1) {
@@ -143,7 +152,7 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
     case dv_video_recdate:  /* VAUX recording date */
         ct = c->start_time + av_rescale_rnd(c->frames, c->sys->time_base.num,
                                             c->sys->time_base.den, AV_ROUND_DOWN);
-        ff_brktimegm(ct, &tc);
+        brktimegm(ct, &tc);
         buf[1] = 0xff; /* ds, tm, tens of time zone, units of time zone */
                        /* 0xff is very likely to be "unknown" */
         buf[2] = (3 << 6) | /* reserved -- always 1 */
@@ -159,7 +168,7 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
     case dv_video_rectime:  /* VAUX recording time */
         ct = c->start_time + av_rescale_rnd(c->frames, c->sys->time_base.num,
                                                        c->sys->time_base.den, AV_ROUND_DOWN);
-        ff_brktimegm(ct, &tc);
+        brktimegm(ct, &tc);
         buf[1] = (3 << 6) | /* reserved -- always 1 */
                  0x3f; /* tens of frame, units of frame: 0x3f - "unknown" ? */
         buf[2] = (1 << 7) | /* reserved -- always 1 */
diff --git a/libavformat/internal.h b/libavformat/internal.h
index f45b1cd6b4..d0db331b96 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -365,8 +365,6 @@ do {\
 } while(0)
 #endif
 
-struct tm *ff_brktimegm(time_t secs, struct tm *tm);
-
 /**
  * Automatically create sub-directories
  *



More information about the ffmpeg-cvslog mailing list