GST_OGG_SET_STATE (ogg, GST_OGG_STATE_SEEK);
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
- pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;);
+ pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;
+ );
GST_DEBUG_OBJECT (ogg,
"initiating seeking to format %d, offset %" G_GUINT64_FORMAT, format,
offset);
gst_event_unref (event);
GST_FLAG_UNSET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT);
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
- pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;);
+ pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;
+ );
break;
default:
gst_pad_event_default (pad, event);
*end = G_MAXINT64;
g_assert (ogg->current_chain >= 0);
- FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, *start = MAX (*start, pad->end_offset););
+ FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, *start = MAX (*start, pad->end_offset);
+ );
if (ogg->setup_state == SETUP_FIND_LAST_CHAIN) {
*end = gst_file_pad_get_length (ogg->sinkpad);
} else {
endpos = G_MAXINT64;
FOR_PAD_IN_CHAIN (ogg, pad, ogg->chains->len - 1,
- endpos = MIN (endpos, pad->start_offset););
+ endpos = MIN (endpos, pad->start_offset);
+ );
}
if (!ogg->seek_skipped || gst_ogg_demux_position (ogg) >= endpos) {
/* have we found the endposition for all streams yet? */
buf = GST_BUFFER (pad->headers->data);
pad->headers = g_list_remove (pad->headers, buf);
} else {
- /* create empty buffer for the stream */
- buf = gst_buffer_new_and_alloc (0);
+ buf = pad->buffer;
+ gst_buffer_ref (buf);
}
/* create a packet from the buffer */
* to flush the current page */
if (ogg_mux->pulling && best &&
ogg_mux->pulling != best && ogg_mux->pulling->buffer) {
+ GstOggPad *pad = ogg_mux->pulling;
+
GstClockTime last_ts =
- GST_BUFFER_TIMESTAMP (ogg_mux->pulling->buffer) +
- GST_BUFFER_DURATION (ogg_mux->pulling->buffer);
+ GST_BUFFER_TIMESTAMP (pad->buffer) + GST_BUFFER_DURATION (pad->buffer);
/* if the next packet in the current page is going to make the page
* too long, we need to flush */
if (last_ts > ogg_mux->next_ts + ogg_mux->max_delay) {
ogg_page page;
- while (ogg_stream_flush (&ogg_mux->pulling->stream, &page)) {
- gst_ogg_mux_push_page (ogg_mux, &page, ogg_mux->pulling->first_delta);
+ while (ogg_stream_flush (&pad->stream, &page)) {
+ gst_ogg_mux_push_page (ogg_mux, &page, pad->first_delta);
/* increment the page number counter */
- ogg_mux->pulling->pageno++;
- ogg_mux->pulling->first_delta = TRUE;
+ pad->pageno++;
+ /* mark other pages as delta */
+ pad->first_delta = TRUE;
}
+ pad->new_page = TRUE;
ogg_mux->pulling = NULL;
}
}
gst_ogg_mux_push_page (ogg_mux, &page, pad->first_delta);
/* increment the page number counter */
pad->pageno++;
+ /* mark other pages as delta */
pad->first_delta = TRUE;
}
pad->new_page = TRUE;
/* if we get it on the pad with deltaunits,
* we mark the page as non delta */
pad->first_delta = FALSE;
+ } else if (ogg_mux->delta_pad != NULL) {
+ /* if there are pads with delta frames, we
+ * must mark this one as delta */
+ pad->first_delta = TRUE;
+ } else {
+ pad->first_delta = FALSE;
}
}
pad->new_page = FALSE;
/* let ogg write out the pages now. The packet we got could end
* up in more than one page so we need to write them all */
- while (ogg_stream_pageout (&pad->stream, &page) > 0) {
- /* we have a complete page now, we can push the page
- * and make sure to pull on a new pad the next time around */
+ if (ogg_stream_pageout (&pad->stream, &page) > 0) {
+ /* push the page */
gst_ogg_mux_push_page (ogg_mux, &page, pad->first_delta);
- /* increment the page number counter */
pad->pageno++;
+ /* mark next pages as delta */
+ pad->first_delta = TRUE;
+
+ /* use an inner loop her to flush the remaining pages and
+ * mark them as delta frames as well */
+ while (ogg_stream_pageout (&pad->stream, &page) > 0) {
+ /* we have a complete page now, we can push the page
+ * and make sure to pull on a new pad the next time around */
+ gst_ogg_mux_push_page (ogg_mux, &page, pad->first_delta);
+ /* increment the page number counter */
+ pad->pageno++;
+ }
+ /* need a new page as well */
+ pad->new_page = TRUE;
+ pad->duration = 0;
/* we're done pulling on this pad, make sure to choose a new
* pad for pulling in the next iteration */
ogg_mux->pulling = NULL;
- pad->first_delta = TRUE;
- pad->duration = 0;
- pad->new_page = TRUE;
}
}
}