OLD | NEW |
1 /* | 1 /* |
2 * MPEG1/2 demuxer | 2 * MPEG1/2 demuxer |
3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard | 3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 error_redo: | 241 error_redo: |
242 url_fseek(s->pb, last_sync, SEEK_SET); | 242 url_fseek(s->pb, last_sync, SEEK_SET); |
243 redo: | 243 redo: |
244 /* next start code (should be immediately after) */ | 244 /* next start code (should be immediately after) */ |
245 m->header_state = 0xff; | 245 m->header_state = 0xff; |
246 size = MAX_SYNC_SIZE; | 246 size = MAX_SYNC_SIZE; |
247 startcode = find_next_start_code(s->pb, &size, &m->header_state); | 247 startcode = find_next_start_code(s->pb, &size, &m->header_state); |
248 last_sync = url_ftell(s->pb); | 248 last_sync = url_ftell(s->pb); |
249 //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(s->pb)); | 249 //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(s->pb)); |
250 if (startcode < 0) | 250 if (startcode < 0){ |
251 return AVERROR(EIO); | 251 if(url_feof(s->pb)) |
| 252 return AVERROR_EOF; |
| 253 //FIXME we should remember header_state |
| 254 return AVERROR(EAGAIN); |
| 255 } |
| 256 |
252 if (startcode == PACK_START_CODE) | 257 if (startcode == PACK_START_CODE) |
253 goto redo; | 258 goto redo; |
254 if (startcode == SYSTEM_HEADER_START_CODE) | 259 if (startcode == SYSTEM_HEADER_START_CODE) |
255 goto redo; | 260 goto redo; |
256 if (startcode == PADDING_STREAM) { | 261 if (startcode == PADDING_STREAM) { |
257 url_fskip(s->pb, get_be16(s->pb)); | 262 url_fskip(s->pb, get_be16(s->pb)); |
258 goto redo; | 263 goto redo; |
259 } | 264 } |
260 if (startcode == PRIVATE_STREAM_2) { | 265 if (startcode == PRIVATE_STREAM_2) { |
261 len = get_be16(s->pb); | 266 len = get_be16(s->pb); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 NULL_IF_CONFIG_SMALL("MPEG-PS format"), | 611 NULL_IF_CONFIG_SMALL("MPEG-PS format"), |
607 sizeof(MpegDemuxContext), | 612 sizeof(MpegDemuxContext), |
608 mpegps_probe, | 613 mpegps_probe, |
609 mpegps_read_header, | 614 mpegps_read_header, |
610 mpegps_read_packet, | 615 mpegps_read_packet, |
611 NULL, | 616 NULL, |
612 NULL, //mpegps_read_seek, | 617 NULL, //mpegps_read_seek, |
613 mpegps_read_dts, | 618 mpegps_read_dts, |
614 .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT, | 619 .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT, |
615 }; | 620 }; |
OLD | NEW |