From patchwork Sat Dec 31 10:48:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 1999 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp3201226vsb; Sat, 31 Dec 2016 02:48:32 -0800 (PST) X-Received: by 10.194.141.47 with SMTP id rl15mr17878880wjb.135.1483181312684; Sat, 31 Dec 2016 02:48:32 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b143si33065761wmb.45.2016.12.31.02.48.32; Sat, 31 Dec 2016 02:48:32 -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=@gmail.com; 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=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 03BF8689B3D; Sat, 31 Dec 2016 12:48:26 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wj0-f175.google.com (mail-wj0-f175.google.com [209.85.210.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CD5B36898DB for ; Sat, 31 Dec 2016 12:48:19 +0200 (EET) Received: by mail-wj0-f175.google.com with SMTP id tq7so156480261wjb.0 for ; Sat, 31 Dec 2016 02:48:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=ZgiOvcS79DiB3B3OKXXgEfX7ZGQS9wS1Tk488YaMriw=; b=LCIY8VPqxidzkpl4DrNKF2UJ7OeshRVtvboDN+MrELeTA4ZaXn71n9kEYwQiy3SCxJ 7VWpNCoLtojMhqrfcTPxBxqtgWzvt88+WzYZzlhbbSmOT/Czcyg+aKszlpC96l9xUeD9 K8nZrbW7ZWQAV/ErGV7xOHnx79U6+TsatGNLxYjMJ4W/PA59I41I1rRRDacauhWnmfLS U3gyB2+dTyIoOTSZdbD7zVDm71klL7X2EEi/blVdrkoIx67uup1flxY/4qiARcob401u l7L/gVho3iJuoU/DmDUO6vFTm/epFZsnq4eyRILi3F1TdCm/ZLewrtTseYbsvFVxdacU 8ELg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=ZgiOvcS79DiB3B3OKXXgEfX7ZGQS9wS1Tk488YaMriw=; b=FPdE+Vur9/GGw2KJbSgSiXxf8UjXpgUjKncIQ4C+GlDQy3v8aksKs+gpKKDuE+Vooq db2JoQPdelV69vfEBRn9zBWL0F2VPuAyS+GfdBbPpORgnTh6+g97g+sZCdd7evtVyDuS D6lp7QWYbzEmEEeTfMjo1d+tVhRph07Z1sQYJim4jn2AUA16Ixzl58bkTb7k3TP5Fa5w x23d1qeaRwz+90mCrCKh1TZMctYwQUZctr6rB2Kn6fibpB1ItHqf5Aala4GvtZc3AQqv vP3LtdS9J/6ZnMSI5BKOIEu60nll1vR7Qm5l7UtqwIdDZECn6hfLjirEPrDPx0fQw0V/ SWng== X-Gm-Message-State: AIkVDXIpfOWBseQaq3pwl0ww43Ue4KePnXvr3TiElfJCOeWFbm6iP/+6uweuOYrKEc17rPJgKV31zeyF46UuGQ== X-Received: by 10.194.136.166 with SMTP id qb6mr41772731wjb.42.1483181303340; Sat, 31 Dec 2016 02:48:23 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.171.106 with HTTP; Sat, 31 Dec 2016 02:48:22 -0800 (PST) In-Reply-To: References: <20161230171111.GA26868@sunshine.barsnick.net> From: Steven Liu Date: Sat, 31 Dec 2016 18:48:22 +0800 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] [PATCH] libavformat/hlsenc: default segment name and, use_localtime 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 2016-12-31 1:24 GMT+08:00 Bodecs Bela : > > 2016.12.30. 18:11 keltezéssel, Moritz Barsnick írta: > >> On Fri, Dec 30, 2016 at 15:38:25 +0100, Bodecs Bela wrote: >> >>> is not available on all system/environment. This patch checks %s >>> availabilty at runtine and alter the default format string if necessary. >>> >> You forgot to add the patch. >> > please, forgive me. I attached it now. > > >> Moritz >> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > > Bela > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > Signed-off-by: Bela Bodecs --- libavformat/hlsenc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) const char *vtt_pattern = "%d.vtt"; AVDictionary *options = NULL; int basename_size; diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index c9d8e3c..76b85e8 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -829,13 +829,22 @@ fail: return err; } +static const char * get_default_pattern_localtime_fmt(void) +{ + char b[21]; + time_t t = time(NULL); + struct tm *p, tmbuf; + p = localtime_r(&t, &tmbuf); + return (strftime(b, sizeof(b), "%s", p) > 2) ? "-%s.ts" : "-%Y%m%d%H%I%S.ts"; Why check strftime result bigger than 2,not 1 not 3? +} + static int hls_write_header(AVFormatContext *s) { HLSContext *hls = s->priv_data; int ret, i; char *p; const char *pattern = "%d.ts"; - const char *pattern_localtime_fmt = "-%s.ts"; + const char *pattern_localtime_fmt = get_default_pattern_localtime_fmt();