1 /*****************************************************************************
2 * asf.c : ASFv01 file input module for vlc
3 *****************************************************************************
4 * Copyright (C) 2001 VideoLAN
5 * $Id: asf.c,v 1.32 2003/08/17 23:42:37 fenrir Exp $
6 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
23 /*****************************************************************************
25 *****************************************************************************/
26 #include <stdlib.h> /* malloc(), free() */
29 #include <vlc/input.h>
31 #include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */
35 /*****************************************************************************
37 *****************************************************************************/
38 static int Open ( vlc_object_t * );
39 static void Close ( vlc_object_t * );
42 set_description( _("ASF v1.0 demuxer") );
43 set_capability( "demux", 200 );
44 set_callbacks( Open, Close );
45 add_shortcut( "asf" );
49 /*****************************************************************************
51 *****************************************************************************/
52 static int Demux ( input_thread_t * );
54 static mtime_t GetMoviePTS( demux_sys_t * );
55 static int DemuxPacket( input_thread_t *, vlc_bool_t b_play_audio );
57 /*****************************************************************************
58 * Open: check file and initializes ASF structures
59 *****************************************************************************/
60 static int Open( vlc_object_t * p_this )
62 input_thread_t *p_input = (input_thread_t *)p_this;
69 vlc_bool_t b_seekable;
71 input_info_category_t *p_cat;
73 /* a little test to see if it could be a asf stream */
74 if( input_Peek( p_input, &p_peek, 16 ) < 16 )
76 msg_Warn( p_input, "ASF plugin discarded (cannot peek)" );
79 ASF_GetGUID( &guid, p_peek );
80 if( !ASF_CmpGUID( &guid, &asf_object_header_guid ) )
82 msg_Warn( p_input, "ASF plugin discarded (not a valid file)" );
86 /* Set p_input field */
87 p_input->pf_demux = Demux;
88 p_input->p_demux_data = p_demux = malloc( sizeof( demux_sys_t ) );
89 memset( p_demux, 0, sizeof( demux_sys_t ) );
92 /* Now load all object ( except raw data ) */
93 b_seekable = p_input->stream.b_seekable &&
94 p_input->stream.i_method == INPUT_METHOD_FILE;
96 if( !ASF_ReadObjectRoot( p_input, &p_demux->root, b_seekable ) )
98 msg_Warn( p_input, "ASF plugin discarded (not a valid file)" );
102 /* Check if we have found all mandatory asf object */
103 if( !p_demux->root.p_hdr || !p_demux->root.p_data )
105 msg_Warn( p_input, "ASF plugin discarded (not a valid file)" );
109 if( !( p_demux->p_fp = ASF_FindObject( p_demux->root.p_hdr,
110 &asf_object_file_properties_guid, 0 ) ) )
113 "ASF plugin discarded (missing file_properties object)" );
117 if( p_demux->p_fp->i_min_data_packet_size != p_demux->p_fp->i_max_data_packet_size )
120 "ASF plugin discarded (invalid file_properties object)" );
124 p_demux->i_streams = ASF_CountObject( p_demux->root.p_hdr,
125 &asf_object_stream_properties_guid );
126 if( !p_demux->i_streams )
128 msg_Warn( p_input, "ASF plugin discarded (cannot find any stream!)" );
132 msg_Dbg( p_input, "found %d streams", p_demux->i_streams );
134 p_cat = input_InfoCategory( p_input, "Asf" );
135 input_AddInfo( p_cat, _("Number of streams"), "%d" , p_demux->i_streams );
137 /* create one program */
138 vlc_mutex_lock( &p_input->stream.stream_lock );
139 if( input_InitStream( p_input, 0 ) == -1)
141 vlc_mutex_unlock( &p_input->stream.stream_lock );
142 msg_Err( p_input, "cannot init stream" );
145 if( input_AddProgram( p_input, 0, 0) == NULL )
147 vlc_mutex_unlock( &p_input->stream.stream_lock );
148 msg_Err( p_input, "cannot add program" );
151 p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
152 p_input->stream.i_mux_rate = 0 ; /* updated later */
153 vlc_mutex_unlock( &p_input->stream.stream_lock );
155 for( i_stream = 0; i_stream < p_demux->i_streams; i_stream ++ )
157 asf_stream_t *p_stream;
158 asf_object_stream_properties_t *p_sp;
159 char psz_cat[sizeof("Stream ")+10];
160 sprintf( psz_cat, "Stream %d", i_stream );
161 p_cat = input_InfoCategory( p_input, psz_cat);
163 p_sp = ASF_FindObject( p_demux->root.p_hdr,
164 &asf_object_stream_properties_guid,
168 p_demux->stream[p_sp->i_stream_number] =
169 malloc( sizeof( asf_stream_t ) );
170 memset( p_stream, 0, sizeof( asf_stream_t ) );
172 p_stream->i_time = -1;
173 p_stream->p_sp = p_sp;
175 vlc_mutex_lock( &p_input->stream.stream_lock );
176 p_stream->p_es = NULL;
178 vlc_mutex_unlock( &p_input->stream.stream_lock );
179 if( ASF_CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_audio ) )
182 if( p_sp->p_type_specific_data )
184 i_codec = GetWLE( p_sp->p_type_specific_data );
191 p_stream->i_cat = AUDIO_ES;
192 p_stream->p_es = input_AddES( p_input,
193 p_input->stream.p_selected_program,
194 p_sp->i_stream_number, AUDIO_ES, NULL, 0 );
196 input_AddInfo( p_cat, _("Type"), _("Audio") );
198 "adding new audio stream(codec:0x%x,ID:%d)",
200 p_sp->i_stream_number );
204 p_stream->p_es->i_fourcc =
205 VLC_FOURCC( 'a', 'r', 'a', 'w' );
209 p_stream->p_es->i_fourcc =
210 VLC_FOURCC( 'm','p','g','a' );
213 p_stream->p_es->i_fourcc =
214 VLC_FOURCC( 'a','5','2',' ' );
217 p_stream->p_es->i_fourcc =
218 VLC_FOURCC( 'w','m','a','1' );
221 p_stream->p_es->i_fourcc =
222 VLC_FOURCC( 'w','m','a','2' );
225 p_stream->p_es->i_fourcc =
226 VLC_FOURCC( 'm','s',(i_codec >> 8)&0xff,i_codec&0xff );
228 input_AddInfo( p_cat, _("Codec"), "%.4s", (char*)&p_stream->p_es->i_fourcc );
229 if( p_sp->i_type_specific_data_length > 0 )
235 i_size = p_sp->i_type_specific_data_length;
237 p_wf = malloc( i_size );
238 p_stream->p_es->p_waveformatex = (void*)p_wf;
239 p_data = p_sp->p_type_specific_data;
241 p_wf->wFormatTag = GetWLE( p_data );
242 p_wf->nChannels = GetWLE( p_data + 2 );
243 input_AddInfo( p_cat, _("Channels"), "%d", p_wf->nChannels );
244 p_wf->nSamplesPerSec = GetDWLE( p_data + 4 );
245 input_AddInfo( p_cat, _("Sample Rate"), "%d", p_wf->nSamplesPerSec );
246 p_wf->nAvgBytesPerSec = GetDWLE( p_data + 8 );
247 input_AddInfo( p_cat, _("Avg. byterate"), "%d", p_wf->nAvgBytesPerSec );
248 p_wf->nBlockAlign = GetWLE( p_data + 12 );
249 p_wf->wBitsPerSample = GetWLE( p_data + 14 );
250 input_AddInfo( p_cat, _("Bits Per Sample"), "%d", p_wf->wBitsPerSample );
251 p_wf->cbSize = __MIN( GetWLE( p_data + 16 ), i_size - sizeof( WAVEFORMATEX ));
252 if( p_wf->cbSize > 0 )
254 memcpy( &p_wf[1], p_data + sizeof( WAVEFORMATEX ), p_wf->cbSize );
259 if( ASF_CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_video ) )
261 p_stream->i_cat = VIDEO_ES;
262 p_stream->p_es = input_AddES( p_input,
263 p_input->stream.p_selected_program,
264 p_sp->i_stream_number, VIDEO_ES, NULL, 0 );
266 input_AddInfo( p_cat, _("Type"), _("Video") );
267 msg_Dbg( p_input, "adding new video stream(ID:%d)",
268 p_sp->i_stream_number );
269 if( p_sp->p_type_specific_data )
271 p_stream->p_es->i_fourcc =
272 VLC_FOURCC( p_sp->p_type_specific_data[27],
273 p_sp->p_type_specific_data[28],
274 p_sp->p_type_specific_data[29],
275 p_sp->p_type_specific_data[30] );
279 p_stream->p_es->i_fourcc =
280 VLC_FOURCC( 'u','n','d','f' );
282 input_AddInfo( p_cat, _("Codec"), "%.4s", (char*)&p_stream->p_es->i_fourcc );
283 if( p_sp->i_type_specific_data_length > 11 )
285 BITMAPINFOHEADER *p_bih;
289 i_size = p_sp->i_type_specific_data_length - 11;
291 p_bih = malloc( i_size );
292 p_stream->p_es->p_bitmapinfoheader = (void*)p_bih;
293 p_data = p_sp->p_type_specific_data + 11;
295 p_bih->biSize = GetDWLE( p_data );
296 input_AddInfo( p_cat, _("Size"), "%d", p_bih->biSize );
297 p_bih->biWidth = GetDWLE( p_data + 4 );
298 p_bih->biHeight = GetDWLE( p_data + 8 );
299 input_AddInfo( p_cat, _("Resolution"), "%dx%d", p_bih->biWidth, p_bih->biHeight );
300 p_bih->biPlanes = GetDWLE( p_data + 12 );
301 input_AddInfo( p_cat, _("Planes"), "%d", p_bih->biPlanes );
302 p_bih->biBitCount = GetDWLE( p_data + 14 );
303 input_AddInfo( p_cat, _("Bits Per Pixel"), "%d", p_bih->biBitCount );
304 p_bih->biCompression= GetDWLE( p_data + 16 );
305 p_bih->biSizeImage = GetDWLE( p_data + 20 );
306 input_AddInfo( p_cat, _("Image Size"), "%d", p_bih->biSizeImage );
307 p_bih->biXPelsPerMeter = GetDWLE( p_data + 24 );
308 input_AddInfo( p_cat, _("X pixels per meter"), "%d", p_bih->biXPelsPerMeter );
309 p_bih->biYPelsPerMeter = GetDWLE( p_data + 28 );
310 input_AddInfo( p_cat, _("Y pixels per meter"), "%d", p_bih->biYPelsPerMeter );
311 p_bih->biClrUsed = GetDWLE( p_data + 32 );
312 p_bih->biClrImportant = GetDWLE( p_data + 36 );
314 if( i_size > sizeof( BITMAPINFOHEADER ) )
316 memcpy( (uint8_t*)p_bih + sizeof( BITMAPINFOHEADER ),
317 p_data + sizeof( BITMAPINFOHEADER ),
318 i_size - sizeof( BITMAPINFOHEADER ) );
325 p_stream->i_cat = UNKNOWN_ES;
326 msg_Dbg( p_input, "ignoring unknown stream(ID:%d)",
327 p_sp->i_stream_number );
330 vlc_mutex_lock( &p_input->stream.stream_lock );
333 input_SelectES( p_input, p_stream->p_es );
335 vlc_mutex_unlock( &p_input->stream.stream_lock );
339 p_demux->i_data_begin = p_demux->root.p_data->i_object_pos + 50;
340 if( p_demux->root.p_data->i_object_size != 0 )
342 p_demux->i_data_end = p_demux->root.p_data->i_object_pos +
343 p_demux->root.p_data->i_object_size;
347 p_demux->i_data_end = -1;
351 // go to first packet
352 ASF_SeekAbsolute( p_input, p_demux->i_data_begin );
354 vlc_mutex_lock( &p_input->stream.stream_lock );
355 /* try to calculate movie time */
356 if( p_demux->p_fp->i_data_packets_count > 0 )
361 /* real number of packets */
362 i_count = ( p_input->stream.p_selected_area->i_size -
363 p_demux->i_data_begin ) /
364 p_demux->p_fp->i_min_data_packet_size;
365 /* calculate the time duration in s */
366 i_length = (mtime_t)p_demux->p_fp->i_play_duration / 10 *
368 (mtime_t)p_demux->p_fp->i_data_packets_count /
372 p_input->stream.i_mux_rate =
373 p_input->stream.p_selected_area->i_size / 50 / i_length;
377 p_input->stream.i_mux_rate = 0;
383 p_input->stream.i_mux_rate = 0;
386 p_input->stream.p_selected_program->b_is_ok = 1;
387 vlc_mutex_unlock( &p_input->stream.stream_lock );
392 ASF_FreeObjectRoot( p_input, &p_demux->root );
398 /*****************************************************************************
399 * Demux: read packet and send them to decoders
400 *****************************************************************************/
401 static int Demux( input_thread_t *p_input )
403 demux_sys_t *p_demux = p_input->p_demux_data;
404 vlc_bool_t b_play_audio;
408 b_stream = VLC_FALSE;
409 for( i = 0; i < 128; i++ )
411 if( p_demux->stream[i] &&
412 p_demux->stream[i]->p_es &&
413 p_demux->stream[i]->p_es->p_decoder_fifo )
420 msg_Warn( p_input, "no stream selected, exiting..." );
424 /* catch seek from user */
425 if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT )
429 msleep( p_input->i_pts_delay );
430 i_offset = ASF_TellAbsolute( p_input ) - p_demux->i_data_begin;
436 i_offset += p_demux->p_fp->i_min_data_packet_size -
437 i_offset % p_demux->p_fp->i_min_data_packet_size;
438 ASF_SeekAbsolute( p_input, p_demux->i_data_begin + i_offset );
440 p_demux->i_time = -1;
441 for( i = 0; i < 128 ; i++ )
443 #define p_stream p_demux->stream[i]
446 p_stream->i_time = -1;
452 /* Check if we need to send the audio data to decoder */
453 b_play_audio = !p_input->stream.control.b_mute;
458 mtime_t i_time_begin = GetMoviePTS( p_demux );
466 if( ( i_result = DemuxPacket( p_input, b_play_audio ) ) <= 0 )
470 if( i_time_begin == -1 )
472 i_time_begin = GetMoviePTS( p_demux );
476 i_length = GetMoviePTS( p_demux ) - i_time_begin;
477 if( i_length < 0 || i_length >= 40 * 1000 )
484 p_demux->i_time = GetMoviePTS( p_demux );
485 if( p_demux->i_time >= 0 )
487 input_ClockManageRef( p_input,
488 p_input->stream.p_selected_program,
489 p_demux->i_time * 9 / 100 );
495 /*****************************************************************************
496 * Close: frees unused data
497 *****************************************************************************/
498 static void Close( vlc_object_t * p_this )
500 input_thread_t *p_input = (input_thread_t *)p_this;
501 demux_sys_t *p_sys = p_input->p_demux_data;
504 msg_Dbg( p_input, "Freeing all memory" );
506 ASF_FreeObjectRoot( p_input, &p_sys->root );
507 for( i_stream = 0; i_stream < 128; i_stream++ )
509 #define p_stream p_sys->stream[i_stream]
512 if( p_stream->p_pes )
514 input_DeletePES( p_input->p_method_data, p_stream->p_pes );
524 /*****************************************************************************
526 *****************************************************************************/
527 static mtime_t GetMoviePTS( demux_sys_t *p_demux )
533 for( i_stream = 0; i_stream < 128 ; i_stream++ )
535 #define p_stream p_demux->stream[i_stream]
536 if( p_stream && p_stream->p_es && p_stream->p_es->p_decoder_fifo && p_stream->i_time > 0)
540 i_time = p_stream->i_time;
544 i_time = __MIN( i_time, p_stream->i_time );
553 #define GETVALUE2b( bits, var, def ) \
554 switch( (bits)&0x03 ) \
556 case 1: var = p_peek[i_skip]; i_skip++; break; \
557 case 2: var = GetWLE( p_peek + i_skip ); i_skip+= 2; break; \
558 case 3: var = GetDWLE( p_peek + i_skip ); i_skip+= 4; break; \
560 default: var = def; break;\
563 static int DemuxPacket( input_thread_t *p_input, vlc_bool_t b_play_audio )
565 demux_sys_t *p_demux = p_input->p_demux_data;
566 int i_data_packet_min = p_demux->p_fp->i_min_data_packet_size;
570 int i_packet_size_left;
572 int i_packet_property;
574 int b_packet_multiple_payload;
576 int i_packet_sequence;
577 int i_packet_padding_length;
579 uint32_t i_packet_send_time;
580 uint16_t i_packet_duration;
583 int i_payload_length_type;
586 if( input_Peek( p_input, &p_peek, i_data_packet_min ) < i_data_packet_min )
589 msg_Warn( p_input, "cannot peek while getting new packet, EOF ?" );
594 /* *** parse error correction if present *** */
597 unsigned int i_error_correction_length_type;
598 unsigned int i_error_correction_data_length;
599 unsigned int i_opaque_data_present;
601 i_error_correction_data_length = p_peek[0] & 0x0f; // 4bits
602 i_opaque_data_present = ( p_peek[0] >> 4 )& 0x01; // 1bit
603 i_error_correction_length_type = ( p_peek[0] >> 5 ) & 0x03; // 2bits
604 i_skip += 1; // skip error correction flags
606 if( i_error_correction_length_type != 0x00 ||
607 i_opaque_data_present != 0 ||
608 i_error_correction_data_length != 0x02 )
610 goto loop_error_recovery;
613 i_skip += i_error_correction_data_length;
617 msg_Warn( p_input, "p_peek[0]&0x80 != 0x80" );
621 if( i_skip + 2 >= i_data_packet_min )
623 goto loop_error_recovery;
626 i_packet_flags = p_peek[i_skip]; i_skip++;
627 i_packet_property = p_peek[i_skip]; i_skip++;
629 b_packet_multiple_payload = i_packet_flags&0x01;
631 /* read some value */
632 GETVALUE2b( i_packet_flags >> 5, i_packet_length, i_data_packet_min );
633 GETVALUE2b( i_packet_flags >> 1, i_packet_sequence, 0 );
634 GETVALUE2b( i_packet_flags >> 3, i_packet_padding_length, 0 );
636 i_packet_send_time = GetDWLE( p_peek + i_skip ); i_skip += 4;
637 i_packet_duration = GetWLE( p_peek + i_skip ); i_skip += 2;
639 // i_packet_size_left = i_packet_length; // XXX données reellement lu
640 /* FIXME I have to do that for some file, I don't known why */
641 i_packet_size_left = i_data_packet_min;
643 if( b_packet_multiple_payload )
645 i_payload_count = p_peek[i_skip] & 0x3f;
646 i_payload_length_type = ( p_peek[i_skip] >> 6 )&0x03;
652 i_payload_length_type = 0x02; // unused
655 for( i_payload = 0; i_payload < i_payload_count ; i_payload++ )
657 asf_stream_t *p_stream;
660 int i_media_object_number;
661 int i_media_object_offset;
662 int i_replicated_data_length;
663 int i_payload_data_length;
664 int i_payload_data_pos;
665 int i_sub_payload_data_length;
671 if( i_skip >= i_packet_size_left )
673 /* prevent some segfault with invalid file */
677 i_stream_number = p_peek[i_skip] & 0x7f;
680 GETVALUE2b( i_packet_property >> 4, i_media_object_number, 0 );
681 GETVALUE2b( i_packet_property >> 2, i_tmp, 0 );
682 GETVALUE2b( i_packet_property, i_replicated_data_length, 0 );
684 if( i_replicated_data_length > 1 ) // should be at least 8 bytes
686 i_pts = (mtime_t)GetDWLE( p_peek + i_skip + 4 ) * 1000;
687 i_skip += i_replicated_data_length;
690 i_media_object_offset = i_tmp;
692 if( i_skip >= i_packet_size_left )
697 else if( i_replicated_data_length == 1 )
700 msg_Dbg( p_input, "found compressed payload" );
702 i_pts = (mtime_t)i_tmp * 1000;
703 i_pts_delta = (mtime_t)p_peek[i_skip] * 1000; i_skip++;
705 i_media_object_offset = 0;
709 i_pts = (mtime_t)i_packet_send_time * 1000;
712 i_media_object_offset = i_tmp;
715 i_pts = __MAX( i_pts - p_demux->p_fp->i_preroll * 1000, 0 );
716 if( b_packet_multiple_payload )
718 GETVALUE2b( i_payload_length_type, i_payload_data_length, 0 );
722 i_payload_data_length = i_packet_length -
723 i_packet_padding_length - i_skip;
726 if( i_payload_data_length < 0 || i_skip + i_payload_data_length > i_packet_size_left )
733 "payload(%d/%d) stream_number:%d media_object_number:%d media_object_offset:%d replicated_data_length:%d payload_data_length %d",
737 i_media_object_number,
738 i_media_object_offset,
739 i_replicated_data_length,
740 i_payload_data_length );
743 if( !( p_stream = p_demux->stream[i_stream_number] ) )
746 "undeclared stream[Id 0x%x]", i_stream_number );
747 i_skip += i_payload_data_length;
748 continue; // over payload
751 if( !p_stream->p_es || !p_stream->p_es->p_decoder_fifo )
753 i_skip += i_payload_data_length;
758 for( i_payload_data_pos = 0;
759 i_payload_data_pos < i_payload_data_length &&
760 i_packet_size_left > 0;
761 i_payload_data_pos += i_sub_payload_data_length )
763 data_packet_t *p_data;
765 // read sub payload length
766 if( i_replicated_data_length == 1 )
768 i_sub_payload_data_length = p_peek[i_skip]; i_skip++;
769 i_payload_data_pos++;
773 i_sub_payload_data_length = i_payload_data_length;
776 /* FIXME I don't use i_media_object_number, sould I ? */
777 if( p_stream->p_pes && i_media_object_offset == 0 )
779 /* send complete packet to decoder */
780 if( p_stream->p_pes->i_pes_size > 0 )
782 if( p_stream->p_es->p_decoder_fifo &&
783 ( b_play_audio || p_stream->i_cat != AUDIO_ES ) )
785 p_stream->p_pes->i_rate =
786 p_input->stream.control.i_rate;
787 input_DecodePES( p_stream->p_es->p_decoder_fifo,
792 input_DeletePES( p_input->p_method_data,
795 p_stream->p_pes = NULL;
799 if( !p_stream->p_pes ) // add a new PES
802 ( (mtime_t)i_pts + i_payload * (mtime_t)i_pts_delta );
804 p_stream->p_pes = input_NewPES( p_input->p_method_data );
805 p_stream->p_pes->i_dts =
806 p_stream->p_pes->i_pts =
807 input_ClockGetTS( p_input,
808 p_input->stream.p_selected_program,
809 p_stream->i_time * 9 /100 );
811 //msg_Err( p_input, "stream[0x%2x] pts=%lld", i_stream_number, p_stream->p_pes->i_pts );
812 p_stream->p_pes->p_next = NULL;
813 p_stream->p_pes->i_nb_data = 0;
814 p_stream->p_pes->i_pes_size = 0;
817 i_read = i_sub_payload_data_length + i_skip;
818 if( input_SplitBuffer( p_input, &p_data, i_read ) < i_read )
820 msg_Warn( p_input, "cannot read data" );
823 p_data->p_payload_start += i_skip;
824 i_packet_size_left -= i_read;
827 if( !p_stream->p_pes->p_first )
829 p_stream->p_pes->p_first = p_stream->p_pes->p_last = p_data;
833 p_stream->p_pes->p_last->p_next = p_data;
834 p_stream->p_pes->p_last = p_data;
836 p_stream->p_pes->i_pes_size += i_sub_payload_data_length;
837 p_stream->p_pes->i_nb_data++;
840 if( i_packet_size_left > 0 )
842 if( input_Peek( p_input, &p_peek, i_packet_size_left ) < i_packet_size_left )
845 msg_Warn( p_input, "cannot peek, EOF ?" );
852 if( i_packet_size_left > 0 )
854 if( !ASF_SkipBytes( p_input, i_packet_size_left ) )
856 msg_Warn( p_input, "cannot skip data, EOF ?" );
864 msg_Warn( p_input, "unsupported packet header" );
865 if( p_demux->p_fp->i_min_data_packet_size != p_demux->p_fp->i_max_data_packet_size )
867 msg_Err( p_input, "unsupported packet header, fatal error" );
870 ASF_SkipBytes( p_input, i_data_packet_min );