]> git.sesse.net Git - vlc/blobdiff - modules/access_filter/record.c
Merged OSD functionality on the same core functions. All OSD functionality is describ...
[vlc] / modules / access_filter / record.c
index 757c7da05407fd60e9c257d91d3b8f481a92c578..f95d65ce935310ba6d08b956e5ba0671e89d3827 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * record.c
  *****************************************************************************
- * Copyright (C) 2005 VideoLAN
+ * Copyright (C) 2005 the VideoLAN team
  * $Id: demux.c 7546 2004-04-29 13:53:29Z gbazin $
  *
  * Author: Laurent Aimar <fenrir@via.ecp.fr>
@@ -31,7 +31,9 @@
 #include <vlc/vout.h>
 
 #include "vlc_keys.h"
-#include <osd.h>
+#include <vlc_osd.h>
+#include <errno.h>
+#include <time.h>
 
 /*****************************************************************************
  * Module descriptor
@@ -45,14 +47,15 @@ static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
 vlc_module_begin();
+    set_shortname( _("Record") );
     set_description( _("Record") );
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_ACCESS_FILTER );
     set_capability( "access_filter", 0 );
     add_shortcut( "record" );
 
-    add_string( "record-path", NULL, NULL,
-                RECORD_PATH_TXT, RECORD_PATH_LONGTXT, VLC_TRUE );
+    add_directory( "record-path", NULL, NULL,
+                   RECORD_PATH_TXT, RECORD_PATH_LONGTXT, VLC_TRUE );
 
     set_callbacks( Open, Close );
 
@@ -323,20 +326,37 @@ static void Dump( access_t *p_access, uint8_t *p_buffer, int i_buffer )
         time_t t = time(NULL);
         struct tm l;
 
-        if( !localtime_r( &t, &l ) )
-            memset( &l, 0, sizeof(l) );
+#ifdef HAVE_LOCALTIME_R
+        if( !localtime_r( &t, &l ) ) memset( &l, 0, sizeof(l) );
+#else
+        /* Grrr */
+        {
+            struct tm *p_l = localtime( &t );
+            if( p_l ) l = *p_l;
+            else memset( &l, 0, sizeof(l) );
+        }
+#endif
 
         p_input = vlc_object_find( p_access, VLC_OBJECT_INPUT, FIND_PARENT );
         if( p_input )
         {
             vlc_mutex_lock( &p_input->input.p_item->lock );
-            if( p_input->input.p_item->psz_name &&
-                strlen( p_input->input.p_item->psz_name ) < 64 )
-                psz_name = strdup( p_input->input.p_item->psz_name );
+            if( p_input->input.p_item->psz_name )
+            {
+                char *p = strrchr( p_input->input.p_item->psz_name, '/' );
+                if( p == NULL )
+                    p = strrchr( p_input->input.p_item->psz_name, '\\' );
+
+                if( p == NULL )
+                    psz_name = strdup( p_input->input.p_item->psz_name );
+                else if( p[1] != '\0' )
+                    psz_name = strdup( &p[1] );
+            }
             vlc_mutex_unlock( &p_input->input.p_item->lock );
 
             vlc_object_release( p_input );
         }
+
         if( psz_name == NULL )
             psz_name = strdup( "Unknown" );