Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
be4edda6
Commit
be4edda6
authored
11 years ago
by
Martin Storsjö
Browse files
Options
Downloads
Patches
Plain Diff
http: Expose the content location via an AVOption
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
393d80cc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavformat/http.c
+15
-5
15 additions, 5 deletions
libavformat/http.c
libavformat/version.h
+1
-1
1 addition, 1 deletion
libavformat/version.h
with
16 additions
and
6 deletions
libavformat/http.c
+
15
−
5
View file @
be4edda6
...
@@ -51,7 +51,7 @@ typedef struct {
...
@@ -51,7 +51,7 @@ typedef struct {
int
http_code
;
int
http_code
;
int64_t
chunksize
;
/**< Used if "Transfer-Encoding: chunked" otherwise -1. */
int64_t
chunksize
;
/**< Used if "Transfer-Encoding: chunked" otherwise -1. */
int64_t
off
,
filesize
;
int64_t
off
,
filesize
;
char
location
[
MAX_URL_SIZE
]
;
char
*
location
;
HTTPAuthState
auth_state
;
HTTPAuthState
auth_state
;
HTTPAuthState
proxy_auth_state
;
HTTPAuthState
proxy_auth_state
;
char
*
headers
;
char
*
headers
;
...
@@ -83,6 +83,7 @@ static const AVOption options[] = {
...
@@ -83,6 +83,7 @@ static const AVOption options[] = {
{
"none"
,
"No auth method set, autodetect"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HTTP_AUTH_NONE
},
0
,
0
,
D
|
E
,
"auth_type"
},
{
"none"
,
"No auth method set, autodetect"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HTTP_AUTH_NONE
},
0
,
0
,
D
|
E
,
"auth_type"
},
{
"basic"
,
"HTTP basic authentication"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HTTP_AUTH_BASIC
},
0
,
0
,
D
|
E
,
"auth_type"
},
{
"basic"
,
"HTTP basic authentication"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HTTP_AUTH_BASIC
},
0
,
0
,
D
|
E
,
"auth_type"
},
{
"send_expect_100"
,
"Force sending an Expect: 100-continue header for POST"
,
OFFSET
(
send_expect_100
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
E
},
{
"send_expect_100"
,
"Force sending an Expect: 100-continue header for POST"
,
OFFSET
(
send_expect_100
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
E
},
{
"location"
,
"The actual location of the data received"
,
OFFSET
(
location
),
AV_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
D
|
E
},
{
NULL
}
{
NULL
}
};
};
#define HTTP_CLASS(flavor)\
#define HTTP_CLASS(flavor)\
...
@@ -218,7 +219,10 @@ int ff_http_do_new_request(URLContext *h, const char *uri)
...
@@ -218,7 +219,10 @@ int ff_http_do_new_request(URLContext *h, const char *uri)
int
ret
;
int
ret
;
s
->
off
=
0
;
s
->
off
=
0
;
av_strlcpy
(
s
->
location
,
uri
,
sizeof
(
s
->
location
));
av_free
(
s
->
location
);
s
->
location
=
av_strdup
(
uri
);
if
(
!
s
->
location
)
return
AVERROR
(
ENOMEM
);
av_dict_copy
(
&
options
,
s
->
chained_options
,
0
);
av_dict_copy
(
&
options
,
s
->
chained_options
,
0
);
ret
=
http_open_cnx
(
h
,
&
options
);
ret
=
http_open_cnx
(
h
,
&
options
);
...
@@ -235,7 +239,9 @@ static int http_open(URLContext *h, const char *uri, int flags,
...
@@ -235,7 +239,9 @@ static int http_open(URLContext *h, const char *uri, int flags,
h
->
is_streamed
=
1
;
h
->
is_streamed
=
1
;
s
->
filesize
=
-
1
;
s
->
filesize
=
-
1
;
av_strlcpy
(
s
->
location
,
uri
,
sizeof
(
s
->
location
));
s
->
location
=
av_strdup
(
uri
);
if
(
!
s
->
location
)
return
AVERROR
(
ENOMEM
);
if
(
options
)
if
(
options
)
av_dict_copy
(
&
s
->
chained_options
,
*
options
,
0
);
av_dict_copy
(
&
s
->
chained_options
,
*
options
,
0
);
...
@@ -335,10 +341,14 @@ static int process_line(URLContext *h, char *line, int line_count,
...
@@ -335,10 +341,14 @@ static int process_line(URLContext *h, char *line, int line_count,
while
(
av_isspace
(
*
p
))
while
(
av_isspace
(
*
p
))
p
++
;
p
++
;
if
(
!
av_strcasecmp
(
tag
,
"Location"
))
{
if
(
!
av_strcasecmp
(
tag
,
"Location"
))
{
char
redirected_location
[
MAX_URL_SIZE
];
char
redirected_location
[
MAX_URL_SIZE
]
,
*
new_loc
;
ff_make_absolute_url
(
redirected_location
,
sizeof
(
redirected_location
),
ff_make_absolute_url
(
redirected_location
,
sizeof
(
redirected_location
),
s
->
location
,
p
);
s
->
location
,
p
);
av_strlcpy
(
s
->
location
,
redirected_location
,
sizeof
(
s
->
location
));
new_loc
=
av_strdup
(
redirected_location
);
if
(
!
new_loc
)
return
AVERROR
(
ENOMEM
);
av_free
(
s
->
location
);
s
->
location
=
new_loc
;
*
new_location
=
1
;
*
new_location
=
1
;
}
else
if
(
!
av_strcasecmp
(
tag
,
"Content-Length"
)
&&
s
->
filesize
==
-
1
)
{
}
else
if
(
!
av_strcasecmp
(
tag
,
"Content-Length"
)
&&
s
->
filesize
==
-
1
)
{
s
->
filesize
=
strtoll
(
p
,
NULL
,
10
);
s
->
filesize
=
strtoll
(
p
,
NULL
,
10
);
...
...
This diff is collapsed.
Click to expand it.
libavformat/version.h
+
1
−
1
View file @
be4edda6
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 55
#define LIBAVFORMAT_VERSION_MAJOR 55
#define LIBAVFORMAT_VERSION_MINOR 10
#define LIBAVFORMAT_VERSION_MINOR 10
#define LIBAVFORMAT_VERSION_MICRO
0
#define LIBAVFORMAT_VERSION_MICRO
1
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
LIBAVFORMAT_VERSION_MINOR, \
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment