Skip to content

Commit

Permalink
examples/hls2rtp: use custom user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
quarium authored and cmassiot committed Sep 26, 2024
1 parent c34d9b8 commit f439456
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/hls2rtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ static uint64_t bandwidth_max = UINT64_MAX;
static const char *url = NULL;
static const char *addr = "127.0.0.1";
static const char *dump = NULL;
static const char *user_agent = "hls2rtp/1.0";
static struct output video_output = {
.port = 5004,
.rtp_type = 96,
Expand Down Expand Up @@ -1282,6 +1283,7 @@ enum opt {
OPT_MIN_DEVIATION,
OPT_DELAY,
OPT_QUIT_TIMEOUT,
OPT_USER_AGENT,
};

static struct option options[] = {
Expand Down Expand Up @@ -1311,6 +1313,7 @@ static struct option options[] = {
{ "min-deviation", required_argument, NULL, OPT_MIN_DEVIATION },
{ "delay", required_argument, NULL, OPT_DELAY },
{ "quit-timeout", required_argument, NULL, OPT_QUIT_TIMEOUT },
{ "user-agent", required_argument, NULL, OPT_USER_AGENT },
{ 0, 0, 0, 0 },
};

Expand Down Expand Up @@ -1443,6 +1446,9 @@ int main(int argc, char **argv)
case OPT_QUIT_TIMEOUT:
quit_timeout = strtoull(optarg, NULL, 10);
break;
case OPT_USER_AGENT:
user_agent = optarg;
break;

case OPT_HELP:
return usage(argv[0], NULL);
Expand Down Expand Up @@ -1754,6 +1760,7 @@ int main(int argc, char **argv)
{
struct upipe_mgr *upipe_fsrc_mgr = upipe_fsrc_mgr_alloc();
struct upipe_mgr *upipe_http_src_mgr = upipe_http_src_mgr_alloc();
upipe_http_src_mgr_set_user_agent(upipe_http_src_mgr, user_agent);
assert(upipe_fsrc_mgr && upipe_http_src_mgr);
ubase_assert(upipe_auto_src_mgr_set_mgr(upipe_auto_src_mgr, "file",
upipe_fsrc_mgr));
Expand Down

0 comments on commit f439456

Please sign in to comment.