From patchwork Wed Nov 29 15:44:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jeyapal, Karthick" X-Patchwork-Id: 6451 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp4651033jah; Wed, 29 Nov 2017 07:44:38 -0800 (PST) X-Google-Smtp-Source: AGs4zMaf1vd5klB+2znYf/6ZgYgrrwL5DDbt2SAY6MI1YYx/C9UWyspjTwKghch4LfyOO3dm6g3u X-Received: by 10.223.182.147 with SMTP id j19mr2597611wre.159.1511970278783; Wed, 29 Nov 2017 07:44:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511970278; cv=none; d=google.com; s=arc-20160816; b=xx3IKW5M1XrECChT4c3AJHKqIoKNWJpmQQGS9S9C3K2t96fRDdj8HtyyAja8MSSSLh 2vfviZJtWL9vKzVCE3COL5OA/drTdvAgdWn8LRMpYE8guxf/f5kMrxDGVDLsEJplVG3f OSfLMTXJXGr8NNaSXLzHoF4FWeotL7/CfhRnAgMIBJLKPSuNnRQ2AsaexbFh4W9dH9To r5lDrPhdFQ0WY7gDGT0Jj4qTIymFYXsCE2qcvyQlOgewOjPqhdXhiTjRz9UP3IhV+H6e PvIE9L2AiyxWKp8vCDQvV330njTXM4ajuxbUgu2fBu0dBodwCxA5h1cITT8522hMOIhI 4jGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=deWfsrJFWZAXTifbXVAjOKRUmqJIPfBIBzzKNPsBZ+M=; b=YebRl6stEvtXxhEmkMVK8TeJvmZLujdHBCyghb7uya489PpJiWnL0Ot9I3Z/eBo+EF IOzVWdAqDfgFyp4SeaOq7RIqis6yFES23worLyguLgEw1lzGz89LR1sIZc7iaji4L1ic Ue4zh6kXCAVInix05BLM3sBOuebV99MJ4Rx0hbgm0VVrXeIuc0Jj2PfF106x1PUBYneK v+58ba9h1FHzDswN8uUofWIeP+OaCseUwRopLUBp42IN6kwmgevmIWUAVx2fB9WS73fs e7UHIBaYXwLl1UfS8WO71CJhMQS6K63BLqATYYMnZUMEbDbsHKLNjqVtasCszuCDbGlh eR4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@smtpservice.net header.s=m78bu0.a1-4.dyn header.b=HyUB9fEp; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id c138si1562363wmh.28.2017.11.29.07.44.38; Wed, 29 Nov 2017 07:44:38 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@smtpservice.net header.s=m78bu0.a1-4.dyn header.b=HyUB9fEp; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 20B4968A4AB; Wed, 29 Nov 2017 17:44:34 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from a2i831.smtp2go.com (a2i831.smtp2go.com [103.47.207.63]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5B94568A460 for ; Wed, 29 Nov 2017 17:44:27 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=m78bu0.a1-4.dyn; x=1511971176; h=Feedback-ID: X-Smtpcorp-Track:Message-Id:Date:Subject:To:From:Reply-To:Sender: List-Unsubscribe; bh=rKMYElDMlWywBvwPEUaTCklqCjhFAH1xGaEEUAxCh+E=; b=HyUB9fEp M+rbvZssFGXnGnznhREQ88B8Rt05ccd5ngm6yTweca9UJkcVKkHgoWmfuWMmZMm1ypVQrtOS31C5A Z4NAg1Chrf60cXWrdNcUC6C2QpcEUURUpqX+wi64VCPv9RiLoY54oIeRNlYoUXPAE4BC/nJ9ZDNTc 65IUsqLEicc9okrF41xL7gIoPr2grisHffuoGRMX14UmdtpDKq5123wb0GTU6gufZxPNA3qKL9x3P +R1RELnouDpv+jtj1lA6XJdJxZsk6VVSocCWtbSApirEl6C1rdaYBlBplIs2QUJa0NXj6BvPdq/ow opOPijJKizjYPj+JFWr2ZJ837Q==; From: Karthick J To: ffmpeg-devel@ffmpeg.org Date: Wed, 29 Nov 2017 21:14:14 +0530 Message-Id: <1511970255-12569-1-git-send-email-kjeyapal@akamai.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511968600-8168-2-git-send-email-kjeyapal@akamai.com> References: <1511968600-8168-2-git-send-email-kjeyapal@akamai.com> X-Smtpcorp-Track: 1-K4bUNmF6xb3j.HpbYVXQXI Feedback-ID: 337386m:337386asVRLGB:337386sujvI7RAeX:SMTPCORP X-Report-Abuse: Please forward a copy of this message, including all headers, to Subject: [FFmpeg-devel] [PATCH v2 1/2] avformat/hlsenc: Refactored 'get_int_from_double' function to allow reuse X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Karthick Jeyapal MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Karthick Jeyapal --- libavformat/hlsenc.c | 7 +------ libavformat/hlsplaylist.h | 5 +++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index f63b08d..cdfbf45 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -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; diff --git a/libavformat/hlsplaylist.h b/libavformat/hlsplaylist.h index fd36c7e..68ef8d4 100644 --- a/libavformat/hlsplaylist.h +++ b/libavformat/hlsplaylist.h @@ -32,6 +32,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);