+ ogg->curidx = idx;
+ os->incomplete = 0;
+
+ if (os->header) {
+ os->header = os->codec->header (s, idx);
+ if (!os->header){
+ os->segp = segp;
+ os->psize = psize;
+
+ // We have reached the first non-header packet in this stream.
+ // Unfortunately more header packets may still follow for others,
+ // so we reset this later unless we are done with the headers
+ // for all streams.
+ ogg->headers = 1;
+
+ // Update the header state for all streams and
+ // compute the data_offset.
+ if (!s->data_offset)
+ s->data_offset = os->sync_pos;
+ for (i = 0; i < ogg->nstreams; i++) {
+ struct ogg_stream *cur_os = ogg->streams + i;
+ if (cur_os->header > 0)
+ ogg->headers = 0;
+
+ // if we have a partial non-header packet, its start is
+ // obviously at or after the data start
+ if (cur_os->incomplete)
+ s->data_offset = FFMIN(s->data_offset, cur_os->sync_pos);
+ }