1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#
# Found as a reversed patch at:
# http://www.nabble.com/0.9.4-and-raw1394-td20153815.html
#
--- vlc-20090123/modules/access/dv.c.orig 2009-01-23 00:46:54.000000000 +0100
+++ vlc-20090123/modules/access/dv.c 2009-01-23 01:11:19.000000000 +0100
@@ -98,7 +98,8 @@
} event_thread_t;
static void* Raw1394EventThread( vlc_object_t * );
-static int Raw1394Handler( raw1394handle_t, int, size_t, quadlet_t * );
+static enum raw1394_iso_disposition Raw1394Handler( raw1394handle_t handle, unsigned char *data, size_t length, unsigned char channel, unsigned char tag, unsigned char sy, unsigned int cycle, unsigned int dropped );
+//static int Raw1394Handler( raw1394handle_t, int, size_t, quadlet_t * );
static int Raw1394GetNumPorts( access_t *p_access );
static raw1394handle_t Raw1394Open( access_t *, int );
@@ -140,7 +141,7 @@
char *psz_name = strdup( p_access->psz_path );
struct raw1394_portinfo port_inf[ 16 ];
- iso_handler_t oldhandler;
+// iso_handler_t oldhandler;
msg_Dbg( p_access, "opening device %s", psz_name );
@@ -211,10 +212,20 @@
return VLC_EGENERIC;
}
- oldhandler = raw1394_set_iso_handler( p_sys->p_raw1394,
- p_sys->i_channel, Raw1394Handler );
+// oldhandler = raw1394_set_iso_handler( p_sys->p_raw1394,
+// p_sys->i_channel, Raw1394Handler );
+ if ( raw1394_iso_recv_init( p_sys->p_raw1394, Raw1394Handler, 2000, 1025,
+ p_sys->i_channel, RAW1394_DMA_PACKET_PER_BUFFER, -1 )
+< 0 )
+ {
+ msg_Err( p_access, "failed to initialize isochronous recieving" );
+ Close( p_this );
+ free( psz_name );
+ return VLC_EGENERIC;
+ }
raw1394_set_userdata( p_sys->p_raw1394, p_access );
- raw1394_start_iso_rcv( p_sys->p_raw1394, p_sys->i_channel );
+// raw1394_start_iso_rcv( p_sys->p_raw1394, p_sys->i_channel );
+ raw1394_iso_recv_start( p_sys->p_raw1394, -1, -1, 0 );
p_sys->raw1394_poll.fd = raw1394_get_fd( p_sys->p_raw1394 );
p_sys->raw1394_poll.events = POLLIN | POLLPRI;
@@ -256,8 +267,11 @@
/* stop the event handler */
vlc_object_kill( p_sys->p_ev );
- if( p_sys->p_raw1394 )
- raw1394_stop_iso_rcv( p_sys->p_raw1394, p_sys->i_channel );
+ if( p_sys->p_raw1394 ) {
+// raw1394_stop_iso_rcv( p_sys->p_raw1394, p_sys->i_channel );
+ raw1394_iso_stop( p_sys->p_raw1394 );
+ raw1394_iso_shutdown( p_sys->p_raw1394 );
+}
vlc_mutex_destroy( &p_sys->p_ev->lock );
vlc_thread_join( p_sys->p_ev );
@@ -388,7 +402,7 @@
return NULL;
}
-static int Raw1394Handler( raw1394handle_t handle, int channel, size_t length, quadlet_t *data )
+static enum raw1394_iso_disposition Raw1394Handler( raw1394handle_t handle, unsigned char *data, size_t length, unsigned char channel, unsigned char tag, unsigned char sy, unsigned int cycle, unsigned int dropped )
{
access_t *p_access = NULL;
access_sys_t *p_sys = NULL;
@@ -402,7 +416,7 @@
/* skip empty packets */
if ( length > 16 )
{
- unsigned char * p = ( unsigned char* ) &data[ 3 ];
+ unsigned char * p = ( unsigned char* ) &data[ 8 ];
int section_type = p[ 0 ] >> 5; /* section type is in bits 5 - 7 */
int dif_sequence = p[ 1 ] >> 4; /* dif sequence number is in bits 4 - 7 */
int dif_block = p[ 2 ];
@@ -460,7 +474,7 @@
}
vlc_mutex_unlock( &p_sys->p_ev->lock );
}
- return 0;
+ return RAW1394_ISO_OK;
}
/*
|