Re: [FFmpeg-soc] [vlc-devel] ffmpeg rtsp access demuxer
Hi, 2010/6/23 Rémi Denis-Courmont <rem@videolan.org>:
On Saturday 12 June 2010 08:53:03 Josh Allmann, you wrote:
Hello,
Here is a first attempt at integrating the RTSP layer from ffmpeg. It does so by adding an access demuxer to the VLC scaffolding for libavformat.
All the major transports are working (udp, tcp, rtsp-http). I have not yet looked at features like auth or muxing, but I can do that once I know this patch is on the right track.
@@ -117,10 +119,33 @@ int OpenDemux( vlc_object_t *p_this ) unsigned int i; int64_t i_start_time = -1; bool b_can_seek; + char filename[128] = "", opts[8] = ""; + int filename_len = 0;
I'm afraid an RTSP URL could easily exceed 127 characters. Why don't you use asprintf() or similar instead?
Well, that's a good function to know. Fixed.
+ if( var_CreateGetBool( p_demux, "rtsp-tcp" ) )
var_InheritBool.
Fixed
+ strcpy(opts, "?tcp");
If I'm not mistaken, you could simply assign a const char pointer instead of using strcpy().
Fixed
+ else if( var_CreateGetBool( p_demux, "rtsp-http" ) ) + strcpy(opts, "?http"); + else if( var_CreateGetBool( p_demux, "rtsp-udp" ) ) + strcpy(opts, "?udp");
Same notes as above.
Fixed
+ /* build the filename string */ + if( p_demux->psz_access ) + { + filename_len += av_strlcatf( filename + filename_len, + sizeof(filename) - filename_len, + "%s://", p_demux->psz_access); + } + filename_len += av_strlcpy( filename + filename_len, + p_demux->psz_path, + sizeof(filename) - filename_len ); + filename_len += av_strlcpy( filename + filename_len, + opts, + sizeof(filename) - filename_len );
As noted above, this could probably be corrected and simplified to if (psz_access) asprintf(...); else asprintf(...); plus error handling.
Indeed, simplified considerably.
-- Rémi Denis-Courmont
participants (1)
-
Josh Allmann