Commit 44b70ce5 authored by Martin Storsjö's avatar Martin Storsjö
Browse files

rtsp: Untangle the dependencies between the RTSP/SDP demuxers and RTSP muxer

This allows compilation of one of them without requiring the others'
dependencies to be present.

Originally committed as revision 25535 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 8bf0f969
......@@ -912,6 +912,7 @@ CONFIG_LIST="
pic
postproc
rdft
rtpdec
runtime_cpudetect
shared
small
......@@ -1362,11 +1363,12 @@ mxf_d10_muxer_select="mxf_muxer"
ogg_demuxer_select="golomb"
psp_muxer_select="mov_muxer"
rtp_demuxer_select="sdp_demuxer"
rtsp_demuxer_select="http_protocol sdp_demuxer"
rtsp_muxer_select="rtp_muxer http_protocol sdp_demuxer"
rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
rtsp_demuxer_select="http_protocol rtpdec"
rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
sap_demuxer_select="sdp_demuxer"
sap_muxer_select="rtp_muxer rtp_protocol"
sdp_demuxer_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
sdp_demuxer_select="rtpdec"
spdif_muxer_select="aac_parser"
tg2_muxer_select="mov_muxer"
tgp_muxer_select="mov_muxer"
......
......@@ -230,11 +230,11 @@ OBJS-$(CONFIG_RTP_MUXER) += rtp.o \
rtpenc_xiph.o \
avc.o
OBJS-$(CONFIG_RTSP_DEMUXER) += rtsp.o httpauth.o
OBJS-$(CONFIG_RTSP_MUXER) += rtsp.o rtspenc.o httpauth.o
OBJS-$(CONFIG_RTSP_MUXER) += rtsp.o rtspenc.o httpauth.o \
rtpenc_chain.o
OBJS-$(CONFIG_SAP_DEMUXER) += sapdec.o
OBJS-$(CONFIG_SAP_MUXER) += sapenc.o rtpenc_chain.o
OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o \
rdt.o \
OBJS-$(CONFIG_RTPDEC) += rdt.o \
rtp.o \
rtpdec.o \
rtpdec_amr.o \
......@@ -247,8 +247,8 @@ OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o \
rtpdec_qt.o \
rtpdec_svq3.o \
rtpdec_vp8.o \
rtpdec_xiph.o \
rtpenc_chain.o
rtpdec_xiph.o
OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o
OBJS-$(CONFIG_SEGAFILM_DEMUXER) += segafilm.o
OBJS-$(CONFIG_SHORTEN_DEMUXER) += rawdec.o
OBJS-$(CONFIG_SIFF_DEMUXER) += siff.o
......
......@@ -183,7 +183,7 @@ void av_register_all(void)
REGISTER_MUXDEMUX (RTSP, rtsp);
REGISTER_MUXDEMUX (SAP, sap);
REGISTER_DEMUXER (SDP, sdp);
#if CONFIG_SDP_DEMUXER
#if CONFIG_RTPDEC
av_register_rtp_dynamic_payload_handlers();
av_register_rdt_dynamic_payload_handlers();
#endif
......
......@@ -125,6 +125,7 @@ static int get_sockaddr(const char *buf, struct sockaddr_storage *sock)
return 0;
}
#if CONFIG_RTPDEC
/* parse the rtpmap description: <codec_name>/<clock_rate>[/<other params>] */
static int sdp_parse_rtpmap(AVFormatContext *s,
AVCodecContext *codec, RTSPStream *rtsp_st,
......@@ -457,6 +458,7 @@ static int sdp_parse(AVFormatContext *s, const char *content)
}
return 0;
}
#endif /* CONFIG_RTPDEC */
/* close and free RTSP streams */
void ff_rtsp_close_streams(AVFormatContext *s)
......@@ -483,9 +485,9 @@ void ff_rtsp_close_streams(AVFormatContext *s)
av_metadata_free(&rtpctx->metadata);
av_free(rtpctx->streams[0]);
av_free(rtpctx);
} else if (rt->transport == RTSP_TRANSPORT_RDT)
} else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
ff_rdt_parse_close(rtsp_st->transport_priv);
else
else if (CONFIG_RTPDEC)
rtp_parse_close(rtsp_st->transport_priv);
}
if (rtsp_st->rtp_handle)
......@@ -514,17 +516,17 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
if (!st)
s->ctx_flags |= AVFMTCTX_NOHEADER;
if (s->oformat) {
if (s->oformat && CONFIG_RTSP_MUXER) {
rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st,
rtsp_st->rtp_handle,
RTSP_TCP_MAX_PACKET_SIZE);
/* Ownership of rtp_handle is passed to the rtp mux context */
rtsp_st->rtp_handle = NULL;
} else if (rt->transport == RTSP_TRANSPORT_RDT)
} else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
rtsp_st->dynamic_protocol_context,
rtsp_st->dynamic_handler);
else
else if (CONFIG_RTPDEC)
rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle,
rtsp_st->sdp_payload_type,
(rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay)
......@@ -532,7 +534,7 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
if (!rtsp_st->transport_priv) {
return AVERROR(ENOMEM);
} else if (rt->transport != RTSP_TRANSPORT_RDT) {
} else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) {
if (rtsp_st->dynamic_handler) {
rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv,
rtsp_st->dynamic_protocol_context,
......@@ -1068,7 +1070,7 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port,
snprintf(cmd, sizeof(cmd),
"Transport: %s\r\n",
transport);
if (i == 0 && rt->server_type == RTSP_SERVER_REAL) {
if (i == 0 && rt->server_type == RTSP_SERVER_REAL && CONFIG_RTPDEC) {
char real_res[41], real_csum[9];
ff_rdt_calc_response_and_checksum(real_res, real_csum,
real_challenge);
......@@ -1133,7 +1135,8 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port,
* potential NAT router by sending dummy packets.
* RTP/RTCP dummy packets are used for RDT, too.
*/
if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat)
if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat &&
CONFIG_RTPDEC)
rtp_send_punch_packets(rtsp_st->rtp_handle);
break;
}
......@@ -1232,6 +1235,7 @@ static int rtsp_read_play(AVFormatContext *s)
return 0;
}
#if CONFIG_RTSP_DEMUXER
static int rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
{
RTSPState *rt = s->priv_data;
......@@ -1268,7 +1272,9 @@ static int rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply
return 0;
}
#endif /* CONFIG_RTSP_DEMUXER */
#if CONFIG_RTSP_MUXER
static int rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
{
RTSPState *rt = s->priv_data;
......@@ -1332,6 +1338,7 @@ static int rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
return 0;
}
#endif /* CONFIG_RTSP_MUXER */
void ff_rtsp_close_connections(AVFormatContext *s)
{
......@@ -1548,9 +1555,9 @@ redirect:
break;
}
if (s->iformat)
if (s->iformat && CONFIG_RTSP_DEMUXER)
err = rtsp_setup_input_streams(s, reply);
else
else if (CONFIG_RTSP_MUXER)
err = rtsp_setup_output_streams(s, host);
if (err)
goto fail;
......@@ -1589,6 +1596,7 @@ redirect:
}
#endif /* CONFIG_RTSP_DEMUXER || CONFIG_RTSP_MUXER */
#if CONFIG_RTPDEC
static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
uint8_t *buf, int buf_size, int64_t wait_end)
{
......@@ -1777,6 +1785,7 @@ end:
return ret;
}
#endif /* CONFIG_RTPDEC */
#if CONFIG_RTSP_DEMUXER
static int rtsp_read_header(AVFormatContext *s,
......@@ -2020,6 +2029,7 @@ AVInputFormat rtsp_demuxer = {
};
#endif /* CONFIG_RTSP_DEMUXER */
#if CONFIG_SDP_DEMUXER
static int sdp_probe(AVProbeData *p1)
{
const char *p = p1->buf, *p_end = p1->buf + p1->buf_size;
......@@ -2104,7 +2114,9 @@ AVInputFormat sdp_demuxer = {
rtsp_fetch_packet,
sdp_read_close,
};
#endif /* CONFIG_SDP_DEMUXER */
#if CONFIG_RTP_DEMUXER
static int rtp_probe(AVProbeData *p)
{
if (av_strstart(p->filename, "rtp:", NULL))
......@@ -2207,4 +2219,5 @@ AVInputFormat rtp_demuxer = {
sdp_read_close,
.flags = AVFMT_NOFILE,
};
#endif /* CONFIG_RTP_DEMUXER */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment