gst_query_parse_duration (query, &format, NULL);
/* can only get position in time */
if (format != GST_FORMAT_TIME) {
- GST_DEBUG ("only query duration on TIME is supported");
+ GST_DEBUG_OBJECT (ogg, "only query duration on TIME is supported");
res = FALSE;
goto done;
}
* seek query upstream after converting it to bytes using
* the average bitrate of the stream. */
if (!ogg->seekable) {
- GST_DEBUG ("seek on non seekable stream");
+ GST_DEBUG_OBJECT (ogg, "seek on non seekable stream");
goto error;
}
}
default:
- GST_DEBUG ("We only handle seek events here");
+ GST_DEBUG_OBJECT (ogg, "We only handle seek events here");
goto error;
break;
}
return res;
+ /* ERRORS */
error:
- GST_DEBUG ("error handling event");
- gst_event_unref (event);
- return FALSE;
+ {
+ GST_DEBUG_OBJECT (ogg, "error handling event");
+ gst_event_unref (event);
+ return FALSE;
+ }
}
static gboolean
* seek query upstream after converting it to bytes using
* the average bitrate of the stream. */
if (!ogg->seekable) {
- GST_DEBUG ("seek on non seekable stream");
+ GST_DEBUG_OBJECT (ogg, "seek on non seekable stream");
goto error;
}
/* ERRORS */
error:
{
- GST_DEBUG ("error handling event");
+ GST_DEBUG_OBJECT (ogg, "error handling event");
gst_event_unref (event);
return FALSE;
}
} else {
gst_segment_set_last_stop (&ogg->segment, GST_FORMAT_TIME,
current_time);
- GST_DEBUG ("ogg current time %" GST_TIME_FORMAT,
+ GST_DEBUG_OBJECT (ogg, "ogg current time %" GST_TIME_FORMAT,
GST_TIME_ARGS (current_time));
}
}
GstEvent *event;
GstClockTime segment_start, segment_stop;
- GST_DEBUG ("chain->begin_time: %" GST_TIME_FORMAT,
+ GST_DEBUG_OBJECT (ogg, "chain->begin_time: %" GST_TIME_FORMAT,
GST_TIME_ARGS (chain->begin_time));
- GST_DEBUG ("chain->segment_start: %" GST_TIME_FORMAT,
+ GST_DEBUG_OBJECT (ogg, "chain->segment_start: %" GST_TIME_FORMAT,
GST_TIME_ARGS (chain->segment_start));
- GST_DEBUG ("chain->segment_stop: %" GST_TIME_FORMAT,
+ GST_DEBUG_OBJECT (ogg, "chain->segment_stop: %" GST_TIME_FORMAT,
GST_TIME_ARGS (chain->segment_stop));
if (chain->begin_time != GST_CLOCK_TIME_NONE) {
segment_stop = chain->segment_stop;
}
- GST_DEBUG ("segment_start: %" GST_TIME_FORMAT,
+ GST_DEBUG_OBJECT (ogg, "segment_start: %" GST_TIME_FORMAT,
GST_TIME_ARGS (segment_start));
- GST_DEBUG ("segment_stop: %" GST_TIME_FORMAT,
+ GST_DEBUG_OBJECT (ogg, "segment_stop: %" GST_TIME_FORMAT,
GST_TIME_ARGS (segment_stop));
/* create the newsegment event we are going to send out */
static gint
gst_ogg_demux_submit_buffer (GstOggDemux * ogg, GstBuffer * buffer)
{
- guint size;
+ gint size;
guint8 *data;
gchar *oggbuffer;
/* read more data from the current offset and submit to
* the ogg sync layer.
*
- * Return number of bytes written.
+ * Return number of bytes written or 0 on EOS or -1 on error.
*/
static gint
gst_ogg_demux_get_data (GstOggDemux * ogg)
GST_LOG_OBJECT (ogg, "get data %lld %lld", ogg->offset, ogg->length);
if (ogg->offset == ogg->length)
- return 0;
+ goto eos;
ret = gst_pad_pull_range (ogg->sinkpad, ogg->offset, CHUNKSIZE, &buffer);
if (ret != GST_FLOW_OK)
- return -1;
+ goto error;
size = gst_ogg_demux_submit_buffer (ogg, buffer);
return size;
+
+ /* ERROR */
+eos:
+ {
+ GST_LOG_OBJECT (ogg, "reached EOS");
+ return 0;
+ }
+error:
+ {
+ GST_WARNING_OBJECT (ogg, "got %d (%s) from pull range", ret,
+ gst_flow_get_name (ret));
+ return -1;
+ }
}
/* Read the next page from the current offset.
if (chain == NULL)
return TRUE;
- GST_DEBUG ("deactivating chain %p", chain);
+ GST_DEBUG_OBJECT (ogg, "deactivating chain %p", chain);
/* send EOS on all the pads */
for (i = 0; i < chain->streams->len; i++) {
return TRUE;
}
- GST_DEBUG ("activating chain %p", chain);
+ GST_DEBUG_OBJECT (ogg, "activating chain %p", chain);
/* first add the pads */
for (i = 0; i < chain->streams->len; i++) {
if (event)
gst_ogg_demux_send_event (ogg, event);
- GST_DEBUG ("starting chain");
+ GST_DEBUG_OBJECT (ogg, "starting chain");
/* then send out any queued buffers */
for (i = 0; i < chain->streams->len; i++) {
gboolean update;
if (event) {
+ GST_DEBUG_OBJECT (ogg, "seek with event");
+
gst_event_parse_seek (event, &rate, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
goto error;
}
} else {
+ GST_DEBUG_OBJECT (ogg, "seek without event");
+
flags = 0;
+ rate = 1.0;
}
GST_DEBUG_OBJECT (ogg, "seek, rate %g", rate);
cur_type, cur, stop_type, stop, &update);
}
- GST_DEBUG ("segment positions set to %" GST_TIME_FORMAT "-%"
+ GST_DEBUG_OBJECT (ogg, "segment positions set to %" GST_TIME_FORMAT "-%"
GST_TIME_FORMAT, GST_TIME_ARGS (ogg->segment.start),
GST_TIME_ARGS (ogg->segment.stop));
gst_ogg_demux_seek (ogg, bisect);
ret = gst_ogg_demux_get_next_page (ogg, &og, -1);
if (ret == OV_EREAD) {
- GST_LOG_OBJECT (ogg, "OV_READ");
+ GST_LOG_OBJECT (ogg, "OV_EREAD");
return OV_EREAD;
}
if (!res || ogg->length <= 0)
goto no_length;
- GST_DEBUG ("file length %lld", ogg->length);
+ GST_DEBUG_OBJECT (ogg, "file length %lld", ogg->length);
/* read chain from offset 0, this is the first chain of the
* ogg file. */
/*** error cases ***/
no_peer:
{
- GST_DEBUG ("we don't have a peer");
+ GST_DEBUG_OBJECT (ogg, "we don't have a peer");
return FALSE;
}
no_length:
{
- GST_DEBUG ("can't get file length");
+ GST_DEBUG_OBJECT (ogg, "can't get file length");
return FALSE;
}
no_first_chain:
{
- GST_DEBUG ("can't get first chain");
+ GST_DEBUG_OBJECT (ogg, "can't get first chain");
return FALSE;
}
}
ogg = GST_OGG_DEMUX (GST_OBJECT_PARENT (pad));
- GST_DEBUG ("chain");
+ GST_DEBUG_OBJECT (ogg, "chain");
gst_ogg_demux_submit_buffer (ogg, buffer);
while (ret != 0 && result == GST_FLOW_OK) {
newchain->offset = 0;
/* set new chain begin time aligned with end time of old chain */
newchain->begin_time = chain_time;
- GST_DEBUG ("new chain, begin time %" GST_TIME_FORMAT,
+ GST_DEBUG_OBJECT (ogg, "new chain, begin time %" GST_TIME_FORMAT,
GST_TIME_ARGS (chain_time));
/* and this is the one we are building now */