[vlc-commits] stream_UrlNew: avoid harmful vlc_object_find()

Rémi Denis-Courmont git at videolan.org
Tue Mar 29 18:40:49 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Mar 29 19:29:57 2011 +0300| [ff834fa53aba13096e1e29bf0851e9c1c1a8cd87] | committer: Rémi Denis-Courmont

stream_UrlNew: avoid harmful vlc_object_find()

Four access plugins need access to the input at the moment. In all
cases, it would misbehave if the input (item) of the main access was
used.

attachment: failing seems like the correct thing. I don't see a use for
attachment from stream_UrlNew().

CDDA uses the input item to append child nodes for individual tracks.
This is wrong in case of stream_UrlNew(), as the input items would be
wrongly appended to the main access item. Like directory, FTP, etc,
CCDA should probably return a playlist in this particular case.

MMSH uses the input item for redirection. This would not work properly
for stream_UrlNew(): it would rewrite the main access URL instead of
the child stream URL. This failing seems actually safer. Handling the
redirection within the MMS plugin would probably be better.

VCDX uses the input item to fill disc-wide meta data from the GET_TITLE
control request. It should use GET_META instead. In any case, it should
not pollute the meta data of the main access.

Bugs have been filed for the last 3 cases. Fortunately, I doubt any of
these access plugins was ever used through stream_UrlNew().

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff834fa53aba13096e1e29bf0851e9c1c1a8cd87
---

 src/input/stream.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 800e6fd..4e7d08c 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -260,16 +260,8 @@ stream_t *stream_UrlNew( vlc_object_t *p_parent, const char *psz_url )
     strcpy( psz_dup, psz_url );
     input_SplitMRL( &psz_access, &psz_demux, &psz_path, psz_dup );
 
-    /* Get a weak link to the parent input */
-    /* FIXME: This should probably be removed in favor of a NULL input. */
-    input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_parent, VLC_OBJECT_INPUT, FIND_PARENT );
-    
     /* Now try a real access */
-    p_access = access_New( p_parent, p_input, psz_access, psz_demux, psz_path );
-
-    if(p_input)
-        vlc_object_release((vlc_object_t*)p_input);
-
+    p_access = access_New( p_parent, NULL, psz_access, psz_demux, psz_path );
     if( p_access == NULL )
     {
         msg_Err( p_parent, "no suitable access module for `%s'", psz_url );



More information about the vlc-commits mailing list