From patchwork Mon Sep 4 08:06:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 4973 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.15.201 with SMTP id 70csp2880206jao; Mon, 4 Sep 2017 01:06:49 -0700 (PDT) X-Received: by 10.28.174.11 with SMTP id x11mr2939595wme.71.1504512409487; Mon, 04 Sep 2017 01:06:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504512409; cv=none; d=google.com; s=arc-20160816; b=dbMxFbpbu+zYXAcVhGT2r/Y1tVVZR2JCFiRUaA0duAc1kywEh8+AZmAVEkaMHQE5yC 98abVCKp72s9BNEaENUEUdZx0gTxfbPl/xKT9bh7x4UwWOmfo4R8MsPb0KnoZNtPQ637 QR+OG5ovceayGf9GzaiAigh00WSp2k1piz26SrGUrukUp9beEC2HXib6i2IbxDP2gjjl z4C8KzkfYThJp7w+Pp1MMysUB2/xlqBrSBKGqaE5KeMOIoWNwIvEMdgcb2jPBnNXKB2O clT78zRXpoIzyXaTxoy3TtIwyKwj9rBJgJwoGk8EzTuJ0MkZABPAPNwGaYedfgJz8cAU 8Ppw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:to:message-id:date:from:references:in-reply-to :mime-version:dkim-signature:delivered-to:arc-authentication-results; bh=rxUVcLjH1+XPamR9J63/uej4oGi34Oxl/Pe02uY/dqw=; b=b8l4lei2n70dSGXABU/YwQFunOU3G/C/1Gk9uVdZNsEbmT082k1pZu9pwDh1PRW0ca MpeokRbiIciW6qxQgRJla8CPsrcPRbwAuGESNKy4W0mJMWaluGVx1G+TvPXgEzTmAD3w JNHo02Gxyjt5gWhQElbzIbXRy7TIzb+Pz4jIa5CQbaDbUA24PPQktDCq1kXOzbUwe6hH nFXDfj4XZrKs6Sv/Ni111Ux67h9xEkazo1lvv4myxLCV+Lflqc6btscfdfZ9Oa638qd5 tug4TMohQat/Hj67mkN15hvOeAJrdqvnbrR7bwmKQGp1wxk2B13tWx04znsfmtKZlf2v VNXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=qqtm4vGc; 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 sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 196si4471613wmi.191.2017.09.04.01.06.49; Mon, 04 Sep 2017 01:06:49 -0700 (PDT) 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 header.s=20161025 header.b=qqtm4vGc; 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 sp=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 20F32689EDA; Mon, 4 Sep 2017 11:06:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi0-f51.google.com (mail-oi0-f51.google.com [209.85.218.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C3ACA689C98 for ; Mon, 4 Sep 2017 11:06:37 +0300 (EEST) Received: by mail-oi0-f51.google.com with SMTP id r203so39251339oih.0 for ; Mon, 04 Sep 2017 01:06:40 -0700 (PDT) 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 :content-transfer-encoding; bh=6yzLVH3UmCaFo1ge9gsD1l8YxxNr3pgdMIJxPdaF3dc=; b=qqtm4vGcdUF6kTw9EZHbB6TQjj63msJBwiW01dNhOzM3c5ZlF2DedEx6lc+DSv0WMZ h29MrnHATfkI288zPwLrGJAY51Y96z0e+fqpLyupnuaefJTvuRQcInb3oRlekyhU1jY6 Vn/TMONXFsifGvE5HXp+CztPovKwiEyGB6m8AJ66ZS5g+OC+X+sZXgKAcm8zzmn83mg8 XNnoDWOfb1bmbLzaNmiF3Aq1TRJ2x9QDnc0SSADMja6xVAL2oZsxJSIRLwoG0K+2UV3q mP3yOjxeq/D58TREsY6OWCzqN4014QeAlTZiAXbbZiwEk4co7btZJwwn2l9tpe54V3Mu g2Rg== 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:content-transfer-encoding; bh=6yzLVH3UmCaFo1ge9gsD1l8YxxNr3pgdMIJxPdaF3dc=; b=W/F6CHwBrJoC3T5FZf/c9mVZr6yph6h7Fu2QcH905WjEnuUtlNFWrLnuurLugWtxr0 ybfj8Vi+sjCSE1Fx0vNGcJWtYXt3ywzl0s0q3vLzQj5kxk6HiCXprYTlZq6eDcm1nZ7g 5w1AXVBSsMNfAau1C9TZ5tVBrRWQmywWfaJjEsS4JJ4hf7Y/RDawI9O07LzR2I5NA2L6 0/y0y8DKGo2pSpdp1CBAgDAtMNVUtfBhZwvpAAAP18Hdjsnsq5ioHtUQpyprYzmSv6Eo ScLD6rHoSmiwRWdEY/RWqosRGp4M+En5HFlSlxsl4MVeNCnSsHqVdd195/sXlsve7SNI AYKA== X-Gm-Message-State: AHPjjUjR+PwnAErHMUOb38FoH7wvbtzG55PPw56MlsPEeXK/s1tIKEZs pru4JVHpzPu48sRVZq2FbOz2QdoMVpIV X-Google-Smtp-Source: ADKCNb7vG9mF5H3L/35p4Ulk5hwvAOA8Ht07wF+gtlWm8bpg20HFneUbL5kFQlssBW0GIRnjnI1SyV1qFco5OeygOcw= X-Received: by 10.202.1.203 with SMTP id 194mr8762001oib.177.1504512398616; Mon, 04 Sep 2017 01:06:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.153.195 with HTTP; Mon, 4 Sep 2017 01:06:37 -0700 (PDT) In-Reply-To: <091B79F8-32D2-4038-A9B4-1869B9C10676@akamai.com> References: <599DE65F-2623-485C-B792-1B676ECD4B13@akamai.com> <57235E72-9C91-4A91-B81A-FF4D1FCFEEDF@akamai.com> <091B79F8-32D2-4038-A9B4-1869B9C10676@akamai.com> From: Steven Liu Date: Mon, 4 Sep 2017 16:06:37 +0800 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH 1/1] avformat/hlsenc: Added configuration to override HTTP User-Agent 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" 2017-09-04 16:01 GMT+08:00 Jeyapal, Karthick : >>On 9/4/17, 12:41 PM, "Steven Liu" > wrote: >> >>Hi Karthick, >>set user_agent better than user-agent, because the user-agent is >>duplicate with user_agent, and the user-agent will be deprecated in >>new version, refer to : >>https://ffmpeg.org/ffmpeg-protocols.html#http >> >> BTW, the patch is ok, if modify the user-agent to user_agent > > Hi Steven, > > Thanks for the reply. I am not using ‘user-agent’. I was using ‘http_user_agent’. Do you want me to rename ‘http_user_agent’ to ‘user_agent’? > I used ‘http_user_agent’ just to indirectly infer that it is http-specific option. But I am OK to rename it to ‘user_agent’ if you insist. > > Regards, > Karthick > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel From 352a1f8fa223f573ec634be55197a17c71dd606d Mon Sep 17 00:00:00 2001 From: Karthick J Date: Fri, 1 Sep 2017 15:55:48 +0530 Subject: [PATCH 1/1] avformat/hlsenc: Added configuration to override HTTP User-Agent Signed-off-by: Karthick J --- doc/muxers.texi | 4 ++++ libavformat/hlsenc.c | 5 +++++ libavformat/version.h | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 2bec5f8..5a4f17b 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -728,6 +728,10 @@ server using the HTTP PUT method, and update the m3u8 files every @code{refresh} times using the same method. Note that the HTTP server must support the given method for uploading files. + +@item http_user_agent +Override User-Agent field in HTTP header. Applicable only for HTTP output. + @end table @anchor{ico} diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index dd36fde..70ad281 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -175,6 +175,7 @@ typedef struct HLSContext { double initial_prog_date_time; char current_segment_final_filename_fmt[1024]; // when renaming segments + char *user_agent; } HLSContext; static int get_int_from_double(double val) @@ -975,6 +976,9 @@ static void set_http_options(AVFormatContext *s, AVDictionary **options, HLSCont av_log(c, AV_LOG_WARNING, "No HTTP method set, hls muxer defaulting to method PUT.\n"); av_dict_set(options, "method", "PUT", 0); } + if (c->user_agent) + av_dict_set(options, "user-agent", c->user_agent, 0); should be av_dict_set(options, "user_agent", c->user_agent, 0); + } static void write_m3u8_head_block(HLSContext *hls, AVIOContext *out, int version, @@ -1818,6 +1822,7 @@ static const AVOption options[] = { {"generic", "start_number value (default)", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_START_SEQUENCE_AS_START_NUMBER }, INT_MIN, INT_MAX, E, "start_sequence_source_type" }, {"epoch", "seconds since epoch", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_START_SEQUENCE_AS_SECONDS_SINCE_EPOCH }, INT_MIN, INT_MAX, E, "start_sequence_source_type" }, {"datetime", "current datetime as YYYYMMDDhhmmss", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_START_SEQUENCE_AS_FORMATTED_DATETIME }, INT_MIN, INT_MAX, E, "start_sequence_source_type" }, + {"http_user_agent", "override User-Agent field in HTTP header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, { NULL }, }; diff --git a/libavformat/version.h b/libavformat/version.h index 0af524c..9ee9d3e 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -33,7 +33,7 @@ // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 57 #define LIBAVFORMAT_VERSION_MINOR 80 -#define LIBAVFORMAT_VERSION_MICRO 100 +#define LIBAVFORMAT_VERSION_MICRO 101 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \