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 *, uint64_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 *, uint64_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_t *p_item = input_GetItem( p_input );
169 input_item_PostSubItem( p_item, p_new_loc );
171 vlc_gc_decref( p_new_loc );
172 vlc_object_release( p_input );
174 free( psz_location );
176 p_access->pf_block = NULL;
177 p_access->pf_read = ReadRedirect;
180 free( psz_location );
183 if( Start( p_access, 0 ) )
185 msg_Err( p_access, "cannot start stream" );
186 free( p_sys->p_header );
190 if( !p_sys->b_broadcast )
192 p_access->info.i_size = p_sys->asfh.i_file_size;
198 vlc_UrlClean( &p_sys->proxy );
199 vlc_UrlClean( &p_sys->url );
204 /*****************************************************************************
205 * Close: free unused data structures
206 *****************************************************************************/
207 void MMSHClose ( access_t *p_access )
209 access_sys_t *p_sys = p_access->p_sys;
213 free( p_sys->p_header );
215 vlc_UrlClean( &p_sys->proxy );
216 vlc_UrlClean( &p_sys->url );
220 /*****************************************************************************
222 *****************************************************************************/
223 static int Control( access_t *p_access, int i_query, va_list args )
225 access_sys_t *p_sys = p_access->p_sys;
234 case ACCESS_CAN_SEEK:
235 pb_bool = (bool*)va_arg( args, bool* );
236 *pb_bool = !p_sys->b_broadcast;
239 case ACCESS_CAN_FASTSEEK:
240 pb_bool = (bool*)va_arg( args, bool* );
244 case ACCESS_CAN_PAUSE:
245 case ACCESS_CAN_CONTROL_PACE:
246 pb_bool = (bool*)va_arg( args, bool* );
251 case ACCESS_GET_PTS_DELAY:
252 pi_64 = (int64_t*)va_arg( args, int64_t * );
253 *pi_64 = (int64_t)var_GetInteger( p_access, "mms-caching" ) * INT64_C(1000);
256 case ACCESS_GET_PRIVATE_ID_STATE:
257 i_int = (int)va_arg( args, int );
258 pb_bool = (bool *)va_arg( args, bool * );
260 if( (i_int < 0) || (i_int > 127) )
262 *pb_bool = p_sys->asfh.stream[i_int].i_selected ? true : false;
266 case ACCESS_SET_PAUSE_STATE:
267 b_bool = (bool)va_arg( args, int );
271 Seek( p_access, p_access->info.i_pos );
274 case ACCESS_GET_TITLE_INFO:
275 case ACCESS_SET_TITLE:
276 case ACCESS_SET_SEEKPOINT:
277 case ACCESS_SET_PRIVATE_ID_STATE:
278 case ACCESS_GET_CONTENT_TYPE:
282 msg_Warn( p_access, "unimplemented query in control" );
289 /*****************************************************************************
290 * Seek: try to go at the right place
291 *****************************************************************************/
292 static int Seek( access_t *p_access, uint64_t i_pos )
294 access_sys_t *p_sys = p_access->p_sys;
299 msg_Dbg( p_access, "seeking to %"PRId64, i_pos );
301 i_packet = ( i_pos - p_sys->i_header ) / p_sys->asfh.i_min_data_packet_size;
302 i_offset = ( i_pos - p_sys->i_header ) % p_sys->asfh.i_min_data_packet_size;
305 Start( p_access, i_packet * p_sys->asfh.i_min_data_packet_size );
307 while( vlc_object_alive (p_access) )
309 if( GetPacket( p_access, &ck ) )
313 if( ck.i_type != 0x4824 )
316 msg_Warn( p_access, "skipping header" );
319 p_access->info.i_pos = i_pos;
320 p_access->info.b_eof = false;
321 p_sys->i_packet_used += i_offset;
326 /*****************************************************************************
328 *****************************************************************************/
329 static ssize_t ReadRedirect( access_t *p_access, uint8_t *p, size_t i_len )
331 VLC_UNUSED(p_access); VLC_UNUSED(p); VLC_UNUSED(i_len);
335 /*****************************************************************************
337 *****************************************************************************/
338 static block_t *Block( access_t *p_access )
340 access_sys_t *p_sys = p_access->p_sys;
341 const unsigned i_packet_min = p_sys->asfh.i_min_data_packet_size;
343 if( p_access->info.i_pos < p_sys->i_start + p_sys->i_header )
345 const size_t i_offset = p_access->info.i_pos - p_sys->i_start;
346 const size_t i_copy = p_sys->i_header - i_offset;
348 block_t *p_block = block_New( p_access, i_copy );
352 memcpy( p_block->p_buffer, &p_sys->p_header[i_offset], i_copy );
353 p_access->info.i_pos += i_copy;
356 else if( p_sys->i_packet_length > 0 &&
357 p_sys->i_packet_used < __MAX( p_sys->i_packet_length, i_packet_min ) )
360 size_t i_padding = 0;
362 if( p_sys->i_packet_used < p_sys->i_packet_length )
363 i_copy = p_sys->i_packet_length - p_sys->i_packet_used;
364 if( __MAX( p_sys->i_packet_used, p_sys->i_packet_length ) < i_packet_min )
365 i_padding = i_packet_min - __MAX( p_sys->i_packet_used, p_sys->i_packet_length );
367 block_t *p_block = block_New( p_access, i_copy + i_padding );
372 memcpy( &p_block->p_buffer[0], &p_sys->p_packet[p_sys->i_packet_used], i_copy );
374 memset( &p_block->p_buffer[i_copy], 0, i_padding );
376 p_sys->i_packet_used += i_copy + i_padding;
377 p_access->info.i_pos += i_copy + i_padding;
383 if( GetPacket( p_access, &ck ) )
386 if( p_sys->b_broadcast )
388 if( (ck.i_type == 0x4524) && (ck.i_sequence != 0) )
389 i_ret = Restart( p_access );
390 else if( ck.i_type == 0x4324 )
391 i_ret = Reset( p_access );
395 p_access->info.b_eof = true;
399 if( ck.i_type != 0x4424 )
401 p_sys->i_packet_used = 0;
402 p_sys->i_packet_length = 0;
409 static int Restart( access_t *p_access )
411 access_sys_t *p_sys = p_access->p_sys;
412 char *psz_location = NULL;
414 msg_Dbg( p_access, "Restart the stream" );
415 p_sys->i_start = p_access->info.i_pos;
418 msg_Dbg( p_access, "stoping the stream" );
422 msg_Dbg( p_access, "describe the stream" );
423 if( Describe( p_access, &psz_location ) )
425 msg_Err( p_access, "describe failed" );
428 free( psz_location );
431 if( Start( p_access, 0 ) )
433 msg_Err( p_access, "Start failed" );
438 static int Reset( access_t *p_access )
440 access_sys_t *p_sys = p_access->p_sys;
441 asf_header_t old_asfh = p_sys->asfh;
444 msg_Dbg( p_access, "Reset the stream" );
445 p_sys->i_start = p_access->info.i_pos;
448 p_sys->i_packet_sequence = 0;
449 p_sys->i_packet_used = 0;
450 p_sys->i_packet_length = 0;
451 p_sys->p_packet = NULL;
453 /* Get the next header FIXME memory loss ? */
454 GetHeader( p_access );
455 if( p_sys->i_header <= 0 )
458 asf_HeaderParse ( &p_sys->asfh,
459 p_sys->p_header, p_sys->i_header );
460 msg_Dbg( p_access, "packet count=%"PRId64" packet size=%d",
461 p_sys->asfh.i_data_packets_count,
462 p_sys->asfh.i_min_data_packet_size );
464 asf_StreamSelect( &p_sys->asfh,
465 var_CreateGetInteger( p_access, "mms-maxbitrate" ),
466 var_CreateGetBool( p_access, "mms-all" ),
467 var_CreateGetInteger( p_access, "audio" ),
468 var_CreateGetInteger( p_access, "video" ) );
470 /* Check we have comptible asfh */
471 for( i = 1; i < 128; i++ )
473 asf_stream_t *p_old = &old_asfh.stream[i];
474 asf_stream_t *p_new = &p_sys->asfh.stream[i];
476 if( p_old->i_cat != p_new->i_cat || p_old->i_selected != p_new->i_selected )
481 msg_Warn( p_access, "incompatible asf header, restart" );
482 return Restart( p_access );
486 p_sys->i_packet_used = 0;
487 p_sys->i_packet_length = 0;
491 static int OpenConnection( access_t *p_access )
493 access_sys_t *p_sys = p_access->p_sys;
494 vlc_url_t srv = p_sys->b_proxy ? p_sys->proxy : p_sys->url;
496 if( ( p_sys->fd = net_ConnectTCP( p_access,
497 srv.psz_host, srv.i_port ) ) < 0 )
499 msg_Err( p_access, "cannot connect to %s:%d",
500 srv.psz_host, srv.i_port );
506 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
507 "GET http://%s:%d%s HTTP/1.0\r\n",
508 p_sys->url.psz_host, p_sys->url.i_port,
509 ( (p_sys->url.psz_path == NULL) ||
510 (*p_sys->url.psz_path == '\0') ) ?
511 "/" : p_sys->url.psz_path );
513 /* Proxy Authentication */
514 if( p_sys->proxy.psz_username && *p_sys->proxy.psz_username )
519 if( asprintf( &buf, "%s:%s", p_sys->proxy.psz_username,
520 p_sys->proxy.psz_password ? p_sys->proxy.psz_password : "" ) == -1 )
523 b64 = vlc_b64_encode( buf );
526 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
527 "Proxy-Authorization: Basic %s\r\n", b64 );
533 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
534 "GET %s HTTP/1.0\r\n"
536 ( (p_sys->url.psz_path == NULL) ||
537 (*p_sys->url.psz_path == '\0') ) ?
538 "/" : p_sys->url.psz_path,
539 p_sys->url.psz_host, p_sys->url.i_port );
544 /*****************************************************************************
546 *****************************************************************************/
547 static int Describe( access_t *p_access, char **ppsz_location )
549 access_sys_t *p_sys = p_access->p_sys;
550 char *psz_location = NULL;
555 p_sys->b_broadcast = true;
556 p_sys->i_request_context = 1;
557 p_sys->i_packet_sequence = 0;
558 p_sys->i_packet_used = 0;
559 p_sys->i_packet_length = 0;
560 p_sys->p_packet = NULL;
562 GenerateGuid ( &p_sys->guid );
564 if( OpenConnection( p_access ) )
567 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
569 "User-Agent: "MMSH_USER_AGENT"\r\n"
570 "Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=0:0,request-context=%d,max-duration=0\r\n"
571 "Pragma: xClientGUID={"GUID_FMT"}\r\n"
572 "Connection: Close\r\n",
573 p_sys->i_request_context++,
574 GUID_PRINT( p_sys->guid ) );
576 if( net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL, "\r\n" ) < 0 )
578 msg_Err( p_access, "failed to send request" );
582 /* Receive the http header */
583 if( ( psz = net_Gets( p_access, p_sys->fd, NULL ) ) == NULL )
585 msg_Err( p_access, "failed to read answer" );
589 if( strncmp( psz, "HTTP/1.", 7 ) )
591 msg_Err( p_access, "invalid HTTP reply '%s'", psz );
595 i_code = atoi( &psz[9] );
598 msg_Err( p_access, "error: %s", psz );
603 msg_Dbg( p_access, "HTTP reply '%s'", psz );
607 char *psz = net_Gets( p_access, p_sys->fd, NULL );
612 msg_Err( p_access, "failed to read answer" );
622 if( ( p = strchr( psz, ':' ) ) == NULL )
624 msg_Err( p_access, "malformed header line: %s", psz );
629 while( *p == ' ' ) p++;
631 /* FIXME FIXME test Content-Type to see if it's a plain stream or an
633 if( !strcasecmp( psz, "Pragma" ) )
635 if( strstr( p, "features" ) )
637 /* FIXME, it is a bit badly done here ..... */
638 if( strstr( p, "broadcast" ) )
640 msg_Dbg( p_access, "stream type = broadcast" );
641 p_sys->b_broadcast = true;
643 else if( strstr( p, "seekable" ) )
645 msg_Dbg( p_access, "stream type = seekable" );
646 p_sys->b_broadcast = false;
650 msg_Warn( p_access, "unknow stream types (%s)", p );
651 p_sys->b_broadcast = false;
655 else if( !strcasecmp( psz, "Location" ) )
657 psz_location = strdup( p );
663 /* Handle the redirection */
664 if( ( (i_code == 301) || (i_code == 302) ||
665 (i_code == 303) || (i_code == 307) ) &&
666 psz_location && *psz_location )
668 msg_Dbg( p_access, "redirection to %s", psz_location );
669 net_Close( p_sys->fd ); p_sys->fd = -1;
671 *ppsz_location = psz_location;
674 free( psz_location );
676 /* Read the asf header */
677 GetHeader( p_access );
678 if( p_sys->i_header <= 0 )
680 msg_Err( p_access, "header size == 0" );
683 /* close this connection */
684 net_Close( p_sys->fd );
687 /* *** parse header and get stream and their id *** */
688 /* get all streams properties,
690 * TODO : stream bitrates properties(optional)
691 * and bitrate mutual exclusion(optional) */
692 asf_HeaderParse ( &p_sys->asfh,
693 p_sys->p_header, p_sys->i_header );
694 msg_Dbg( p_access, "packet count=%"PRId64" packet size=%d",
695 p_sys->asfh.i_data_packets_count,
696 p_sys->asfh.i_min_data_packet_size );
698 if( p_sys->asfh.i_min_data_packet_size <= 0 )
701 asf_StreamSelect( &p_sys->asfh,
702 var_CreateGetInteger( p_access, "mms-maxbitrate" ),
703 var_CreateGetBool( p_access, "mms-all" ),
704 var_CreateGetInteger( p_access, "audio" ),
705 var_CreateGetInteger( p_access, "video" ) );
711 net_Close( p_sys->fd );
717 static void GetHeader( access_t *p_access )
719 access_sys_t *p_sys = p_access->p_sys;
721 /* Read the asf header */
723 free( p_sys->p_header );
724 p_sys->p_header = NULL;
728 if( GetPacket( p_access, &ck ) || ck.i_type != 0x4824 )
733 p_sys->i_header += ck.i_data;
734 p_sys->p_header = xrealloc( p_sys->p_header, p_sys->i_header );
735 memcpy( &p_sys->p_header[p_sys->i_header - ck.i_data],
736 ck.p_data, ck.i_data );
739 msg_Dbg( p_access, "complete header size=%d", p_sys->i_header );
743 /*****************************************************************************
745 ****************************************************************************/
746 static int Start( access_t *p_access, uint64_t i_pos )
748 access_sys_t *p_sys = p_access->p_sys;
750 int i_streams_selected = 0;
754 msg_Dbg( p_access, "starting stream" );
756 for( i = 1; i < 128; i++ )
758 if( p_sys->asfh.stream[i].i_cat == ASF_STREAM_UNKNOWN )
761 if( p_sys->asfh.stream[i].i_selected )
762 i_streams_selected++;
764 if( i_streams_selected <= 0 )
766 msg_Err( p_access, "no stream selected" );
770 if( OpenConnection( p_access ) )
773 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
775 "User-Agent: "MMSH_USER_AGENT"\r\n" );
776 if( p_sys->b_broadcast )
778 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
779 "Pragma: no-cache,rate=1.000000,request-context=%d\r\n",
780 p_sys->i_request_context++ );
784 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
785 "Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=%u:%u,request-context=%d,max-duration=0\r\n",
786 (uint32_t)((i_pos >> 32)&0xffffffff),
787 (uint32_t)(i_pos&0xffffffff),
788 p_sys->i_request_context++ );
790 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
791 "Pragma: xPlayStrm=1\r\n"
792 "Pragma: xClientGUID={"GUID_FMT"}\r\n"
793 "Pragma: stream-switch-count=%d\r\n"
794 "Pragma: stream-switch-entry=",
795 GUID_PRINT( p_sys->guid ),
798 for( i = 1; i < 128; i++ )
800 if( p_sys->asfh.stream[i].i_cat != ASF_STREAM_UNKNOWN )
803 if( p_sys->asfh.stream[i].i_selected )
807 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
808 "ffff:%d:%d ", i, i_select );
811 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL, "\r\n" );
812 net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
813 "Connection: Close\r\n" );
815 if( net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL, "\r\n" ) < 0 )
817 msg_Err( p_access, "failed to send request" );
821 psz = net_Gets( p_access, p_sys->fd, NULL );
824 msg_Err( p_access, "cannot read data 0" );
828 if( atoi( &psz[9] ) >= 400 )
830 msg_Err( p_access, "error: %s", psz );
834 msg_Dbg( p_access, "HTTP reply '%s'", psz );
837 /* FIXME check HTTP code */
840 char *psz = net_Gets( p_access, p_sys->fd, NULL );
843 msg_Err( p_access, "cannot read data 1" );
851 msg_Dbg( p_access, "%s", psz );
855 p_sys->i_packet_used = 0;
856 p_sys->i_packet_length = 0;
861 /*****************************************************************************
863 *****************************************************************************/
864 static void Stop( access_t *p_access )
866 access_sys_t *p_sys = p_access->p_sys;
868 msg_Dbg( p_access, "closing stream" );
871 net_Close( p_sys->fd );
876 /*****************************************************************************
878 *****************************************************************************/
879 static int GetPacket( access_t * p_access, chunk_t *p_ck )
881 access_sys_t *p_sys = p_access->p_sys;
885 memset( p_ck, 0, sizeof( chunk_t ) );
887 /* Read the chunk header */
888 /* Some headers are short, like 0x4324. Reading 12 bytes will cause us
889 * to lose synchronization with the stream. Just read to the length
890 * (4 bytes), decode and then read up to 8 additional bytes to get the
893 if( net_Read( p_access, p_sys->fd, NULL, p_sys->buffer, 4, true ) < 4 )
895 msg_Err( p_access, "cannot read data 2" );
899 p_ck->i_type = GetWLE( p_sys->buffer);
900 p_ck->i_size = GetWLE( p_sys->buffer + 2);
902 restsize = p_ck->i_size;
906 if( net_Read( p_access, p_sys->fd, NULL, p_sys->buffer + 4, restsize, true ) < restsize )
908 msg_Err( p_access, "cannot read data 3" );
911 p_ck->i_sequence = GetDWLE( p_sys->buffer + 4);
912 p_ck->i_unknown = GetWLE( p_sys->buffer + 8);
914 /* Set i_size2 to 8 if this header was short, since a real value won't be
915 * present in the buffer. Using 8 avoid reading additional data for the
921 p_ck->i_size2 = GetWLE( p_sys->buffer + 10);
923 p_ck->p_data = p_sys->buffer + 12;
924 p_ck->i_data = p_ck->i_size2 - 8;
926 if( p_ck->i_type == 0x4524 ) // Transfer complete
928 if( p_ck->i_sequence == 0 )
930 msg_Warn( p_access, "EOF" );
935 msg_Warn( p_access, "next stream following" );
939 else if( p_ck->i_type == 0x4324 )
941 /* 0x4324 is CHUNK_TYPE_RESET: a new stream will follow with a sequence of 0 */
942 msg_Warn( p_access, "next stream following (reset) seq=%d", p_ck->i_sequence );
945 else if( (p_ck->i_type != 0x4824) && (p_ck->i_type != 0x4424) )
947 msg_Err( p_access, "invalid chunk FATAL (0x%x)", p_ck->i_type );
951 if( (p_ck->i_data > 0) &&
952 (net_Read( p_access, p_sys->fd, NULL, &p_sys->buffer[12],
953 p_ck->i_data, true ) < p_ck->i_data) )
955 msg_Err( p_access, "cannot read data 4" );
960 if( (p_sys->i_packet_sequence != 0) &&
961 (p_ck->i_sequence != p_sys->i_packet_sequence) )
963 msg_Warn( p_access, "packet lost ? (%d != %d)", p_ck->i_sequence, p_sys->i_packet_sequence );
967 p_sys->i_packet_sequence = p_ck->i_sequence + 1;
968 p_sys->i_packet_used = 0;
969 p_sys->i_packet_length = p_ck->i_data;
970 p_sys->p_packet = p_ck->p_data;