[FFmpeg-devel] [PATCH 1/1] avformat/hlsenc: Added configuration to override HTTP User-Agent
Steven Liu
lingjiujianke at gmail.com
Mon Sep 4 11:06:37 EEST 2017
2017-09-04 16:01 GMT+08:00 Jeyapal, Karthick <kjeyapal at akamai.com>:
>>On 9/4/17, 12:41 PM, "Steven Liu" <lingjiujianke at gmail.com<mailto:lingjiujianke at gmail.com>> 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 at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>From 352a1f8fa223f573ec634be55197a17c71dd606d Mon Sep 17 00:00:00 2001
From: Karthick J <kjeyapal at akamai.com>
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 <kjeyapal at akamai.com>
---
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.
+
+ at 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, \
--
1.9.1
More information about the ffmpeg-devel
mailing list