[vlc-devel] commit: Support for opening any file descriptor with fd:// ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Feb 21 10:56:15 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Feb 21 11:55:14 2009 +0200| [3fc7274ffd449868982bd5fb2d5a98d81ffb25f7] | committer: Rémi Denis-Courmont 

Support for opening any file descriptor with fd://

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

 modules/access/file.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/access/file.c b/modules/access/file.c
index 91f2a84..555f1bd 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -88,6 +88,7 @@ vlc_module_begin ()
     add_obsolete_string( "file-cat" )
     set_capability( "access", 50 )
     add_shortcut( "file" )
+    add_shortcut( "fd" )
     add_shortcut( "stream" )
     set_callbacks( Open, Close )
 vlc_module_end ()
@@ -121,8 +122,6 @@ static int Open( vlc_object_t *p_this )
     access_t     *p_access = (access_t*)p_this;
     access_sys_t *p_sys;
 
-    bool    b_stdin = !strcmp (p_access->psz_path, "-");
-
     /* Update default_pts to a suitable value for file access */
     var_Create( p_access, "file-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
 
@@ -135,13 +134,17 @@ static int Open( vlc_object_t *p_this )
         p_sys->b_pace_control = true;
 
     /* Open file */
-    msg_Dbg (p_access, "opening file `%s'", p_access->psz_path);
-
     int fd = -1;
-    if (b_stdin)
+
+    if (!strcasecmp (p_access->psz_access, "fd"))
+        fd = dup (atoi (p_access->psz_path));
+    else if (!strcmp (p_access->psz_path, "-"))
         fd = dup (0);
     else
+    {
+        msg_Dbg (p_access, "opening file `%s'", p_access->psz_path);
         fd = open_file (p_access, p_access->psz_path);
+    }
     if (fd == -1)
         goto error;
 
@@ -165,8 +168,6 @@ static int Open( vlc_object_t *p_this )
     else if (!S_ISBLK (st.st_mode))
         p_access->pf_seek = NoSeek;
 #else
-    if (b_stdin)
-        p_access->pf_seek = NoSeek;
 # warning File size not known!
 #endif
 




More information about the vlc-devel mailing list