Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
云duo
FFmpeg
提交
ab0287fc
F
FFmpeg
项目概览
云duo
/
FFmpeg
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FFmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ab0287fc
编写于
2月 16, 2011
作者:
A
Anton Khirnov
提交者:
Janne Grunau
2月 17, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move find_info_tag to lavu and add av_ prefix to it
Signed-off-by:
N
Janne Grunau
<
janne-ffmpeg@jannau.net
>
上级
979395bb
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
85 addition
and
62 deletion
+85
-62
ffserver.c
ffserver.c
+3
-3
libavformat/avformat.h
libavformat/avformat.h
+4
-5
libavformat/rtpproto.c
libavformat/rtpproto.c
+8
-7
libavformat/sapenc.c
libavformat/sapenc.c
+5
-4
libavformat/sdp.c
libavformat/sdp.c
+2
-1
libavformat/udp.c
libavformat/udp.c
+8
-7
libavformat/utils.c
libavformat/utils.c
+5
-35
libavformat/version.h
libavformat/version.h
+3
-0
libavutil/parseutils.c
libavutil/parseutils.c
+39
-0
libavutil/parseutils.h
libavutil/parseutils.h
+8
-0
未找到文件。
ffserver.c
浏览文件 @
ab0287fc
...
...
@@ -2135,10 +2135,10 @@ static int open_input_stream(HTTPContext *c, const char *info)
strcpy
(
input_filename
,
c
->
stream
->
feed
->
feed_filename
);
buf_size
=
FFM_PACKET_SIZE
;
/* compute position (absolute time) */
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"date"
,
info
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"date"
,
info
))
{
if
((
ret
=
av_parse_time
(
&
stream_pos
,
buf
,
0
))
<
0
)
return
ret
;
}
else
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"buffer"
,
info
))
{
}
else
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"buffer"
,
info
))
{
int
prebuffer
=
strtol
(
buf
,
0
,
10
);
stream_pos
=
av_gettime
()
-
prebuffer
*
(
int64_t
)
1000000
;
}
else
...
...
@@ -2147,7 +2147,7 @@ static int open_input_stream(HTTPContext *c, const char *info)
strcpy
(
input_filename
,
c
->
stream
->
feed_filename
);
buf_size
=
0
;
/* compute position (relative time) */
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"date"
,
info
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"date"
,
info
))
{
if
((
ret
=
av_parse_time
(
&
stream_pos
,
buf
,
1
))
<
0
)
return
ret
;
}
else
...
...
libavformat/avformat.h
浏览文件 @
ab0287fc
...
...
@@ -1501,13 +1501,12 @@ int64_t ffm_read_write_index(int fd);
int
ffm_write_write_index
(
int
fd
,
int64_t
pos
);
void
ffm_set_write_index
(
AVFormatContext
*
s
,
int64_t
pos
,
int64_t
file_size
);
#if FF_API_FIND_INFO_TAG
/**
* Attempt to find a specific tag in a URL.
*
* syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done.
* Return 1 if found.
* @deprecated use av_find_info_tag in libavutil instead.
*/
int
find_info_tag
(
char
*
arg
,
int
arg_size
,
const
char
*
tag1
,
const
char
*
info
);
attribute_deprecated
int
find_info_tag
(
char
*
arg
,
int
arg_size
,
const
char
*
tag1
,
const
char
*
info
);
#endif
/**
* Return in 'buf' the path with '%d' replaced by a number.
...
...
libavformat/rtpproto.c
浏览文件 @
ab0287fc
...
...
@@ -24,6 +24,7 @@
* RTP protocol
*/
#include "libavutil/parseutils.h"
#include "libavutil/avstring.h"
#include "avformat.h"
#include "rtpdec.h"
...
...
@@ -161,25 +162,25 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
p
=
strchr
(
uri
,
'?'
);
if
(
p
)
{
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"ttl"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"ttl"
,
p
))
{
ttl
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"rtcpport"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"rtcpport"
,
p
))
{
rtcp_port
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"localport"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"localport"
,
p
))
{
local_rtp_port
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"localrtpport"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"localrtpport"
,
p
))
{
local_rtp_port
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"localrtcpport"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"localrtcpport"
,
p
))
{
local_rtcp_port
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"pkt_size"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"pkt_size"
,
p
))
{
max_packet_size
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"connect"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"connect"
,
p
))
{
connect
=
strtol
(
buf
,
NULL
,
10
);
}
}
...
...
libavformat/sapenc.c
浏览文件 @
ab0287fc
...
...
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
#include "libavutil/parseutils.h"
#include "libavutil/random_seed.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
...
...
@@ -87,16 +88,16 @@ static int sap_write_header(AVFormatContext *s)
option_list
=
strrchr
(
path
,
'?'
);
if
(
option_list
)
{
char
buf
[
50
];
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"announce_port"
,
option_list
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"announce_port"
,
option_list
))
{
port
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"same_port"
,
option_list
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"same_port"
,
option_list
))
{
same_port
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"ttl"
,
option_list
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"ttl"
,
option_list
))
{
ttl
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"announce_addr"
,
option_list
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"announce_addr"
,
option_list
))
{
av_strlcpy
(
announce_addr
,
buf
,
sizeof
(
announce_addr
));
}
}
...
...
libavformat/sdp.c
浏览文件 @
ab0287fc
...
...
@@ -21,6 +21,7 @@
#include <string.h>
#include "libavutil/avstring.h"
#include "libavutil/base64.h"
#include "libavutil/parseutils.h"
#include "libavcodec/xiph.h"
#include "avformat.h"
#include "internal.h"
...
...
@@ -136,7 +137,7 @@ static int sdp_get_address(char *dest_addr, int size, int *ttl, const char *url)
if
(
p
)
{
char
buff
[
64
];
if
(
find_info_tag
(
buff
,
sizeof
(
buff
),
"ttl"
,
p
))
{
if
(
av_
find_info_tag
(
buff
,
sizeof
(
buff
),
"ttl"
,
p
))
{
*
ttl
=
strtol
(
buff
,
NULL
,
10
);
}
else
{
*
ttl
=
5
;
...
...
libavformat/udp.c
浏览文件 @
ab0287fc
...
...
@@ -27,6 +27,7 @@
#define _BSD_SOURCE
/* Needed for using struct ip_mreq with recent glibc */
#define _DARWIN_C_SOURCE
/* Needed for using IP_MULTICAST_TTL on OS X */
#include "avformat.h"
#include "libavutil/parseutils.h"
#include <unistd.h>
#include "internal.h"
#include "network.h"
...
...
@@ -259,7 +260,7 @@ int udp_set_remote_url(URLContext *h, const char *uri)
s
->
is_multicast
=
ff_is_multicast_address
((
struct
sockaddr
*
)
&
s
->
dest_addr
);
p
=
strchr
(
uri
,
'?'
);
if
(
p
)
{
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"connect"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"connect"
,
p
))
{
int
was_connected
=
s
->
is_connected
;
s
->
is_connected
=
strtol
(
buf
,
NULL
,
10
);
if
(
s
->
is_connected
&&
!
was_connected
)
{
...
...
@@ -330,7 +331,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
p
=
strchr
(
uri
,
'?'
);
if
(
p
)
{
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"reuse"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"reuse"
,
p
))
{
const
char
*
endptr
=
NULL
;
s
->
reuse_socket
=
strtol
(
buf
,
&
endptr
,
10
);
/* assume if no digits were found it is a request to enable it */
...
...
@@ -338,19 +339,19 @@ static int udp_open(URLContext *h, const char *uri, int flags)
s
->
reuse_socket
=
1
;
reuse_specified
=
1
;
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"ttl"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"ttl"
,
p
))
{
s
->
ttl
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"localport"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"localport"
,
p
))
{
s
->
local_port
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"pkt_size"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"pkt_size"
,
p
))
{
h
->
max_packet_size
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"buffer_size"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"buffer_size"
,
p
))
{
s
->
buffer_size
=
strtol
(
buf
,
NULL
,
10
);
}
if
(
find_info_tag
(
buf
,
sizeof
(
buf
),
"connect"
,
p
))
{
if
(
av_
find_info_tag
(
buf
,
sizeof
(
buf
),
"connect"
,
p
))
{
s
->
is_connected
=
strtol
(
buf
,
NULL
,
10
);
}
}
...
...
libavformat/utils.c
浏览文件 @
ab0287fc
...
...
@@ -3391,44 +3391,14 @@ int64_t parse_date(const char *timestr, int duration)
}
#endif
#if FF_API_FIND_INFO_TAG
#include "libavutil/parseutils.h"
int
find_info_tag
(
char
*
arg
,
int
arg_size
,
const
char
*
tag1
,
const
char
*
info
)
{
const
char
*
p
;
char
tag
[
128
],
*
q
;
p
=
info
;
if
(
*
p
==
'?'
)
p
++
;
for
(;;)
{
q
=
tag
;
while
(
*
p
!=
'\0'
&&
*
p
!=
'='
&&
*
p
!=
'&'
)
{
if
((
q
-
tag
)
<
sizeof
(
tag
)
-
1
)
*
q
++
=
*
p
;
p
++
;
}
*
q
=
'\0'
;
q
=
arg
;
if
(
*
p
==
'='
)
{
p
++
;
while
(
*
p
!=
'&'
&&
*
p
!=
'\0'
)
{
if
((
q
-
arg
)
<
arg_size
-
1
)
{
if
(
*
p
==
'+'
)
*
q
++
=
' '
;
else
*
q
++
=
*
p
;
}
p
++
;
}
}
*
q
=
'\0'
;
if
(
!
strcmp
(
tag
,
tag1
))
return
1
;
if
(
*
p
!=
'&'
)
break
;
p
++
;
}
return
0
;
return
av_find_info_tag
(
arg
,
arg_size
,
tag1
,
info
);
}
#endif
int
av_get_frame_filename
(
char
*
buf
,
int
buf_size
,
const
char
*
path
,
int
number
)
...
...
libavformat/version.h
浏览文件 @
ab0287fc
...
...
@@ -98,5 +98,8 @@
#ifndef FF_API_PARSE_DATE
#define FF_API_PARSE_DATE (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_FIND_INFO_TAG
#define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
#endif //AVFORMAT_VERSION_H
libavutil/parseutils.c
浏览文件 @
ab0287fc
...
...
@@ -608,6 +608,45 @@ int av_parse_time(int64_t *timeval, const char *datestr, int duration)
return
0
;
}
int
av_find_info_tag
(
char
*
arg
,
int
arg_size
,
const
char
*
tag1
,
const
char
*
info
)
{
const
char
*
p
;
char
tag
[
128
],
*
q
;
p
=
info
;
if
(
*
p
==
'?'
)
p
++
;
for
(;;)
{
q
=
tag
;
while
(
*
p
!=
'\0'
&&
*
p
!=
'='
&&
*
p
!=
'&'
)
{
if
((
q
-
tag
)
<
sizeof
(
tag
)
-
1
)
*
q
++
=
*
p
;
p
++
;
}
*
q
=
'\0'
;
q
=
arg
;
if
(
*
p
==
'='
)
{
p
++
;
while
(
*
p
!=
'&'
&&
*
p
!=
'\0'
)
{
if
((
q
-
arg
)
<
arg_size
-
1
)
{
if
(
*
p
==
'+'
)
*
q
++
=
' '
;
else
*
q
++
=
*
p
;
}
p
++
;
}
}
*
q
=
'\0'
;
if
(
!
strcmp
(
tag
,
tag1
))
return
1
;
if
(
*
p
!=
'&'
)
break
;
p
++
;
}
return
0
;
}
#ifdef TEST
#undef printf
...
...
libavutil/parseutils.h
浏览文件 @
ab0287fc
...
...
@@ -106,4 +106,12 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
*/
int
av_parse_time
(
int64_t
*
timeval
,
const
char
*
timestr
,
int
duration
);
/**
* Attempt to find a specific tag in a URL.
*
* syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done.
* Return 1 if found.
*/
int
av_find_info_tag
(
char
*
arg
,
int
arg_size
,
const
char
*
tag1
,
const
char
*
info
);
#endif
/* AVUTIL_PARSEUTILS_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录