mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-09 16:02:59 +00:00
ext/ogg/: Fix the case where the muxer would mark pages as delta frames when they are not (vorbis only ogg).
Original commit message from CVS: * ext/ogg/gstoggdemux.c: (gst_ogg_pad_push): * ext/ogg/gstoggmux.c: (gst_ogg_mux_next_buffer), (gst_ogg_mux_send_headers), (gst_ogg_mux_loop): Fix the case where the muxer would mark pages as delta frames when they are not (vorbis only ogg).
This commit is contained in:
parent
68d1ca33ae
commit
630cdffa7d
3 changed files with 51 additions and 19 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2004-09-15 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_push):
|
||||||
|
* ext/ogg/gstoggmux.c: (gst_ogg_mux_next_buffer),
|
||||||
|
(gst_ogg_mux_send_headers), (gst_ogg_mux_loop):
|
||||||
|
Fix the case where the muxer would mark pages as delta
|
||||||
|
frames when they are not (vorbis only ogg).
|
||||||
|
|
||||||
2004-09-15 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
2004-09-15 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
* gst/playback/gstplaybasebin.c: (state_change), (setup_source),
|
* gst/playback/gstplaybasebin.c: (state_change), (setup_source),
|
||||||
|
|
|
@ -533,7 +533,8 @@ gst_ogg_demux_src_event (GstPad * pad, GstEvent * event)
|
||||||
|
|
||||||
GST_OGG_SET_STATE (ogg, GST_OGG_STATE_SEEK);
|
GST_OGG_SET_STATE (ogg, GST_OGG_STATE_SEEK);
|
||||||
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
|
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,
|
GST_DEBUG_OBJECT (ogg,
|
||||||
"initiating seeking to format %d, offset %" G_GUINT64_FORMAT, format,
|
"initiating seeking to format %d, offset %" G_GUINT64_FORMAT, format,
|
||||||
offset);
|
offset);
|
||||||
|
@ -606,7 +607,8 @@ gst_ogg_demux_handle_event (GstPad * pad, GstEvent * event)
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
GST_FLAG_UNSET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT);
|
GST_FLAG_UNSET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT);
|
||||||
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
|
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
|
||||||
pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;);
|
pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
gst_pad_event_default (pad, event);
|
gst_pad_event_default (pad, event);
|
||||||
|
@ -876,7 +878,8 @@ _find_chain_get_unknown_part (GstOggDemux * ogg, gint64 * start, gint64 * end)
|
||||||
*end = G_MAXINT64;
|
*end = G_MAXINT64;
|
||||||
|
|
||||||
g_assert (ogg->current_chain >= 0);
|
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) {
|
if (ogg->setup_state == SETUP_FIND_LAST_CHAIN) {
|
||||||
*end = gst_file_pad_get_length (ogg->sinkpad);
|
*end = gst_file_pad_get_length (ogg->sinkpad);
|
||||||
|
@ -1005,7 +1008,8 @@ _find_streams_check (GstOggDemux * ogg)
|
||||||
} else {
|
} else {
|
||||||
endpos = G_MAXINT64;
|
endpos = G_MAXINT64;
|
||||||
FOR_PAD_IN_CHAIN (ogg, pad, ogg->chains->len - 1,
|
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) {
|
if (!ogg->seek_skipped || gst_ogg_demux_position (ogg) >= endpos) {
|
||||||
/* have we found the endposition for all streams yet? */
|
/* have we found the endposition for all streams yet? */
|
||||||
|
|
|
@ -720,8 +720,8 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
|
||||||
buf = GST_BUFFER (pad->headers->data);
|
buf = GST_BUFFER (pad->headers->data);
|
||||||
pad->headers = g_list_remove (pad->headers, buf);
|
pad->headers = g_list_remove (pad->headers, buf);
|
||||||
} else {
|
} else {
|
||||||
/* create empty buffer for the stream */
|
buf = pad->buffer;
|
||||||
buf = gst_buffer_new_and_alloc (0);
|
gst_buffer_ref (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a packet from the buffer */
|
/* create a packet from the buffer */
|
||||||
|
@ -860,20 +860,23 @@ gst_ogg_mux_loop (GstElement * element)
|
||||||
* to flush the current page */
|
* to flush the current page */
|
||||||
if (ogg_mux->pulling && best &&
|
if (ogg_mux->pulling && best &&
|
||||||
ogg_mux->pulling != best && ogg_mux->pulling->buffer) {
|
ogg_mux->pulling != best && ogg_mux->pulling->buffer) {
|
||||||
|
GstOggPad *pad = ogg_mux->pulling;
|
||||||
|
|
||||||
GstClockTime last_ts =
|
GstClockTime last_ts =
|
||||||
GST_BUFFER_TIMESTAMP (ogg_mux->pulling->buffer) +
|
GST_BUFFER_TIMESTAMP (pad->buffer) + GST_BUFFER_DURATION (pad->buffer);
|
||||||
GST_BUFFER_DURATION (ogg_mux->pulling->buffer);
|
|
||||||
/* if the next packet in the current page is going to make the page
|
/* if the next packet in the current page is going to make the page
|
||||||
* too long, we need to flush */
|
* too long, we need to flush */
|
||||||
if (last_ts > ogg_mux->next_ts + ogg_mux->max_delay) {
|
if (last_ts > ogg_mux->next_ts + ogg_mux->max_delay) {
|
||||||
ogg_page page;
|
ogg_page page;
|
||||||
|
|
||||||
while (ogg_stream_flush (&ogg_mux->pulling->stream, &page)) {
|
while (ogg_stream_flush (&pad->stream, &page)) {
|
||||||
gst_ogg_mux_push_page (ogg_mux, &page, ogg_mux->pulling->first_delta);
|
gst_ogg_mux_push_page (ogg_mux, &page, pad->first_delta);
|
||||||
/* increment the page number counter */
|
/* increment the page number counter */
|
||||||
ogg_mux->pulling->pageno++;
|
pad->pageno++;
|
||||||
ogg_mux->pulling->first_delta = TRUE;
|
/* mark other pages as delta */
|
||||||
|
pad->first_delta = TRUE;
|
||||||
}
|
}
|
||||||
|
pad->new_page = TRUE;
|
||||||
ogg_mux->pulling = NULL;
|
ogg_mux->pulling = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -961,6 +964,7 @@ gst_ogg_mux_loop (GstElement * element)
|
||||||
gst_ogg_mux_push_page (ogg_mux, &page, pad->first_delta);
|
gst_ogg_mux_push_page (ogg_mux, &page, pad->first_delta);
|
||||||
/* increment the page number counter */
|
/* increment the page number counter */
|
||||||
pad->pageno++;
|
pad->pageno++;
|
||||||
|
/* mark other pages as delta */
|
||||||
pad->first_delta = TRUE;
|
pad->first_delta = TRUE;
|
||||||
}
|
}
|
||||||
pad->new_page = TRUE;
|
pad->new_page = TRUE;
|
||||||
|
@ -982,6 +986,12 @@ gst_ogg_mux_loop (GstElement * element)
|
||||||
/* if we get it on the pad with deltaunits,
|
/* if we get it on the pad with deltaunits,
|
||||||
* we mark the page as non delta */
|
* we mark the page as non delta */
|
||||||
pad->first_delta = FALSE;
|
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;
|
pad->new_page = FALSE;
|
||||||
|
@ -1000,18 +1010,28 @@ gst_ogg_mux_loop (GstElement * element)
|
||||||
|
|
||||||
/* let ogg write out the pages now. The packet we got could end
|
/* 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 */
|
* up in more than one page so we need to write them all */
|
||||||
while (ogg_stream_pageout (&pad->stream, &page) > 0) {
|
if (ogg_stream_pageout (&pad->stream, &page) > 0) {
|
||||||
/* we have a complete page now, we can push the page
|
/* 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);
|
gst_ogg_mux_push_page (ogg_mux, &page, pad->first_delta);
|
||||||
/* increment the page number counter */
|
|
||||||
pad->pageno++;
|
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
|
/* we're done pulling on this pad, make sure to choose a new
|
||||||
* pad for pulling in the next iteration */
|
* pad for pulling in the next iteration */
|
||||||
ogg_mux->pulling = NULL;
|
ogg_mux->pulling = NULL;
|
||||||
pad->first_delta = TRUE;
|
|
||||||
pad->duration = 0;
|
|
||||||
pad->new_page = TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue