]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/vod.c
Make the video transcoder support filter chains that output multiple frames
[vlc] / modules / stream_out / vod.c
index e0b81ea9194c992a7c3db6abf04bc1a501538297..41c8d254253babfd4b3e28d08b29325a4b1f5f8c 100644 (file)
@@ -77,7 +77,7 @@ struct vod_media_t
 
 struct vod_sys_t
 {
-    char *psz_rtsp_url;
+    char *psz_rtsp_path;
 
     /* */
     vlc_thread_t thread;
@@ -123,20 +123,31 @@ int OpenVoD( vlc_object_t *p_this )
     psz_url = var_InheritString( p_vod, "rtsp-host" );
 
     if( psz_url == NULL )
-        p_sys->psz_rtsp_url = strdup( "/" );
+        p_sys->psz_rtsp_path = strdup( "/" );
     else
-    if( !( strlen( psz_url ) > 0 && psz_url[strlen( psz_url ) - 1] == '/' ) )
     {
-         if( asprintf( &p_sys->psz_rtsp_url, "%s/", psz_url ) == -1 )
-         {
-             p_sys->psz_rtsp_url = NULL;
-             free( psz_url );
-             goto error;
-         }
-         free( psz_url );
+        vlc_url_t url;
+        vlc_UrlParse( &url, psz_url, 0 );
+        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 );
     }
-    else
-        p_sys->psz_rtsp_url = psz_url;
 
     p_vod->pf_media_new = MediaNew;
     p_vod->pf_media_del = MediaAskDel;
@@ -154,7 +165,7 @@ int OpenVoD( vlc_object_t *p_this )
 error:
     if( p_sys )
     {
-        free( p_sys->psz_rtsp_url );
+        free( p_sys->psz_rtsp_path );
         free( p_sys );
     }
 
@@ -185,7 +196,7 @@ void CloseVoD( vlc_object_t * p_this )
     }
     block_FifoRelease( p_sys->p_fifo_cmd );
 
-    free( p_sys->psz_rtsp_url );
+    free( p_sys->psz_rtsp_path );
     free( p_sys );
 }
 
@@ -263,18 +274,13 @@ 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_url;
+    char *psz_path;
 
-    if( asprintf( &psz_url, "%s%s", p_sys->psz_rtsp_url, psz_name ) < 0 )
+    if( asprintf( &psz_path, "%s%s", p_sys->psz_rtsp_path, psz_name ) < 0 )
         return;
 
-    vlc_url_t url;
-    vlc_UrlParse( &url, psz_url, 0 );
-    free( psz_url );
-
-    p_media->rtsp = RtspSetup(VLC_OBJECT(p_vod), p_media, url.psz_path);
-
-    vlc_UrlClean( &url );
+    p_media->rtsp = RtspSetup(VLC_OBJECT(p_vod), p_media, psz_path);
+    free( psz_path );
 
     if (p_media->rtsp == NULL)
         return;
@@ -333,7 +339,7 @@ static void CommandPush( vod_t *p_vod, rtsp_cmd_type_t i_type,
     else
         cmd.psz_arg = NULL;
 
-    p_cmd = block_New( p_vod, sizeof(rtsp_cmd_t) );
+    p_cmd = block_Alloc( sizeof(rtsp_cmd_t) );
     memcpy( p_cmd->p_buffer, &cmd, sizeof(cmd) );
 
     block_FifoPut( p_vod->p_sys->p_fifo_cmd, p_cmd );