#include <gst/base/gsttypefindhelper.h>
-
static const GstElementDetails gst_ogg_demux_details =
GST_ELEMENT_DETAILS ("Ogg demuxer",
"Codec/Demuxer",
if (caps == NULL) {
GST_WARNING_OBJECT (ogg,
- "couldn't find caps for stream with serial %08lx", pad->serialno);
+ "couldn't find caps for stream with serial %08x", pad->serialno);
caps = gst_caps_new_simple ("application/octet-stream", NULL);
} else {
/* ogg requires you to use a decoder element to define the
if (!pad->elem_pad)
goto no_decoder;
- GST_DEBUG_OBJECT (ogg, "%p init decoder serial %08lx", pad, pad->serialno);
+ GST_DEBUG_OBJECT (ogg, "%p init decoder serial %08x", pad, pad->serialno);
buf = gst_buffer_new_and_alloc (packet->bytes);
memcpy (GST_BUFFER_DATA (buf), packet->packet, packet->bytes);
no_decoder:
{
GST_WARNING_OBJECT (ogg,
- "pad %08lx does not have elem_pad, no decoder ?", pad);
+ "pad %08x does not have elem_pad, no decoder ?", pad);
return GST_FLOW_ERROR;
}
decoder_error:
GstOggDemux *ogg = pad->ogg;
#endif
- GST_DEBUG_OBJECT (ogg, "%p queueing data serial %08lx", pad, pad->serialno);
+ GST_DEBUG_OBJECT (ogg, "%p queueing data serial %08x", pad, pad->serialno);
buf = gst_buffer_new_and_alloc (packet->bytes);
memcpy (buf->data, packet->packet, packet->bytes);
GstOggChain *chain;
GST_DEBUG_OBJECT (ogg,
- "%p streaming to peer serial %08lx", pad, pad->serialno);
+ "%p streaming to peer serial %08x", pad, pad->serialno);
ret =
gst_pad_alloc_buffer_and_set_caps (GST_PAD (pad), GST_BUFFER_OFFSET_NONE,
no_buffer:
{
GST_DEBUG_OBJECT (ogg,
- "%p could not get buffer from peer %08lx, %d (%s)", pad,
+ "%p could not get buffer from peer %08x, %d (%s)", pad,
pad->serialno, ret, gst_flow_get_name (ret));
if (ret == GST_FLOW_NOT_LINKED)
ret = GST_FLOW_OK;
GstOggDemux *ogg = pad->ogg;
- GST_DEBUG_OBJECT (ogg, "%p submit packet serial %08lx", pad, pad->serialno);
+ GST_DEBUG_OBJECT (ogg, "%p submit packet serial %08x", pad, pad->serialno);
if (!pad->have_type) {
if (!ogg->have_fishead && packet->bytes == SKELETON_FISHEAD_SIZE &&
granule = packet->granulepos;
if (granule != -1) {
- GST_DEBUG_OBJECT (ogg, "%p has granulepos %lld", pad, granule);
+ GST_DEBUG_OBJECT (ogg, "%p has granulepos %" G_GINT64_FORMAT, pad, granule);
ogg->current_granule = granule;
pad->current_granule = granule;
/* granulepos 0 and -1 are considered header packets.
* internal decoder produced a frame and we don't have a
* granulepos because in that case the granulpos must have been 0 */
if (pad->first_granule == -1 && granule != 0) {
- GST_DEBUG_OBJECT (ogg, "%p found first granulepos %lld", pad, granule);
+ GST_DEBUG_OBJECT (ogg, "%p found first granulepos %" G_GINT64_FORMAT, pad,
+ granule);
pad->first_granule = granule;
}
}
}
}
- /* if we are building a chain, store buffer for when we activate
+ /* if we are building a chain, store buffer for when we activate
* it. This path is taken if we operate in streaming mode. */
if (ogg->building_chain) {
ret = gst_ogg_demux_queue_data (pad, packet);
choked:
{
GST_WARNING_OBJECT (ogg,
- "ogg stream choked on page (serial %08lx), resetting stream",
+ "ogg stream choked on page (serial %08x), resetting stream",
pad->serialno);
gst_ogg_pad_reset (pad);
/* we continue to recover */
GstTagList *list;
gchar *name;
- GST_DEBUG_OBJECT (chain->ogg, "creating new stream %08lx in chain %p",
+ GST_DEBUG_OBJECT (chain->ogg, "creating new stream %08x in chain %p",
serialno, chain);
ret = g_object_new (GST_TYPE_OGG_PAD, NULL);
gst_object_sink (GST_OBJECT (ret));
list = gst_tag_list_new ();
- name = g_strdup_printf ("serial_%08lx", serialno);
+ name = g_strdup_printf ("serial_%08x", serialno);
GST_PAD_DIRECTION (ret) = GST_PAD_SRC;
ret->chain = chain;
ret->serialno = serialno;
if (ogg_stream_init (&ret->stream, serialno) != 0) {
- GST_ERROR ("Could not initialize ogg_stream struct for serial %08lx.",
+ GST_ERROR ("Could not initialize ogg_stream struct for serial %08x.",
serialno);
gst_object_unref (ret);
return NULL;
gst_tag_list_free (list);
GST_DEBUG_OBJECT (chain->ogg,
- "created new ogg src %p for stream with serial %08lx", ret, serialno);
+ "created new ogg src %p for stream with serial %08x", ret, serialno);
g_array_append_val (chain->streams, ret);
static void
gst_ogg_demux_seek (GstOggDemux * ogg, gint64 offset)
{
- GST_LOG_OBJECT (ogg, "seeking to %lld", offset);
+ GST_LOG_OBJECT (ogg, "seeking to %" G_GINT64_FORMAT, offset);
ogg->offset = offset;
ogg_sync_reset (&ogg->sync);
GstBuffer *buffer;
gint size;
- GST_LOG_OBJECT (ogg, "get data %lld %lld", ogg->offset, ogg->length);
+ GST_LOG_OBJECT (ogg, "get data %" G_GINT64_FORMAT " %" G_GINT64_FORMAT,
+ ogg->offset, ogg->length);
if (ogg->offset == ogg->length)
goto eos;
}
/* Read the next page from the current offset.
+ * boundary: number of bytes ahead we allow looking for;
+ * -1 if no boundary
+ * returns the offset the next page starts at, or OV_FALSE if we couldn't
+ * find a new page within the boundary
*/
static gint64
gst_ogg_demux_get_next_page (GstOggDemux * ogg, ogg_page * og, gint64 boundary)
{
gint64 end_offset = 0;
- GST_LOG_OBJECT (ogg, "get next page %lld", boundary);
+ GST_LOG_OBJECT (ogg,
+ "get next page, current offset %" G_GINT64_FORMAT ", bytes boundary %"
+ G_GINT64_FORMAT, ogg->offset, boundary);
if (boundary > 0)
end_offset = ogg->offset + boundary;
glong more;
if (boundary > 0 && ogg->offset >= end_offset) {
- GST_LOG_OBJECT (ogg, "offset %lld >= end_offset %lld", ogg->offset,
- end_offset);
+ GST_LOG_OBJECT (ogg,
+ "offset %" G_GINT64_FORMAT " >= end_offset %" G_GINT64_FORMAT,
+ ogg->offset, end_offset);
return OV_FALSE;
}
ogg_sync_reset (&ogg->sync);
GST_LOG_OBJECT (ogg,
- "got page at %lld, serial %08lx, end at %lld, granule %lld", ret,
+ "got page at %" G_GINT64_FORMAT ", serial %08x, end at %"
+ G_GINT64_FORMAT ", granule %" G_GINT64_FORMAT, ret,
ogg_page_serialno (og), ogg->offset, ogg_page_granulepos (og));
return ret;
if (bisect <= begin)
bisect = begin;
+ GST_DEBUG_OBJECT (ogg, "Initial guess: %" G_GINT64_FORMAT, bisect);
}
gst_ogg_demux_seek (ogg, bisect);
", end %" G_GINT64_FORMAT, bisect, begin, end);
result = gst_ogg_demux_get_next_page (ogg, &og, end - ogg->offset);
+ GST_LOG_OBJECT (ogg, "looking for next page returned %" G_GINT64_FORMAT,
+ result);
if (result == OV_EREAD) {
goto seek_error;
}
gst_ogg_demux_seek (ogg, bisect);
}
} else {
+ /* found offset of next ogg page */
gint64 granulepos;
GstClockTime granuletime;
GstFormat format;
GstOggPad *pad;
+ GST_LOG_OBJECT (ogg, "found next ogg page at %" G_GINT64_FORMAT,
+ result);
granulepos = ogg_page_granulepos (&og);
- if (granulepos == -1)
+ if (granulepos == -1) {
+ GST_LOG_OBJECT (ogg, "granulepos of next page is -1");
continue;
+ }
pad = gst_ogg_chain_get_stream (chain, ogg_page_serialno (&og));
if (pad == NULL || pad->is_skeleton)
} else {
if (granuletime < pad->first_time)
continue;
+ GST_LOG_OBJECT (ogg, "granulepos %" G_GINT64_FORMAT "maps to time %"
+ GST_TIME_FORMAT, granulepos, GST_TIME_ARGS (granuletime));
granuletime -= pad->first_time;
}
GstOggChain *nextchain;
GST_LOG_OBJECT (ogg,
- "bisect begin: %lld, searched: %lld, end %lld, chain: %p", begin,
- searched, end, chain);
+ "bisect begin: %" G_GINT64_FORMAT ", searched: %" G_GINT64_FORMAT
+ ", end %" G_GINT64_FORMAT ", chain: %p", begin, searched, end, chain);
/* the below guards against garbage seperating the last and
* first pages of two links. */
}
}
- GST_LOG_OBJECT (ogg, "current chain ends at %lld", searched);
+ GST_LOG_OBJECT (ogg, "current chain ends at %" G_GINT64_FORMAT, searched);
chain->end_offset = searched;
gst_ogg_demux_read_end_chain (ogg, chain);
- GST_LOG_OBJECT (ogg, "found begin at %lld", next);
+ GST_LOG_OBJECT (ogg, "found begin at %" G_GINT64_FORMAT, next);
gst_ogg_demux_seek (ogg, next);
nextchain = gst_ogg_demux_read_chain (ogg);
gboolean done;
gint i;
- GST_LOG_OBJECT (ogg, "reading chain at %lld", offset);
+ GST_LOG_OBJECT (ogg, "reading chain at %" G_GINT64_FORMAT, offset);
/* first read the BOS pages, do typefind on them, create
* the decoders, send data to the decoders. */
}
/* the timestamp will be filled in when we submit the pages */
done &= (pad->start_time != GST_CLOCK_TIME_NONE);
- GST_LOG_OBJECT (ogg, "done %08lx now %d", serial, done);
+ GST_LOG_OBJECT (ogg, "done %08x now %d", serial, done);
}
/* we read a page not belonging to the current chain: seek back to the
return chain;
}
-/* read the last pages from the ogg stream to get the final
+/* read the last pages from the ogg stream to get the final
* page end_offsets.
*/
static gint
if (!res || ogg->length <= 0)
goto no_length;
- GST_DEBUG_OBJECT (ogg, "file length %lld", ogg->length);
+ GST_DEBUG_OBJECT (ogg, "file length %" G_GINT64_FORMAT, ogg->length);
/* read chain from offset 0, this is the first chain of the
* ogg file. */
granule = ogg_page_granulepos (&page);
GST_LOG_OBJECT (ogg,
- "processing ogg page (serial %08lx, pageno %ld, granule pos %llu, bos %d)",
+ "processing ogg page (serial %08x, pageno %ld, granulepos %"
+ G_GINT64_FORMAT ", bos %d)",
serialno, ogg_page_pageno (&page), granule, ogg_page_bos (&page));
if (ogg_page_bos (&page)) {
unknown_pad:
{
GST_ELEMENT_ERROR (ogg, STREAM, DECODE,
- (NULL), ("unknown ogg pad for serial %08d detected", serialno));
+ (NULL), ("unknown ogg pad for serial %08x detected", serialno));
gst_ogg_demux_send_event (ogg, gst_event_new_eos ());
return GST_FLOW_ERROR;
}
gst_event_unref (event);
}
-/* random access code
+/* random access code
*
- * - first find all the chains and streams by scanning the
- * file.
- * - then get and chain buffers, just like the streaming
- * case.
- * - when seeking, we can use the chain info to perform the
- * seek.
+ * - first find all the chains and streams by scanning the file.
+ * - then get and chain buffers, just like the streaming case.
+ * - when seeking, we can use the chain info to perform the seek.
*/
static void
gst_ogg_demux_loop (GstOggPad * pad)
gst_event_unref (event);
}
- GST_LOG_OBJECT (ogg, "pull data %lld", ogg->offset);
+ GST_LOG_OBJECT (ogg, "pull data %" G_GINT64_FORMAT, ogg->offset);
if (ogg->offset == ogg->length)
goto eos;
for (j = 0; j < chain->streams->len; j++) {
GstOggPad *stream = g_array_index (chain->streams, GstOggPad *, j);
- GST_INFO_OBJECT (ogg, " stream %08lx:", stream->serialno);
+ GST_INFO_OBJECT (ogg, " stream %08x:", stream->serialno);
GST_INFO_OBJECT (ogg, " start time: %" GST_TIME_FORMAT,
GST_TIME_ARGS (stream->start_time));
GST_INFO_OBJECT (ogg, " first granulepos: %" G_GINT64_FORMAT,