/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_access.h>
#include <errno.h>
#define CACHING_TEXT N_("Caching value in ms")
#define CACHING_LONGTEXT N_( \
- "Caching value for DV streams. This" \
+ "Caching value for DV streams. This " \
"value should be set in milliseconds." )
-vlc_module_begin();
- set_description( _("Digital Video (Firewire/ieee1394) input") );
- set_shortname( _("dv") );
- set_category( CAT_INPUT );
- set_subcategory( SUBCAT_INPUT_ACCESS );
- add_integer( "dv-caching", 60000 / 1000, NULL, CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
- change_safe();
- set_capability( "access2", 0 );
- add_shortcut( "dv" );
- add_shortcut( "dv1394" );
- add_shortcut( "raw1394" );
- set_callbacks( Open, Close );
-vlc_module_end();
+vlc_module_begin ()
+ set_description( N_("Digital Video (Firewire/ieee1394) input") )
+ set_shortname( N_("dv") )
+ set_category( CAT_INPUT )
+ set_subcategory( SUBCAT_INPUT_ACCESS )
+ add_integer( "dv-caching", 60000 / 1000, NULL, CACHING_TEXT, CACHING_LONGTEXT, true )
+ set_capability( "access", 0 )
+ add_shortcut( "dv" )
+ add_shortcut( "dv1394" )
+ add_shortcut( "raw1394" )
+ set_callbacks( Open, Close )
+vlc_module_end ()
typedef struct
{
} event_thread_t;
-static int Raw1394EventThread( vlc_object_t * );
+static void* Raw1394EventThread( vlc_object_t * );
static int Raw1394Handler( raw1394handle_t, int, size_t, quadlet_t * );
static int Raw1394GetNumPorts( access_t *p_access );
/* Set up p_access */
access_InitFields( p_access );
ACCESS_SET_CALLBACKS( NULL, Block, Control, NULL );
- p_access->info.b_prebuffered = VLC_FALSE;
p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
if( !p_sys )
p_sys->p_frame = NULL;
p_sys->p_ev = NULL;
- vlc_mutex_init( p_access, &p_sys->lock );
+ vlc_mutex_init( &p_sys->lock );
p_sys->i_node = DiscoverAVC( p_access, &p_sys->i_port, p_sys->i_guid );
if( p_sys->i_node < 0 )
raw1394_start_iso_rcv( p_sys->p_raw1394, p_sys->i_channel );
p_sys->raw1394_poll.fd = raw1394_get_fd( p_sys->p_raw1394 );
- p_sys->raw1394_poll.events = POLLIN | POLLERR | POLLHUP | POLLPRI;
+ p_sys->raw1394_poll.events = POLLIN | POLLPRI;
/* Update default_pts to a suitable value for udp access */
var_Create( p_access, "dv-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
p_sys->p_ev->p_frame = NULL;
p_sys->p_ev->pp_last = &p_sys->p_ev->p_frame;
p_sys->p_ev->p_access = p_access;
- vlc_mutex_init( p_access, &p_sys->p_ev->lock );
+ vlc_mutex_init( &p_sys->p_ev->lock );
vlc_thread_create( p_sys->p_ev, "dv event thread handler", Raw1394EventThread,
- VLC_THREAD_PRIORITY_OUTPUT, VLC_FALSE );
+ VLC_THREAD_PRIORITY_OUTPUT, false );
free( psz_name );
return VLC_SUCCESS;
p_sys->p_ev->pp_last = &p_sys->p_frame;
vlc_mutex_unlock( &p_sys->p_ev->lock );
}
- vlc_object_destroy( p_sys->p_ev );
+ vlc_object_release( p_sys->p_ev );
}
if( p_sys->p_frame )
static int Control( access_t *p_access, int i_query, va_list args )
{
access_sys_t *p_sys = p_access->p_sys;
- vlc_bool_t *pb_bool;
+ bool *pb_bool;
int64_t *pi_64;
switch( i_query )
{
/* */
case ACCESS_CAN_PAUSE:
- pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
- *pb_bool = VLC_TRUE;
+ pb_bool = (bool*)va_arg( args, bool* );
+ *pb_bool = true;
break;
case ACCESS_CAN_SEEK:
case ACCESS_CAN_FASTSEEK:
case ACCESS_CAN_CONTROL_PACE:
- pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
- *pb_bool = VLC_FALSE;
+ pb_bool = (bool*)va_arg( args, bool* );
+ *pb_bool = false;
break;
case ACCESS_GET_PTS_DELAY:
access_sys_t *p_sys = p_access->p_sys;
block_t *p_block = NULL;
-// if( !p_access->psz_demux )
-// p_access->psz_demux = strdup( "rawdv" );
+#if 0
+ if( !p_access->psz_demux )
+ {
+ free( p_access->psz_demux );
+ p_access->psz_demux = strdup( "rawdv" );
+ }
+#endif
vlc_mutex_lock( &p_sys->lock );
p_block = p_sys->p_frame;
return p_block;
}
-static int Raw1394EventThread( vlc_object_t *p_this )
+static void* Raw1394EventThread( vlc_object_t *p_this )
{
event_thread_t *p_ev = (event_thread_t *) p_this;
access_t *p_access = (access_t *) p_ev->p_access;
access_sys_t *p_sys = (access_sys_t *) p_access->p_sys;
int result = 0;
+ int canc = vlc_savecancel ();
AVCPlay( p_access, p_sys->i_node );
- vlc_thread_ready( p_this );
-
- while( !p_sys->p_ev->b_die )
+ while( vlc_object_alive (p_sys->p_ev) )
{
while( ( result = poll( &(p_sys->raw1394_poll), 1, 200 ) ) < 0 )
{
perror( "error: raw1394 poll" );
msg_Err( p_access, "retrying device raw1394" );
}
- if( p_sys->p_ev->b_die )
- break;
}
- if( p_sys->p_ev->b_die )
+ if( !vlc_object_alive (p_sys->p_ev) )
break;
if( result > 0 && ( ( p_sys->raw1394_poll.revents & POLLIN )
|| ( p_sys->raw1394_poll.revents & POLLPRI ) ) )
}
AVCStop( p_access, p_sys->i_node );
- return VLC_SUCCESS;
+ vlc_restorecancel (canc);
+ return NULL;
}
static int Raw1394Handler( raw1394handle_t handle, int channel, size_t length, quadlet_t *data )