* the ogg sync layer.
*/
static GstFlowReturn
-gst_ogg_demux_get_data (GstOggDemux * ogg)
+gst_ogg_demux_get_data (GstOggDemux * ogg, gint64 end_offset)
{
GstFlowReturn ret;
GstBuffer *buffer;
- GST_LOG_OBJECT (ogg, "get data %" G_GINT64_FORMAT " %" G_GINT64_FORMAT,
- ogg->read_offset, ogg->length);
+ GST_LOG_OBJECT (ogg,
+ "get data %" G_GINT64_FORMAT " %" G_GINT64_FORMAT " %" G_GINT64_FORMAT,
+ ogg->read_offset, ogg->length, end_offset);
+
+ if (end_offset > 0 && ogg->read_offset >= end_offset)
+ goto boundary_reached;
+
if (ogg->read_offset == ogg->length)
goto eos;
return ret;
/* ERROR */
+boundary_reached:
+ {
+ GST_LOG_OBJECT (ogg, "reached boundary");
+ return GST_FLOW_LIMIT;
+ }
eos:
{
GST_LOG_OBJECT (ogg, "reached EOS");
gst_ogg_demux_get_next_page (GstOggDemux * ogg, ogg_page * og, gint64 boundary,
gint64 * offset)
{
- gint64 end_offset = 0;
+ gint64 end_offset = -1;
GstFlowReturn ret;
GST_LOG_OBJECT (ogg,
while (TRUE) {
glong more;
- if (boundary > 0 && ogg->offset >= end_offset)
+ if (end_offset > 0 && ogg->offset >= end_offset)
goto boundary_reached;
more = ogg_sync_pageseek (&ogg->sync, og);
goto boundary_reached;
GST_LOG_OBJECT (ogg, "need more data");
- ret = gst_ogg_demux_get_data (ogg);
+ ret = gst_ogg_demux_get_data (ogg, end_offset);
if (ret != GST_FLOW_OK)
break;
} else {