Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
c2688f3a
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,发现更多精彩内容 >>
提交
c2688f3a
编写于
10月 29, 2010
作者:
M
Martin Storsjö
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rtsp: Move rtsp_setup_output_streams into rtspenc.c
Originally committed as revision 25600 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
63e856df
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
74 addition
and
73 deletion
+74
-73
libavformat/rtsp.c
libavformat/rtsp.c
+1
-73
libavformat/rtsp.h
libavformat/rtsp.h
+6
-0
libavformat/rtspenc.c
libavformat/rtspenc.c
+67
-0
未找到文件。
libavformat/rtsp.c
浏览文件 @
c2688f3a
...
...
@@ -1269,78 +1269,6 @@ static int rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply
static
int
rtsp_setup_input_streams
(
AVFormatContext
*
s
,
RTSPMessageHeader
*
reply
);
#endif
/* !CONFIG_RTSP_DEMUXER */
#if CONFIG_RTSP_MUXER
static
int
rtsp_setup_output_streams
(
AVFormatContext
*
s
,
const
char
*
addr
)
{
RTSPState
*
rt
=
s
->
priv_data
;
RTSPMessageHeader
reply1
,
*
reply
=
&
reply1
;
int
i
;
char
*
sdp
;
AVFormatContext
sdp_ctx
,
*
ctx_array
[
1
];
s
->
start_time_realtime
=
av_gettime
();
/* Announce the stream */
sdp
=
av_mallocz
(
SDP_MAX_SIZE
);
if
(
sdp
==
NULL
)
return
AVERROR
(
ENOMEM
);
/* We create the SDP based on the RTSP AVFormatContext where we
* aren't allowed to change the filename field. (We create the SDP
* based on the RTSP context since the contexts for the RTP streams
* don't exist yet.) In order to specify a custom URL with the actual
* peer IP instead of the originally specified hostname, we create
* a temporary copy of the AVFormatContext, where the custom URL is set.
*
* FIXME: Create the SDP without copying the AVFormatContext.
* This either requires setting up the RTP stream AVFormatContexts
* already here (complicating things immensely) or getting a more
* flexible SDP creation interface.
*/
sdp_ctx
=
*
s
;
ff_url_join
(
sdp_ctx
.
filename
,
sizeof
(
sdp_ctx
.
filename
),
"rtsp"
,
NULL
,
addr
,
-
1
,
NULL
);
ctx_array
[
0
]
=
&
sdp_ctx
;
if
(
avf_sdp_create
(
ctx_array
,
1
,
sdp
,
SDP_MAX_SIZE
))
{
av_free
(
sdp
);
return
AVERROR_INVALIDDATA
;
}
av_log
(
s
,
AV_LOG_VERBOSE
,
"SDP:
\n
%s
\n
"
,
sdp
);
ff_rtsp_send_cmd_with_content
(
s
,
"ANNOUNCE"
,
rt
->
control_uri
,
"Content-Type: application/sdp
\r\n
"
,
reply
,
NULL
,
sdp
,
strlen
(
sdp
));
av_free
(
sdp
);
if
(
reply
->
status_code
!=
RTSP_STATUS_OK
)
return
AVERROR_INVALIDDATA
;
/* Set up the RTSPStreams for each AVStream */
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
RTSPStream
*
rtsp_st
;
AVStream
*
st
=
s
->
streams
[
i
];
rtsp_st
=
av_mallocz
(
sizeof
(
RTSPStream
));
if
(
!
rtsp_st
)
return
AVERROR
(
ENOMEM
);
dynarray_add
(
&
rt
->
rtsp_streams
,
&
rt
->
nb_rtsp_streams
,
rtsp_st
);
st
->
priv_data
=
rtsp_st
;
rtsp_st
->
stream_index
=
i
;
av_strlcpy
(
rtsp_st
->
control_url
,
rt
->
control_uri
,
sizeof
(
rtsp_st
->
control_url
));
/* Note, this must match the relative uri set in the sdp content */
av_strlcatf
(
rtsp_st
->
control_url
,
sizeof
(
rtsp_st
->
control_url
),
"/streamid=%d"
,
i
);
}
return
0
;
}
#else
/* !CONFIG_RTSP_MUXER */
/* A declaration of this function is needed so that the function is
* defined when parsing the call to it, even if dead code elimination
* will remove the call later.
*/
static
int
rtsp_setup_output_streams
(
AVFormatContext
*
s
,
const
char
*
addr
);
#endif
/* !CONFIG_RTSP_MUXER */
void
ff_rtsp_close_connections
(
AVFormatContext
*
s
)
{
RTSPState
*
rt
=
s
->
priv_data
;
...
...
@@ -1559,7 +1487,7 @@ redirect:
if
(
s
->
iformat
&&
CONFIG_RTSP_DEMUXER
)
err
=
rtsp_setup_input_streams
(
s
,
reply
);
else
if
(
CONFIG_RTSP_MUXER
)
err
=
rtsp_setup_output_streams
(
s
,
host
);
err
=
ff_
rtsp_setup_output_streams
(
s
,
host
);
if
(
err
)
goto
fail
;
...
...
libavformat/rtsp.h
浏览文件 @
c2688f3a
...
...
@@ -468,4 +468,10 @@ void ff_rtsp_close_streams(AVFormatContext *s);
*/
void
ff_rtsp_close_connections
(
AVFormatContext
*
rt
);
/**
* Announce the stream to the server and set up the RTSPStream child
* objects for each media stream.
*/
int
ff_rtsp_setup_output_streams
(
AVFormatContext
*
s
,
const
char
*
addr
);
#endif
/* AVFORMAT_RTSP_H */
libavformat/rtspenc.c
浏览文件 @
c2688f3a
...
...
@@ -29,6 +29,73 @@
#include "rtsp.h"
#include "internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/avstring.h"
#define SDP_MAX_SIZE 16384
int
ff_rtsp_setup_output_streams
(
AVFormatContext
*
s
,
const
char
*
addr
)
{
RTSPState
*
rt
=
s
->
priv_data
;
RTSPMessageHeader
reply1
,
*
reply
=
&
reply1
;
int
i
;
char
*
sdp
;
AVFormatContext
sdp_ctx
,
*
ctx_array
[
1
];
s
->
start_time_realtime
=
av_gettime
();
/* Announce the stream */
sdp
=
av_mallocz
(
SDP_MAX_SIZE
);
if
(
sdp
==
NULL
)
return
AVERROR
(
ENOMEM
);
/* We create the SDP based on the RTSP AVFormatContext where we
* aren't allowed to change the filename field. (We create the SDP
* based on the RTSP context since the contexts for the RTP streams
* don't exist yet.) In order to specify a custom URL with the actual
* peer IP instead of the originally specified hostname, we create
* a temporary copy of the AVFormatContext, where the custom URL is set.
*
* FIXME: Create the SDP without copying the AVFormatContext.
* This either requires setting up the RTP stream AVFormatContexts
* already here (complicating things immensely) or getting a more
* flexible SDP creation interface.
*/
sdp_ctx
=
*
s
;
ff_url_join
(
sdp_ctx
.
filename
,
sizeof
(
sdp_ctx
.
filename
),
"rtsp"
,
NULL
,
addr
,
-
1
,
NULL
);
ctx_array
[
0
]
=
&
sdp_ctx
;
if
(
avf_sdp_create
(
ctx_array
,
1
,
sdp
,
SDP_MAX_SIZE
))
{
av_free
(
sdp
);
return
AVERROR_INVALIDDATA
;
}
av_log
(
s
,
AV_LOG_VERBOSE
,
"SDP:
\n
%s
\n
"
,
sdp
);
ff_rtsp_send_cmd_with_content
(
s
,
"ANNOUNCE"
,
rt
->
control_uri
,
"Content-Type: application/sdp
\r\n
"
,
reply
,
NULL
,
sdp
,
strlen
(
sdp
));
av_free
(
sdp
);
if
(
reply
->
status_code
!=
RTSP_STATUS_OK
)
return
AVERROR_INVALIDDATA
;
/* Set up the RTSPStreams for each AVStream */
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
RTSPStream
*
rtsp_st
;
AVStream
*
st
=
s
->
streams
[
i
];
rtsp_st
=
av_mallocz
(
sizeof
(
RTSPStream
));
if
(
!
rtsp_st
)
return
AVERROR
(
ENOMEM
);
dynarray_add
(
&
rt
->
rtsp_streams
,
&
rt
->
nb_rtsp_streams
,
rtsp_st
);
st
->
priv_data
=
rtsp_st
;
rtsp_st
->
stream_index
=
i
;
av_strlcpy
(
rtsp_st
->
control_url
,
rt
->
control_uri
,
sizeof
(
rtsp_st
->
control_url
));
/* Note, this must match the relative uri set in the sdp content */
av_strlcatf
(
rtsp_st
->
control_url
,
sizeof
(
rtsp_st
->
control_url
),
"/streamid=%d"
,
i
);
}
return
0
;
}
static
int
rtsp_write_record
(
AVFormatContext
*
s
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录