* Preamble
*****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <vlc/vlc.h>
+#include <vlc_plugin.h>
#include <vlc_input.h>
#include <vlc_access.h>
add_shortcut( "record" );
add_directory( "record-path", NULL, NULL,
- RECORD_PATH_TXT, RECORD_PATH_LONGTXT, VLC_TRUE );
+ RECORD_PATH_TXT, RECORD_PATH_LONGTXT, true );
+ change_unsafe();
set_callbacks( Open, Close );
*****************************************************************************/
static block_t *Block ( access_t * );
-static int Read ( access_t *, uint8_t *, int );
+static ssize_t Read ( access_t *, uint8_t *, size_t );
static int Control( access_t *, int i_query, va_list args );
static int Seek ( access_t *, int64_t );
struct access_sys_t
{
- vlc_bool_t b_dump;
+ bool b_dump;
char *psz_path;
const char *psz_ext;
p_sys->i_size = 0;
p_sys->psz_file = NULL;
p_sys->psz_ext = "dat";
- p_sys->b_dump = VLC_FALSE;
+ p_sys->b_dump = false;
p_sys->p_vout = NULL;
p_sys->i_vout_chan = -1;
p_sys->i_update_sav = p_access->info.i_update;
if( *psz == '\0' )
{
free( psz );
- if( p_access->p_libvlc->psz_homedir )
+ if( p_access->p_libvlc->psz_homedir ) /* XXX: This should never happen */
psz = strdup( p_access->p_libvlc->psz_homedir );
}
p_sys->psz_path = psz;
msg_Dbg( p_access, "Record access filter path %s", psz );
/* catch all key event */
- var_AddCallback( p_access->p_libvlc, "key-pressed", EventKey, p_access );
+ var_AddCallback( p_access->p_libvlc, "key-action", EventKey, p_access );
return VLC_SUCCESS;
}
access_t *p_access = (access_t*)p_this;
access_sys_t *p_sys = p_access->p_sys;
- var_DelCallback( p_access->p_libvlc, "key-pressed", EventKey, p_access );
+ var_DelCallback( p_access->p_libvlc, "key-action", EventKey, p_access );
if( p_sys->f )
{
/*****************************************************************************
*
*****************************************************************************/
-static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
+static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
{
access_t *p_src = p_access->p_source;
int i_ret;
access_t *p_access = p_data;
access_sys_t *p_sys = p_access->p_sys;
- struct hotkey *p_hotkeys = p_access->p_libvlc->p_hotkeys;
- int i_action = -1, i;
+ (void)psz_var;
+ (void)oldval;
- for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
- {
- if( p_hotkeys[i].i_key == newval.i_int )
- {
- i_action = p_hotkeys[i].i_action;
- }
- }
-
- if( i_action == ACTIONID_RECORD )
+ if( newval.i_int == ACTIONID_RECORD )
{
if( p_sys->b_dump )
- p_sys->b_dump = VLC_FALSE;
+ p_sys->b_dump = false;
else
- p_sys->b_dump = VLC_TRUE;
+ p_sys->b_dump = true;
}
return VLC_SUCCESS;
/*****************************************************************************
*
*****************************************************************************/
-static void Notify( access_t *p_access, vlc_bool_t b_dump )
+static void Notify( access_t *p_access, bool b_dump )
{
access_sys_t *p_sys = p_access->p_sys;
vout_thread_t *p_vout;
{
if( p_sys->f )
{
- msg_Dbg( p_access, "dumped "I64Fd" kb (%s)",
+ msg_Dbg( p_access, "dumped %"PRId64" kb (%s)",
p_sys->i_size/1024, p_sys->psz_file );
- Notify( p_access, VLC_FALSE );
+ Notify( p_access, false );
fclose( p_sys->f );
p_sys->f = NULL;
time_t t = time(NULL);
struct tm 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 )
free( psz_name );
if( p_sys->psz_file == NULL )
{
- p_sys->b_dump = VLC_FALSE;
+ p_sys->b_dump = false;
return;
}
free( psz_name );
if( p_sys->psz_file == NULL )
{
- p_sys->b_dump = VLC_FALSE;
+ p_sys->b_dump = false;
return;
}
p_sys->f = utf8_fopen( p_sys->psz_file, "wb" );
if( p_sys->f == NULL )
{
- msg_Err( p_access, "cannot open file '%s' (%s)",
- p_sys->psz_file, strerror(errno) );
+ msg_Err( p_access, "cannot open file '%s' (%m)",
+ p_sys->psz_file );
free( p_sys->psz_file );
p_sys->psz_file = NULL;
- p_sys->b_dump = VLC_FALSE;
+ p_sys->b_dump = false;
return;
}
- Notify( p_access, VLC_TRUE );
+ Notify( p_access, true );
p_sys->i_size = 0;
}