]> git.sesse.net Git - vlc/commitdiff
mediadirs: better detection for recorded material
authorErwan Tulou <erwan10@videolan.org>
Sat, 3 Apr 2010 16:42:14 +0000 (18:42 +0200)
committerErwan Tulou <erwan10@videolan.org>
Sat, 3 Apr 2010 16:57:34 +0000 (18:57 +0200)
especially, also detect material recorded at the stream filter level

modules/services_discovery/mediadirs.c
src/text/filesystem.c

index 6cd5e605d71079c3030f9fd27655f599a71be5ce..9f911519386484351a5cd5ab632e1655f72fd46a 100644 (file)
@@ -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 );
index e230f058c10178b8a45f107e50bf716c1d71d4dd..66111acfa8afe0a221a51b1b991f3beb6b348156 100644 (file)
@@ -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;
         }