Changeset 9d349e1ce5812e1d6e7a754368d240d00efe03e2
- Timestamp:
- 02/27/08 20:46:04
(6 months ago)
- Author:
- Rafaël Carré <funman@videolan.org>
- git-committer:
- Rafaël Carré <funman@videolan.org> 1204141564 +0000
- git-parent:
[689d893b4e6d2c86d5b63f5d4c358cf1a09795e0]
- git-author:
- Rafaël Carré <funman@videolan.org> 1204141564 +0000
- Message:
asf demuxer: fix header demuxing & use padding without confusing the user (refs #1404)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r99fab90 |
r9d349e1 |
|
| 90 | 90 | |
|---|
| 91 | 91 | unsigned int i_track; |
|---|
| 92 | | asf_track_t *track[128]; |
|---|
| | 92 | asf_track_t *track[128]; /* track number is stored on 7 bits */ |
|---|
| 93 | 93 | |
|---|
| 94 | 94 | int64_t i_data_begin; |
|---|
| … | … | |
| 150 | 150 | int i_result; |
|---|
| 151 | 151 | |
|---|
| 152 | | if( p_demux->b_die ) break; |
|---|
| | 152 | if( p_demux->b_die ) |
|---|
| | 153 | break; |
|---|
| | 154 | if( p_sys->i_data_end >= 0 && |
|---|
| | 155 | stream_Tell( p_demux->s ) >= p_sys->i_data_end ) |
|---|
| | 156 | return 0; /* EOF */ |
|---|
| 153 | 157 | |
|---|
| 154 | 158 | /* Check if we have concatenated files */ |
|---|
| … | … | |
| 427 | 431 | GETVALUE2b( i_packet_flags >> 3, i_packet_padding_length, 0 ); |
|---|
| 428 | 432 | |
|---|
| | 433 | if( i_packet_padding_length > i_packet_length ) |
|---|
| | 434 | { |
|---|
| | 435 | msg_Warn( p_demux, "Too large padding: %d", i_packet_padding_length ); |
|---|
| | 436 | goto loop_error_recovery; |
|---|
| | 437 | } |
|---|
| | 438 | |
|---|
| 429 | 439 | i_packet_send_time = GetDWLE( p_peek + i_skip ); i_skip += 4; |
|---|
| 430 | 440 | i_packet_duration = GetWLE( p_peek + i_skip ); i_skip += 2; |
|---|
| 431 | 441 | |
|---|
| 432 | | // i_packet_size_left = i_packet_length; // XXX data really read |
|---|
| 433 | | /* FIXME I have to do that for some file, I don't known why */ |
|---|
| 434 | | i_packet_size_left = i_data_packet_min; |
|---|
| | 442 | i_packet_size_left = i_packet_length - i_packet_padding_length; |
|---|
| 435 | 443 | |
|---|
| 436 | 444 | if( b_packet_multiple_payload ) |
|---|
| … | … | |
| 513 | 521 | else |
|---|
| 514 | 522 | { |
|---|
| 515 | | i_payload_data_length = i_packet_length - |
|---|
| 516 | | i_packet_padding_length - i_skip; |
|---|
| 517 | | } |
|---|
| 518 | | |
|---|
| 519 | | if( i_payload_data_length < 0 || i_skip + i_payload_data_length > i_packet_size_left ) |
|---|
| | 523 | i_payload_data_length = i_packet_length - i_skip; |
|---|
| | 524 | } |
|---|
| | 525 | |
|---|
| | 526 | if( i_payload_data_length < 0 || i_payload_data_length > i_packet_size_left ) |
|---|
| 520 | 527 | { |
|---|
| 521 | 528 | break; |
|---|
| … | … | |
| 617 | 624 | if( i_packet_size_left > 0 ) |
|---|
| 618 | 625 | { |
|---|
| | 626 | msg_Warn( p_demux, "Didn't read %d bytes in the packet", |
|---|
| | 627 | i_packet_size_left ); |
|---|
| 619 | 628 | if( stream_Read( p_demux->s, NULL, i_packet_size_left ) |
|---|
| 620 | 629 | < i_packet_size_left ) |
|---|
| 621 | 630 | { |
|---|
| 622 | | msg_Warn( p_demux, "cannot skip data, EOF ?" ); |
|---|
| | 631 | msg_Err( p_demux, "cannot skip data, EOF ?" ); |
|---|
| 623 | 632 | return 0; |
|---|
| 624 | 633 | } |
|---|
| 625 | 634 | } |
|---|
| | 635 | |
|---|
| | 636 | if( i_packet_padding_length > 0 ) |
|---|
| | 637 | if( stream_Read( p_demux->s, NULL, i_packet_padding_length ) |
|---|
| | 638 | < i_packet_padding_length ) |
|---|
| | 639 | { |
|---|
| | 640 | msg_Err( p_demux, "cannot skip padding data, EOF ?" ); |
|---|
| | 641 | return 0; |
|---|
| | 642 | } |
|---|
| 626 | 643 | |
|---|
| 627 | 644 | return 1; |
|---|
| r99fab90 |
r9d349e1 |
|
| 135 | 135 | static void ASF_FreeObject_Null( asf_object_t *pp_obj ) |
|---|
| 136 | 136 | { |
|---|
| | 137 | VLC_UNUSED(pp_obj); |
|---|
| 137 | 138 | return; |
|---|
| 138 | 139 | } |
|---|
| … | … | |
| 271 | 272 | const uint8_t *p_peek; |
|---|
| 272 | 273 | |
|---|
| 273 | | if( ( i_peek = stream_Peek( s, &p_peek, 104) ) < 104 ) |
|---|
| | 274 | if( ( i_peek = stream_Peek( s, &p_peek, 104 ) ) < 104 ) |
|---|
| 274 | 275 | { |
|---|
| 275 | 276 | return VLC_EGENERIC; |
|---|
| … | … | |
| 279 | 280 | p_fp->i_creation_date = GetQWLE( p_peek + 48 ); |
|---|
| 280 | 281 | p_fp->i_data_packets_count = GetQWLE( p_peek + 56 ); |
|---|
| 281 | | p_fp->i_play_duration = GetQWLE( p_peek + 64 ); |
|---|
| 282 | | p_fp->i_send_duration = GetQWLE( p_peek + 72 ); |
|---|
| 283 | | p_fp->i_preroll = GetQWLE( p_peek + 80 ); |
|---|
| | 282 | p_fp->i_send_duration = GetQWLE( p_peek + 64 ); |
|---|
| | 283 | p_fp->i_play_duration = GetQWLE( p_peek + 72 ); |
|---|
| | 284 | p_fp->i_preroll = GetDWLE( p_peek + 80 ); |
|---|
| | 285 | p_fp->i_unknown = GetDWLE( p_peek + 84 ); |
|---|
| 284 | 286 | p_fp->i_flags = GetDWLE( p_peek + 88 ); |
|---|
| 285 | 287 | p_fp->i_min_data_packet_size = GetDWLE( p_peek + 92 ); |
|---|
| … | … | |
| 291 | 293 | "read \"file properties object\" file_id:" GUID_FMT |
|---|
| 292 | 294 | " file_size:"I64Fd" creation_date:"I64Fd" data_packets_count:" |
|---|
| 293 | | I64Fd" play_duration:"I64Fd" send_duration:"I64Fd" preroll:" |
|---|
| 294 | | I64Fd" flags:%d min_data_packet_size:%d max_data_packet_size:%d " |
|---|
| 295 | | "max_bitrate:%d", |
|---|
| | 295 | I64Fd" send_duration:"I64Fd" play_duration:"I64Fd" preroll:%d" |
|---|
| | 296 | "unknown:%d flags:%d min_data_packet_size:%d " |
|---|
| | 297 | "max_data_packet_size:%d max_bitrate:%d", |
|---|
| 296 | 298 | GUID_PRINT( p_fp->i_file_id ), p_fp->i_file_size, |
|---|
| 297 | 299 | p_fp->i_creation_date, p_fp->i_data_packets_count, |
|---|
| 298 | | p_fp->i_play_duration, p_fp->i_send_duration, |
|---|
| 299 | | p_fp->i_preroll, p_fp->i_flags, |
|---|
| | 300 | p_fp->i_send_duration, p_fp->i_play_duration, |
|---|
| | 301 | p_fp->i_preroll, p_fp->i_unknown, p_fp->i_flags, |
|---|
| 300 | 302 | p_fp->i_min_data_packet_size, p_fp->i_max_data_packet_size, |
|---|
| 301 | 303 | p_fp->i_max_bitrate ); |
|---|
| r6ee1e19 |
r9d349e1 |
|
| 199 | 199 | uint64_t i_creation_date; |
|---|
| 200 | 200 | uint64_t i_data_packets_count; |
|---|
| | 201 | uint64_t i_send_duration; |
|---|
| 201 | 202 | uint64_t i_play_duration; |
|---|
| 202 | | uint64_t i_send_duration; |
|---|
| 203 | | uint64_t i_preroll; |
|---|
| | 203 | uint32_t i_preroll; |
|---|
| | 204 | uint32_t i_unknown; /* ignored, usually 0 */ |
|---|
| 204 | 205 | uint32_t i_flags; |
|---|
| 205 | 206 | uint32_t i_min_data_packet_size; |
|---|