]> git.sesse.net Git - ffmpeg/commitdiff
avformat/hlsenc: Refactored 'get_int_from_double' function to allow reuse
authorKarthick J <kjeyapal@akamai.com>
Thu, 30 Nov 2017 02:54:54 +0000 (10:54 +0800)
committerSteven Liu <lq@chinaffmpeg.org>
Thu, 30 Nov 2017 02:54:54 +0000 (10:54 +0800)
libavformat/hlsenc.c
libavformat/hlsplaylist.h

index f63b08d7094baf046280555c5702f6de72d49d27..cdfbf458239200ddc632d231eed0972f3c0a278d 100644 (file)
@@ -203,11 +203,6 @@ typedef struct HLSContext {
     int http_persistent;
 } HLSContext;
 
-static int get_int_from_double(double val)
-{
-    return (int)((val - (int)val) >= 0.001) ? (int)(val + 1) : (int)val;
-}
-
 static int mkdir_p(const char *path) {
     int ret = 0;
     char *temp = av_strdup(path);
@@ -1211,7 +1206,7 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs)
 
     for (en = vs->segments; en; en = en->next) {
         if (target_duration <= en->duration)
-            target_duration = get_int_from_double(en->duration);
+            target_duration = hls_get_int_from_double(en->duration);
     }
 
     vs->discontinuity_set = 0;
index 9263a6463b41b151acd62f5c220f56628f824eb2..4cbc8cacc91520e8fe21a12f50d35417b55df12e 100644 (file)
@@ -36,6 +36,11 @@ typedef enum {
     PLAYLIST_TYPE_NB,
 } PlaylistType;
 
+static inline int hls_get_int_from_double(double val)
+{
+    return (int)((val - (int)val) >= 0.001) ? (int)(val + 1) : (int)val;
+}
+
 void ff_hls_write_playlist_version(AVIOContext *out, int version);
 void ff_hls_write_stream_info(AVStream *st, AVIOContext *out,
                               int bandwidth, char *filename);