comparison rtsp.c @ 3979:e6bf0896a019 libavformat

Implement RDTDemuxContext, which contains RDT-specific data (similar to RTPDemuxContext for RTP) for these streams where the transport protocol is RDT (as served by Realmedia servers).
author rbultje
date Sat, 04 Oct 2008 04:19:15 +0000
parents 0033b09d74b9
children 566758832da5
comparison
equal deleted inserted replaced
3978:0033b09d74b9 3979:e6bf0896a019
871 RTSPStream *rtsp_st; 871 RTSPStream *rtsp_st;
872 872
873 for(i=0;i<rt->nb_rtsp_streams;i++) { 873 for(i=0;i<rt->nb_rtsp_streams;i++) {
874 rtsp_st = rt->rtsp_streams[i]; 874 rtsp_st = rt->rtsp_streams[i];
875 if (rtsp_st) { 875 if (rtsp_st) {
876 if (rtsp_st->tx_ctx) 876 if (rtsp_st->tx_ctx) {
877 if (rt->transport == RTSP_TRANSPORT_RDT)
878 ff_rdt_parse_close(rtsp_st->tx_ctx);
879 else
877 rtp_parse_close(rtsp_st->tx_ctx); 880 rtp_parse_close(rtsp_st->tx_ctx);
881 }
878 if (rtsp_st->rtp_handle) 882 if (rtsp_st->rtp_handle)
879 url_close(rtsp_st->rtp_handle); 883 url_close(rtsp_st->rtp_handle);
880 if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context) 884 if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context)
881 rtsp_st->dynamic_handler->close(rtsp_st->dynamic_protocol_context); 885 rtsp_st->dynamic_handler->close(rtsp_st->dynamic_protocol_context);
882 } 886 }
885 } 889 }
886 890
887 static int 891 static int
888 rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) 892 rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
889 { 893 {
894 RTSPState *rt = s->priv_data;
890 AVStream *st = NULL; 895 AVStream *st = NULL;
891 896
892 /* open the RTP context */ 897 /* open the RTP context */
893 if (rtsp_st->stream_index >= 0) 898 if (rtsp_st->stream_index >= 0)
894 st = s->streams[rtsp_st->stream_index]; 899 st = s->streams[rtsp_st->stream_index];
895 if (!st) 900 if (!st)
896 s->ctx_flags |= AVFMTCTX_NOHEADER; 901 s->ctx_flags |= AVFMTCTX_NOHEADER;
902
903 if (rt->transport == RTSP_TRANSPORT_RDT)
904 rtsp_st->tx_ctx = ff_rdt_parse_open(s, st,
905 rtsp_st->dynamic_protocol_context,
906 rtsp_st->dynamic_handler);
907 else
897 rtsp_st->tx_ctx = rtp_parse_open(s, st, rtsp_st->rtp_handle, rtsp_st->sdp_payload_type, &rtsp_st->rtp_payload_data); 908 rtsp_st->tx_ctx = rtp_parse_open(s, st, rtsp_st->rtp_handle, rtsp_st->sdp_payload_type, &rtsp_st->rtp_payload_data);
898 909
899 if (!rtsp_st->tx_ctx) { 910 if (!rtsp_st->tx_ctx) {
900 return AVERROR(ENOMEM); 911 return AVERROR(ENOMEM);
901 } else { 912 } else if (rt->transport != RTSP_TRANSPORT_RDT) {
902 if(rtsp_st->dynamic_handler) { 913 if(rtsp_st->dynamic_handler) {
903 rtp_parse_set_dynamic_protocol(rtsp_st->tx_ctx, 914 rtp_parse_set_dynamic_protocol(rtsp_st->tx_ctx,
904 rtsp_st->dynamic_protocol_context, 915 rtsp_st->dynamic_protocol_context,
905 rtsp_st->dynamic_handler); 916 rtsp_st->dynamic_handler);
906 } 917 }