[vlc-commits] commit: mediadirs: better detection for recorded material (Erwan Tulou )

git at videolan.org git at videolan.org
Sat Apr 3 18:58:22 CEST 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Sat Apr  3 18:42:14 2010 +0200| [b77716ee8402a82627c1fffe225212e1d206b908] | committer: Erwan Tulou 

mediadirs: better detection for recorded material

especially, also detect material recorded at the stream filter level

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

 modules/services_discovery/mediadirs.c |   33 +++++++++++++++++++++----------
 src/text/filesystem.c                  |   10 ++++----
 2 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/modules/services_discovery/mediadirs.c b/modules/services_discovery/mediadirs.c
index 6cd5e60..9f91151 100644
--- a/modules/services_discovery/mediadirs.c
+++ b/modules/services_discovery/mediadirs.c
@@ -259,8 +259,9 @@ static int onNewFileAdded( vlc_object_t *p_this, char const *psz_var,
                      vlc_value_t oldval, vlc_value_t newval, void *p_data )
 {
     services_discovery_t *p_sd = p_data;
+    services_discovery_sys_t *p_sys = p_sd->p_sys;
 
-    (void)p_this; (void)psz_var; (void)oldval;
+    (void)psz_var; (void)oldval;
     char* psz_file = newval.psz_string;
     if( !psz_file || !*psz_file )
         return VLC_EGENERIC;
@@ -268,24 +269,34 @@ static int onNewFileAdded( vlc_object_t *p_this, char const *psz_var,
     char* psz_uri = make_URI( psz_file );
     input_item_t* p_item = input_item_New( p_sd, psz_uri, NULL );
 
-    if( fileType( p_sd, psz_file ) == Picture )
+    if( p_sys->i_type == Picture )
     {
-        formatSnapshotItem( p_item );
-        services_discovery_AddItem( p_sd, p_item, NULL );
+        if( fileType( p_sd, psz_file ) == Picture )
+        {
+            formatSnapshotItem( p_item );
+            services_discovery_AddItem( p_sd, p_item, NULL );
 
-        msg_Dbg( p_sd, "New snapshot added : %s", psz_file );
+            msg_Dbg( p_sd, "New snapshot added : %s", psz_file );
+        }
     }
-    else if( fileType( p_sd, psz_file ) == Audio )
+    else if( p_sys->i_type == Audio )
     {
-        services_discovery_AddItem( p_sd, p_item, NULL );
+        if( fileType( p_sd, psz_file ) == Audio )
+        {
+            services_discovery_AddItem( p_sd, p_item, NULL );
 
-        msg_Dbg( p_sd, "New recorded audio added : %s", psz_file );
+            msg_Dbg( p_sd, "New recorded audio added : %s", psz_file );
+        }
     }
-    else if( fileType( p_sd, psz_file ) == Video )
+    else if( p_sys->i_type == Video )
     {
-        services_discovery_AddItem( p_sd, p_item, NULL );
+        if( fileType( p_sd, psz_file ) == Video ||
+            fileType( p_sd, psz_file ) == Unknown )
+        {
+            services_discovery_AddItem( p_sd, p_item, NULL );
 
-        msg_Dbg( p_sd, "New recorded video added : %s", psz_file );
+            msg_Dbg( p_sd, "New recorded video added : %s", psz_file );
+        }
     }
 
     vlc_gc_decref( p_item );
diff --git a/src/text/filesystem.c b/src/text/filesystem.c
index e230f05..66111ac 100644
--- a/src/text/filesystem.c
+++ b/src/text/filesystem.c
@@ -695,12 +695,12 @@ int vlc_accept (int lfd, struct sockaddr *addr, socklen_t *alen, bool nonblock)
         if (fd != -1)
         {
 #ifndef WIN32
-    fcntl (fd, F_SETFD, FD_CLOEXEC);
-    if (nonblock)
-        fcntl (fd, F_SETFL, fcntl (fd, F_GETFL, 0) | O_NONBLOCK);
+            fcntl (fd, F_SETFD, FD_CLOEXEC);
+            if (nonblock)
+                fcntl (fd, F_SETFL, fcntl (fd, F_GETFL, 0) | O_NONBLOCK);
 #else
-    if (nonblock)
-        ioctlsocket (fd, FIONBIO, &(unsigned long){ 1 });
+            if (nonblock)
+                ioctlsocket (fd, FIONBIO, &(unsigned long){ 1 });
 #endif
             return fd;
         }



More information about the vlc-commits mailing list