1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-08 13:22:53 +02:00

rtsp: Split out a function undoing the setup made by ff_rtsp_make_setup_request

Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
This commit is contained in:
Martin Storsjo 2011-01-24 09:49:02 +00:00 committed by Janne Grunau
parent fef5649a82
commit 93e7490ee0
2 changed files with 43 additions and 22 deletions

View File

@ -474,16 +474,15 @@ int ff_sdp_parse(AVFormatContext *s, const char *content)
}
#endif /* CONFIG_RTPDEC */
/* close and free RTSP streams */
void ff_rtsp_close_streams(AVFormatContext *s)
void ff_rtsp_undo_setup(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
int i;
RTSPStream *rtsp_st;
for (i = 0; i < rt->nb_rtsp_streams; i++) {
rtsp_st = rt->rtsp_streams[i];
if (rtsp_st) {
RTSPStream *rtsp_st = rt->rtsp_streams[i];
if (!rtsp_st)
continue;
if (rtsp_st->transport_priv) {
if (s->oformat) {
AVFormatContext *rtpctx = rtsp_st->transport_priv;
@ -504,8 +503,24 @@ void ff_rtsp_close_streams(AVFormatContext *s)
else if (CONFIG_RTPDEC)
rtp_parse_close(rtsp_st->transport_priv);
}
rtsp_st->transport_priv = NULL;
if (rtsp_st->rtp_handle)
url_close(rtsp_st->rtp_handle);
rtsp_st->rtp_handle = NULL;
}
}
/* close and free RTSP streams */
void ff_rtsp_close_streams(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
int i;
RTSPStream *rtsp_st;
ff_rtsp_undo_setup(s);
for (i = 0; i < rt->nb_rtsp_streams; i++) {
rtsp_st = rt->rtsp_streams[i];
if (rtsp_st) {
if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context)
rtsp_st->dynamic_handler->close(
rtsp_st->dynamic_protocol_context);

View File

@ -511,4 +511,10 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt);
int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
int lower_transport, const char *real_challenge);
/**
* Undo the effect of ff_rtsp_make_setup_request, close the
* transport_priv and rtp_handle fields.
*/
void ff_rtsp_undo_setup(AVFormatContext *s);
#endif /* AVFORMAT_RTSP_H */