[vlc-devel] commit: rtp sout: fix RTSP track numbering in SDP (Pierre Ynard )
git version control
git at videolan.org
Fri Jan 22 18:49:45 CET 2010
vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Fri Jan 22 18:47:09 2010 +0100| [e30cb4fb539e4fa5ae16ae04c45fe9c6ed52f586] | committer: Pierre Ynard
rtp sout: fix RTSP track numbering in SDP
Add a helper to get the right values from the RTSP code
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e30cb4fb539e4fa5ae16ae04c45fe9c6ed52f586
---
modules/stream_out/rtp.c | 11 ++++++-----
modules/stream_out/rtp.h | 2 ++
modules/stream_out/rtsp.c | 13 +++++++++++++
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index e20669e..c9568c8 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -833,11 +833,12 @@ char *SDPGenerate( const sout_stream_t *p_stream, const char *rtsp_url )
if( rtsp_url != NULL )
{
- assert( strlen( rtsp_url ) > 0 );
- bool addslash = ( rtsp_url[strlen( rtsp_url ) - 1] != '/' );
- sdp_AddAttribute ( &psz_sdp, "control",
- addslash ? "%s/trackID=%u" : "%strackID=%u",
- rtsp_url, i );
+ char *track_url = RtspAppendTrackPath( id->rtsp_id, rtsp_url );
+ if( track_url != NULL )
+ {
+ sdp_AddAttribute ( &psz_sdp, "control", "%s", track_url );
+ free( track_url );
+ }
}
else
{
diff --git a/modules/stream_out/rtp.h b/modules/stream_out/rtp.h
index d4bc741..94b8a79 100644
--- a/modules/stream_out/rtp.h
+++ b/modules/stream_out/rtp.h
@@ -34,6 +34,8 @@ rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid,
unsigned loport, unsigned hiport );
void RtspDelId( rtsp_stream_t *rtsp, rtsp_stream_id_t * );
+char *RtspAppendTrackPath( rtsp_stream_id_t *id, const char *base );
+
char *SDPGenerate( const sout_stream_t *p_stream, const char *rtsp_url );
uint32_t rtp_compute_ts( const sout_stream_id_t *id, int64_t i_pts );
diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c
index 844890e..1bc02bc 100644
--- a/modules/stream_out/rtsp.c
+++ b/modules/stream_out/rtsp.c
@@ -179,6 +179,19 @@ struct rtsp_strack_t
};
+char *RtspAppendTrackPath( rtsp_stream_id_t *id, const char *base )
+{
+ assert( ( strlen( base ) > 0 && base[strlen( base ) - 1] == '/' )
+ ^ ( id->stream->track_sep[0] == '/' ) );
+
+ char *url;
+ if( asprintf( &url, "%s%strackID=%u", base, id->stream->track_sep,
+ id->track_id ) == -1 )
+ url = NULL;
+ return url;
+}
+
+
rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid,
uint32_t ssrc,
/* Multicast stuff - TODO: cleanup */
More information about the vlc-devel
mailing list