| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Ogg bitstream support | 2 * Ogg bitstream support |
| 3 * Luca Barbato <lu_zero@gentoo.org> | 3 * Luca Barbato <lu_zero@gentoo.org> |
| 4 * Based on tcvp implementation | 4 * Based on tcvp implementation |
| 5 * | 5 * |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 Copyright (C) 2005 Michael Ahlberg, Måns Rullgård | 9 Copyright (C) 2005 Michael Ahlberg, Måns Rullgård |
| 10 | 10 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 av_log(s, AV_LOG_WARNING, "Page at %"PRId64" is missing granule\n", os->
page_pos); | 376 av_log(s, AV_LOG_WARNING, "Page at %"PRId64" is missing granule\n", os->
page_pos); |
| 377 | 377 |
| 378 ogg->curidx = idx; | 378 ogg->curidx = idx; |
| 379 os->incomplete = 0; | 379 os->incomplete = 0; |
| 380 | 380 |
| 381 if (os->header) { | 381 if (os->header) { |
| 382 os->header = os->codec->header (s, idx); | 382 os->header = os->codec->header (s, idx); |
| 383 if (!os->header){ | 383 if (!os->header){ |
| 384 os->segp = segp; | 384 os->segp = segp; |
| 385 os->psize = psize; | 385 os->psize = psize; |
| 386 if (!ogg->headers) | 386 |
| 387 s->data_offset = os->sync_pos; | 387 // We've reached the first non-header packet. All header |
| 388 // packets must be complete before the first non-header |
| 389 // one, so everything that follows must be non-header. |
| 388 ogg->headers = 1; | 390 ogg->headers = 1; |
| 391 |
| 392 // Update the header state for all streams and |
| 393 // compute the data_offset. |
| 394 s->data_offset = os->sync_pos; |
| 395 for (i = 0; i < ogg->nstreams; i++) { |
| 396 struct ogg_stream *cur_os = ogg->streams + i; |
| 397 // Set stream header state to 0 if its last packet |
| 398 // was a header. |
| 399 if (cur_os->header > 0) |
| 400 cur_os->header = 0; |
| 401 |
| 402 // if we have a partial non-header packet, its start is |
| 403 // obviously at or after the data start. |
| 404 if (cur_os->incomplete) |
| 405 s->data_offset = FFMIN(s->data_offset, cur_os->sync_pos); |
| 406 } |
| 389 }else{ | 407 }else{ |
| 390 os->pstart += os->psize; | 408 os->pstart += os->psize; |
| 391 os->psize = 0; | 409 os->psize = 0; |
| 392 } | 410 } |
| 393 } else { | 411 } else { |
| 394 os->pflags = 0; | 412 os->pflags = 0; |
| 395 os->pduration = 0; | 413 os->pduration = 0; |
| 396 if (os->codec && os->codec->packet) | 414 if (os->codec && os->codec->packet) |
| 397 os->codec->packet (s, idx); | 415 os->codec->packet (s, idx); |
| 398 if (str) | 416 if (str) |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 sizeof (struct ogg), | 691 sizeof (struct ogg), |
| 674 ogg_probe, | 692 ogg_probe, |
| 675 ogg_read_header, | 693 ogg_read_header, |
| 676 ogg_read_packet, | 694 ogg_read_packet, |
| 677 ogg_read_close, | 695 ogg_read_close, |
| 678 ogg_read_seek, | 696 ogg_read_seek, |
| 679 ogg_read_timestamp, | 697 ogg_read_timestamp, |
| 680 .extensions = "ogg", | 698 .extensions = "ogg", |
| 681 .flags = AVFMT_GENERIC_INDEX, | 699 .flags = AVFMT_GENERIC_INDEX, |
| 682 }; | 700 }; |
| OLD | NEW |