[vlc-devel] ffmpeg rtsp access demuxer
Rémi Denis-Courmont
rem at videolan.org
Thu Jun 24 02:27:57 CEST 2010
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?
+ if( var_CreateGetBool( p_demux, "rtsp-tcp" ) )
var_InheritBool.
+ strcpy(opts, "?tcp");
If I'm not mistaken, you could simply assign a const char pointer instead of
using strcpy().
+ 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.
+ /* 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.
--
Rémi Denis-Courmont
More information about the vlc-devel
mailing list