1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2001, 2002 the VideoLAN team
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
32 #include <vlc_common.h>
33 #include <vlc_access.h>
34 #include <vlc_strings.h>
35 #include <vlc_input.h>
37 #include <vlc_network.h>
49 /*****************************************************************************
51 *****************************************************************************/
52 int MMSHOpen ( access_t * );
53 void MMSHClose ( access_t * );
55 static block_t *Block( access_t *p_access );
56 static ssize_t ReadRedirect( access_t *, uint8_t *, size_t );
57 static int Seek( access_t *, int64_t );
58 static int Control( access_t *, int, va_list );
60 static int Describe( access_t *, char **ppsz_location );
61 static int Start( access_t *, int64_t );
62 static void Stop( access_t * );
64 static int GetPacket( access_t *, chunk_t * );
65 static void GetHeader( access_t *p_access );
67 static int Restart( access_t * );
68 static int Reset( access_t * );
70 //#define MMSH_USER_AGENT "NSPlayer/4.1.0.3856"
71 #define MMSH_USER_AGENT "NSPlayer/7.10.0.3059"
73 /****************************************************************************
74 * Open: connect to ftp server and ask for file
75 ****************************************************************************/
76 int MMSHOpen( access_t *p_access )
79 char *psz_location = NULL;
82 STANDARD_BLOCK_ACCESS_INIT
84 p_sys->i_proto= MMS_PROTO_HTTP;
88 p_sys->b_proxy = false;
89 memset( &p_sys->proxy, 0, sizeof(p_sys->proxy) );
92 /* TODO reuse instead http-proxy from http access ? */
93 psz_proxy = var_CreateGetNonEmptyString( p_access, "mmsh-proxy" );
96 char *psz_http_proxy = var_InheritString( p_access, "http-proxy" );
99 psz_proxy = psz_http_proxy;
100 var_SetString( p_access, "mmsh-proxy", psz_proxy );
106 p_sys->b_proxy = true;
107 vlc_UrlParse( &p_sys->proxy, psz_proxy, 0 );
113 const char *http_proxy = getenv( "http_proxy" );
116 p_sys->b_proxy = true;
117 vlc_UrlParse( &p_sys->proxy, http_proxy, 0 );
124 if( ( p_sys->proxy.psz_host == NULL ) ||
125 ( *p_sys->proxy.psz_host == '\0' ) )
127 msg_Warn( p_access, "invalid proxy host" );
128 vlc_UrlClean( &p_sys->proxy );
133 if( p_sys->proxy.i_port <= 0 )
134 p_sys->proxy.i_port = 80;
135 msg_Dbg( p_access, "Using http proxy %s:%d",
136 p_sys->proxy.psz_host, p_sys->proxy.i_port );
139 /* open a tcp connection */
140 vlc_UrlParse( &p_sys->url, p_access->psz_path, 0 );
141 if( ( p_sys->url.psz_host == NULL ) ||
142 ( *p_sys->url.psz_host == '\0' ) )
144 msg_Err( p_access, "invalid host" );
147 if( p_sys->url.i_port <= 0 )
148 p_sys->url.i_port = 80;
150 if( Describe( p_access, &psz_location ) )
153 /* Handle redirection */
154 if( psz_location && *psz_location )
156 msg_Dbg( p_access, "redirection to %s", psz_location );
158 input_thread_t * p_input = access_GetParentInput( p_access );
159 input_item_t * p_new_loc;
163 free( psz_location );
166 /** \bug we do not autodelete here */
167 p_new_loc = input_item_New( p_access, psz_location, psz_location );
168 input_item_AddSubItem( input_GetItem( p_input ), p_new_loc );
169 vlc_gc_decref( p_new_loc );
170 vlc_object_release( p_input );
172 free( psz_location );
174 p_access->pf_block = NULL;
175 p_access->pf_read = ReadRedirect;
178 free( psz_location );
181 if( Start( p_access, 0 ) )
183 msg_Err( p_access, "cannot start stream" );
184 free( p_sys->p_header );
188 if( !p_sys->b_broadcast )
190 p_access->info.i_size = p_sys->asfh.i_file_size;
196 vlc_UrlClean( &p_sys->proxy );
197 vlc_UrlClean( &p_sys->url );
202 /*****************************************************************************
203 * Close: free unused data structures
204 *****************************************************************************/
205 void MMSHClose ( access_t *p_access )
207 access_sys_t *p_sys = p_access->p_sys;
211 free( p_sys->p_header );
213 vlc_UrlClean( &p_sys->proxy );
214 vlc_UrlClean( &p_sys->url );
218 /*****************************************************************************
220 *****************************************************************************/
221 static int Control( access_t *p_access, int i_query, va_list args )
223 access_sys_t *p_sys = p_access->p_sys;
232 case ACCESS_CAN_SEEK:
233 pb_bool = (bool*)va_arg( args, bool* );
234 *pb_bool = !p_sys->b_broadcast;
237 case ACCESS_CAN_FASTSEEK:
238 pb_bool = (bool*)va_arg( args, bool* );
242 case ACCESS_CAN_PAUSE:
243 case ACCESS_CAN_CONTROL_PACE:
244 pb_bool = (bool*)va_arg( args, bool* );
249 case ACCESS_GET_PTS_DELAY:
250 pi_64 = (int64_t*)va_arg( args, int64_t * );
251 *pi_64 = (int64_t)var_GetInteger( p_access, "mms-caching" ) * INT64_C(1000);
254 case ACCESS_GET_PRIVATE_ID_STATE:
255 i_int = (int)va_arg( args, int );
256 pb_bool = (bool *)va_arg( args, bool * );
258 if( (i_int < 0) || (i_int > 127) )
260 *pb_bool = p_sys->asfh.stream[i_int].i_selected ? true : false;
264 case ACCESS_SET_PAUSE_STATE:
265 b_bool = (bool)va_arg( args, int );
269 Seek( p_access, p_access->info.i_pos );
272 case ACCESS_GET_TITLE_INFO:
273 case ACCESS_SET_TITLE:
274 case ACCESS_SET_SEEKPOINT:
275 case ACCESS_SET_PRIVATE_ID_STATE:
276 case ACCESS_GET_CONTENT_TYPE:
280 msg_Warn( p_access, "unimplemented query in control" );
287 /*****************************************************************************
288 * Seek: try to go at the right place
289 *****************************************************************************/
290 static int Seek( access_t *p_access, int64_t i_pos )
292 access_sys_t *p_sys = p_access->p_sys;
297 msg_Dbg( p_access, "seeking to %"PRId64, i_pos );
299 i_packet = ( i_pos - p_sys->i_header ) / p_sys->asfh.i_min_data_packet_size;
300 i_offset = ( i_pos - p_sys->i_header ) % p_sys->asfh.i_min_data_packet_size;
303 Start( p_access, i_packet * p_sys->asfh.i_min_data_packet_size );
305 while( vlc_object_alive (p_access) )
307 if( GetPacket( p_access, &ck ) )
311 if( ck.i_type != 0x4824 )
314 msg_Warn( p_access, "skipping header" );
317 p_access->info.i_pos = i_pos;
318 p_access->info.b_eof = false;
319 p_sys->i_packet_used += i_offset;
324 /*****************************************************************************
326 *****************************************************************************/
327 static ssize_t ReadRedirect( access_t *p_access, uint8_t *p, size_t i_len )
329 VLC_UNUSED(p_access); VLC_UNUSED(p); VLC_UNUSED(i_len);
333 /*****************************************************************************
335 *****************************************************************************/
336 static block_t *Block( access_t *p_access )
338 access_sys_t *p_sys = p_access->p_sys;
339 const unsigned i_packet_min = p_sys->asfh.i_min_data_packet_size;
341 if( p_access->info.i_pos < p_sys->i_start + p_sys->i_header )
343 const size_t i_offset = p_access->info.i_pos - p_sys->i_start;
344 const size_t i_copy = p_sys->i_header - i_offset;
346 block_t *p_block = block_New( p_access, i_copy );
350 memcpy( p_block->p_buffer, &p_sys->p_header[i_offset], i_copy );
351 p_access->info.i_pos += i_copy;
354 else if( p_sys->i_packet_length > 0 &&
355 p_sys->i_packet_used < __MAX( p_sys->i_packet_length, i_packet_min ) )
358 size_t i_padding = 0;
360 if( p_sys->i_packet_used < p_sys->i_packet_length )
361 i_copy = p_sys->i_packet_length - p_sys->i_packet_used;
362 if( __MAX( p_sys->i_packet_used, p_sys->i_packet_length ) < i_packet_min )
363 i_padding = i_packet_min - __MAX( p_sys->i_packet_used, p_sys->i_packet_length );
365 block_t *p_block = block_New( p_access, i_copy + i_padding );
370 memcpy( &p_block->p_buffer[0], &p_sys->p_packet[p_sys->i_packet_used], i_copy );
372 memset( &p_block->p_buffer[i_copy], 0, i_padding );
374 p_sys->i_packet_used += i_copy + i_padding;
375 p_access->info.i_pos += i_copy + i_padding;
381 if( GetPacket( p_access, &ck ) )
384 if( p_sys->b_broadcast )
386 if( (ck.i_type == 0x4524) && (ck.i_sequence != 0) )
387 i_ret = Restart( p_access );
388 else if( ck.i_type == 0x4324 )
389 i_ret = Reset( p_access );
393 p_access->info.b_eof = true;
397 if( ck.i_type != 0x4424 )
399 p_sys->i_packet_used = 0;
400 p_sys->i_packet_length = 0;
407 static int Restart( access_t *p_access )
409 access_sys_t *p_sys = p_access->p_sys;
410 char *psz_location = NULL;
412 msg_Dbg( p_access, "Restart the stream" );
413 p_sys->i_start = p_access->info.i_pos;
416 msg_Dbg( p_access, "stoping the stream" );
420 msg_Dbg( p_access, "describe the stream" );
421 if( Describe( p_access, &psz_location ) )
423 msg_Err( p_access, "describe failed" );
426 free( psz_location );
429 if( Start( p_access, 0 ) )
431 msg_Err( p_access, "Start failed" );
436 static int Reset( access_t *p_access )
438 access_sys_t *p_sys = p_access->p_sys;
439 asf_header_t old_asfh = p_sys->asfh;
442 msg_Dbg( p_access, "Reset the stream" );
443 p_sys->i_start = p_access->info.i_pos;
446 p_sys->i_packet_sequence = 0;
447 p_sys->i_packet_used = 0;
448 p_sys->i_packet_length = 0;
449 p_sys->p_packet = NULL;
451 /* Get the next header FIXME memory loss ? */
452 GetHeader( p_access );
453 if( p_sys->i_header <= 0 )
456 asf_HeaderParse ( &p_sys->asfh,
457 p_sys->p_header, p_sys->i_header );
458 msg_Dbg( p_access, "packet count=%"PRId64" packet size=%d",
459 p_sys->asfh.i_data_packets_count,
460 p_sys->asfh.i_min_data_packet_size );
462 asf_StreamSelect( &p_sys->asfh,
463 var_CreateGetInteger( p_access, "mms-maxbitrate" ),
464 var_CreateGetBool( p_access, "mms-all" ),
465 var_CreateGetInteger( p_access, "audio" ),
466 var_CreateGetInteger( p_access, "video" ) );
468 /* Check we have comptible asfh */
469 for( i = 1; i < 128; i++ )
471 asf_stream_t *p_old = &old_asfh.stream[i];
472 asf_stream_t *p_new = &p_sys->asfh.stream[i];
474 if( p_old->i_cat != p_new->i_cat || p_old->i_selected != p_new->i_selected )
479 msg_Warn( p_access, "incompatible asf header, restart" );
480 return Restart( p_access );
484 p_sys->i_packet_used = 0;
485 p_sys->i_packet_length = 0;
489 static int OpenConnection( access_t *p_access )
491 access_sys_t *p_sys = p_access->p_sys;
492 vlc_url_t srv = p_sys->b_proxy ? p_sys->proxy : p_sys->url;
494 if( ( p_sys->fd = net_ConnectTCP( p_access,
495 srv.psz_host, srv.i_port ) ) < 0 )
497 msg_Err( p_access, "cannot connect to %s:%d",
498 srv.psz_host, srv.i_port );
504 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
505 "GET http://%s:%d%s HTTP/1.0\r\n",
506 p_sys->url.psz_host, p_sys->url.i_port,
507 ( (p_sys->url.psz_path == NULL) ||
508 (*p_sys->url.psz_path == '\0') ) ?
509 "/" : p_sys->url.psz_path );
511 /* Proxy Authentication */
512 if( p_sys->proxy.psz_username && *p_sys->proxy.psz_username )
517 if( asprintf( &buf, "%s:%s", p_sys->proxy.psz_username,
518 p_sys->proxy.psz_password ? p_sys->proxy.psz_password : "" ) == -1 )
521 b64 = vlc_b64_encode( buf );
524 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
525 "Proxy-Authorization: Basic %s\r\n", b64 );
531 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
532 "GET %s HTTP/1.0\r\n"
534 ( (p_sys->url.psz_path == NULL) ||
535 (*p_sys->url.psz_path == '\0') ) ?
536 "/" : p_sys->url.psz_path,
537 p_sys->url.psz_host, p_sys->url.i_port );
542 /*****************************************************************************
544 *****************************************************************************/
545 static int Describe( access_t *p_access, char **ppsz_location )
547 access_sys_t *p_sys = p_access->p_sys;
548 char *psz_location = NULL;
553 p_sys->b_broadcast = true;
554 p_sys->i_request_context = 1;
555 p_sys->i_packet_sequence = 0;
556 p_sys->i_packet_used = 0;
557 p_sys->i_packet_length = 0;
558 p_sys->p_packet = NULL;
560 GenerateGuid ( &p_sys->guid );
562 if( OpenConnection( p_access ) )
565 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
567 "User-Agent: "MMSH_USER_AGENT"\r\n"
568 "Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=0:0,request-context=%d,max-duration=0\r\n"
569 "Pragma: xClientGUID={"GUID_FMT"}\r\n"
570 "Connection: Close\r\n",
571 p_sys->i_request_context++,
572 GUID_PRINT( p_sys->guid ) );
574 if( net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL, "\r\n" ) < 0 )
576 msg_Err( p_access, "failed to send request" );
580 /* Receive the http header */
581 if( ( psz = net_Gets( p_access, p_sys->fd, NULL ) ) == NULL )
583 msg_Err( p_access, "failed to read answer" );
587 if( strncmp( psz, "HTTP/1.", 7 ) )
589 msg_Err( p_access, "invalid HTTP reply '%s'", psz );
593 i_code = atoi( &psz[9] );
596 msg_Err( p_access, "error: %s", psz );
601 msg_Dbg( p_access, "HTTP reply '%s'", psz );
605 char *psz = net_Gets( p_access, p_sys->fd, NULL );
610 msg_Err( p_access, "failed to read answer" );
620 if( ( p = strchr( psz, ':' ) ) == NULL )
622 msg_Err( p_access, "malformed header line: %s", psz );
627 while( *p == ' ' ) p++;
629 /* FIXME FIXME test Content-Type to see if it's a plain stream or an
631 if( !strcasecmp( psz, "Pragma" ) )
633 if( strstr( p, "features" ) )
635 /* FIXME, it is a bit badly done here ..... */
636 if( strstr( p, "broadcast" ) )
638 msg_Dbg( p_access, "stream type = broadcast" );
639 p_sys->b_broadcast = true;
641 else if( strstr( p, "seekable" ) )
643 msg_Dbg( p_access, "stream type = seekable" );
644 p_sys->b_broadcast = false;
648 msg_Warn( p_access, "unknow stream types (%s)", p );
649 p_sys->b_broadcast = false;
653 else if( !strcasecmp( psz, "Location" ) )
655 psz_location = strdup( p );
661 /* Handle the redirection */
662 if( ( (i_code == 301) || (i_code == 302) ||
663 (i_code == 303) || (i_code == 307) ) &&
664 psz_location && *psz_location )
666 msg_Dbg( p_access, "redirection to %s", psz_location );
667 net_Close( p_sys->fd ); p_sys->fd = -1;
669 *ppsz_location = psz_location;
672 free( psz_location );
674 /* Read the asf header */
675 GetHeader( p_access );
676 if( p_sys->i_header <= 0 )
678 msg_Err( p_access, "header size == 0" );
681 /* close this connection */
682 net_Close( p_sys->fd );
685 /* *** parse header and get stream and their id *** */
686 /* get all streams properties,
688 * TODO : stream bitrates properties(optional)
689 * and bitrate mutual exclusion(optional) */
690 asf_HeaderParse ( &p_sys->asfh,
691 p_sys->p_header, p_sys->i_header );
692 msg_Dbg( p_access, "packet count=%"PRId64" packet size=%d",
693 p_sys->asfh.i_data_packets_count,
694 p_sys->asfh.i_min_data_packet_size );
696 if( p_sys->asfh.i_min_data_packet_size <= 0 )
699 asf_StreamSelect( &p_sys->asfh,
700 var_CreateGetInteger( p_access, "mms-maxbitrate" ),
701 var_CreateGetBool( p_access, "mms-all" ),
702 var_CreateGetInteger( p_access, "audio" ),
703 var_CreateGetInteger( p_access, "video" ) );
709 net_Close( p_sys->fd );
715 static void GetHeader( access_t *p_access )
717 access_sys_t *p_sys = p_access->p_sys;
719 /* Read the asf header */
721 free( p_sys->p_header );
722 p_sys->p_header = NULL;
726 if( GetPacket( p_access, &ck ) || ck.i_type != 0x4824 )
731 p_sys->i_header += ck.i_data;
732 p_sys->p_header = xrealloc( p_sys->p_header, p_sys->i_header );
733 memcpy( &p_sys->p_header[p_sys->i_header - ck.i_data],
734 ck.p_data, ck.i_data );
737 msg_Dbg( p_access, "complete header size=%d", p_sys->i_header );
741 /*****************************************************************************
743 ****************************************************************************/
744 static int Start( access_t *p_access, int64_t i_pos )
746 access_sys_t *p_sys = p_access->p_sys;
748 int i_streams_selected = 0;
752 msg_Dbg( p_access, "starting stream" );
754 for( i = 1; i < 128; i++ )
756 if( p_sys->asfh.stream[i].i_cat == ASF_STREAM_UNKNOWN )
759 if( p_sys->asfh.stream[i].i_selected )
760 i_streams_selected++;
762 if( i_streams_selected <= 0 )
764 msg_Err( p_access, "no stream selected" );
768 if( OpenConnection( p_access ) )
771 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
773 "User-Agent: "MMSH_USER_AGENT"\r\n" );
774 if( p_sys->b_broadcast )
776 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
777 "Pragma: no-cache,rate=1.000000,request-context=%d\r\n",
778 p_sys->i_request_context++ );
782 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
783 "Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=%u:%u,request-context=%d,max-duration=0\r\n",
784 (uint32_t)((i_pos >> 32)&0xffffffff),
785 (uint32_t)(i_pos&0xffffffff),
786 p_sys->i_request_context++ );
788 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
789 "Pragma: xPlayStrm=1\r\n"
790 "Pragma: xClientGUID={"GUID_FMT"}\r\n"
791 "Pragma: stream-switch-count=%d\r\n"
792 "Pragma: stream-switch-entry=",
793 GUID_PRINT( p_sys->guid ),
796 for( i = 1; i < 128; i++ )
798 if( p_sys->asfh.stream[i].i_cat != ASF_STREAM_UNKNOWN )
801 if( p_sys->asfh.stream[i].i_selected )
805 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
806 "ffff:%d:%d ", i, i_select );
809 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL, "\r\n" );
810 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
811 "Connection: Close\r\n" );
813 if( net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL, "\r\n" ) < 0 )
815 msg_Err( p_access, "failed to send request" );
819 psz = net_Gets( p_access, p_sys->fd, NULL );
822 msg_Err( p_access, "cannot read data 0" );
826 if( atoi( &psz[9] ) >= 400 )
828 msg_Err( p_access, "error: %s", psz );
832 msg_Dbg( p_access, "HTTP reply '%s'", psz );
835 /* FIXME check HTTP code */
838 char *psz = net_Gets( p_access, p_sys->fd, NULL );
841 msg_Err( p_access, "cannot read data 1" );
849 msg_Dbg( p_access, "%s", psz );
853 p_sys->i_packet_used = 0;
854 p_sys->i_packet_length = 0;
859 /*****************************************************************************
861 *****************************************************************************/
862 static void Stop( access_t *p_access )
864 access_sys_t *p_sys = p_access->p_sys;
866 msg_Dbg( p_access, "closing stream" );
869 net_Close( p_sys->fd );
874 /*****************************************************************************
876 *****************************************************************************/
877 static int GetPacket( access_t * p_access, chunk_t *p_ck )
879 access_sys_t *p_sys = p_access->p_sys;
883 memset( p_ck, 0, sizeof( chunk_t ) );
885 /* Read the chunk header */
886 /* Some headers are short, like 0x4324. Reading 12 bytes will cause us
887 * to lose synchronization with the stream. Just read to the length
888 * (4 bytes), decode and then read up to 8 additional bytes to get the
891 if( net_Read( p_access, p_sys->fd, NULL, p_sys->buffer, 4, true ) < 4 )
893 msg_Err( p_access, "cannot read data 2" );
897 p_ck->i_type = GetWLE( p_sys->buffer);
898 p_ck->i_size = GetWLE( p_sys->buffer + 2);
900 restsize = p_ck->i_size;
904 if( net_Read( p_access, p_sys->fd, NULL, p_sys->buffer + 4, restsize, true ) < restsize )
906 msg_Err( p_access, "cannot read data 3" );
909 p_ck->i_sequence = GetDWLE( p_sys->buffer + 4);
910 p_ck->i_unknown = GetWLE( p_sys->buffer + 8);
912 /* Set i_size2 to 8 if this header was short, since a real value won't be
913 * present in the buffer. Using 8 avoid reading additional data for the
919 p_ck->i_size2 = GetWLE( p_sys->buffer + 10);
921 p_ck->p_data = p_sys->buffer + 12;
922 p_ck->i_data = p_ck->i_size2 - 8;
924 if( p_ck->i_type == 0x4524 ) // Transfer complete
926 if( p_ck->i_sequence == 0 )
928 msg_Warn( p_access, "EOF" );
933 msg_Warn( p_access, "next stream following" );
937 else if( p_ck->i_type == 0x4324 )
939 /* 0x4324 is CHUNK_TYPE_RESET: a new stream will follow with a sequence of 0 */
940 msg_Warn( p_access, "next stream following (reset) seq=%d", p_ck->i_sequence );
943 else if( (p_ck->i_type != 0x4824) && (p_ck->i_type != 0x4424) )
945 msg_Err( p_access, "invalid chunk FATAL (0x%x)", p_ck->i_type );
949 if( (p_ck->i_data > 0) &&
950 (net_Read( p_access, p_sys->fd, NULL, &p_sys->buffer[12],
951 p_ck->i_data, true ) < p_ck->i_data) )
953 msg_Err( p_access, "cannot read data 4" );
958 if( (p_sys->i_packet_sequence != 0) &&
959 (p_ck->i_sequence != p_sys->i_packet_sequence) )
961 msg_Warn( p_access, "packet lost ? (%d != %d)", p_ck->i_sequence, p_sys->i_packet_sequence );
965 p_sys->i_packet_sequence = p_ck->i_sequence + 1;
966 p_sys->i_packet_used = 0;
967 p_sys->i_packet_length = p_ck->i_data;
968 p_sys->p_packet = p_ck->p_data;