Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
780d7897
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
780d7897
编写于
3月 05, 2010
作者:
M
Martin Storsjö
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a function ff_url_join for assembling URLs
Originally committed as revision 22225 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
67d4b3f2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
73 addition
and
0 deletion
+73
-0
libavformat/avformat.h
libavformat/avformat.h
+24
-0
libavformat/utils.c
libavformat/utils.c
+49
-0
未找到文件。
libavformat/avformat.h
浏览文件 @
780d7897
...
...
@@ -1350,6 +1350,30 @@ void url_split(char *proto, int proto_size,
char
*
path
,
int
path_size
,
const
char
*
url
);
/**
* Assembles a URL string from components. This is the reverse operation
* of url_split.
*
* Note, this requires networking to be initialized, so the caller must
* ensure ff_network_init has been called.
*
* @see url_split
*
* @param str the buffer to fill with the url
* @param size the size of the str buffer
* @param proto the protocol identifier, if null, the separator
* after the identifier is left out, too
* @param authorization an optional authorization string, may be null
* @param hostname the host name string
* @param port the port number, left out from the string if negative
* @param fmt a generic format string for everything to add after the
* host/port, may be null
* @return the number of characters written to the destination buffer
*/
int
ff_url_join
(
char
*
str
,
int
size
,
const
char
*
proto
,
const
char
*
authorization
,
const
char
*
hostname
,
int
port
,
const
char
*
fmt
,
...);
#if LIBAVFORMAT_VERSION_MAJOR < 53
/**
* @deprecated Use av_match_ext() instead.
...
...
libavformat/utils.c
浏览文件 @
780d7897
...
...
@@ -27,6 +27,10 @@
#include <sys/time.h>
#include <time.h>
#include <strings.h>
#include <stdarg.h>
#if CONFIG_NETWORK
#include "network.h"
#endif
#undef NDEBUG
#include <assert.h>
...
...
@@ -3446,3 +3450,48 @@ void av_set_pts_info(AVStream *s, int pts_wrap_bits,
if
(
!
s
->
time_base
.
num
||
!
s
->
time_base
.
den
)
s
->
time_base
.
num
=
s
->
time_base
.
den
=
0
;
}
int
ff_url_join
(
char
*
str
,
int
size
,
const
char
*
proto
,
const
char
*
authorization
,
const
char
*
hostname
,
int
port
,
const
char
*
fmt
,
...)
{
#if CONFIG_NETWORK
struct
addrinfo
hints
,
*
ai
;
#endif
str
[
0
]
=
'\0'
;
if
(
proto
)
av_strlcatf
(
str
,
size
,
"%s://"
,
proto
);
if
(
authorization
)
av_strlcatf
(
str
,
size
,
"%s@"
,
authorization
);
#if CONFIG_NETWORK && defined(AF_INET6)
/* Determine if hostname is a numerical IPv6 address,
* properly escape it within [] in that case. */
memset
(
&
hints
,
0
,
sizeof
(
hints
));
hints
.
ai_flags
=
AI_NUMERICHOST
;
if
(
!
getaddrinfo
(
hostname
,
NULL
,
&
hints
,
&
ai
))
{
if
(
ai
->
ai_family
==
AF_INET6
)
{
av_strlcat
(
str
,
"["
,
size
);
av_strlcat
(
str
,
hostname
,
size
);
av_strlcat
(
str
,
"]"
,
size
);
}
else
{
av_strlcat
(
str
,
hostname
,
size
);
}
freeaddrinfo
(
ai
);
}
else
#endif
/* Not an IPv6 address, just output the plain string. */
av_strlcat
(
str
,
hostname
,
size
);
if
(
port
>=
0
)
av_strlcatf
(
str
,
size
,
":%d"
,
port
);
if
(
fmt
)
{
va_list
vl
;
int
len
=
strlen
(
str
);
va_start
(
vl
,
fmt
);
vsnprintf
(
str
+
len
,
size
>
len
?
size
-
len
:
0
,
fmt
,
vl
);
va_end
(
vl
);
}
return
strlen
(
str
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录