mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-30 11:24:17 +00:00
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
This commit is contained in:
parent
8bf0f96954
commit
44b70ce563
8
configure
vendored
8
configure
vendored
@ -912,6 +912,7 @@ CONFIG_LIST="
|
|||||||
pic
|
pic
|
||||||
postproc
|
postproc
|
||||||
rdft
|
rdft
|
||||||
|
rtpdec
|
||||||
runtime_cpudetect
|
runtime_cpudetect
|
||||||
shared
|
shared
|
||||||
small
|
small
|
||||||
@ -1362,11 +1363,12 @@ mxf_d10_muxer_select="mxf_muxer"
|
|||||||
ogg_demuxer_select="golomb"
|
ogg_demuxer_select="golomb"
|
||||||
psp_muxer_select="mov_muxer"
|
psp_muxer_select="mov_muxer"
|
||||||
rtp_demuxer_select="sdp_demuxer"
|
rtp_demuxer_select="sdp_demuxer"
|
||||||
rtsp_demuxer_select="http_protocol sdp_demuxer"
|
rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
|
||||||
rtsp_muxer_select="rtp_muxer http_protocol sdp_demuxer"
|
rtsp_demuxer_select="http_protocol rtpdec"
|
||||||
|
rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
|
||||||
sap_demuxer_select="sdp_demuxer"
|
sap_demuxer_select="sdp_demuxer"
|
||||||
sap_muxer_select="rtp_muxer rtp_protocol"
|
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"
|
spdif_muxer_select="aac_parser"
|
||||||
tg2_muxer_select="mov_muxer"
|
tg2_muxer_select="mov_muxer"
|
||||||
tgp_muxer_select="mov_muxer"
|
tgp_muxer_select="mov_muxer"
|
||||||
|
@ -230,11 +230,11 @@ OBJS-$(CONFIG_RTP_MUXER) += rtp.o \
|
|||||||
rtpenc_xiph.o \
|
rtpenc_xiph.o \
|
||||||
avc.o
|
avc.o
|
||||||
OBJS-$(CONFIG_RTSP_DEMUXER) += rtsp.o httpauth.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_DEMUXER) += sapdec.o
|
||||||
OBJS-$(CONFIG_SAP_MUXER) += sapenc.o rtpenc_chain.o
|
OBJS-$(CONFIG_SAP_MUXER) += sapenc.o rtpenc_chain.o
|
||||||
OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o \
|
OBJS-$(CONFIG_RTPDEC) += rdt.o \
|
||||||
rdt.o \
|
|
||||||
rtp.o \
|
rtp.o \
|
||||||
rtpdec.o \
|
rtpdec.o \
|
||||||
rtpdec_amr.o \
|
rtpdec_amr.o \
|
||||||
@ -247,8 +247,8 @@ OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o \
|
|||||||
rtpdec_qt.o \
|
rtpdec_qt.o \
|
||||||
rtpdec_svq3.o \
|
rtpdec_svq3.o \
|
||||||
rtpdec_vp8.o \
|
rtpdec_vp8.o \
|
||||||
rtpdec_xiph.o \
|
rtpdec_xiph.o
|
||||||
rtpenc_chain.o
|
OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o
|
||||||
OBJS-$(CONFIG_SEGAFILM_DEMUXER) += segafilm.o
|
OBJS-$(CONFIG_SEGAFILM_DEMUXER) += segafilm.o
|
||||||
OBJS-$(CONFIG_SHORTEN_DEMUXER) += rawdec.o
|
OBJS-$(CONFIG_SHORTEN_DEMUXER) += rawdec.o
|
||||||
OBJS-$(CONFIG_SIFF_DEMUXER) += siff.o
|
OBJS-$(CONFIG_SIFF_DEMUXER) += siff.o
|
||||||
|
@ -183,7 +183,7 @@ void av_register_all(void)
|
|||||||
REGISTER_MUXDEMUX (RTSP, rtsp);
|
REGISTER_MUXDEMUX (RTSP, rtsp);
|
||||||
REGISTER_MUXDEMUX (SAP, sap);
|
REGISTER_MUXDEMUX (SAP, sap);
|
||||||
REGISTER_DEMUXER (SDP, sdp);
|
REGISTER_DEMUXER (SDP, sdp);
|
||||||
#if CONFIG_SDP_DEMUXER
|
#if CONFIG_RTPDEC
|
||||||
av_register_rtp_dynamic_payload_handlers();
|
av_register_rtp_dynamic_payload_handlers();
|
||||||
av_register_rdt_dynamic_payload_handlers();
|
av_register_rdt_dynamic_payload_handlers();
|
||||||
#endif
|
#endif
|
||||||
|
@ -125,6 +125,7 @@ static int get_sockaddr(const char *buf, struct sockaddr_storage *sock)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_RTPDEC
|
||||||
/* parse the rtpmap description: <codec_name>/<clock_rate>[/<other params>] */
|
/* parse the rtpmap description: <codec_name>/<clock_rate>[/<other params>] */
|
||||||
static int sdp_parse_rtpmap(AVFormatContext *s,
|
static int sdp_parse_rtpmap(AVFormatContext *s,
|
||||||
AVCodecContext *codec, RTSPStream *rtsp_st,
|
AVCodecContext *codec, RTSPStream *rtsp_st,
|
||||||
@ -457,6 +458,7 @@ static int sdp_parse(AVFormatContext *s, const char *content)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_RTPDEC */
|
||||||
|
|
||||||
/* close and free RTSP streams */
|
/* close and free RTSP streams */
|
||||||
void ff_rtsp_close_streams(AVFormatContext *s)
|
void ff_rtsp_close_streams(AVFormatContext *s)
|
||||||
@ -483,9 +485,9 @@ void ff_rtsp_close_streams(AVFormatContext *s)
|
|||||||
av_metadata_free(&rtpctx->metadata);
|
av_metadata_free(&rtpctx->metadata);
|
||||||
av_free(rtpctx->streams[0]);
|
av_free(rtpctx->streams[0]);
|
||||||
av_free(rtpctx);
|
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);
|
ff_rdt_parse_close(rtsp_st->transport_priv);
|
||||||
else
|
else if (CONFIG_RTPDEC)
|
||||||
rtp_parse_close(rtsp_st->transport_priv);
|
rtp_parse_close(rtsp_st->transport_priv);
|
||||||
}
|
}
|
||||||
if (rtsp_st->rtp_handle)
|
if (rtsp_st->rtp_handle)
|
||||||
@ -514,17 +516,17 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
|
|||||||
if (!st)
|
if (!st)
|
||||||
s->ctx_flags |= AVFMTCTX_NOHEADER;
|
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->transport_priv = ff_rtp_chain_mux_open(s, st,
|
||||||
rtsp_st->rtp_handle,
|
rtsp_st->rtp_handle,
|
||||||
RTSP_TCP_MAX_PACKET_SIZE);
|
RTSP_TCP_MAX_PACKET_SIZE);
|
||||||
/* Ownership of rtp_handle is passed to the rtp mux context */
|
/* Ownership of rtp_handle is passed to the rtp mux context */
|
||||||
rtsp_st->rtp_handle = NULL;
|
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->transport_priv = ff_rdt_parse_open(s, st->index,
|
||||||
rtsp_st->dynamic_protocol_context,
|
rtsp_st->dynamic_protocol_context,
|
||||||
rtsp_st->dynamic_handler);
|
rtsp_st->dynamic_handler);
|
||||||
else
|
else if (CONFIG_RTPDEC)
|
||||||
rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle,
|
rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle,
|
||||||
rtsp_st->sdp_payload_type,
|
rtsp_st->sdp_payload_type,
|
||||||
(rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay)
|
(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) {
|
if (!rtsp_st->transport_priv) {
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
} else if (rt->transport != RTSP_TRANSPORT_RDT) {
|
} else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) {
|
||||||
if (rtsp_st->dynamic_handler) {
|
if (rtsp_st->dynamic_handler) {
|
||||||
rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv,
|
rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv,
|
||||||
rtsp_st->dynamic_protocol_context,
|
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),
|
snprintf(cmd, sizeof(cmd),
|
||||||
"Transport: %s\r\n",
|
"Transport: %s\r\n",
|
||||||
transport);
|
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];
|
char real_res[41], real_csum[9];
|
||||||
ff_rdt_calc_response_and_checksum(real_res, real_csum,
|
ff_rdt_calc_response_and_checksum(real_res, real_csum,
|
||||||
real_challenge);
|
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.
|
* potential NAT router by sending dummy packets.
|
||||||
* RTP/RTCP dummy packets are used for RDT, too.
|
* 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);
|
rtp_send_punch_packets(rtsp_st->rtp_handle);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1232,6 +1235,7 @@ static int rtsp_read_play(AVFormatContext *s)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_RTSP_DEMUXER
|
||||||
static int rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
|
static int rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
|
||||||
{
|
{
|
||||||
RTSPState *rt = s->priv_data;
|
RTSPState *rt = s->priv_data;
|
||||||
@ -1268,7 +1272,9 @@ static int rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_RTSP_DEMUXER */
|
||||||
|
|
||||||
|
#if CONFIG_RTSP_MUXER
|
||||||
static int rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
|
static int rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
|
||||||
{
|
{
|
||||||
RTSPState *rt = s->priv_data;
|
RTSPState *rt = s->priv_data;
|
||||||
@ -1332,6 +1338,7 @@ static int rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_RTSP_MUXER */
|
||||||
|
|
||||||
void ff_rtsp_close_connections(AVFormatContext *s)
|
void ff_rtsp_close_connections(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
@ -1548,9 +1555,9 @@ redirect:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->iformat)
|
if (s->iformat && CONFIG_RTSP_DEMUXER)
|
||||||
err = rtsp_setup_input_streams(s, reply);
|
err = rtsp_setup_input_streams(s, reply);
|
||||||
else
|
else if (CONFIG_RTSP_MUXER)
|
||||||
err = rtsp_setup_output_streams(s, host);
|
err = rtsp_setup_output_streams(s, host);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -1589,6 +1596,7 @@ redirect:
|
|||||||
}
|
}
|
||||||
#endif /* CONFIG_RTSP_DEMUXER || CONFIG_RTSP_MUXER */
|
#endif /* CONFIG_RTSP_DEMUXER || CONFIG_RTSP_MUXER */
|
||||||
|
|
||||||
|
#if CONFIG_RTPDEC
|
||||||
static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
|
static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
|
||||||
uint8_t *buf, int buf_size, int64_t wait_end)
|
uint8_t *buf, int buf_size, int64_t wait_end)
|
||||||
{
|
{
|
||||||
@ -1777,6 +1785,7 @@ end:
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_RTPDEC */
|
||||||
|
|
||||||
#if CONFIG_RTSP_DEMUXER
|
#if CONFIG_RTSP_DEMUXER
|
||||||
static int rtsp_read_header(AVFormatContext *s,
|
static int rtsp_read_header(AVFormatContext *s,
|
||||||
@ -2020,6 +2029,7 @@ AVInputFormat rtsp_demuxer = {
|
|||||||
};
|
};
|
||||||
#endif /* CONFIG_RTSP_DEMUXER */
|
#endif /* CONFIG_RTSP_DEMUXER */
|
||||||
|
|
||||||
|
#if CONFIG_SDP_DEMUXER
|
||||||
static int sdp_probe(AVProbeData *p1)
|
static int sdp_probe(AVProbeData *p1)
|
||||||
{
|
{
|
||||||
const char *p = p1->buf, *p_end = p1->buf + p1->buf_size;
|
const char *p = p1->buf, *p_end = p1->buf + p1->buf_size;
|
||||||
@ -2104,7 +2114,9 @@ AVInputFormat sdp_demuxer = {
|
|||||||
rtsp_fetch_packet,
|
rtsp_fetch_packet,
|
||||||
sdp_read_close,
|
sdp_read_close,
|
||||||
};
|
};
|
||||||
|
#endif /* CONFIG_SDP_DEMUXER */
|
||||||
|
|
||||||
|
#if CONFIG_RTP_DEMUXER
|
||||||
static int rtp_probe(AVProbeData *p)
|
static int rtp_probe(AVProbeData *p)
|
||||||
{
|
{
|
||||||
if (av_strstart(p->filename, "rtp:", NULL))
|
if (av_strstart(p->filename, "rtp:", NULL))
|
||||||
@ -2207,4 +2219,5 @@ AVInputFormat rtp_demuxer = {
|
|||||||
sdp_read_close,
|
sdp_read_close,
|
||||||
.flags = AVFMT_NOFILE,
|
.flags = AVFMT_NOFILE,
|
||||||
};
|
};
|
||||||
|
#endif /* CONFIG_RTP_DEMUXER */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user