[vlc-devel] [RFC PATCH 1/2] vod: fix rtsp_path

Zhao Zhili quinkblack at foxmail.com
Sat Sep 29 15:25:55 CEST 2018


1. The document says rtsp-host is address/path
2. stream_out/vod treats it as url, which is incorrect
3. httpd treats it as address or hostname

It simple to fix it by taking the rtsp-host as only hostname.
---
 modules/stream_out/vod.c | 51 +++++-------------------------------------------
 1 file changed, 5 insertions(+), 46 deletions(-)

diff --git a/modules/stream_out/vod.c b/modules/stream_out/vod.c
index e1b6cbd..6b358ca 100644
--- a/modules/stream_out/vod.c
+++ b/modules/stream_out/vod.c
@@ -78,8 +78,6 @@ struct vod_media_t
 
 typedef struct
 {
-    char *psz_rtsp_path;
-
     /* */
     vlc_thread_t thread;
     block_fifo_t *p_fifo_cmd;
@@ -116,39 +114,10 @@ int OpenVoD( vlc_object_t *p_this )
 {
     vod_t *p_vod = (vod_t *)p_this;
     vod_sys_t *p_sys = NULL;
-    char *psz_url;
 
     p_vod->p_sys = p_sys = malloc( sizeof( vod_sys_t ) );
-    if( !p_sys ) goto error;
-
-    psz_url = var_InheritString( p_vod, "rtsp-host" );
-
-    if( psz_url == NULL )
-        p_sys->psz_rtsp_path = strdup( "/" );
-    else
-    {
-        vlc_url_t url;
-        vlc_UrlParse( &url, psz_url );
-        free( psz_url );
-
-        if( url.psz_path == NULL )
-            p_sys->psz_rtsp_path = strdup( "/" );
-        else
-        if( !( strlen( url.psz_path ) > 0
-               && url.psz_path[strlen( url.psz_path ) - 1] == '/' ) )
-        {
-            if( asprintf( &p_sys->psz_rtsp_path, "%s/", url.psz_path ) == -1 )
-            {
-                p_sys->psz_rtsp_path = NULL;
-                vlc_UrlClean( &url );
-                goto error;
-            }
-        }
-        else
-            p_sys->psz_rtsp_path = strdup( url.psz_path );
-
-        vlc_UrlClean( &url );
-    }
+    if( !p_sys )
+        return VLC_EGENERIC;
 
     p_vod->pf_media_new = MediaNew;
     p_vod->pf_media_del = MediaAskDel;
@@ -158,19 +127,11 @@ int OpenVoD( vlc_object_t *p_this )
     {
         msg_Err( p_vod, "cannot spawn rtsp vod thread" );
         block_FifoRelease( p_sys->p_fifo_cmd );
-        goto error;
-    }
-
-    return VLC_SUCCESS;
-
-error:
-    if( p_sys )
-    {
-        free( p_sys->psz_rtsp_path );
         free( p_sys );
+        return VLC_EGENERIC;
     }
 
-    return VLC_EGENERIC;
+    return VLC_SUCCESS;
 }
 
 /*****************************************************************************
@@ -197,7 +158,6 @@ void CloseVoD( vlc_object_t * p_this )
     }
     block_FifoRelease( p_sys->p_fifo_cmd );
 
-    free( p_sys->psz_rtsp_path );
     free( p_sys );
 }
 
@@ -274,10 +234,9 @@ error:
 static void MediaSetup( vod_t *p_vod, vod_media_t *p_media,
                         const char *psz_name )
 {
-    vod_sys_t *p_sys = p_vod->p_sys;
     char *psz_path;
 
-    if( asprintf( &psz_path, "%s%s", p_sys->psz_rtsp_path, psz_name ) < 0 )
+    if( asprintf( &psz_path, "/%s", psz_name ) < 0 )
         return;
 
     p_media->rtsp = RtspSetup(VLC_OBJECT(p_vod), p_media, psz_path);
-- 
2.9.5





More information about the vlc-devel mailing list